Package com.jme3.scene
Class BatchNode
java.lang.Object
com.jme3.scene.Spatial
com.jme3.scene.Node
com.jme3.scene.GeometryGroupNode
com.jme3.scene.BatchNode
- All Implemented Interfaces:
- HasLocalTransform,- CloneableSmartAsset,- Collidable,- Savable,- JmeCloneable,- Cloneable
- Direct Known Subclasses:
- SimpleBatchNode
BatchNode holds geometries that are a batched version of all the geometries that are in its sub scenegraph.
 There is one geometry per different material in the sub tree.
 The geometries are directly attached to the node in the scene graph.
 Usage is like any other node except you have to call the 
batch() method once all the geometries have been attached to the sub scene graph and their material set
 (see todo more automagic for further enhancements)
 All the geometries that have been batched are set to not be rendered - Spatial.CullHint is left intact.
 The sub geometries can be transformed as usual, their transforms are used to update the mesh of the geometryBatch.
 Sub geoms can be removed but it may be slower than the normal spatial removing
 Sub geoms can be added after the batch() method has been called but won't be batched and will just be rendered as normal geometries.
 To integrate them in the batch you have to call the batch() method again on the batchNode.
 TODO more automagic (batch when needed in the updateLogicalState)
- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from class com.jme3.scene.SpatialSpatial.BatchHint, Spatial.CullHint, Spatial.DFSMode
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected SafeArrayList<BatchNode.Batch>the list of geometry holding the batched meshesprotected Map<Geometry,BatchNode.Batch> a map for storing the batches by geometry to quickly access the batch when updatingFields inherited from class com.jme3.scene.SpatialbatchHint, controls, cullHint, frustrumIntersects, key, localLights, localOverrides, localTransform, name, parent, queueBucket, queueDistance, refreshFlags, RF_BOUND, RF_CHILD_LIGHTLIST, RF_LIGHTLIST, RF_MATPARAM_OVERRIDE, RF_TRANSFORM, shadowMode, userData, worldBound, worldLights, worldOverrides, worldTransform
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidbatch()Batch this batchNode every geometry of the sub scene graph of this node will be batched into a single mesh that will be rendered in one callclone(boolean cloneMaterials) voidcloneFields(Cloner cloner, Object original) Called internally by com.jme3.util.clone.Cloner.intcollideWith(Collidable other, CollisionResults results) Check collision with another Collidable.detachChildAt(int index) detachChildAtremoves a child at a given index.protected voiddoBatch()Returns the material that is used for the first batch of this BatchNode.protected Matrix4ffinal booleanvoidCalled bygeomto specify that it has been unassociated from itsGeometryGroupNode.voidonMaterialChange(Geometry geom) voidonMeshChange(Geometry geom) voidonTransformChange(Geometry geom) Called bygeomto specify that its world transform has been changed.voidsetMaterial(Material material) Sets the material to the all the batches of this BatchNode.protected voidsetNeedsFullRebatch(boolean needsFullRebatch) protected voidMethods inherited from class com.jme3.scene.GeometryGroupNodegetGeometryStartIndex, setGeometryStartIndexMethods inherited from class com.jme3.scene.NodeattachChild, attachChildAt, breadthFirstTraversal, deepClone, depthFirstTraversal, descendantMatches, descendantMatches, descendantMatches, detachAllChildren, detachChild, detachChildNamed, getChild, getChild, getChildIndex, getChildren, getQuantity, getTriangleCount, getVertexCount, hasChild, oldDeepClone, read, setLightListRefresh, setLodLevel, setMatParamOverrideRefresh, setModelBound, setParent, setTransformRefresh, swapChildren, updateGeometricState, updateLogicalState, updateModelBound, updateWorldBound, writeMethods inherited from class com.jme3.scene.SpatialaddControl, addControlAt, addLight, addMatParamOverride, breadthFirstTraversal, center, checkCulling, clearMatParamOverrides, clone, depthFirstTraversal, forceRefresh, getBatchHint, getControl, getControl, getCullHint, getKey, getLastFrustumIntersection, getLocalBatchHint, getLocalCullHint, getLocalLightList, getLocalMatParamOverrides, getLocalQueueBucket, getLocalRotation, getLocalScale, getLocalShadowMode, getLocalToWorldMatrix, getLocalTransform, getLocalTranslation, getName, getNumControls, getParent, getQueueBucket, getShadowMode, getUserData, getUserDataKeys, getWorldBound, getWorldLightList, getWorldMatParamOverrides, getWorldRotation, getWorldScale, getWorldTransform, getWorldTranslation, hasAncestor, jmeClone, localToWorld, lookAt, matches, move, move, oldClone, removeControl, removeControl, removeFromParent, removeLight, removeMatParamOverride, rotate, rotate, rotateUpTo, runControlRender, scale, scale, setBatchHint, setBoundRefresh, setCullHint, setKey, setLastFrustumIntersection, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalScale, setLocalTransform, setLocalTranslation, setLocalTranslation, setName, setQueueBucket, setRequiresUpdates, setShadowMode, setUserData, toString, updateMatParamOverrides, updateWorldLightList, updateWorldTransforms, worldToLocal
- 
Field Details- 
batchesthe list of geometry holding the batched meshes
- 
batchesByGeoma map for storing the batches by geometry to quickly access the batch when updating
 
- 
- 
Constructor Details- 
BatchNodepublic BatchNode()Construct a batchNode
- 
BatchNode
 
- 
- 
Method Details- 
onTransformChangeDescription copied from class:GeometryGroupNodeCalled bygeomto specify that its world transform has been changed.- Specified by:
- onTransformChangein class- GeometryGroupNode
- Parameters:
- geom- The Geometry whose transform changed.
 
- 
onMaterialChangeDescription copied from class:GeometryGroupNode- Specified by:
- onMaterialChangein class- GeometryGroupNode
- Parameters:
- geom- The Geometry whose material changed.
 
- 
onMeshChangeDescription copied from class:GeometryGroupNodeCalled bygeomto specify that itsmeshhas been changed. This is also called when the geometry'slod levelchanges.- Specified by:
- onMeshChangein class- GeometryGroupNode
- Parameters:
- geom- The Geometry whose mesh changed.
 
- 
onGeometryUnassociatedDescription copied from class:GeometryGroupNodeCalled bygeomto specify that it has been unassociated from itsGeometryGroupNode. Unassociation occurs when theGeometryisdetachedfrom its parentNode.- Specified by:
- onGeometryUnassociatedin class- GeometryGroupNode
- Parameters:
- geom- The Geometry which is being unassociated.
 
- 
getTransformMatrix
- 
updateSubBatch
- 
batchpublic void batch()Batch this batchNode every geometry of the sub scene graph of this node will be batched into a single mesh that will be rendered in one call
- 
doBatchprotected void doBatch()
- 
detachChildAtDescription copied from class:NodedetachChildAtremoves a child at a given index. That child is returned for saving purposes.- Overrides:
- detachChildAtin class- Node
- Parameters:
- index- the index of the child to be removed.
- Returns:
- the child at the supplied index.
 
- 
isBatch
- 
setMaterialSets the material to the all the batches of this BatchNode. Use setMaterial(Material material,int batchIndex) to set a material to a specific batch.- Overrides:
- setMaterialin class- Node
- Parameters:
- material- the material to use for this geometry
 
- 
getMaterialReturns the material that is used for the first batch of this BatchNode.Use getMaterial(Material material,int batchIndex) to get a material from a specific batch. - Returns:
- the material that is used for the first batch of this BatchNode
- See Also:
 
- 
setNeedsFullRebatchprotected void setNeedsFullRebatch(boolean needsFullRebatch) 
- 
clone- Overrides:
- clonein class- Node
- Parameters:
- cloneMaterials- true to clone materials, false to share them
- Returns:
- A clone of this Spatial, the scene graph in its entirety is cloned and can be altered independently of the original scene graph. Note that meshes of geometries are not cloned explicitly, they are shared if static, or specially cloned if animated.
- See Also:
 
- 
cloneFieldsCalled internally by com.jme3.util.clone.Cloner. Do not call directly.- Specified by:
- cloneFieldsin interface- JmeCloneable
- Overrides:
- cloneFieldsin class- Node
- Parameters:
- cloner- The cloner that is performing the cloning operation. The cloneFields method can call back into the cloner to make clones of its subordinate fields.
- original- The original object from which this object was cloned. This is provided for the very rare case that this object needs to refer to its original for some reason. In general, all of the relevant values should have been transferred during the shallow clone, and this object need only clone what it wants.
 
- 
collideWithDescription copied from interface:CollidableCheck collision with another Collidable.- Specified by:
- collideWithin interface- Collidable
- Overrides:
- collideWithin class- Node
- Parameters:
- other- The object to check collision against
- results- Will contain the list of- CollisionResults.
- Returns:
- how many collisions were found between this and other
 
 
-