new MeshBatch(mesh, material, dynamic)
Parameters:
Name | Type | Description |
---|---|---|
mesh |
Mesh | The |
material |
Material | The |
dynamic |
Boolean | Whether or not the generated geometry is dynamic. If so, updating the instance transforms often can be faster, but it removes frustum culling for this batch unless bounds are explicitly assigned. Defaults to false. |
Properties:
Name | Type | Description |
---|---|---|
numInstances |
number | The amount of instances that will be drawn. |
Extends
Methods
-
createInstance(transform)
-
Adds an instance with a given transform. This method returns the ID for the instance, which is used when the instance needs to be deleted or its transform updated.
Parameters:
Name Type Description transform
A
Matrix4x4
or aTransform
containing the transformation for the instance.Returns:
An ID representing the instance. Use this to set the transform in
MeshBatch#setTransform
andMeshBatch#destroyInstance
.- Type
- number
-
destroyInstance(instanceID)
-
Destroys an instance.
Parameters:
Name Type Description instanceID
The instance ID as returned by
MeshBatch#createInstance
-
setTransform(instanceID, transform)
-
Changes the transform for an instance.
Parameters:
Name Type Description instanceID
The instance ID as returned by
MeshBatch#createInstance
transform