point light work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-09-20 00:10:30 -04:00
parent 4b41ac823c
commit b410a1de1a
5 changed files with 40 additions and 7 deletions

View File

@ -532,13 +532,18 @@
},
"pointLight" : {
"const": 1.0,
"linear": 0.7,
"quadratic": 0.35,
"radius": 1.0,
"linear": 0.9,
"quadratic": 0.9,
"radius": 3.0,
"color": {
"x": 0.3,
"y": 0.3,
"z": 0.3
},
"offset": {
"x": 0.0,
"y": 0.6,
"z": 0.0
}
},
"idleData": {

View File

@ -416,13 +416,18 @@
},
"pointLight" : {
"const": 1.0,
"linear": 0.7,
"quadratic": 0.35,
"radius": 1.0,
"linear": 0.9,
"quadratic": 0.9,
"radius": 3.0,
"color": {
"x": 0.3,
"y": 0.3,
"z": 0.3
},
"offset": {
"x": 0.0,
"y": 0.3,
"z": 0.0
}
},
"idleData": {

View File

@ -812,6 +812,9 @@ Fix terrain editing across chunk borders on server
- Also because the client doesn't scan border chunks to see if they should update
Fix shader program bug with no-bone variants
Particle Emitter work (it renders! it has management!)
Texture atlasing for particle system
Texture atlas caching
Point light offsets
# TODO

View File

@ -36,7 +36,13 @@ public class ClientPointLightComponent implements BehaviorTree {
@Override
public void simulate(float deltaTime) {
Vector3d entityPos = EntityUtils.getPosition(parent);
light.setPosition(new Vector3f((float)entityPos.x,(float)entityPos.y,(float)entityPos.z));
Vector3d offset = null;
if(description.getOffset() != null){
offset = new Vector3d(description.getOffset());
} else {
offset = new Vector3d();
}
light.setPosition(new Vector3f((float)entityPos.x,(float)entityPos.y,(float)entityPos.z).add((float)offset.x,(float)offset.y,(float)offset.z));
}
/**

View File

@ -1,5 +1,6 @@
package electrosphere.game.data.common.light;
import org.joml.Vector3d;
import org.joml.Vector3f;
/**
@ -32,6 +33,11 @@ public class PointLightDescription {
*/
Vector3f color;
/**
* The offset from the entity base to place the point light at
*/
Vector3d offset;
/**
* Sets the constant attenuation factor
* @param constant The constant attenuation factor
@ -112,4 +118,12 @@ public class PointLightDescription {
return radius;
}
/**
* Gets the offset from the base of the entity to place the point light at
* @return The offset
*/
public Vector3d getOffset(){
return offset;
}
}