@Override public Node clone(boolean cloneMaterials) { BatchNode clone = (BatchNode) super.clone(cloneMaterials); if (batches.size() > 0) { for (Batch b : batches) { for (int i = 0; i < clone.children.size(); i++) { if (clone.children.get(i).getName().equals(b.geometry.getName())) { clone.children.remove(i); break; } } } clone.needsFullRebatch = true; clone.batches = new SafeArrayList<Batch>(Batch.class); clone.batchesByGeom = new HashMap<Geometry, Batch>(); clone.batch(); } return clone; }
@Override public void simpleUpdate(float tpf) { if (!done) { done = true; batch.attachChild(cube2); batch.batch(); } updateBoindPoints(points); frustum.update(points); time += tpf; dl.setDirection(cam.getDirection()); cube2.setLocalTranslation(FastMath.sin(-time) * 3, FastMath.cos(time) * 3, 0); cube2.setLocalRotation(new Quaternion().fromAngleAxis(time, Vector3f.UNIT_Z)); cube2.setLocalScale(Math.max(FastMath.sin(time), 0.5f)); // batch.setLocalRotation(new Quaternion().fromAngleAxis(time, Vector3f.UNIT_Z)); } //
batchNode.batch();
rootNode.setShadowMode(ShadowMode.Off); batchNode.batch(); batchNode.setShadowMode(ShadowMode.CastAndReceive); rootNode.attachChild(batchNode);
batch.batch(); rootNode.attachChild(batch); cube.setLocalTranslation(3, 0, 0);
@Override public Node clone(boolean cloneMaterials) { BatchNode clone = (BatchNode) super.clone(cloneMaterials); if (batches.size() > 0) { for (Batch b : batches) { for (int i = 0; i < clone.children.size(); i++) { if (clone.children.get(i).getName().equals(b.geometry.getName())) { clone.children.remove(i); break; } } } clone.needsFullRebatch = true; clone.batches = new SafeArrayList<Batch>(Batch.class); clone.batchesByGeom = new HashMap<Geometry, Batch>(); clone.batch(); } return clone; }
@Override public Spatial construct() { super.construct(); // Pillars if (hasPillars()) { BatchNode pillarsNode = new BatchNode("Pillars"); contructPillars(pillarsNode); if (!pillarsNode.getChildren().isEmpty()) { pillarsNode.setShadowMode(RenderQueue.ShadowMode.CastAndReceive); pillarsNode.batch(); getRootNode().attachChild(pillarsNode); } } return getRootNode(); }
batchNode.batch();
public Spatial construct() { setupCoordinates(); // Add the floor getRootNode().detachAllChildren(); BatchNode floorNode = constructFloor(); if (floorNode != null) { floorNode.setName("Floor"); floorNode.setShadowMode(getFloorShadowMode()); floorNode.batch(); getRootNode().attachChild(floorNode); } // Custom wall BatchNode wallNode = constructWall(); if (wallNode != null) { wallNode.setName("Wall"); wallNode.setShadowMode(getWallShadowMode()); wallNode.batch(); getRootNode().attachChild(wallNode); } // The objects on the floor Node objectsNode = constructObjects(); if (objectsNode != null) { objectsNode.setName("Objects"); objectsNode.setShadowMode(RenderQueue.ShadowMode.CastAndReceive); getRootNode().attachChild(objectsNode); } return getRootNode(); }
((BatchNode) spatial).attachChild(part); ((BatchNode) spatial).batch(); } else {