This class reduces the complexity of the geometry it is given. More...
#include <OgreProgressiveMesh.h>
Classes | |
class | PMFaceVertex |
A vertex as used by a face. More... | |
class | PMTriangle |
A triangle in the progressive mesh, holds extra info like face normal. More... | |
class | PMVertex |
A vertex in the progressive mesh, holds info like collapse cost etc. More... | |
struct | PMWorkingData |
Data used to calculate the collapse costs. More... | |
Public Types | |
enum | VertexReductionQuota { VRQ_CONSTANT, VRQ_PROPORTIONAL, VRQ_ERROR_COST } |
The way to derive the quota of vertices which are reduced at each LOD. More... | |
typedef vector< Real >::type | LodValueList |
Public Member Functions | |
void * | operator new (size_t sz, const char *file, int line, const char *func) |
operator new, with debug line info | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *ptr) |
placement operator new | |
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
array operator new, with debug line info | |
void * | operator new[] (size_t sz) |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete (void *ptr, const char *, int, const char *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *ptr, const char *, int, const char *) |
Static Public Member Functions | |
static bool | generateLodLevels (Mesh *pMesh, const LodValueList &lodValues, VertexReductionQuota reductionMethod, Real reductionValue) |
Automatically generates lower level of detail versions of this mesh for use when a simpler version of the model is acceptable for rendering. | |
static MeshPtr | generateSimplifiedMesh (const String &name, const String &groupName, Mesh *inMesh, bool dropOriginalGeometry, const LodValueList &lodValues, VertexReductionQuota reductionMethod, Real reductionValue, size_t *removedVertexDuplicatesCount) |
Automatically generates lower level of detail versions of this mesh for use when a simpler version of the model is acceptable for rendering. | |
Protected Types | |
typedef vector < ProgressiveMesh * >::type | ProgressiveMeshList |
typedef vector< PMTriangle >::type | TriangleList |
typedef vector< PMFaceVertex > ::type | FaceVertexList |
typedef vector< PMVertex >::type | CommonVertexList |
typedef std::pair< Real, unsigned int > | CostIndexPair |
typedef vector< CostIndexPair > ::type | WorstCostList |
typedef vector< PMWorkingData > ::type | WorkingDataList |
typedef std::pair< unsigned, PMVertex * > | IndexVertexPair |
We can defragment mesh, removing unused vertices and re-indexing other, storing old-to-new mapping in index map. | |
Protected Member Functions | |
ProgressiveMesh (SubMesh *pSubMesh) | |
Constructor, takes SubMesh pointer. | |
virtual | ~ProgressiveMesh () |
virtual void | addExtraVertexPositionBuffer (const VertexData *vertexData) |
Adds an extra vertex position buffer. | |
void | addWorkingData (const VertexData *vertexData, const IndexData *indexData) |
Internal method for building PMWorkingData from geometry data. | |
void | mergeWorkingDataBorders () |
void | initialiseEdgeCollapseCosts (void) |
Internal method for initialising the edge collapse costs. | |
Real | computeEdgeCollapseCost (PMVertex *src, PMVertex *dest) const |
Internal calculation method for deriving a collapse cost from u to v. | |
bool | collapseInvertsNormals (PMVertex *src, PMVertex *dest) const |
Internal calculation method, return true if edge collapse flip some neighbor face normal. | |
Real | computeEdgeCostAtVertexForBuffer (PMVertex *v) |
Internal method evaluates all collapse costs from this vertex and picks the lowest for a single buffer. | |
Real | computeEdgeCostAtVertex (size_t vertIndex) |
Internal method evaluates all collapse costs from this vertex for every buffer and returns the worst. | |
void | computeAllCosts (void) |
Internal method to compute edge collapse costs for all buffers /. | |
void | recomputeInvalidCosts () |
void | sortIndexesByCost () |
CostIndexPair * | getNextCollapser () |
void | bakeNewLOD (IndexData *pData) |
Internal method builds an new LOD based on the current state. | |
void | collapse (PMVertex *collapser) |
Internal method, collapses vertex onto it's saved collapse target. | |
void | dumpContents (const String &log) |
Internal debugging method. | |
Static Protected Member Functions | |
static void | initializeProgressiveMeshList (ProgressiveMeshList &pmList, Mesh *pMesh) |
Allocates internal resources. | |
static void | freeProgressiveMeshList (ProgressiveMeshList *pmList) |
Deletes allocated internal resources. | |
static bool | build (ProgressiveMeshList &pmInList, const LodStrategy *lodStrategy, const LodValueList &lodValues, VertexReductionQuota quota, Real reductionValue=0.5f) |
Builds the progressive mesh with the specified number of levels. | |
static size_t | getInvalidCostCount (ProgressiveMesh::ProgressiveMeshList &pmList) |
Internal methods for lazy costs recomputing. | |
static bool | recomputeInvalidCosts (ProgressiveMeshList &pmInList) |
static int | cmpByCost (const void *p1, const void *p2) |
static void | getNextCollapser (ProgressiveMeshList &pmList, ProgressiveMesh *&pm, CostIndexPair *&bestCollapser) |
Internal methods for getting the index of next best vertex to collapse among all submeshes. | |
static void | bakeLodUsage (Mesh *pMesh, LodStrategy *lodStrategy, const LodValueList &lodValues, bool skipFirstLodLevel=false) |
Internal method builds an LODs usage, possibly skipping first LOD, that can be used as original geometry. | |
static void | bakeSimplifiedMesh (Mesh *destMesh, Mesh *srcMesh, ProgressiveMeshList &pmList, bool dropFirstLodLevel=false) |
Optionally discards first LOD level (i.e. original geometry), removes unused vertices, remaps indexes. | |
static void | createSimplifiedVertexData (vector< IndexVertexPair >::type &usedVertices, VertexData *inVData, VertexData *&outVData, AxisAlignedBox &aabox) |
Defragments vertices, removing unused. Useful if original geometry is redundant or dropped at all. | |
static void | createIndexMap (vector< IndexVertexPair >::type &usedVertices, unsigned allVertexCount, vector< unsigned >::type &indexMap) |
During vertices defragmentation vertices are re-indexed, so old-to-new mapping is stored in index map by this function. | |
Protected Attributes | |
SubMesh * | mSubMesh |
Can be NULL for non-indexed subMeshes, such PM would be skipped. | |
VertexData * | mVertexData |
IndexData * | mIndexData |
vector< IndexData * >::type | mLodFaceList |
size_t | mRemovedVertexDuplicatesCount |
size_t | mCurrNumIndexes |
float | mInvSquaredBoundBoxDiagonal |
int | mVertexComponentFlags |
WorkingDataList | mWorkingData |
Multiple copies, 1 per vertex buffer. | |
WorstCostList | mWorstCosts |
The worst collapse cost from all vertex buffers for each vertex. | |
BitArray | mInvalidCostMask |
size_t | mInvalidCostCount |
size_t | mWorstCostsSize |
size_t | mNextWorstCostHint |
PMVertex::FaceList | mEdgeAdjacentSides |
Temporary variable used in computeEdgeCollapseCost, declared here to avoid multiple memory allocations. |
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.
Definition at line 107 of file OgreProgressiveMesh.h.
typedef vector<PMVertex>::type Ogre::ProgressiveMesh::CommonVertexList [protected] |
Definition at line 308 of file OgreProgressiveMesh.h.
typedef std::pair<Real, unsigned int> Ogre::ProgressiveMesh::CostIndexPair [protected] |
Definition at line 309 of file OgreProgressiveMesh.h.
typedef vector<PMFaceVertex>::type Ogre::ProgressiveMesh::FaceVertexList [protected] |
Definition at line 307 of file OgreProgressiveMesh.h.
typedef std::pair<unsigned, PMVertex*> Ogre::ProgressiveMesh::IndexVertexPair [protected] |
We can defragment mesh, removing unused vertices and re-indexing other, storing old-to-new mapping in index map.
Definition at line 376 of file OgreProgressiveMesh.h.
typedef vector<Real>::type Ogre::ProgressiveMesh::LodValueList |
Definition at line 110 of file OgreProgressiveMesh.h.
typedef vector<ProgressiveMesh*>::type Ogre::ProgressiveMesh::ProgressiveMeshList [protected] |
Definition at line 168 of file OgreProgressiveMesh.h.
typedef vector<PMTriangle>::type Ogre::ProgressiveMesh::TriangleList [protected] |
Definition at line 306 of file OgreProgressiveMesh.h.
typedef vector<PMWorkingData>::type Ogre::ProgressiveMesh::WorkingDataList [protected] |
Definition at line 320 of file OgreProgressiveMesh.h.
typedef vector<CostIndexPair>::type Ogre::ProgressiveMesh::WorstCostList [protected] |
Definition at line 310 of file OgreProgressiveMesh.h.
The way to derive the quota of vertices which are reduced at each LOD.
Definition at line 113 of file OgreProgressiveMesh.h.
Ogre::ProgressiveMesh::ProgressiveMesh | ( | SubMesh * | pSubMesh | ) | [protected] |
Constructor, takes SubMesh pointer.
virtual Ogre::ProgressiveMesh::~ProgressiveMesh | ( | ) | [protected, virtual] |
virtual void Ogre::ProgressiveMesh::addExtraVertexPositionBuffer | ( | const VertexData * | vertexData | ) | [protected, virtual] |
Adds an extra vertex position buffer.
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 | ( | const VertexData * | vertexData, | |
const IndexData * | indexData | |||
) | [protected] |
Internal method for building PMWorkingData from geometry data.
static void Ogre::ProgressiveMesh::bakeLodUsage | ( | Mesh * | pMesh, | |
LodStrategy * | lodStrategy, | |||
const LodValueList & | lodValues, | |||
bool | skipFirstLodLevel = false | |||
) | [static, protected] |
Internal method builds an LODs usage, possibly skipping first LOD, that can be used as original geometry.
void Ogre::ProgressiveMesh::bakeNewLOD | ( | IndexData * | pData | ) | [protected] |
Internal method builds an new LOD based on the current state.
static void Ogre::ProgressiveMesh::bakeSimplifiedMesh | ( | Mesh * | destMesh, | |
Mesh * | srcMesh, | |||
ProgressiveMeshList & | pmList, | |||
bool | dropFirstLodLevel = false | |||
) | [static, protected] |
Optionally discards first LOD level (i.e. original geometry), removes unused vertices, remaps indexes.
static bool Ogre::ProgressiveMesh::build | ( | ProgressiveMeshList & | pmInList, | |
const LodStrategy * | lodStrategy, | |||
const LodValueList & | lodValues, | |||
VertexReductionQuota | quota, | |||
Real | reductionValue = 0.5f | |||
) | [static, protected] |
Builds the progressive mesh with the specified number of levels.
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 |
static int Ogre::ProgressiveMesh::cmpByCost | ( | const void * | p1, | |
const void * | p2 | |||
) | [static, protected] |
void Ogre::ProgressiveMesh::collapse | ( | PMVertex * | collapser | ) | [protected] |
Internal method, collapses vertex onto it's saved collapse target.
bool Ogre::ProgressiveMesh::collapseInvertsNormals | ( | PMVertex * | src, | |
PMVertex * | dest | |||
) | const [protected] |
Internal calculation method, return true if edge collapse flip some neighbor face normal.
void Ogre::ProgressiveMesh::computeAllCosts | ( | void | ) | [protected] |
Internal method to compute edge collapse costs for all buffers /.
Real Ogre::ProgressiveMesh::computeEdgeCollapseCost | ( | PMVertex * | src, | |
PMVertex * | dest | |||
) | const [protected] |
Internal calculation method for deriving a collapse cost from u to v.
Real Ogre::ProgressiveMesh::computeEdgeCostAtVertex | ( | size_t | vertIndex | ) | [protected] |
Internal method evaluates all collapse costs from this vertex for every buffer and returns the worst.
Internal method evaluates all collapse costs from this vertex and picks the lowest for a single buffer.
static void Ogre::ProgressiveMesh::createIndexMap | ( | vector< IndexVertexPair >::type & | usedVertices, | |
unsigned | allVertexCount, | |||
vector< unsigned >::type & | indexMap | |||
) | [static, protected] |
During vertices defragmentation vertices are re-indexed, so old-to-new mapping is stored in index map by this function.
static void Ogre::ProgressiveMesh::createSimplifiedVertexData | ( | vector< IndexVertexPair >::type & | usedVertices, | |
VertexData * | inVData, | |||
VertexData *& | outVData, | |||
AxisAlignedBox & | aabox | |||
) | [static, protected] |
Defragments vertices, removing unused. Useful if original geometry is redundant or dropped at all.
void Ogre::ProgressiveMesh::dumpContents | ( | const String & | log | ) | [protected] |
Internal debugging method.
static void Ogre::ProgressiveMesh::freeProgressiveMeshList | ( | ProgressiveMeshList * | pmList | ) | [static, protected] |
Deletes allocated internal resources.
static bool Ogre::ProgressiveMesh::generateLodLevels | ( | Mesh * | pMesh, | |
const LodValueList & | lodValues, | |||
VertexReductionQuota | reductionMethod, | |||
Real | reductionValue | |||
) | [static] |
Automatically generates lower level of detail versions of this mesh for use when a simpler version of the model is acceptable for rendering.
lodValues | A list of lod values indicating the values at which new lods should be generated. These are 'user values', before being potentially transformed by the strategy, so for the distance strategy this is an unsquared distance for example. | |
reductionMethod | The way to determine the number of vertices collapsed per LOD | |
reductionValue | Meaning depends on reductionMethod, typically either the proportion of remaining vertices to collapse or a fixed number of vertices. |
static MeshPtr Ogre::ProgressiveMesh::generateSimplifiedMesh | ( | const String & | name, | |
const String & | groupName, | |||
Mesh * | inMesh, | |||
bool | dropOriginalGeometry, | |||
const LodValueList & | lodValues, | |||
VertexReductionQuota | reductionMethod, | |||
Real | reductionValue, | |||
size_t * | removedVertexDuplicatesCount | |||
) | [static] |
Automatically generates lower level of detail versions of this mesh for use when a simpler version of the model is acceptable for rendering.
static size_t Ogre::ProgressiveMesh::getInvalidCostCount | ( | ProgressiveMesh::ProgressiveMeshList & | pmList | ) | [static, protected] |
Internal methods for lazy costs recomputing.
CostIndexPair* Ogre::ProgressiveMesh::getNextCollapser | ( | ) | [protected] |
static void Ogre::ProgressiveMesh::getNextCollapser | ( | ProgressiveMeshList & | pmList, | |
ProgressiveMesh *& | pm, | |||
CostIndexPair *& | bestCollapser | |||
) | [static, protected] |
Internal methods for getting the index of next best vertex to collapse among all submeshes.
void Ogre::ProgressiveMesh::initialiseEdgeCollapseCosts | ( | void | ) | [protected] |
Internal method for initialising the edge collapse costs.
static void Ogre::ProgressiveMesh::initializeProgressiveMeshList | ( | ProgressiveMeshList & | pmList, | |
Mesh * | pMesh | |||
) | [static, protected] |
Allocates internal resources.
void Ogre::ProgressiveMesh::mergeWorkingDataBorders | ( | ) | [protected] |
void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr, | |
const char * | , | |||
int | , | |||
const char * | ||||
) | [inherited] |
Definition at line 107 of file OgreMemoryAllocatedObject.h.
void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr, | |
void * | ||||
) | [inherited] |
Definition at line 101 of file OgreMemoryAllocatedObject.h.
void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr | ) | [inherited] |
Definition at line 95 of file OgreMemoryAllocatedObject.h.
void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr, | |
const char * | , | |||
int | , | |||
const char * | ||||
) | [inherited] |
Definition at line 118 of file OgreMemoryAllocatedObject.h.
void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr | ) | [inherited] |
Definition at line 112 of file OgreMemoryAllocatedObject.h.
void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz, | |
void * | ptr | |||
) | [inherited] |
placement operator new
Definition at line 78 of file OgreMemoryAllocatedObject.h.
void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz | ) | [inherited] |
Definition at line 72 of file OgreMemoryAllocatedObject.h.
void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz, | |
const char * | file, | |||
int | line, | |||
const char * | func | |||
) | [inherited] |
operator new, with debug line info
Definition at line 67 of file OgreMemoryAllocatedObject.h.
void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz | ) | [inherited] |
Definition at line 90 of file OgreMemoryAllocatedObject.h.
void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz, | |
const char * | file, | |||
int | line, | |||
const char * | func | |||
) | [inherited] |
array operator new, with debug line info
Definition at line 85 of file OgreMemoryAllocatedObject.h.
void Ogre::ProgressiveMesh::recomputeInvalidCosts | ( | ) | [protected] |
static bool Ogre::ProgressiveMesh::recomputeInvalidCosts | ( | ProgressiveMeshList & | pmInList | ) | [static, protected] |
void Ogre::ProgressiveMesh::sortIndexesByCost | ( | ) | [protected] |
size_t Ogre::ProgressiveMesh::mCurrNumIndexes [protected] |
Definition at line 225 of file OgreProgressiveMesh.h.
PMVertex::FaceList Ogre::ProgressiveMesh::mEdgeAdjacentSides [mutable, protected] |
Temporary variable used in computeEdgeCollapseCost, declared here to avoid multiple memory allocations.
Definition at line 332 of file OgreProgressiveMesh.h.
IndexData* Ogre::ProgressiveMesh::mIndexData [protected] |
Definition at line 220 of file OgreProgressiveMesh.h.
size_t Ogre::ProgressiveMesh::mInvalidCostCount [protected] |
Definition at line 327 of file OgreProgressiveMesh.h.
BitArray Ogre::ProgressiveMesh::mInvalidCostMask [protected] |
Definition at line 326 of file OgreProgressiveMesh.h.
float Ogre::ProgressiveMesh::mInvSquaredBoundBoxDiagonal [protected] |
Definition at line 226 of file OgreProgressiveMesh.h.
vector<IndexData*>::type Ogre::ProgressiveMesh::mLodFaceList [protected] |
Definition at line 222 of file OgreProgressiveMesh.h.
size_t Ogre::ProgressiveMesh::mNextWorstCostHint [protected] |
Definition at line 329 of file OgreProgressiveMesh.h.
size_t Ogre::ProgressiveMesh::mRemovedVertexDuplicatesCount [protected] |
Definition at line 224 of file OgreProgressiveMesh.h.
SubMesh* Ogre::ProgressiveMesh::mSubMesh [protected] |
Can be NULL for non-indexed subMeshes, such PM would be skipped.
Definition at line 217 of file OgreProgressiveMesh.h.
int Ogre::ProgressiveMesh::mVertexComponentFlags [protected] |
Definition at line 227 of file OgreProgressiveMesh.h.
VertexData* Ogre::ProgressiveMesh::mVertexData [protected] |
Definition at line 219 of file OgreProgressiveMesh.h.
WorkingDataList Ogre::ProgressiveMesh::mWorkingData [protected] |
Multiple copies, 1 per vertex buffer.
Definition at line 322 of file OgreProgressiveMesh.h.
WorstCostList Ogre::ProgressiveMesh::mWorstCosts [protected] |
The worst collapse cost from all vertex buffers for each vertex.
Definition at line 325 of file OgreProgressiveMesh.h.
size_t Ogre::ProgressiveMesh::mWorstCostsSize [protected] |
Definition at line 328 of file OgreProgressiveMesh.h.
Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 23:39:03 2012