From e19be328a79de757eb044a6fb096a28d9c1b72ad Mon Sep 17 00:00:00 2001 From: shadowislord Date: Sun, 8 Feb 2015 17:41:35 -0500 Subject: [PATCH] Add simple test case for the "scene not updated" crash in the SDK --- .../jme3test/scene/TestRefreshFlagBug.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 jme3-examples/src/main/java/jme3test/scene/TestRefreshFlagBug.java diff --git a/jme3-examples/src/main/java/jme3test/scene/TestRefreshFlagBug.java b/jme3-examples/src/main/java/jme3test/scene/TestRefreshFlagBug.java new file mode 100644 index 000000000..6c8d4d87c --- /dev/null +++ b/jme3-examples/src/main/java/jme3test/scene/TestRefreshFlagBug.java @@ -0,0 +1,45 @@ +package jme3test.scene; + +import com.jme3.app.SimpleApplication; +import com.jme3.material.Material; +import com.jme3.scene.Geometry; +import com.jme3.scene.Node; +import com.jme3.scene.shape.Box; + +public class TestRefreshFlagBug extends SimpleApplication { + + private float time = 0; + private boolean attached = false; + private Node inBetweenNode; + + public static void main(String[] args) { + TestRefreshFlagBug app = new TestRefreshFlagBug(); + app.start(); + } + + @Override + public void simpleUpdate(float tpf) { + time += tpf; + if (time > 5 && !attached) { + attached = true; + + Box b = new Box(1, 1, 1); + Geometry geom = new Geometry("Box", b); + Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); + geom.setMaterial(mat); + + inBetweenNode.attachChild(geom); + + // the refresh flags become corrupted here ... + inBetweenNode.getWorldBound(); + } + } + + @Override + public void simpleInitApp() { + inBetweenNode = new Node("In Between Node"); + rootNode.attachChild(inBetweenNode); + + flyCam.setDragToRotate(true); + } +}