Package com.ardor3d.scenegraph
Class InstancingManager
java.lang.Object
com.ardor3d.scenegraph.InstancingManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanapply(Mesh mesh, Renderer renderer, GLSLShaderObjectsState shader) Applies all instancing info to the mesh and returns if the current render call is allowed to continueprotected FloatBufferFill the buffer with the transforms and return itintSplit the batch in multiple batches if number of visible meshes exceeds this amount.intReturns the number of meshes to be drawn in this batch.booleanvoidregisterMesh(Mesh mesh) Register a mesh for instancing for this current frame (internal use only)voidsetMaxBatchSize(int maxBatchSize) Split the batch in multiple batches if number of visible meshes exceeds this amount.
-
Constructor Details
-
InstancingManager
public InstancingManager()
-
-
Method Details
-
registerMesh
Register a mesh for instancing for this current frame (internal use only)- Parameters:
mesh- the mesh to register
-
fillTransformBuffer
Fill the buffer with the transforms and return it- Returns:
- the transform buffer
-
getPrimitiveCount
public int getPrimitiveCount()Returns the number of meshes to be drawn in this batch. This function is only valid after the apply call (internal use only)- Returns:
- the number of meshes to be drawn in this batch
-
getMaxBatchSize
public int getMaxBatchSize()Split the batch in multiple batches if number of visible meshes exceeds this amount. Using larger batches will lead to better performance, although you might overflow the uniform space of the shader/videocard (crashes)- Returns:
- maximum batch size
-
setMaxBatchSize
public void setMaxBatchSize(int maxBatchSize) Split the batch in multiple batches if number of visible meshes exceeds this amount. Using larger batches will lead to better performance, although you might overflow the uniform space of the shader/videocard (crashes)- Parameters:
maxBatchSize- maximum batch size
-
isAddedToRenderQueue
public boolean isAddedToRenderQueue() -
apply
Applies all instancing info to the mesh and returns if the current render call is allowed to continue- Parameters:
mesh- the meshrenderer- the renderershader- the shader- Returns:
- continue rendering or skip rendering all together
-