CrystalSpace

Public API Reference

csTriangleMeshLOD Class Reference
[Geometry utilities]

A static class which performs the calculation of the best order to do the collapsing of a triangle mesh. More...

#include <csgeom/trimeshlod.h>

List of all members.

Static Public Member Functions

static void CalculateLOD (csTriangleMesh *mesh, csTriangleVerticesCost *verts, int *translate, int *emerge_from, csTriangleLODAlgo *lodalgo)
 For the given mesh and a set of vertices calculate the best order in which to perform LOD reduction.
static csTriangleCalculateLOD (csTriangleMesh *mesh, csTriangleVerticesCost *verts, float max_cost, int &num_triangles, csTriangleLODAlgo *lodalgo)
 Calculate a simplified set of triangles so that all vertices with cost lower then the maximum cost are removed.
static csTriangleCalculateLODFast (csTriangleMesh *mesh, csTriangleVerticesCost *verts, float max_cost, int &num_triangles, csTriangleLODAlgo *lodalgo)
 This is a faster version of CalculateLOD() which doesn't recalculate the cost of a vertex after edge collapse.

Detailed Description

A static class which performs the calculation of the best order to do the collapsing of a triangle mesh.

Definition at line 180 of file trimeshlod.h.


Member Function Documentation

static void csTriangleMeshLOD::CalculateLOD ( csTriangleMesh mesh,
csTriangleVerticesCost verts,
int *  translate,
int *  emerge_from,
csTriangleLODAlgo lodalgo 
) [static]

For the given mesh and a set of vertices calculate the best order in which to perform LOD reduction.

This fills two arrays (which should have the same size as the number of vertices in 'verts'). 'translate' contains a mapping from the old order of vertices to the new one. The new ordering of vertices is done in a way so that the first vertex is the one which is always present in the model and with increasing detail; vertices are added in ascending vertex order. 'emerge_from' indicates (for a given index in the new order) from which each vertex arises (or seen the other way around: to what this vertex had collapsed).

Parameters:
mesh the source triangle mesh.
verts the vertex costs.
translate contains a mapping from the old order of vertices to the new one.
emerge_from indicates from which each vertex arises.
lodalgo is the lod algorithm.
Remarks:
Note: The given 'mesh' and 'verts' objects are no longer valid after calling this function. Don't expect any useful information here.
static csTriangle* csTriangleMeshLOD::CalculateLOD ( csTriangleMesh mesh,
csTriangleVerticesCost verts,
float  max_cost,
int &  num_triangles,
csTriangleLODAlgo lodalgo 
) [static]

Calculate a simplified set of triangles so that all vertices with cost lower then the maximum cost are removed.

The resulting simplified triangle mesh is returned (and number of triangles is set to num_triangles). You must delete[] the returned list of triangles if you don't want to use it anymore.

Parameters:
mesh the source triangle mesh.
verts the vertex costs.
max_cost the cost which sets the limit for the simplification.
num_triangles receives the number of triangles in the simplified set.
lodalgo is the Lod algorithm.
Remarks:
Note: The given 'mesh' and 'verts' objects are no longer valid after calling this function. Don't expect any useful information here.
static csTriangle* csTriangleMeshLOD::CalculateLODFast ( csTriangleMesh mesh,
csTriangleVerticesCost verts,
float  max_cost,
int &  num_triangles,
csTriangleLODAlgo lodalgo 
) [static]

This is a faster version of CalculateLOD() which doesn't recalculate the cost of a vertex after edge collapse.

It is less accurate in cases where the cost of a vertex can change after edge collapse but it calculates a LOT faster. You must delete[] the returned list of triangles if you don't want to use it anymore.

Parameters:
mesh the source triangle mesh.
verts the vertex costs.
max_cost the cost which sets the limit for the simplification.
num_triangles receives the number of triangles in the simplified set.
lodalgo is the lod algorithm.
Remarks:
Note: The given 'mesh' and 'verts' objects are no longer valid after calling this function. Don't expect any useful information here.

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

Generated for Crystal Space 1.4.1 by doxygen 1.7.1