# Ogre::ProgressiveMesh Class Reference
LOD

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

`#include <OgreProgressiveMesh.h>`

Inheritance diagram for Ogre::ProgressiveMesh:
[legend]

List of all members.

## 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 }
| The way to derive the quota of vertices which are reduced at each LOD. More...
typedef vector< IndexData * >::type | LODFaceList

## Public Member Functions

| ProgressiveMesh (const VertexData *vertexData, const IndexData *indexData)
| Constructor, takes the geometry data and index buffer.
virtual | ~ProgressiveMesh ()
virtual void | addExtraVertexPositionBuffer (const VertexData *vertexData)
| Adds an extra vertex position buffer.
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.
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 *)

## Protected Types

typedef vector< PMTriangle >::type | TriangleList
typedef vector< PMFaceVertex > ::type | FaceVertexList
typedef vector< PMVertex >::type | CommonVertexList
typedef vector< Real >::type | WorstCostList
typedef vector< PMWorkingData > ::type | WorkingDataList

## Protected Member Functions

void | addWorkingData (const VertexData *vertexData, const IndexData *indexData)
| Internal method for building PMWorkingData from geometry data.
void | initialiseEdgeCollapseCosts (void)
| Internal method for initialising the edge collapse costs.
Real | computeEdgeCollapseCost (PMVertex *src, PMVertex *dest)
| Internal calculation method for deriving a collapse cost from u to v.
Real | computeEdgeCostAtVertexForBuffer (WorkingDataList::iterator idata, size_t vertIndex)
| Internal method evaluates all collapse costs from this vertex and picks the lowest for a single buffer.
void | 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 /.
size_t | getNextCollapser (void)
| Internal method for getting the index of next best vertex to collapse.
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.

## Protected Attributes

const VertexData * | mpVertexData
const IndexData * | mpIndexData
size_t | mCurrNumIndexes
size_t | mNumCommonVertices
WorkingDataList | mWorkingData
| Multiple copies, 1 per vertex buffer.
WorstCostList | mWorstCosts
| The worst collapse cost from all vertex buffers for each vertex.

## 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.

Definition at line 64 of file OgreProgressiveMesh.h.

## Member Typedef Documentation

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

Definition at line 192 of file OgreProgressiveMesh.h.

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

Definition at line 191 of file OgreProgressiveMesh.h.

typedef vector<IndexData*>::type Ogre::ProgressiveMesh::LODFaceList

Definition at line 77 of file OgreProgressiveMesh.h.

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

Definition at line 190 of file OgreProgressiveMesh.h.

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

Definition at line 203 of file OgreProgressiveMesh.h.

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

Definition at line 193 of file OgreProgressiveMesh.h.

## Member Enumeration Documentation

enum Ogre::ProgressiveMesh::VertexReductionQuota

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

Enumerator:

  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.

Definition at line 69 of file OgreProgressiveMesh.h.

## Constructor & Destructor Documentation

Ogre::ProgressiveMesh::ProgressiveMesh | ( | const VertexData * | vertexData,
|  | const IndexData * | indexData
| ) |  |

Constructor, takes the geometry data and index buffer.

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

virtual Ogre::ProgressiveMesh::~ProgressiveMesh | ( |  | ) | `[virtual]`

## Member Function Documentation

virtual void Ogre::ProgressiveMesh::addExtraVertexPositionBuffer | ( | const VertexData * | vertexData | ) | `[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.

  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.

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 | ( | const VertexData * | vertexData,
|  | const IndexData * | indexData
| ) |  | `[protected]`

Internal method for building PMWorkingData from geometry data.

void Ogre::ProgressiveMesh::bakeNewLOD | ( | IndexData * | pData | ) | `[protected]`

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

virtual 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 | ( | size_t | 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,
|  | size_t | 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.

size_t 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.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | void * |
| ) |  | `[inherited]`

Definition at line 101 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr | ) | `[inherited]`

Definition at line 95 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | const char * | ,
|  | int | ,
|  | const char * |
| ) |  | `[inherited]`

Definition at line 107 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr | ) | `[inherited]`

Definition at line 112 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr,
|  | const char * | ,
|  | int | ,
|  | const char * |
| ) |  | `[inherited]`

Definition at line 118 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz,
|  | void * | ptr
| ) |  | `[inherited]`

placement operator new

Definition at line 78 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

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.

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz | ) | `[inherited]`

Definition at line 72 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz | ) | `[inherited]`

Definition at line 90 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

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.

## Member Data Documentation

size_t Ogre::ProgressiveMesh::mCurrNumIndexes`[protected]`

Definition at line 121 of file OgreProgressiveMesh.h.

size_t Ogre::ProgressiveMesh::mNumCommonVertices`[protected]`

Definition at line 122 of file OgreProgressiveMesh.h.

const IndexData* Ogre::ProgressiveMesh::mpIndexData`[protected]`

Definition at line 119 of file OgreProgressiveMesh.h.

const VertexData* Ogre::ProgressiveMesh::mpVertexData`[protected]`

Definition at line 118 of file OgreProgressiveMesh.h.

WorkingDataList Ogre::ProgressiveMesh::mWorkingData`[protected]`

Multiple copies, 1 per vertex buffer.

Definition at line 205 of file OgreProgressiveMesh.h.

WorstCostList Ogre::ProgressiveMesh::mWorstCosts`[protected]`

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

Definition at line 208 of file OgreProgressiveMesh.h.

The documentation for this class was generated from the following file:

- OgreProgressiveMesh.h

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sun May 8 2011 20:28:15