Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

osgUtil::Tesselator Class Reference

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

Inheritance diagram for osgUtil::Tesselator:

Inheritance graph
[legend]
List of all members.

Public Types

typedef std::vector< osg::Vec3 * > VertexPointList
typedef std::vector< osg::ref_ptr<
Prim > > 
PrimList
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  TesselationType { TESS_TYPE_GEOMETRY, TESS_TYPE_DRAWABLE, TESS_TYPE_POLYGONS }
 we interpret all contours in the geometry as a single set to be tesselated or each separate drawable's contours needs to be tesselated. More...


Public Member Functions

 Tesselator ()
 ~Tesselator ()
void setBoundaryOnly (const bool tt)
 Set and get tesselation request boundary only on/off.

const bool getBoundaryOnly ()
void setWindingType (const WindingType wt)
 Set and get tesselation windong rule.

const WindingType getWindingType ()
void setTesselationType (const TesselationType tt)
 Set and get tesselation type.

const TesselationType getTesselationType ()
void retesselatePolygons (osg::Geometry &cxgeom)
 Change the contours lists of the geometry into tesselated primitives (the list of primitives in the original geometry is stored in the tesselator for possible re-use.

void setTesselationNormal (const osg::Vec3 norm)
 Define the normal to the tesselated polygon - this provides a hint how to tesselate the contours; see gluTessNormal in red book or man pages.

osg::Geometry::PrimitiveSetList getContours ()
void beginTesselation ()
void beginContour ()
void addVertex (osg::Vec3 *vertex)
void endContour ()
void endTesselation ()
PrimListgetPrimList ()
void reset ()

Protected Types

typedef std::map< osg::Vec3 *,
unsigned int > 
VertexPtrToIndexMap
typedef std::vector< NewVertexNewVertexList
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 retesselating tesselation can introduce extra vertices for concave or crossing boundaries, these will leak memory if not removed when retesselating.

void collectTesselation (osg::Geometry &cxgeom)
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

void CALLBACK beginCallback (GLenum which, void *userData)
void CALLBACK vertexCallback (GLvoid *data, void *userData)
void CALLBACK combineCallback (GLdouble coords[3], void *vertex_data[4], GLfloat weight[4], void **outData, void *useData)
void CALLBACK endCallback (void *userData)
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

TesselationType _ttype
 tesselation 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 tesselation hint


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<NewVertex> osgUtil::Tesselator::NewVertexList [protected]
 

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

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

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

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


Member Enumeration Documentation

enum osgUtil::Tesselator::TesselationType
 

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

Enumeration values:
TESS_TYPE_GEOMETRY 
TESS_TYPE_DRAWABLE 
TESS_TYPE_POLYGONS 

enum osgUtil::Tesselator::WindingType
 

The winding rule, see red book ch 11.

Enumeration values:
TESS_WINDING_ODD 
TESS_WINDING_NONZERO 
TESS_WINDING_POSITIVE 
TESS_WINDING_NEGATIVE 
TESS_WINDING_ABS_GEQ_TWO 


Constructor & Destructor Documentation

osgUtil::Tesselator::Tesselator  ) 
 

osgUtil::Tesselator::~Tesselator  ) 
 


Member Function Documentation

void osgUtil::Tesselator::addContour osg::PrimitiveSet primitive,
osg::Vec3Array vertices
[protected]
 

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

void osgUtil::Tesselator::addVertex osg::Vec3 vertex  ) 
 

void osgUtil::Tesselator::begin GLenum  mode  )  [protected]
 

void CALLBACK osgUtil::Tesselator::beginCallback GLenum  which,
void *  userData
[static, protected]
 

void osgUtil::Tesselator::beginContour  ) 
 

void osgUtil::Tesselator::beginTesselation  ) 
 

void osgUtil::Tesselator::collectTesselation osg::Geometry cxgeom  )  [protected]
 

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

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

void osgUtil::Tesselator::end  )  [protected]
 

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

void osgUtil::Tesselator::endContour  ) 
 

void osgUtil::Tesselator::endTesselation  ) 
 

void osgUtil::Tesselator::error GLenum  errorCode  )  [protected]
 

void CALLBACK osgUtil::Tesselator::errorCallback GLenum  errorCode,
void *  userData
[static, protected]
 

const bool osgUtil::Tesselator::getBoundaryOnly  )  [inline]
 

osg::Geometry::PrimitiveSetList osgUtil::Tesselator::getContours  )  [inline]
 

PrimList& osgUtil::Tesselator::getPrimList  )  [inline]
 

const TesselationType osgUtil::Tesselator::getTesselationType  )  [inline]
 

const WindingType osgUtil::Tesselator::getWindingType  )  [inline]
 

void osgUtil::Tesselator::handleNewVertices osg::Geometry geom,
VertexPtrToIndexMap vertexPtrToIndexMap
[protected]
 

void osgUtil::Tesselator::reduceArray osg::Array cold,
const unsigned int  nnu
[protected]
 

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

void osgUtil::Tesselator::reset  ) 
 

void osgUtil::Tesselator::retesselatePolygons osg::Geometry cxgeom  ) 
 

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

The name remains retesselatePolygons 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::Tesselator::setBoundaryOnly const bool  tt  )  [inline]
 

Set and get tesselation request boundary only on/off.

void osgUtil::Tesselator::setTesselationNormal const osg::Vec3  norm  )  [inline]
 

Define the normal to the tesselated polygon - this provides a hint how to tesselate 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."

void osgUtil::Tesselator::setTesselationType const TesselationType  tt  )  [inline]
 

Set and get tesselation type.

void osgUtil::Tesselator::setWindingType const WindingType  wt  )  [inline]
 

Set and get tesselation windong rule.

void osgUtil::Tesselator::vertex osg::Vec3 vertex  )  [protected]
 

void CALLBACK osgUtil::Tesselator::vertexCallback GLvoid *  data,
void *  userData
[static, protected]
 


Member Data Documentation

bool osgUtil::Tesselator::_boundaryOnly [protected]
 

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

List of primitives that define the contours.

Vec3dList osgUtil::Tesselator::_coordData [protected]
 

GLenum osgUtil::Tesselator::_errorCode [protected]
 

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

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

of norms/colurs etc for per_primitive attributes.

NewVertexList osgUtil::Tesselator::_newVertexList [protected]
 

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

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

PrimList osgUtil::Tesselator::_primList [protected]
 

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

TesselationType osgUtil::Tesselator::_ttype [protected]
 

tesselation rule, which parts will become solid

WindingType osgUtil::Tesselator::_wtype [protected]
 

winding rule, which parts will become solid

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

the gluTessNormal for tesselation hint


The documentation for this class was generated from the following file:
Generated at Thu Nov 24 16:25:50 2005 for the OpenSceneGraph by doxygen 1.3.6.