LightNode now properly works with SpotLight

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9696 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 13 years ago
parent 23e949974a
commit 5c9afd9d59
  1. 11
      engine/src/core/com/jme3/scene/control/LightControl.java

@ -36,6 +36,7 @@ import com.jme3.export.JmeImporter;
import com.jme3.light.DirectionalLight; import com.jme3.light.DirectionalLight;
import com.jme3.light.Light; import com.jme3.light.Light;
import com.jme3.light.PointLight; import com.jme3.light.PointLight;
import com.jme3.light.SpotLight;
import com.jme3.math.Vector3f; import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager; import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort; import com.jme3.renderer.ViewPort;
@ -128,12 +129,12 @@ public class LightControl extends AbstractControl {
if (light instanceof DirectionalLight) { if (light instanceof DirectionalLight) {
((DirectionalLight) light).setDirection(vars.vect1.set(spatial.getWorldTranslation()).multLocal(-1.0f)); ((DirectionalLight) light).setDirection(vars.vect1.set(spatial.getWorldTranslation()).multLocal(-1.0f));
} }
if (light instanceof SpotLight) {
((SpotLight) light).setPosition(spatial.getWorldTranslation());
((SpotLight) light).setDirection(spatial.getWorldRotation().multLocal(vars.vect1.set(Vector3f.UNIT_Y).multLocal(-1)));
}
vars.release(); vars.release();
//TODO add code for Spot light here when it's done
// if( light instanceof SpotLight){
// ((SpotLight)light).setPosition(spatial.getWorldTranslation());
// ((SpotLight)light).setRotation(spatial.getWorldRotation());
// }
} }

Loading…
Cancel
Save