version 3.3

VRS::ProgressiveMesh Class Reference

#include <vrs/progressivemesh.h>

Inheritance diagram for VRS::ProgressiveMesh:

VRS::Shape VRS::RenderObj VRS::SharedObj VRS::Visitable

List of all members.

Public Types

enum  LoDControlMode { ViewIndependent, ViewDependent, ViewDependentAndSelective }
enum  PlacementPolicy { Optimal, Subset }

Public Member Functions

 VRS_SERIALIZABLE_CLASS_ENUM (LoDControlMode)
 VRS_SERIALIZABLE_CLASS_ENUM (PlacementPolicy)
 ProgressiveMesh (const PolygonSet *source=0, LoDControlMode mode=ProgressiveMesh::ViewDependent, double vertexPairTreshold=0.0, bool preserveTopology=true, PlacementPolicy placement=ProgressiveMesh::Subset)
virtual ~ProgressiveMesh ()
void setMode (LoDControlMode mode)
LoDControlMode getMode () const
void setMaxDetail ()
void setMinDetail ()
bool split (UINT steps=1)
bool collapse (UINT steps=1)
void setScreenSpaceErrorTolerance (double t)
double getScreenSpaceErrorTolerance () const
PolygonSetgetSnapshot () const
UINT getDetailLevel () const
UINT getMaxDetailLevel () const
UINT getNumActiveVertices () const
UINT getNumActiveTriangles () const
UINT getNumVertices () const
UINT getNumTriangles () const
bool hasPreservedTopology () const
PlacementPolicy getPlacementPolicy () const
bool consistent () const
UINT getNumBoundaryVertices () const
UINT getNumBoundaryEdges () const
Iterator< Vector > * newVertexIterator () const
Iterator< Vector > * newNormalIterator () const
Iterator< Vector > * newTextureIterator () const
Iterator< Color > * newColorIterator () const
Iterator< UINT > * newIndexIterator () const
void setRefinementSpeed (UINT frames=5)
UINT getRefinementSpeed () const
void adaptLevelOfDetail (Engine *E)
virtual Bounds boundingBox () const
 Shapes define their bounding box in model coordinates.
 VRS_TYPEINFO (ProgressiveMesh, Shape)
 VRS_SERIALIZABLE (ProgressiveMesh)


Member Enumeration Documentation

Enumerator:
ViewIndependent 
ViewDependent 
ViewDependentAndSelective 

Enumerator:
Optimal 
Subset 


Constructor & Destructor Documentation

VRS::ProgressiveMesh::ProgressiveMesh ( const PolygonSet source = 0,
LoDControlMode  mode = ProgressiveMesh::ViewDependent,
double  vertexPairTreshold = 0.0,
bool  preserveTopology = true,
PlacementPolicy  placement = ProgressiveMesh::Subset 
)

A progressive mesh is a datastructure that allows the usage of a large number of representations of a given triangle mesh at different levels of detail. These different representations can be used to accelerate the rendering process by choosing a mesh of appropriate complexity for given view conditions at runtime.

The triangle mesh is specified by an instance of the class PolygonSet. By default, a progressive mesh is in ViewDependent mode, i.e. the complexity of the used mesh representation is controlled automatically according to the current view conditions and a given screen space tolerance specified using the method setScreenSpaceErrorTolerance(). In the ViewIndipendent mode the mesh complexity can be controlled directly using the methods split() and collapse(). The ViewDependentAndSelective allows to perform the simplify different regions of the mesh surface independently. For that, additional information is required. Therefore the memory requirement of a PM in ViewDependentAndSelective mode is higher than that of a PM in another mode.

The creation of a PM representation is only possible for triangle meshes. Since a PolygonSet can contain primitves of several different types, the data is converted into a single triangle mesh at first. Only primitves that allow a conversion into triangles (i.e. primitives of the types Triangles, TriangleStrip, TriangleFan, Quads, QuadStrip and ConvexFace) are taken into account. Primitives of other types are ignored.

Usually the construction of a PM takes O(nlog n) time and O(n) of storage, where n is the number of triangles of the input mesh. Using the threshold parameter can raise these requirements. (see below)

In the following the optional constructor parameters are explained. Note that they serves only to fit special user requirements and can usually be left out:

  • Usually a progressive mesh is used in ViewDependent mode (see above). The automatic control of the level of detail requires the computation of some help data to efficiently estimate the current screen-space error at runtime. Therefore these help data have to be stored in addition (approximately one double value per vertex) to the progressive mesh. Furthermore, the computation of these help data is usually the most time consuming step of the total precalculation process. If you do not want to use the ViewDependen mode you can skip the computation of the above mentioned help data by setting mode parameter to "ViewIndipendent". In this case the resulting progressive mesh is only usable in "ViewIndipendent" mode.

If the parameter is set to "ViewDependentAndSelective", the neccesary data for selective simplification will be calculated. Since PMs in ViewDependent and PMs in ViewDependentAndSelective mode need different additional data, it is not possible to switch between ViewDependent and ViewDependentAndSelective at runtime. In addition a PM suited for ViewDependentAndSelective mode can only be created from meshes with valid topology and if the topology has been preserved. If the creation of a PM for "ViewDependentAndSelective" mode is impossible, a PM for "ViewDependent" mode will be created.

If you set the mode parameter to "ViewDependentAndSelective", the other parameters are set automatically: Since preserved topology is needed, vertexPairThreshold is set to 0, preserveTopology is set to true. Since the memory requirements of a "ViewDependentAndSelective" PM is clearly higher than that of a "ViewDependent" one, the former is implemented only for subset placement to reduce the size in memory.

  • By default the simplification is based on the edge collapse operation, i.e. the replacement of an edge by a single vertex. Setting the vertexPairThreshold parameter allows the simplification algorithm also to unify pairs of vertices that do not form an edge. This increases the scope of simplification operations and makes it possible to connect disjoint objects during the simplification process. On the other hand, using vertex pair contraction instead of edge collapsing can possibly reduce the quality of the resulting simplified meshes. In particular preserving of the mesh topology (see below) is impossible whith vertex-pair contraction.

If you want to use vertex-pair contraction, be careful with the choice of the threshold parameter. Setting the parameter too high will cause the algorithm to take too much vertex pairs into account. If the threshold exceeds the maximum of all vertex distances of the model, memory and time requirements will increase to O(n^2).

  • PreserveTopology: If the input mesh has a valid surface topology and consistently oriented triangles, the topology can be preserved during the simplification process. Usually this will improve the quality of the result. In addition, preserving the mesh topology can be used to reduce the storage costs of the resulting progressive mesh.

Note: If the input mesh does not fulfill the topological requirements, the flag is automatically set to false. You can check the result by using the hasPreservedTopology() method after the creation of the ProgressiveMesh.

  • If placementPolicy is set to "Subset" a new vertex resulting from the unification of two old vertices always gets the position from one of the old vertices. Therefore no additional vectors for new vertices have to be stored. The quality of simplified meshes obtained using subset placement is usually sufficient in practice, but the geometrically preciseness can be further improved by computing geometrical optimized positions for the new vertices.

If the input mesh contains texture coordinates the placementPolicy parameter is automatically set to "Subset". Since texture coordinates are not explicitly considered during the simplification, process, using optimal placement would increase the texture stretch due to the geometric simplification.

virtual VRS::ProgressiveMesh::~ProgressiveMesh (  )  [virtual]


Member Function Documentation

VRS::ProgressiveMesh::VRS_SERIALIZABLE_CLASS_ENUM ( LoDControlMode   ) 

VRS::ProgressiveMesh::VRS_SERIALIZABLE_CLASS_ENUM ( PlacementPolicy   ) 

void VRS::ProgressiveMesh::setMode ( LoDControlMode  mode  ) 

LoDControlMode VRS::ProgressiveMesh::getMode (  )  const

If the ProgressiveMesh is in "ViewIndipendent" mode, you can choose the level of detail manually. In the "ViewDependent" mode the level of detail is choosen automatically according to the specified screen-space error tolerance and the current viewing conditions.

void VRS::ProgressiveMesh::setMaxDetail (  ) 

void VRS::ProgressiveMesh::setMinDetail (  ) 

The following methods serve to control the level of detail manually. They only take effect if the mesh is in ViewIndipendent mode.

bool VRS::ProgressiveMesh::split ( UINT  steps = 1  ) 

bool VRS::ProgressiveMesh::collapse ( UINT  steps = 1  ) 

void VRS::ProgressiveMesh::setScreenSpaceErrorTolerance ( double  t  ) 

double VRS::ProgressiveMesh::getScreenSpaceErrorTolerance (  )  const

These methods are only useful in "ViewDependent" mode. The tolerance parameter t specifies the maximum distance between the simplified mesh and the full detailed mesh. More exactly, the meaning of the parameter t is as follows: Let p the screen projection of an arbitrary point on the surface of the full detailed mesh under the given viewing conditions. The level of detail is choosen, so that the distance between p and the screen projection of the simplified mesh is only less than t. Note that the exact calculation of the screen-space geometric error is too expensive, so the above mentioned condition is only achieved approximately.

PolygonSet* VRS::ProgressiveMesh::getSnapshot (  )  const

Returns a copy of the mesh in the current state in the form of a PolygonSet

UINT VRS::ProgressiveMesh::getDetailLevel (  )  const

UINT VRS::ProgressiveMesh::getMaxDetailLevel (  )  const

Returns the current state of the mesh. The return value is 0 for the base mesh and the return value of getMaxDetailLevel() for the full-detail state.

UINT VRS::ProgressiveMesh::getNumActiveVertices (  )  const

UINT VRS::ProgressiveMesh::getNumActiveTriangles (  )  const

UINT VRS::ProgressiveMesh::getNumVertices (  )  const

UINT VRS::ProgressiveMesh::getNumTriangles (  )  const

Return the number of vertices and triangles of the mesh in the current state or of the full detailed model.

bool VRS::ProgressiveMesh::hasPreservedTopology (  )  const

PlacementPolicy VRS::ProgressiveMesh::getPlacementPolicy (  )  const

The following methods allow to query some parameters used during the precalculation. The results of these methods possibly differ from your given constructor parameters. See constructor comments for more information.

bool VRS::ProgressiveMesh::consistent (  )  const

UINT VRS::ProgressiveMesh::getNumBoundaryVertices (  )  const

UINT VRS::ProgressiveMesh::getNumBoundaryEdges (  )  const

Some methods to query certain results of the topological analysis of the original data (i.e. the mesh specified by the source parameter of the constructor).

Iterator<Vector>* VRS::ProgressiveMesh::newVertexIterator (  )  const

Iterator<Vector>* VRS::ProgressiveMesh::newNormalIterator (  )  const

Iterator<Vector>* VRS::ProgressiveMesh::newTextureIterator (  )  const

Iterator<Color>* VRS::ProgressiveMesh::newColorIterator (  )  const

Iterator<UINT>* VRS::ProgressiveMesh::newIndexIterator (  )  const

access to the data of the mesh represented in the current state.

void VRS::ProgressiveMesh::setRefinementSpeed ( UINT  frames = 5  ) 

UINT VRS::ProgressiveMesh::getRefinementSpeed (  )  const

since the process of selective refinement can possibly be time consuming, it can be distributed over several consecutive frames in order to trade quality for speed. By default, speed is set to 5, i.e. the refinement process is distributed over 5 frames. The methods takes only effect in ViewDependentAndSelective mode. Since the update process is less time consuming in ViewDependent mode, it is always performed once per frame. The parameter "frames" must lie between 0 and 100. Setting "frames" to 0 freezes the mesh in its current state, i.e. stops the automatic refinement/simplification.

void VRS::ProgressiveMesh::adaptLevelOfDetail ( Engine E  ) 

this method is called by the simplifier

virtual Bounds VRS::ProgressiveMesh::boundingBox (  )  const [virtual]

Shapes define their bounding box in model coordinates.

Implements VRS::Shape.

VRS::ProgressiveMesh::VRS_TYPEINFO ( ProgressiveMesh  ,
Shape   
)

VRS::ProgressiveMesh::VRS_SERIALIZABLE ( ProgressiveMesh   ) 


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

Generated on Tue May 22 06:00:26 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact