From 5c9afd9d5910bc273780a9834fc8c5a8576531b2 Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Fri, 31 Aug 2012 19:20:09 +0000 Subject: [PATCH] LightNode now properly works with SpotLight git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9696 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/core/com/jme3/scene/control/LightControl.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/engine/src/core/com/jme3/scene/control/LightControl.java b/engine/src/core/com/jme3/scene/control/LightControl.java index 2859c9bb5..940d9c451 100644 --- a/engine/src/core/com/jme3/scene/control/LightControl.java +++ b/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.Light; import com.jme3.light.PointLight; +import com.jme3.light.SpotLight; import com.jme3.math.Vector3f; import com.jme3.renderer.RenderManager; import com.jme3.renderer.ViewPort; @@ -128,12 +129,12 @@ public class LightControl extends AbstractControl { if (light instanceof DirectionalLight) { ((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(); - //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()); -// } }