version 3.3

VRS::VertexCacheOptimizer Class Reference

Given an indexed triangle mesh (must be indexed and must contain explicitly triangles) the VertexCacheOptimizer arranges the triangles in a vertex-cache-friendly order to optimize rendering speed. More...

#include <vrs/vertexcacheoptimizer.h>

List of all members.

Static Public Member Functions

static SO< Iterator< SO
< PolygonSet > > > 
createOptimizedClusters (SO< PolygonSet > source)
 This methods builds upon all other methods below.
static SO< PolygonSetoptimize (SO< PolygonSet > poly)
 Returns an optimized copy.
static SO< TriangleSetoptimize (SO< TriangleSet > triangleSet)
static SO< Iterator< unsigned
int > > 
optimize (SO< Iterator< unsigned int > > indices, int numVertices)
 Actually, the vertex-cache optimization concerns the index array only.
static SO< Iterator< SO
< PolygonSet > > > 
splitMesh (SO< PolygonSet > source)
 Splits an indexed triangle mesh into one or more connected components, i.e., sub meshes, for which each two vertex a and b are connected via a path of triangle edges.
static SO< Iterator< SO
< PolygonSet > > > 
clusterMeshes (SO< Iterator< SO< PolygonSet > > > meshes, int maxVertices=0xFFFF)
 Clusters the meshes in the input iterator in a way that the number of vertices in the resulting meshes is as close to the given target vertex number as possible.
static SO< Iterator< SO
< PolygonSet > > > 
splitLargeMeshes (SO< Iterator< SO< PolygonSet > > > meshes, int maxVertices=0xFFFF)
 Splits all meshes with more than 'maxVertices' vertices up into smaller ones.
static SO< PolygonSetextractSubMesh (SO< PolygonSet > mesh, SO< Iterator< unsigned int > > indexSubIterator)
 Given an indexed triangle mesh and a subset of its index iterator, this method creates a submesh containing the triangles within this iterator.


Detailed Description

Given an indexed triangle mesh (must be indexed and must contain explicitly triangles) the VertexCacheOptimizer arranges the triangles in a vertex-cache-friendly order to optimize rendering speed.

In addition, it provides methods to subdivide a given mesh into connected components, which are clustered into batches of desired vertex size.


Member Function Documentation

static SO<Iterator<SO<PolygonSet> > > VRS::VertexCacheOptimizer::createOptimizedClusters ( SO< PolygonSet source  )  [static]

This methods builds upon all other methods below.

The result is a set of sub meshes that are optimized for rendering. It performs the following steps:

  • The input mesh is decomposed into connceted components
  • The triangles of each component are sorted according to vertex-cache coherency
  • Components that exceed 0xffff vertices (the limit for using unsigned short indices) are split into submeshes below the limit.
  • The resulting sub-meshes are composed into clusters, whose vertex numbers are close to (but strictly below) the vertex number limit 0xffff.

static SO<PolygonSet> VRS::VertexCacheOptimizer::optimize ( SO< PolygonSet poly  )  [static]

Returns an optimized copy.

If necessary, 'poly' is first converted into an indexed triangle mesh. Lines and points are not supported and will be lost. If 'poly' is already an indexed triangle mesh, the result differs only be the triangle order.

static SO<TriangleSet> VRS::VertexCacheOptimizer::optimize ( SO< TriangleSet triangleSet  )  [static]

static SO<Iterator<unsigned int> > VRS::VertexCacheOptimizer::optimize ( SO< Iterator< unsigned int > >  indices,
int  numVertices 
) [static]

Actually, the vertex-cache optimization concerns the index array only.

The upper method is only provided for convenience.

static SO<Iterator<SO<PolygonSet> > > VRS::VertexCacheOptimizer::splitMesh ( SO< PolygonSet source  )  [static]

Splits an indexed triangle mesh into one or more connected components, i.e., sub meshes, for which each two vertex a and b are connected via a path of triangle edges.

static SO<Iterator<SO<PolygonSet> > > VRS::VertexCacheOptimizer::clusterMeshes ( SO< Iterator< SO< PolygonSet > > >  meshes,
int  maxVertices = 0xFFFF 
) [static]

Clusters the meshes in the input iterator in a way that the number of vertices in the resulting meshes is as close to the given target vertex number as possible.

Meshes can only exceed the vertex number limit if a single input mesh already did.

static SO<Iterator<SO<PolygonSet> > > VRS::VertexCacheOptimizer::splitLargeMeshes ( SO< Iterator< SO< PolygonSet > > >  meshes,
int  maxVertices = 0xFFFF 
) [static]

Splits all meshes with more than 'maxVertices' vertices up into smaller ones.

All meshes below the vertex number limit are left as they are. Note: The current implementation just splits meshes into index-array ranges. A more sophisticated implementation could try to minimize the number of replicated vertices.

static SO<PolygonSet> VRS::VertexCacheOptimizer::extractSubMesh ( SO< PolygonSet mesh,
SO< Iterator< unsigned int > >  indexSubIterator 
) [static]

Given an indexed triangle mesh and a subset of its index iterator, this method creates a submesh containing the triangles within this iterator.

'mesh' must be indexed and 'indexSubIterator' must be a subset (not necessarily a sub range) of its index iterator.


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

Generated on Wed May 23 06:00:31 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact