use of com.badlogic.gdx.math.Matrix4 in project nhglib by VoidZombie.
the class LightingSystem method process.
@Override
protected void process(int entityId) {
NodeComponent node = nodeMapper.get(entityId);
LightComponent light = lightMapper.get(entityId);
light.light.position.set(node.getTranslation());
light.light.setTransform(node.getTransform());
switch(light.type) {
case SPOT_LIGHT:
case DIRECTIONAL_LIGHT:
Matrix4 tempMatrix = MatrixPool.getMatrix4();
tempMatrix.set(node.getTransform());
tempMatrix.translate(0f, 1f, 0f);
Vector3 direction = VectorPool.getVector3();
Vector3 tempVec = VectorPool.getVector3();
direction.set(light.light.position).sub(tempMatrix.getTranslation(tempVec));
light.light.direction.set(direction);
MatrixPool.freeMatrix4(tempMatrix);
VectorPool.freeVector3(direction, tempVec);
break;
}
}
Aggregations