Hi, I’m trying to use BatchNode.
The process I use is:
- I create the BatchNode:
batchNode = new BatchNode("Batchy");
- I add some nodes with geometries to the batchNode:
for(Spatial s : spatials) batchNode.attachChild(spat);
- I batch the node:
On the 3rd step I get:
java.lang.NullPointerException at com.jme3.scene.BatchNode.mergeGeometries(BatchNode.java:584) at com.jme3.scene.BatchNode.doBatch(BatchNode.java:232) at com.jme3.scene.BatchNode.batch(BatchNode.java:187)
I made a lot of tests with it, and if I put different materials to each node (so to the containing geometries) It doesn’t fire an exception but it only batches per node (obviously).
The scengraph is:
---- BATCH NODE ----
-null (Node) - (362t, 784v)
–MODEL0 (Node) - (362t, 784v)
—structure1 (Geometry)(customMaterial) - (362t, 784v)
-null (Node) - (110t, 129v)
–MODEL1 (Node) - (110t, 129v)
—Cube-ogremesh (Node) - (110t, 129v)
----rotH (Node) - (110t, 129v)
-----rotV (Node) - (82t, 81v)
------tube1 (Geometry)(customMaterial2) - (82t, 81v)
-----lateral1 (Geometry)(customMaterial2) - (28t, 48v)
I use code to print the graph so I’m sure is fine.
With different materials I get the two extra batches at the end of the previous graph (looking at the triangles and vertex I can say that is done as it must):
-Batchy-batch0 (Geometry)(null) - (362t, 784v)
-Batchy-batch1 (Geometry)(null) - (110t, 129v)
But if I replace customMaterial2 by customMaterial, is when I get the previous nullPointer. I would like to know if I’m doing it wrong (what I already checked for hours, even comparing with the jme3test.batching examples) or if this is, actually, a bug.
Thanks in advance for any help.