I found something strange in the SimpleLightNode and LightNode classes:
SimpleLightNode seems to apply the rotation twice on a light, let's say a spot light. In the updateWorldData(float time) method it is first updated, but then again multiplicated, look at the difference between SimpleLightNode and LightNode:
SimpleLightNode:
public void updateWorldData(float time) {
super.updateWorldData(time);
if (light == null) {
return;
}
lightRotate = worldRotation.mult(localRotation, lightRotate);
...
}
LightNode:
public void updateWorldData(float time) {
super.updateWorldData(time);
if(light == null) {
return;
}
...
}
To sum up, the LightNode's updateWorldData is correct except for one thing, this is the second strange thing I found:
For directional light the rotation is set by the node's translation, is this correct? I had to search and wonder why my directional light is not changing on rotating the node but on translating. Same method as above:
case Light.LT_DIRECTIONAL: {
DirectionalLight dLight = (DirectionalLight) light;
dLight.getDirection().set(worldTranslation).negateLocal(); <
break;
}
Correct would be the same as for the spotlight direction setting:
case Light.LT_SPOT: {
SpotLight sLight = (SpotLight) light;
sLight.getLocation().set(worldTranslation);
worldRotation.getRotationColumn(2, sLight.getDirection()); <
break;
}