|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme3.scene.Spatial
com.jme3.scene.Node
com.jme3.scene.BatchNode
public class BatchNode
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 CullHint#Always
to not render them.
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 normal or tangents or both looks a bit weird
TODO more automagic (batch when needed in the updateLogicalState)
Nested Class Summary | |
---|---|
protected class |
BatchNode.Batch
|
Nested classes/interfaces inherited from class com.jme3.scene.Spatial |
---|
Spatial.BatchHint, Spatial.CullHint |
Field Summary | |
---|---|
protected SafeArrayList<BatchNode.Batch> |
batches
the list of geometry holding the batched meshes |
protected java.util.Map<Geometry,BatchNode.Batch> |
batchesByGeom
a map storing he batches by geometry to quickly acces the batch when updating |
Fields inherited from class com.jme3.scene.Node |
---|
children |
Fields inherited from class com.jme3.scene.Spatial |
---|
batchHint, controls, cullHint, frustrumIntersects, key, localLights, localTransform, name, parent, queueBucket, queueDistance, refreshFlags, RF_BOUND, RF_LIGHTLIST, RF_TRANSFORM, shadowMode, userData, worldBound, worldLights, worldTransform |
Constructor Summary | |
---|---|
BatchNode()
Construct a batchNode |
|
BatchNode(java.lang.String name)
|
Method Summary | |
---|---|
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 |
protected void |
doBatch()
|
Material |
getMaterial()
Returns 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 |
int |
getOffsetIndex(Geometry batchedGeometry)
|
protected Transform |
getTransforms(Geometry geom)
|
void |
read(JmeImporter im)
|
void |
setMaterial(Material material)
Sets the material to the all the batches of this BatchNode use setMaterial(Material material,int batchIndex) to set a material to a specific batch |
protected void |
setNeedsFullRebatch(boolean needsFullRebatch)
|
void |
updateGeometricState()
updateGeometricState updates the lightlist,
computes the world transforms, and computes the world bounds
for this Spatial. |
protected void |
updateSubBatch(Geometry bg)
|
void |
write(JmeExporter ex)
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected SafeArrayList<BatchNode.Batch> batches
protected java.util.Map<Geometry,BatchNode.Batch> batchesByGeom
Constructor Detail |
---|
public BatchNode()
public BatchNode(java.lang.String name)
Method Detail |
---|
public void updateGeometricState()
Spatial
updateGeometricState
updates the lightlist,
computes the world transforms, and computes the world bounds
for this Spatial.
Calling this when the Spatial is attached to a node
will cause undefined results. User code should only call this
method on Spatials having no parent.
updateGeometricState
in class Node
Spatial.getWorldLightList()
,
Spatial.getWorldTransform()
,
Spatial.getWorldBound()
protected Transform getTransforms(Geometry geom)
protected void updateSubBatch(Geometry bg)
public void batch()
protected void doBatch()
public void setMaterial(Material material)
setMaterial
in class Node
material
- the material to use for this geometrypublic Material getMaterial()
setMaterial(com.jme3.material.Material)
public void write(JmeExporter ex) throws java.io.IOException
write
in interface Savable
write
in class Node
java.io.IOException
public void read(JmeImporter im) throws java.io.IOException
read
in interface Savable
read
in class Node
java.io.IOException
protected void setNeedsFullRebatch(boolean needsFullRebatch)
public int getOffsetIndex(Geometry batchedGeometry)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |