OpenSceneGraph
|
Originally a simple class for tessellating a single polygon boundary. More...
Classes | |
struct | NewVertex |
struct | Prim |
struct | Vec3d |
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::ref_ptr< Prim > > | PrimList |
Public Member Functions | |
void | setBoundaryOnly (const bool tt) |
Set and get tessellation request boundary only on/off. | |
bool | getBoundaryOnly () |
void | setWindingType (const WindingType wt) |
Set and get tessellation windong rule. | |
WindingType | getWindingType () |
void | setTessellationType (const TessellationType tt) |
Set and get tessellation type. | |
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. More... | |
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. More... | |
osg::Geometry::PrimitiveSetList | getContours () |
virtual void | beginTessellation () |
void | beginContour () |
void | addVertex (osg::Vec3 *vertex) |
Add a vertex to the current contour, see gluTessVertex for details. More... | |
void | endContour () |
void | endTessellation () |
PrimList & | getPrimList () |
void | reset () |
![]() | |
Referenced (bool threadSafeRefUnref) | |
Referenced (const Referenced &) | |
Referenced & | operator= (const Referenced &) |
virtual void | setThreadSafeRefUnref (bool threadSafe) |
Set whether to use a mutex to ensure ref() and unref() are thread safe. More... | |
bool | getThreadSafeRefUnref () const |
Get whether a mutex is used to ensure ref() and unref() are thread safe. More... | |
bool | getThreadSafeRefUnref () const |
OpenThreads::Mutex * | getRefMutex () const |
Get the mutex used to ensure thread safety of ref()/unref(). More... | |
OpenThreads::Mutex * | getRefMutex () const |
int | ref () const |
Increment the reference count by one, indicating that this object has another pointer which is referencing it. More... | |
int | unref () const |
Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More... | |
int | unref_nodelete () const |
Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More... | |
int | referenceCount () const |
Return the number of pointers currently referencing this object. More... | |
ObserverSet * | getObserverSet () const |
Get the ObserverSet if one is attached, otherwise return NULL. More... | |
ObserverSet * | getOrCreateObserverSet () const |
Get the ObserverSet if one is attached, otherwise create an ObserverSet, attach it, then return this newly created ObserverSet. More... | |
void | addObserver (Observer *observer) const |
Add a Observer that is observing this object, notify the Observer when this object gets deleted. More... | |
void | removeObserver (Observer *observer) const |
Remove Observer that is observing this object. More... | |
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 when retessellating tessellation can introduce extra vertices for concave or crossing boundaries, these will leak memory if not removed when retessellating. More... | |
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) |
![]() | |
void | signalObserversAndDelete (bool signalDelete, bool doDelete) const |
void | deleteUsingDeleteHandler () const |
Protected Attributes | |
osg::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. More... | |
osg::Vec3 | tessNormal |
the gluTessNormal for tessellation hint | |
unsigned int | _extraPrimitives |
count of number of extra primitives added | |
![]() | |
OpenThreads::AtomicPtr | _observerSet |
OpenThreads::Atomic | _refCount |
OpenThreads::Mutex * | _refMutex |
int | _refCount |
void * | _observerSet |
Additional Inherited Members | |
![]() | |
static OpenThreads::Mutex * | getGlobalReferencedMutex () |
Get the optional global Referenced mutex, this can be shared between all osg::Referenced. More... | |
static void | setThreadSafeReferenceCounting (bool enableThreadSafeReferenceCounting) |
Set whether reference counting should use a mutex for thread safe reference counting. More... | |
static bool | getThreadSafeReferenceCounting () |
Get whether reference counting is active. More... | |
static void | setDeleteHandler (DeleteHandler *handler) |
Set a DeleteHandler to which deletion of all referenced counted objects will be delegated. More... | |
static DeleteHandler * | getDeleteHandler () |
Get a DeleteHandler. More... | |
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.
we interpret all contours in the geometry as a single set to be tessellated or each separate drawable's contours needs to be tessellated.
The winding rule, see red book ch 11.
void osgUtil::Tessellator::addVertex | ( | osg::Vec3 * | vertex | ) |
Add a vertex to the current contour, see gluTessVertex for details.
Note the vertex pointer is returned at the end of tessellation and must not be left dangling or be overwritten until all results are collected.
|
protected |
remove unused parts of the array, eg for when retessellating tessellation can introduce extra vertices for concave or crossing boundaries, these will leak memory if not removed when retessellating.
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.
|
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."
|
protected |
count number of primitives in a geometry to get right no.
of norms/colurs etc for per_primitive attributes.