Class InstancedDrawer
Helper for instanced drawing of matrices. Contains a dynamically extendable list of matrices and lets you add matrices that should be drawn. Automatically adds new matrix arrays if the max. count of instanced drawing is reached. Once the structure is built, created lists stay in the system, so no new objects are created and the system works with maximal efficiency.
Inheritance
object
InstancedDrawer
Namespace: AS2.Visuals
Assembly: .dll
Syntax
public class InstancedDrawer
Fields
| Edit this page View Sourcecount
Declaration
private int count
Field Value
Type | Description |
---|---|
int |
matricesList
Declaration
private List<Matrix4x4[]> matricesList
Field Value
Type | Description |
---|---|
List<Matrix4x4[]> |
Properties
| Edit this page View SourceCapacity
Declaration
private int Capacity { get; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceAddMatrix(Matrix4x4)
Adds a matrix to the system.
Declaration
public void AddMatrix(Matrix4x4 matrix)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x4 | matrix | The matrix to be added. |
ClearMatrices()
Clears the drawn matrices. Internally, only the counter is set to 0 and the matrices will be overridden when you add new matrices.
Declaration
public void ClearMatrices()
Draw(Mesh, Material, MaterialPropertyBlock)
Draws the matrices stored in this class.
Declaration
public void Draw(Mesh mesh, Material mat, MaterialPropertyBlock matPropBlock = null)
Parameters
Type | Name | Description |
---|---|---|
Mesh | mesh | The mesh to use. |
Material | mat | The material to use. |
MaterialPropertyBlock | matPropBlock | A material property block. Can be omitted. |