light: ensure directional lights are sorted to be always first

experimental
Kirill Vainer 9 years ago
parent 1fa6c4ac11
commit 31383778d9
  1. 2
      jme3-core/src/main/java/com/jme3/light/AmbientLight.java
  2. 4
      jme3-core/src/main/java/com/jme3/light/DirectionalLight.java

@ -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

@ -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;
} }
/** /**

Loading…
Cancel
Save