C# Class Axiom.Core.InstancedGeometry

Pre-transforms and batches up meshes for efficient use as instanced geometry in a scene Shader instancing allows to save both memory and draw calls. While StaticGeometry stores 500 times the same object in a batch to display 500 objects, this shader instancing implementation stores only 80 times the object, and then re-uses the vertex data with different shader parameter. Although you save memory, you make more draw call. However, you still make less draw calls than if you were rendering each object independently. Plus, you can move the batched objects independently of one another which you cannot do with StaticGeometry.
Datei anzeigen Open project: WolfgangSt/axiom Class Usage Examples

Protected Properties

Property Type Description
mBatchInstanceDimensions Vector3
mBuilt bool
mCastShadows bool
mHalfBatchInstanceDimensions Vector3
mName String
mOrigin Vector3
mOwner SceneManager
mSquaredUpperDistance float
mUpperDistance float
mVisible bool

Public Methods

Method Description
AddEntity ( Entity ent, Vector3 position ) : void
AddEntity ( Entity ent, Vector3 position, Quaternion orientation ) : void
AddEntity ( Entity ent, Vector3 position, Quaternion orientation, Vector3 scale ) : void

Adds an Entity to the static geometry. This method takes an existing Entity and adds its details to the list of elements to include when building. Note that the Entity itself is not copied or referenced in this method; an Entity is passed simply so that you can change the materials of attached SubEntity objects if you want. You can add the same Entity instance multiple times with different material settings completely safely, and destroy the Entity before destroying this InstancedGeometry if you like. The Entity passed in is simply Must be called before 'Build'.

AddEntity ( Entity ent, Vector3 position, Vector3 scale ) : void
AddSceneNode ( SceneNode node ) : void

adds all the Entity objects attached to a SceneNode and all it's children to the static geometry. This method performs just like addEntity, except it adds all the entities attached to an entire sub-tree to the geometry. The position / orientation / scale parameters are taken from the node structure instead of being specified manually.

DetermineGeometry ( SubMesh sm ) : List

Look up or calculate the geometry data to use for this SubMesh

InstancedGeometry ( SceneManager owner, String name ) : System
SplitGeometry ( VertexData vd, IndexData id, Axiom.Core.SubMeshLodGeometryLink &targetGeomLink ) : void

Split some shared geometry into dedicated geometry.

Private Methods

Method Description
BuildIndexRemap ( uint pBuffer, int numIndexes, int>.Dictionary &remap ) : void
BuildIndexRemap ( ushort pBuffer, int numIndexes, int>.Dictionary &remap ) : void
RemapIndexes ( uint src, uint dst, int>.Dictionary &remap, int numIndexes ) : void
RemapIndexes ( ushort src, ushort dst, int>.Dictionary &remap, int numIndexes ) : void

Method Details

AddEntity() public method

public AddEntity ( Entity ent, Vector3 position ) : void
ent Entity
position Vector3
return void

AddEntity() public method

public AddEntity ( Entity ent, Vector3 position, Quaternion orientation ) : void
ent Entity
position Vector3
orientation Axiom.Math.Quaternion
return void

AddEntity() public method

Adds an Entity to the static geometry. This method takes an existing Entity and adds its details to the list of elements to include when building. Note that the Entity itself is not copied or referenced in this method; an Entity is passed simply so that you can change the materials of attached SubEntity objects if you want. You can add the same Entity instance multiple times with different material settings completely safely, and destroy the Entity before destroying this InstancedGeometry if you like. The Entity passed in is simply Must be called before 'Build'.
public AddEntity ( Entity ent, Vector3 position, Quaternion orientation, Vector3 scale ) : void
ent Entity The Entity to use as a definition (the Mesh and Materials /// referenced will be recorded for the build call).
position Vector3 The world position at which to add this Entity
orientation Axiom.Math.Quaternion The world orientation at which to add this Entity
scale Vector3
return void

AddEntity() public method

public AddEntity ( Entity ent, Vector3 position, Vector3 scale ) : void
ent Entity
position Vector3
scale Vector3
return void

AddSceneNode() public method

adds all the Entity objects attached to a SceneNode and all it's children to the static geometry. This method performs just like addEntity, except it adds all the entities attached to an entire sub-tree to the geometry. The position / orientation / scale parameters are taken from the node structure instead of being specified manually.
public AddSceneNode ( SceneNode node ) : void
node SceneNode
return void

DetermineGeometry() public method

Look up or calculate the geometry data to use for this SubMesh
public DetermineGeometry ( SubMesh sm ) : List
sm SubMesh
return List

InstancedGeometry() public method

public InstancedGeometry ( SceneManager owner, String name ) : System
owner SceneManager
name String
return System

SplitGeometry() public method

Split some shared geometry into dedicated geometry.
public SplitGeometry ( VertexData vd, IndexData id, Axiom.Core.SubMeshLodGeometryLink &targetGeomLink ) : void
vd Axiom.Graphics.VertexData
id Axiom.Graphics.IndexData
targetGeomLink Axiom.Core.SubMeshLodGeometryLink
return void

Property Details

mBatchInstanceDimensions protected_oe property

protected Vector3 mBatchInstanceDimensions
return Vector3

mBuilt protected_oe property

protected bool mBuilt
return bool

mCastShadows protected_oe property

protected bool mCastShadows
return bool

mHalfBatchInstanceDimensions protected_oe property

protected Vector3 mHalfBatchInstanceDimensions
return Vector3

mName protected_oe property

protected String mName
return String

mOrigin protected_oe property

protected Vector3 mOrigin
return Vector3

mOwner protected_oe property

protected SceneManager,Axiom.Core mOwner
return SceneManager

mSquaredUpperDistance protected_oe property

protected float mSquaredUpperDistance
return float

mUpperDistance protected_oe property

protected float mUpperDistance
return float

mVisible protected_oe property

protected bool mVisible
return bool