light: ensure directional lights are sorted to be always first

This commit is contained in:
Kirill Vainer 2015-09-13 22:06:32 -04:00
parent 1fa6c4ac11
commit 31383778d9
2 changed files with 5 additions and 1 deletions

View File

@ -69,6 +69,8 @@ public class AmbientLight extends Light {
@Override @Override
public void computeLastDistance(Spatial owner) { public void computeLastDistance(Spatial owner) {
// ambient lights must always be before directional lights.
lastDistance = -2;
} }
@Override @Override

View File

@ -80,7 +80,9 @@ public class DirectionalLight extends Light {
@Override @Override
public void computeLastDistance(Spatial owner) { public void computeLastDistance(Spatial owner) {
lastDistance = 0; // directional lights are always closest to their owner // directional lights are after ambient lights
// but before all other lights.
lastDistance = -1;
} }
/** /**