C# Class Axiom.Core.ProgressiveMesh

Class for handling multiple levels of detail for a Mesh
This class reduces the complexity of the geometry it is given. This class is dedicated to reducing the number of triangles in a given mesh taking into account seams in both geometry and texture co-ordinates and meshes which have multiple frames. The primary use for this is generating LOD versions of Mesh objects, but it can be used by any geometry provider. The only limitation at the moment is that the provider uses a common vertex buffer for all LODs and one index buffer per LOD. Therefore at the moment this class can only handle indexed geometry. NB the interface of this class will certainly change when compiled vertex buffers are supported.
Datei anzeigen Open project: WolfgangSt/axiom Class Usage Examples

Public Methods

Method Description
AddExtraVertexPositionBuffer ( VertexData vertexData ) : void

Adds an extra vertex position buffer.

As well as the main vertex buffer, the client of this class may add extra versions of the vertex buffer which will also be taken into account when the cost of simplifying the mesh is taken into account. This is because the cost of simplifying an animated mesh cannot be calculated from just the reference position, multiple positions needs to be assessed in order to find the best simplification option.

DO NOT pass write-only, unshadowed buffers to this method! They will not work. Pass only shadowed buffers, or better yet perform mesh reduction as an offline process using DefaultHardwareBufferManager to manage vertex buffers in system memory.

AddWorkingData ( VertexData vertexData, IndexData indexData ) : void

Internal method for building PMWorkingData from geometry data

BakeNewLOD ( IndexData indexData ) : void

Internal method builds an new LOD based on the current state

Build ( ushort numLevels, List lodFaceList ) : void
Build ( ushort numLevels, List lodFaceList, VertexReductionQuota quota ) : void
Build ( ushort numLevels, List lodFaceList, VertexReductionQuota quota, float reductionValue ) : void

Builds the progressive mesh with the specified number of levels.

Build ( ushort numLevels, List lodFaceList, float reductionValue ) : void
Collapse ( PMVertex src ) : void

Internal method, collapses vertex onto it's saved collapse target.

This updates the working triangle list to drop a triangle and recalculates the edge collapse costs around the collapse target. This also updates all the working vertex lists for the relevant buffer.

ComputeAllCosts ( ) : void
ComputeEdgeCostAtVertex ( uint vertIndex ) : void
InitialiseEdgeCollapseCosts ( ) : void
ProgressiveMesh ( VertexData vertexData, IndexData indexData ) : System

Constructor, takes the geometry data and index buffer.

DO NOT pass write-only, unshadowed buffers to this method! They will not work. Pass only shadowed buffers, or better yet perform mesh reduction as an offline process using DefaultHardwareBufferManager to manage vertex buffers in system memory.

Private Methods

Method Description
ComputeEdgeCollapseCost ( PMVertex src, PMVertex dest ) : float
ComputeEdgeCostAtVertexForBuffer ( PMWorkingData workingData, uint vertIndex ) : float

Internal method evaluates all collapse costs from this vertex and picks the lowest for a single buffer

GetNextCollapser ( ) : int

Method Details

AddExtraVertexPositionBuffer() public method

Adds an extra vertex position buffer.
As well as the main vertex buffer, the client of this class may add extra versions of the vertex buffer which will also be taken into account when the cost of simplifying the mesh is taken into account. This is because the cost of simplifying an animated mesh cannot be calculated from just the reference position, multiple positions needs to be assessed in order to find the best simplification option.

DO NOT pass write-only, unshadowed buffers to this method! They will not work. Pass only shadowed buffers, or better yet perform mesh reduction as an offline process using DefaultHardwareBufferManager to manage vertex buffers in system memory.

public AddExtraVertexPositionBuffer ( VertexData vertexData ) : void
vertexData Axiom.Graphics.VertexData buffer Pointer to x/y/z buffer with vertex positions. /// The number of vertices must be the same as in the original GeometryData passed to the constructor. ///
return void

AddWorkingData() public method

Internal method for building PMWorkingData from geometry data
public AddWorkingData ( VertexData vertexData, IndexData indexData ) : void
vertexData Axiom.Graphics.VertexData
indexData Axiom.Graphics.IndexData
return void

BakeNewLOD() public method

Internal method builds an new LOD based on the current state
public BakeNewLOD ( IndexData indexData ) : void
indexData Axiom.Graphics.IndexData Index data which will have an index buffer created and initialized
return void

Build() public method

public Build ( ushort numLevels, List lodFaceList ) : void
numLevels ushort
lodFaceList List
return void

Build() public method

public Build ( ushort numLevels, List lodFaceList, VertexReductionQuota quota ) : void
numLevels ushort
lodFaceList List
quota VertexReductionQuota
return void

Build() public method

Builds the progressive mesh with the specified number of levels.
public Build ( ushort numLevels, List lodFaceList, VertexReductionQuota quota, float reductionValue ) : void
numLevels ushort
lodFaceList List
quota VertexReductionQuota
reductionValue float
return void

Build() public method

public Build ( ushort numLevels, List lodFaceList, float reductionValue ) : void
numLevels ushort
lodFaceList List
reductionValue float
return void

Collapse() public method

Internal method, collapses vertex onto it's saved collapse target.
This updates the working triangle list to drop a triangle and recalculates the edge collapse costs around the collapse target. This also updates all the working vertex lists for the relevant buffer.
public Collapse ( PMVertex src ) : void
src PMVertex
return void

ComputeAllCosts() public method

public ComputeAllCosts ( ) : void
return void

ComputeEdgeCostAtVertex() public method

public ComputeEdgeCostAtVertex ( uint vertIndex ) : void
vertIndex uint
return void

InitialiseEdgeCollapseCosts() public method

public InitialiseEdgeCollapseCosts ( ) : void
return void

ProgressiveMesh() public method

Constructor, takes the geometry data and index buffer.
DO NOT pass write-only, unshadowed buffers to this method! They will not work. Pass only shadowed buffers, or better yet perform mesh reduction as an offline process using DefaultHardwareBufferManager to manage vertex buffers in system memory.
public ProgressiveMesh ( VertexData vertexData, IndexData indexData ) : System
vertexData Axiom.Graphics.VertexData
indexData Axiom.Graphics.IndexData
return System