Skip to content

Commit 49cc7f2

Browse files
committed
made Spatial iterable
1 parent 1c45ac6 commit 49cc7f2

File tree

4 files changed

+15
-141
lines changed

4 files changed

+15
-141
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1881,7 +1881,7 @@ public void breadthFirstTraversal(SceneGraphVisitor visitor) {
18811881
protected abstract void findNextIteration(GraphIterator iterator);
18821882

18831883
@Override
1884-
public Iterator<Spatial> iterator() {
1884+
public GraphIterator iterator() {
18851885
return new GraphIterator(this);
18861886
}
18871887

jme3-core/src/main/java/com/jme3/vulkan/scene/NotNode.java

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

jme3-core/src/main/java/com/jme3/vulkan/scene/NotSpatial.java

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

jme3-examples/src/main/java/jme3test/vulkan/VulkanHelperTest.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import com.jme3.math.Quaternion;
77
import com.jme3.math.Transform;
88
import com.jme3.math.Vector3f;
9+
import com.jme3.scene.Geometry;
10+
import com.jme3.scene.Spatial;
911
import com.jme3.shaderc.ShaderType;
1012
import com.jme3.shaderc.ShadercLoader;
1113
import com.jme3.system.AppSettings;
@@ -434,10 +436,18 @@ public void update(UpdateFrameManager frames, float tpf) {
434436
// run graphics commands via CommandBatch
435437
graphics.run(graphicsCommands, frames.getCurrentFrame());
436438

437-
material.bind(graphicsCommands, pipeline);
438-
mesh.bind(graphicsCommands);
439-
for (int i = 0; i < 100; i++) {
440-
mesh.draw(graphicsCommands);
439+
// material.bind(graphicsCommands, pipeline);
440+
// mesh.bind(graphicsCommands);
441+
// mesh.draw(graphicsCommands);
442+
443+
// draw all geometries in the rootNode
444+
for (Spatial s : rootNode) {
445+
if (s instanceof Geometry) {
446+
Geometry g = (Geometry)s;
447+
g.getMaterial().bind(graphicsCommands, pipeline);
448+
g.getMesh().bind(graphicsCommands);
449+
g.getMesh().draw(graphicsCommands);
450+
}
441451
}
442452

443453
// material

0 commit comments

Comments
 (0)