Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Ogre::ProgressiveMesh Class Reference

This class reduces the complexity of the geometry it is given. More...

#include <OgreProgressiveMesh.h>

List of all members.

Public Types

typedef std::vector< LODFaceDataLODFaceList
enum  VertexReductionQuota { VRQ_CONSTANT, VRQ_PROPORTIONAL }
 The way to derive the quota of vertices which are reduced at each LOD. More...


Public Methods

 ProgressiveMesh (GeometryData *data, ushort *indexBuffer, ushort numIndexes)
 Constructor, takes the geometry data and index buffer. More...

virtual ~ProgressiveMesh ()
virtual void addExtraVertexPositionBuffer (Real *buffer)
 Adds an extra vertex position buffer. More...

virtual void build (ushort numLevels, LODFaceList *outList, VertexReductionQuota quota=VRQ_PROPORTIONAL, Real reductionValue=0.5f)
 Builds the progressive mesh with the specified number of levels. More...


Protected Types

typedef std::vector< PMTriangleTriangleList
typedef std::vector< PMFaceVertexFaceVertexList
typedef std::vector< PMVertexCommonVertexList
typedef std::vector< RealWorstCostList
typedef std::vector< PMWorkingDataWorkingDataList

Protected Methods

void addWorkingData (Real *pPositions, GeometryData *data, ushort *indexBuffer, ushort numIndexes)
 Internal method for building PMWorkingData from geometry data. More...

void initialiseEdgeCollapseCosts (void)
 Internal method for initialising the edge collapse costs. More...

Real computeEdgeCollapseCost (PMVertex *src, PMVertex *dest)
 Internal calculation method for deriving a collapse cost from u to v. More...

Real computeEdgeCostAtVertexForBuffer (WorkingDataList::iterator idata, ushort vertIndex)
 Internal method evaluates all collapse costs from this vertex and picks the lowest for a single buffer. More...

void computeEdgeCostAtVertex (ushort vertIndex)
 Internal method evaluates all collapse costs from this vertex for every buffer and returns the worst. More...

void computeAllCosts (void)
 Internal method to compute edge collapse costs for all buffers /. More...

ushort getNextCollapser (void)
 Internal method for getting the index of next best vertex to collapse. More...

void bakeNewLOD (LODFaceData *pData)
 Internal method builds an new LOD based on the current state. More...

void collapse (PMVertex *collapser)
 Internal method, collapses vertex onto it's saved collapse target. More...

void dumpContents (const String &log)
 Internal debugging method. More...


Protected Attributes

GeometryDatampGeomData
ushortmpIndexBuffer
ushort mNumIndexes
ushort mCurrNumIndexes
ushort mNumCommonVertices
WorkingDataList mWorkingData
 Multiple copies, 1 per vertex buffer. More...

WorstCostList mWorstCosts
 The worst collapse cost from all vertex buffers for each vertex. More...


Detailed Description

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.


Member Typedef Documentation

typedef std::vector<PMVertex> Ogre::ProgressiveMesh::CommonVertexList [protected]
 

typedef std::vector<PMFaceVertex> Ogre::ProgressiveMesh::FaceVertexList [protected]
 

typedef std::vector<LODFaceData> Ogre::ProgressiveMesh::LODFaceList
 

typedef std::vector<PMTriangle> Ogre::ProgressiveMesh::TriangleList [protected]
 

typedef std::vector<PMWorkingData> Ogre::ProgressiveMesh::WorkingDataList [protected]
 

typedef std::vector<Real> Ogre::ProgressiveMesh::WorstCostList [protected]
 


Member Enumeration Documentation

enum Ogre::ProgressiveMesh::VertexReductionQuota
 

The way to derive the quota of vertices which are reduced at each LOD.

Enumeration values:
VRQ_CONSTANT  A set number of vertices are removed at each reduction.
VRQ_PROPORTIONAL  A proportion of the remaining number of vertices are removed at each reduction.


Constructor & Destructor Documentation

Ogre::ProgressiveMesh::ProgressiveMesh GeometryData   data,
ushort   indexBuffer,
ushort    numIndexes
 

Constructor, takes the geometry data and index buffer.

Ogre::ProgressiveMesh::~ProgressiveMesh   [virtual]
 


Member Function Documentation

void Ogre::ProgressiveMesh::addExtraVertexPositionBuffer Real   buffer [virtual]
 

Adds an extra vertex position buffer.

Remarks:
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.
Parameters:
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.

void Ogre::ProgressiveMesh::addWorkingData Real   pPositions,
GeometryData   data,
ushort   indexBuffer,
ushort    numIndexes
[protected]
 

Internal method for building PMWorkingData from geometry data.

void Ogre::ProgressiveMesh::bakeNewLOD LODFaceData   pData [protected]
 

Internal method builds an new LOD based on the current state.

void Ogre::ProgressiveMesh::build ushort    numLevels,
LODFaceList   outList,
VertexReductionQuota    quota = VRQ_PROPORTIONAL,
Real    reductionValue = 0.5f
[virtual]
 

Builds the progressive mesh with the specified number of levels.

Parameters:
numLevels  The number of levels to include in the output excluding the full detail version.
outList  Pointer to a list of LOD geometry data which will be completed by the application. Each entry is a reduced form of the mesh, in decreasing order of detail.
quota  The way to derive the number of vertices removed at each LOD
reductionValue  Either the proportion of vertices to remove at each level, or a fixed number of vertices to remove at each level, depending on the value of quota

void Ogre::ProgressiveMesh::collapse PMVertex   collapser [protected]
 

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

Remarks:
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.

void Ogre::ProgressiveMesh::computeAllCosts void    [protected]
 

Internal method to compute edge collapse costs for all buffers /.

Real Ogre::ProgressiveMesh::computeEdgeCollapseCost PMVertex   src,
PMVertex   dest
[protected]
 

Internal calculation method for deriving a collapse cost from u to v.

void Ogre::ProgressiveMesh::computeEdgeCostAtVertex ushort    vertIndex [protected]
 

Internal method evaluates all collapse costs from this vertex for every buffer and returns the worst.

Real Ogre::ProgressiveMesh::computeEdgeCostAtVertexForBuffer WorkingDataList::iterator    idata,
ushort    vertIndex
[protected]
 

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

void Ogre::ProgressiveMesh::dumpContents const String   log [protected]
 

Internal debugging method.

ushort Ogre::ProgressiveMesh::getNextCollapser void    [protected]
 

Internal method for getting the index of next best vertex to collapse.

void Ogre::ProgressiveMesh::initialiseEdgeCollapseCosts void    [protected]
 

Internal method for initialising the edge collapse costs.


Member Data Documentation

ushort Ogre::ProgressiveMesh::mCurrNumIndexes [protected]
 

ushort Ogre::ProgressiveMesh::mNumCommonVertices [protected]
 

ushort Ogre::ProgressiveMesh::mNumIndexes [protected]
 

GeometryData* Ogre::ProgressiveMesh::mpGeomData [protected]
 

ushort* Ogre::ProgressiveMesh::mpIndexBuffer [protected]
 

WorkingDataList Ogre::ProgressiveMesh::mWorkingData [protected]
 

Multiple copies, 1 per vertex buffer.

WorstCostList Ogre::ProgressiveMesh::mWorstCosts [protected]
 

The worst collapse cost from all vertex buffers for each vertex.

Copyright © 2002 by The OGRE Team