C# Class Axiom.Graphics.VertexData

Summary class collecting together vertex source information.
Inheritance: DisposableObject
Show file Open project: WolfgangSt/axiom Class Usage Examples

Public Properties

Property Type Description
HWAnimDataItemsUsed int
HWAnimationDataList List
hardwareShadowVolWBuffer HardwareVertexBuffer
vertexBufferBinding VertexBufferBinding
vertexCount int
vertexDeclaration VertexDeclaration
vertexStart int

Public Methods

Method Description
AllocateHardwareAnimationElements ( ushort count ) : void

Allocate elements to serve a holder of morph / pose target data for hardware morphing / pose blending.

This method will allocate the given number of 3D texture coordinate sets for use as a morph target or target pose offset (3D position). These elements will be saved in hwAnimationDataList. It will also assume that the source of these new elements will be new buffers which are not bound at this time, so will start the sources to 1 higher than the current highest binding source. The caller is expected to bind these new buffers when appropriate. For morph animation the original position buffer will be the 'from' keyframe data, whilst for pose animation it will be the original vertex data.

Clone ( ) : VertexData

Clones this vertex data, potentially including replicating any vertex buffers.

Clone ( bool copyData ) : VertexData

Clones this vertex data, potentially including replicating any vertex buffers.

PrepareForShadowVolume ( ) : void

Modifies the vertex data to be suitable for use for rendering shadow geometry.

Preparing vertex data to generate a shadow volume involves firstly ensuring that the vertex buffer containing the positions is a standalone vertex buffer, with no other components in it. This method will therefore break apart any existing vertex buffers if position is sharing a vertex buffer. Secondly, it will double the size of this vertex buffer so that there are 2 copies of the position data for the mesh. The first half is used for the original, and the second half is used for the 'extruded' version. The vertex count used to render will remain the same though, so as not to add any overhead to regular rendering of the object. Both copies of the position are required in one buffer because shadow volumes stretch from the original mesh to the extruded version.

It's important to appreciate that this method can fundamentally change the structure of your vertex buffers, although in reality they will be new buffers. As it happens, if other objects are using the original buffers then they will be unaffected because the reference counting will keep them intact. However, if you have made any assumptions about the structure of the vertex data in the buffers of this object, you may have to rethink them.

VertexData ( ) : System

Default constructor. Calls on the current buffer manager to initialize the bindings and declarations.

Protected Methods

Method Description
dispose ( bool disposeManagedResources ) : void

Method Details

AllocateHardwareAnimationElements() public method

Allocate elements to serve a holder of morph / pose target data for hardware morphing / pose blending.
This method will allocate the given number of 3D texture coordinate sets for use as a morph target or target pose offset (3D position). These elements will be saved in hwAnimationDataList. It will also assume that the source of these new elements will be new buffers which are not bound at this time, so will start the sources to 1 higher than the current highest binding source. The caller is expected to bind these new buffers when appropriate. For morph animation the original position buffer will be the 'from' keyframe data, whilst for pose animation it will be the original vertex data.
public AllocateHardwareAnimationElements ( ushort count ) : void
count ushort
return void

Clone() public method

Clones this vertex data, potentially including replicating any vertex buffers.
public Clone ( ) : VertexData
return VertexData

Clone() public method

Clones this vertex data, potentially including replicating any vertex buffers.
public Clone ( bool copyData ) : VertexData
copyData bool /// If true, makes a copy the vertex buffer in addition to the definition. /// If false, the clone will refer to the same vertex buffer this object refers to. ///
return VertexData

PrepareForShadowVolume() public method

Modifies the vertex data to be suitable for use for rendering shadow geometry.

Preparing vertex data to generate a shadow volume involves firstly ensuring that the vertex buffer containing the positions is a standalone vertex buffer, with no other components in it. This method will therefore break apart any existing vertex buffers if position is sharing a vertex buffer. Secondly, it will double the size of this vertex buffer so that there are 2 copies of the position data for the mesh. The first half is used for the original, and the second half is used for the 'extruded' version. The vertex count used to render will remain the same though, so as not to add any overhead to regular rendering of the object. Both copies of the position are required in one buffer because shadow volumes stretch from the original mesh to the extruded version.

It's important to appreciate that this method can fundamentally change the structure of your vertex buffers, although in reality they will be new buffers. As it happens, if other objects are using the original buffers then they will be unaffected because the reference counting will keep them intact. However, if you have made any assumptions about the structure of the vertex data in the buffers of this object, you may have to rethink them.

public PrepareForShadowVolume ( ) : void
return void

VertexData() public method

Default constructor. Calls on the current buffer manager to initialize the bindings and declarations.
public VertexData ( ) : System
return System

dispose() protected method

protected dispose ( bool disposeManagedResources ) : void
disposeManagedResources bool
return void

Property Details

HWAnimDataItemsUsed public property

Number of hardware animation data items used
public int HWAnimDataItemsUsed
return int

HWAnimationDataList public property

VertexElements used for hardware morph / pose animation
public List HWAnimationDataList
return List

hardwareShadowVolWBuffer public property

Additional shadow volume vertex buffer storage.
This additional buffer is only used where we have prepared this VertexData for use in shadow volume contruction, and where the current render system supports vertex programs. This buffer contains the 'w' vertex position component which will be used by that program to differentiate between extruded and non-extruded vertices. This 'w' component cannot be included in the original position buffer because DirectX does not allow 4-component positions in the fixed-function pipeline, and the original position buffer must still be usable for fixed-function rendering.

Note that we don't store any vertex declaration or vertex buffer binding here becuase this can be reused in the shadow algorithm.

public HardwareVertexBuffer hardwareShadowVolWBuffer
return HardwareVertexBuffer

vertexBufferBinding public property

The vertex buffer bindings to be used.
public VertexBufferBinding vertexBufferBinding
return VertexBufferBinding

vertexCount public property

The number of vertices used in this operation.
public int vertexCount
return int

vertexDeclaration public property

Declaration of the vertex to be used in this operation.
public VertexDeclaration vertexDeclaration
return VertexDeclaration

vertexStart public property

The base vertex index to start from, if using unindexed geometry.
public int vertexStart
return int