Skip to content

Commit 2c91e14

Browse files
Deprecated light node - #1033 (#1042)
* Deprecated light node * Deleted TestLightNode * Cleanup of this... mess. * Removed LightNode usage from TestManyLightsSingle.java * TestConeVSFrustum: use LightControl, revert some non-essential changes * TestManyLightsSingle: revert a non-essential change Co-authored-by: Stephen Gold <[email protected]>
1 parent c4e7a28 commit 2c91e14

File tree

4 files changed

+9
-123
lines changed

4 files changed

+9
-123
lines changed

jme3-core/src/main/java/com/jme3/scene/LightNode.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@
4444
* with a {@link Node} object.
4545
*
4646
* @author Tim8Dev
47+
* @deprecated Use a {@link LightControl} attached to a {@link Node} directly.
4748
*/
49+
@Deprecated
4850
public class LightNode extends Node {
4951

5052
private LightControl lightControl;

jme3-examples/src/main/java/jme3test/light/TestConeVSFrustum.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747
import com.jme3.math.*;
4848
import com.jme3.renderer.Camera;
4949
import com.jme3.scene.Geometry;
50-
import com.jme3.scene.LightNode;
5150
import com.jme3.scene.Node;
5251
import com.jme3.scene.Spatial;
52+
import com.jme3.scene.control.LightControl;
5353
import com.jme3.scene.debug.Grid;
5454
import com.jme3.scene.debug.WireFrustum;
5555
import com.jme3.scene.shape.Box;
@@ -108,8 +108,12 @@ public void simpleInitApp() {
108108
geom.getMaterial().setColor("Diffuse", ColorRGBA.White);
109109
geom.getMaterial().setColor("Ambient", ColorRGBA.DarkGray);
110110
geom.getMaterial().setBoolean("UseMaterialColors", true);
111-
final LightNode ln = new LightNode("lb", spotLight);
111+
112+
final Node ln = new Node("lb");
113+
LightControl lightControl = new LightControl(spotLight);
114+
ln.addControl(lightControl);
112115
ln.attachChild(geom);
116+
113117
geom.setLocalTranslation(0, -spotLight.getSpotRange() / 2f, 0);
114118
geom.rotate(-FastMath.HALF_PI, 0, 0);
115119
rootNode.attachChild(ln);

jme3-examples/src/main/java/jme3test/light/TestLightNode.java

Lines changed: 0 additions & 111 deletions
This file was deleted.

jme3-examples/src/main/java/jme3test/light/TestManyLightsSingle.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
import com.jme3.renderer.RenderManager;
5353
import com.jme3.renderer.ViewPort;
5454
import com.jme3.scene.Geometry;
55-
import com.jme3.scene.LightNode;
5655
import com.jme3.scene.Node;
5756
import com.jme3.scene.Spatial;
5857
import com.jme3.scene.control.AbstractControl;
@@ -105,27 +104,19 @@ public void simpleInitApp() {
105104
if (nb > 60) {
106105
n.removeLight(light);
107106
} else {
108-
109-
LightNode ln = new LightNode("l", light);
110-
n.attachChild(ln);
111-
ln.setLocalTranslation(p.getPosition());
112107
int rand = FastMath.nextRandomInt(0, 3);
113108
switch (rand) {
114109
case 0:
115110
light.setColor(ColorRGBA.Red);
116-
// ln.addControl(new MoveControl(5f));
117111
break;
118112
case 1:
119113
light.setColor(ColorRGBA.Yellow);
120-
// ln.addControl(new MoveControl(5f));
121114
break;
122115
case 2:
123116
light.setColor(ColorRGBA.Green);
124-
//ln.addControl(new MoveControl(-5f));
125117
break;
126118
case 3:
127119
light.setColor(ColorRGBA.Orange);
128-
//ln.addControl(new MoveControl(-5f));
129120
break;
130121
}
131122
}
@@ -278,4 +269,4 @@ protected void controlUpdate(float tpf) {
278269
protected void controlRender(RenderManager rm, ViewPort vp) {
279270
}
280271
}
281-
}
272+
}

0 commit comments

Comments
 (0)