osgUtil::Tessellator Class Reference

Originally a simple class for tessellating a single polygon boundary. More...

Inheritance diagram for osgUtil::Tessellator:

Inheritance graph
[legend]

List of all members.

Public Types

enum  WindingType {
  TESS_WINDING_ODD = GLU_TESS_WINDING_ODD, TESS_WINDING_NONZERO = GLU_TESS_WINDING_NONZERO, TESS_WINDING_POSITIVE = GLU_TESS_WINDING_POSITIVE, TESS_WINDING_NEGATIVE = GLU_TESS_WINDING_NEGATIVE,
  TESS_WINDING_ABS_GEQ_TWO = GLU_TESS_WINDING_ABS_GEQ_TWO
}
 The winding rule, see red book ch 11. More...
enum  TessellationType { TESS_TYPE_GEOMETRY, TESS_TYPE_DRAWABLE, TESS_TYPE_POLYGONS }
 we interpret all contours in the geometry as a single set to be tessellated or each separate drawable's contours needs to be tessellated. More...
typedef std::vector
< osg::Vec3 * > 
VertexPointList
typedef std::vector
< osg::ref_ptr< Prim > > 
PrimList

Public Member Functions

 Tessellator ()
 ~Tessellator ()
void setBoundaryOnly (const bool tt)
 Set and get tessellation request boundary only on/off.
const bool getBoundaryOnly ()
void setWindingType (const WindingType wt)
 Set and get tessellation windong rule.
const WindingType getWindingType ()
void setTessellationType (const TessellationType tt)
 Set and get tessellation type.
const TessellationType getTessellationType ()
void retessellatePolygons (osg::Geometry &cxgeom)
 Change the contours lists of the geometry into tessellated primitives (the list of primitives in the original geometry is stored in the Tessellator for possible re-use.
void setTessellationNormal (const osg::Vec3 norm)
 Define the normal to the tessellated polygon - this provides a hint how to tessellate the contours; see gluTessNormal in red book or man pages.
osg::Geometry::PrimitiveSetList getContours ()
void beginTessellation ()
void beginContour ()
void addVertex (osg::Vec3 *vertex)
void endContour ()
void endTessellation ()
PrimListgetPrimList ()
void reset ()

Protected Types

typedef std::map
< osg::Vec3 *,
unsigned int > 
VertexPtrToIndexMap
typedef std::vector
< NewVertex
NewVertexList
typedef std::vector
< Vec3d * > 
Vec3dList

Protected Member Functions

void reduceArray (osg::Array *cold, const unsigned int nnu)
 remove unused parts of the array, eg for wehn retessellating tessellation can introduce extra vertices for concave or crossing boundaries, these will leak memory if not removed when retessellating.
void collectTessellation (osg::Geometry &cxgeom, unsigned int originalIndex)
void addContour (GLenum mode, unsigned int first, unsigned int last, osg::Vec3Array *vertices)
void addContour (osg::PrimitiveSet *primitive, osg::Vec3Array *vertices)
void handleNewVertices (osg::Geometry &geom, VertexPtrToIndexMap &vertexPtrToIndexMap)
void begin (GLenum mode)
void vertex (osg::Vec3 *vertex)
void combine (osg::Vec3 *vertex, void *vertex_data[4], GLfloat weight[4])
void end ()
void error (GLenum errorCode)

Static Protected Member Functions

static void CALLBACK beginCallback (GLenum which, void *userData)
static void CALLBACK vertexCallback (GLvoid *data, void *userData)
static void CALLBACK combineCallback (GLdouble coords[3], void *vertex_data[4], GLfloat weight[4], void **outData, void *useData)
static void CALLBACK endCallback (void *userData)
static void CALLBACK errorCallback (GLenum errorCode, void *userData)

Protected Attributes

GLUtesselator * _tobj
PrimList _primList
Vec3dList _coordData
NewVertexList _newVertexList
GLenum _errorCode
WindingType _wtype
 winding rule, which parts will become solid
TessellationType _ttype
 tessellation rule, which parts will become solid
bool _boundaryOnly
unsigned int _numberVerts
 number of vertices that are part of the 'original' set of contours
osg::Geometry::PrimitiveSetList _Contours
 List of primitives that define the contours.
unsigned int _index
 count number of primitives in a geometry to get right no.
osg::Vec3 tessNormal
 the gluTessNormal for tessellation hint
unsigned int _extraPrimitives
 count of number of extra primitives added

Classes

struct  NewVertex
struct  Prim
struct  Vec3d


Detailed Description

Originally a simple class for tessellating a single polygon boundary.

Using old style glu tessellation functions for portability. Upgraded Jan 2004 to use the modern glu tessellation functions.


Member Typedef Documentation

typedef std::vector<osg::Vec3*> osgUtil::Tessellator::VertexPointList

typedef std::vector< osg::ref_ptr<Prim> > osgUtil::Tessellator::PrimList

typedef std::map<osg::Vec3*,unsigned int> osgUtil::Tessellator::VertexPtrToIndexMap [protected]

typedef std::vector<NewVertex> osgUtil::Tessellator::NewVertexList [protected]

typedef std::vector<Vec3d*> osgUtil::Tessellator::Vec3dList [protected]


Member Enumeration Documentation

enum osgUtil::Tessellator::WindingType

The winding rule, see red book ch 11.

Enumerator:
TESS_WINDING_ODD 
TESS_WINDING_NONZERO 
TESS_WINDING_POSITIVE 
TESS_WINDING_NEGATIVE 
TESS_WINDING_ABS_GEQ_TWO 

enum osgUtil::Tessellator::TessellationType

we interpret all contours in the geometry as a single set to be tessellated or each separate drawable's contours needs to be tessellated.

Enumerator:
TESS_TYPE_GEOMETRY 
TESS_TYPE_DRAWABLE 
TESS_TYPE_POLYGONS 


Constructor & Destructor Documentation

osgUtil::Tessellator::Tessellator (  ) 

osgUtil::Tessellator::~Tessellator (  ) 


Member Function Documentation

void osgUtil::Tessellator::setBoundaryOnly ( const bool  tt  )  [inline]

Set and get tessellation request boundary only on/off.

const bool osgUtil::Tessellator::getBoundaryOnly (  )  [inline]

void osgUtil::Tessellator::setWindingType ( const WindingType  wt  )  [inline]

Set and get tessellation windong rule.

const WindingType osgUtil::Tessellator::getWindingType (  )  [inline]

void osgUtil::Tessellator::setTessellationType ( const TessellationType  tt  )  [inline]

Set and get tessellation type.

const TessellationType osgUtil::Tessellator::getTessellationType (  )  [inline]

void osgUtil::Tessellator::retessellatePolygons ( osg::Geometry cxgeom  ) 

Change the contours lists of the geometry into tessellated primitives (the list of primitives in the original geometry is stored in the Tessellator for possible re-use.

The name remains retessellatePolygons although it now handles trifans, strips, quads etc. as well as Polygons so as to not break old codes relying on this function name.

void osgUtil::Tessellator::setTessellationNormal ( const osg::Vec3  norm  )  [inline]

Define the normal to the tessellated polygon - this provides a hint how to tessellate the contours; see gluTessNormal in red book or man pages.

GWM July 2005. Can improve teselation "For example, if you know that all polygons lie in the x-y plane, call gluTessNormal(tess, 0.0, 0.0, 1.0) before rendering any polygons."

osg::Geometry::PrimitiveSetList osgUtil::Tessellator::getContours (  )  [inline]

void osgUtil::Tessellator::beginTessellation (  ) 

void osgUtil::Tessellator::beginContour (  ) 

void osgUtil::Tessellator::addVertex ( osg::Vec3 vertex  ) 

void osgUtil::Tessellator::endContour (  ) 

void osgUtil::Tessellator::endTessellation (  ) 

PrimList& osgUtil::Tessellator::getPrimList (  )  [inline]

void osgUtil::Tessellator::reset (  ) 

void osgUtil::Tessellator::reduceArray ( osg::Array cold,
const unsigned int  nnu 
) [protected]

remove unused parts of the array, eg for wehn retessellating tessellation can introduce extra vertices for concave or crossing boundaries, these will leak memory if not removed when retessellating.

void osgUtil::Tessellator::collectTessellation ( osg::Geometry cxgeom,
unsigned int  originalIndex 
) [protected]

void osgUtil::Tessellator::addContour ( GLenum  mode,
unsigned int  first,
unsigned int  last,
osg::Vec3Array vertices 
) [protected]

void osgUtil::Tessellator::addContour ( osg::PrimitiveSet primitive,
osg::Vec3Array vertices 
) [protected]

void osgUtil::Tessellator::handleNewVertices ( osg::Geometry geom,
VertexPtrToIndexMap vertexPtrToIndexMap 
) [protected]

void osgUtil::Tessellator::begin ( GLenum  mode  )  [protected]

void osgUtil::Tessellator::vertex ( osg::Vec3 vertex  )  [protected]

void osgUtil::Tessellator::combine ( osg::Vec3 vertex,
void *  vertex_data[4],
GLfloat  weight[4] 
) [protected]

void osgUtil::Tessellator::end (  )  [protected]

void osgUtil::Tessellator::error ( GLenum  errorCode  )  [protected]

static void CALLBACK osgUtil::Tessellator::beginCallback ( GLenum  which,
void *  userData 
) [static, protected]

static void CALLBACK osgUtil::Tessellator::vertexCallback ( GLvoid *  data,
void *  userData 
) [static, protected]

static void CALLBACK osgUtil::Tessellator::combineCallback ( GLdouble  coords[3],
void *  vertex_data[4],
GLfloat  weight[4],
void **  outData,
void *  useData 
) [static, protected]

static void CALLBACK osgUtil::Tessellator::endCallback ( void *  userData  )  [static, protected]

static void CALLBACK osgUtil::Tessellator::errorCallback ( GLenum  errorCode,
void *  userData 
) [static, protected]


Member Data Documentation

GLUtesselator* osgUtil::Tessellator::_tobj [protected]

PrimList osgUtil::Tessellator::_primList [protected]

Vec3dList osgUtil::Tessellator::_coordData [protected]

NewVertexList osgUtil::Tessellator::_newVertexList [protected]

GLenum osgUtil::Tessellator::_errorCode [protected]

WindingType osgUtil::Tessellator::_wtype [protected]

winding rule, which parts will become solid

TessellationType osgUtil::Tessellator::_ttype [protected]

tessellation rule, which parts will become solid

bool osgUtil::Tessellator::_boundaryOnly [protected]

unsigned int osgUtil::Tessellator::_numberVerts [protected]

number of vertices that are part of the 'original' set of contours

osg::Geometry::PrimitiveSetList osgUtil::Tessellator::_Contours [protected]

List of primitives that define the contours.

unsigned int osgUtil::Tessellator::_index [protected]

count number of primitives in a geometry to get right no.

of norms/colurs etc for per_primitive attributes.

osg::Vec3 osgUtil::Tessellator::tessNormal [protected]

the gluTessNormal for tessellation hint

unsigned int osgUtil::Tessellator::_extraPrimitives [protected]

count of number of extra primitives added


The documentation for this class was generated from the following file:
Generated at Sun Oct 14 02:12:52 2007 for the OpenSceneGraph by doxygen 1.5.3.