Visualization Library 2.0.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
vl::Tessellator Class Reference

Tessellates a complex polygon defined by a set of outlines into a set of triangles that can be rendered by Visualization Library. More...

#include <Tessellator.hpp>

+ Inheritance diagram for vl::Tessellator:

Public Member Functions

 Tessellator ()
 Constructor. More...
 
 ~Tessellator ()
 Destructor. More...
 
const std::vector< dvec3 > & contourVerts () const
 The contours that specify the complex polygon to be tessellated. More...
 
std::vector< dvec3 > & contourVerts ()
 The contours that specify the complex polygon to be tessellated. More...
 
const std::vector< int > & contours () const
 The contours that specify the complex polygon to be tessellated. More...
 
std::vector< int > & contours ()
 The contours that specify the complex polygon to be tessellated. More...
 
const std::vector< fvec3 > & tessellatedTris () const
 A set of triangles representing the tessellated polygon. More...
 
std::vector< fvec3 > & tessellatedTris ()
 A set of triangles representing the tessellated polygon. More...
 
void setTessNormal (const fvec3 &normal)
 See gluTessNormal documentation. More...
 
const fvec3tessNormal () const
 See gluTessNormal documentation. More...
 
void setBoundaryOnly (bool on)
 See gluTessProperty documentation (GLU_TESS_BOUNDARY_ONLY) More...
 
bool boundaryOnly () const
 See gluTessProperty documentation (GLU_TESS_BOUNDARY_ONLY) More...
 
double tolerance () const
 See gluTessProperty documentation (GLU_TESS_TOLERANCE) More...
 
void setTolerance (double tolerance)
 See gluTessProperty documentation (GLU_TESS_TOLERANCE) More...
 
ETessellationWinding windingRule () const
 See gluTessProperty documentation (GLU_TESS_WINDING_RULE) More...
 
void setWindingRule (ETessellationWinding rule)
 See gluTessProperty documentation (GLU_TESS_WINDING_RULE) More...
 
bool tessellate (bool append_tessellated_tris=false)
 
ref< GeometrytessellateGeometry (bool append_tessellated_tris=false)
 Utility function that calls tessellate() and creates a Geometry with the tessellated triangles. More...
 
void setTessellateIntoSinglePolygon (bool on)
 
bool tessellateIntoSinglePolygon () const
 
- Public Member Functions inherited from vl::Object
 Object ()
 Constructor. More...
 
 Object (const Object &other)
 Copy constructor: copies the name, ref count mutex and user data. More...
 
Objectoperator= (const Object &other)
 Copy operator: copies the object's name, ref count mutex and user data. More...
 
const std::string & objectName () const
 The name of the object, by default set to the object's class name. More...
 
void setObjectName (const char *name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setObjectName (const std::string &name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setRefCountMutex (IMutex *mutex)
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () const
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
int referenceCount () const
 Returns the number of references of an object. More...
 
void incReference () const
 Increments the reference count of an object. More...
 
void decReference ()
 Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More...
 
void setAutomaticDelete (bool autodel_on)
 If set to true the Object is deleted when its reference count reaches 0. More...
 
bool automaticDelete () const
 If set to true the Object is deleted when its reference count reaches 0. More...
 
template<class T >
T * as ()
 Casts an Object to the specified class. More...
 
template<class T >
const T * as () const
 Casts an Object to the specified class. More...
 

Protected Member Functions

void freeCombinedVertices ()
 
- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Static Protected Member Functions

static void CALLBACK tessBeginData (GLenum type, Tessellator *tessellator)
 
static void CALLBACK tessVertexData (dvec3 *vec, Tessellator *tessellator)
 
static void CALLBACK tessCombineData (GLdouble coords[3], dvec3 *d[4], GLfloat w[4], dvec3 **dataOut, Tessellator *tessellator)
 
static void CALLBACK tessEnd (void)
 
static void CALLBACK tessError (GLenum errno)
 

Protected Attributes

std::vector< int > mContours
 
std::vector< dvec3mContourVerts
 
std::vector< fvec3mTessellatedTris
 
std::vector< std::vector< fvec3 > > mFans
 
std::vector< std::vector< fvec3 > > mTriStrips
 
std::vector< std::vector< fvec3 > > mLineLoops
 
std::vector< dvec3 *> mCombinedVertices
 
GLenum mPrimitiveType
 
fvec3 mTessNormal
 
bool mBoundaryOnly
 
double mTolerance
 
ETessellationWinding mWindingRule
 
bool mTessellateIntoSinglePolygon
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Detailed Description

Tessellates a complex polygon defined by a set of outlines into a set of triangles that can be rendered by Visualization Library.

For more information see the OpenGL Programmer's Guide chapter #11 "Tessellators and Quadrics".

Definition at line 50 of file Tessellator.hpp.

Constructor & Destructor Documentation

◆ Tessellator()

Tessellator::Tessellator ( )

◆ ~Tessellator()

Tessellator::~Tessellator ( )

Destructor.

Definition at line 47 of file Tessellator.cpp.

References freeCombinedVertices().

Member Function Documentation

◆ boundaryOnly()

bool vl::Tessellator::boundaryOnly ( ) const
inline

See gluTessProperty documentation (GLU_TESS_BOUNDARY_ONLY)

Definition at line 91 of file Tessellator.hpp.

Referenced by tessellate().

◆ contours() [1/2]

const std::vector<int>& vl::Tessellator::contours ( ) const
inline

The contours that specify the complex polygon to be tessellated.

Definition at line 70 of file Tessellator.hpp.

Referenced by vl::Extrusion::extrude(), and vl::Extrusions::extrude().

◆ contours() [2/2]

std::vector<int>& vl::Tessellator::contours ( )
inline

The contours that specify the complex polygon to be tessellated.

Definition at line 73 of file Tessellator.hpp.

◆ contourVerts() [1/2]

const std::vector<dvec3>& vl::Tessellator::contourVerts ( ) const
inline

The contours that specify the complex polygon to be tessellated.

Definition at line 64 of file Tessellator.hpp.

Referenced by vl::Extrusion::extrude(), and vl::Extrusions::extrude().

◆ contourVerts() [2/2]

std::vector<dvec3>& vl::Tessellator::contourVerts ( )
inline

The contours that specify the complex polygon to be tessellated.

Definition at line 67 of file Tessellator.hpp.

◆ freeCombinedVertices()

void Tessellator::freeCombinedVertices ( )
protected

Definition at line 148 of file Tessellator.cpp.

References mCombinedVertices.

Referenced by tessellate(), and ~Tessellator().

◆ setBoundaryOnly()

void vl::Tessellator::setBoundaryOnly ( bool  on)
inline

See gluTessProperty documentation (GLU_TESS_BOUNDARY_ONLY)

Definition at line 88 of file Tessellator.hpp.

◆ setTessellateIntoSinglePolygon()

void vl::Tessellator::setTessellateIntoSinglePolygon ( bool  on)
inline

Definition at line 118 of file Tessellator.hpp.

◆ setTessNormal()

void vl::Tessellator::setTessNormal ( const fvec3 normal)
inline

See gluTessNormal documentation.

Definition at line 82 of file Tessellator.hpp.

◆ setTolerance()

void vl::Tessellator::setTolerance ( double  tolerance)
inline

See gluTessProperty documentation (GLU_TESS_TOLERANCE)

Definition at line 97 of file Tessellator.hpp.

◆ setWindingRule()

void vl::Tessellator::setWindingRule ( ETessellationWinding  rule)
inline

See gluTessProperty documentation (GLU_TESS_WINDING_RULE)

Definition at line 103 of file Tessellator.hpp.

Referenced by vl::Extrusion::extrude(), and vl::Extrusions::extrude().

◆ tessBeginData()

void CALLBACK Tessellator::tessBeginData ( GLenum  type,
Tessellator tessellator 
)
staticprotected

Definition at line 175 of file Tessellator.cpp.

References vl::Log::error(), mFans, mLineLoops, mPrimitiveType, and mTriStrips.

Referenced by tessellate().

◆ tessCombineData()

void CALLBACK Tessellator::tessCombineData ( GLdouble  coords[3],
dvec3 d[4],
GLfloat  w[4],
dvec3 **  dataOut,
Tessellator tessellator 
)
staticprotected

◆ tessellate()

bool Tessellator::tessellate ( bool  append_tessellated_tris = false)

◆ tessellatedTris() [1/2]

const std::vector<fvec3>& vl::Tessellator::tessellatedTris ( ) const
inline

A set of triangles representing the tessellated polygon.

Definition at line 76 of file Tessellator.hpp.

Referenced by vl::Extrusion::extrude(), vl::Extrusions::extrude(), and tessellate().

◆ tessellatedTris() [2/2]

std::vector<fvec3>& vl::Tessellator::tessellatedTris ( )
inline

A set of triangles representing the tessellated polygon.

Definition at line 79 of file Tessellator.hpp.

◆ tessellateGeometry()

ref< Geometry > Tessellator::tessellateGeometry ( bool  append_tessellated_tris = false)

◆ tessellateIntoSinglePolygon()

bool vl::Tessellator::tessellateIntoSinglePolygon ( ) const
inline

Definition at line 120 of file Tessellator.hpp.

References CALLBACK.

Referenced by tessellate().

◆ tessEnd()

void CALLBACK Tessellator::tessEnd ( void  )
staticprotected

Definition at line 226 of file Tessellator.cpp.

Referenced by tessellate().

◆ tessError()

void CALLBACK Tessellator::tessError ( GLenum  errno)
staticprotected

Definition at line 230 of file Tessellator.cpp.

References vl::Log::error().

Referenced by tessellate().

◆ tessNormal()

const fvec3& vl::Tessellator::tessNormal ( ) const
inline

See gluTessNormal documentation.

Definition at line 85 of file Tessellator.hpp.

Referenced by tessellate().

◆ tessVertexData()

void CALLBACK Tessellator::tessVertexData ( dvec3 vec,
Tessellator tessellator 
)
staticprotected

Definition at line 197 of file Tessellator.cpp.

References vl::Log::error(), mFans, mLineLoops, mPrimitiveType, mTessellatedTris, and mTriStrips.

Referenced by tessellate().

◆ tolerance()

double vl::Tessellator::tolerance ( ) const
inline

See gluTessProperty documentation (GLU_TESS_TOLERANCE)

Definition at line 94 of file Tessellator.hpp.

Referenced by tessellate().

◆ windingRule()

ETessellationWinding vl::Tessellator::windingRule ( ) const
inline

See gluTessProperty documentation (GLU_TESS_WINDING_RULE)

Definition at line 100 of file Tessellator.hpp.

Referenced by tessellate().

Member Data Documentation

◆ mBoundaryOnly

bool vl::Tessellator::mBoundaryOnly
protected

Definition at line 145 of file Tessellator.hpp.

Referenced by Tessellator().

◆ mCombinedVertices

std::vector< dvec3* > vl::Tessellator::mCombinedVertices
protected

Definition at line 140 of file Tessellator.hpp.

Referenced by freeCombinedVertices(), and tessCombineData().

◆ mContours

std::vector<int> vl::Tessellator::mContours
protected

Definition at line 132 of file Tessellator.hpp.

Referenced by tessellate().

◆ mContourVerts

std::vector<dvec3> vl::Tessellator::mContourVerts
protected

Definition at line 133 of file Tessellator.hpp.

Referenced by tessellate().

◆ mFans

std::vector< std::vector<fvec3> > vl::Tessellator::mFans
protected

Definition at line 137 of file Tessellator.hpp.

Referenced by tessBeginData(), tessellate(), and tessVertexData().

◆ mLineLoops

std::vector< std::vector<fvec3> > vl::Tessellator::mLineLoops
protected

Definition at line 139 of file Tessellator.hpp.

Referenced by tessBeginData(), tessellate(), and tessVertexData().

◆ mPrimitiveType

GLenum vl::Tessellator::mPrimitiveType
protected

Definition at line 141 of file Tessellator.hpp.

Referenced by tessBeginData(), tessellate(), and tessVertexData().

◆ mTessellatedTris

std::vector<fvec3> vl::Tessellator::mTessellatedTris
protected

Definition at line 135 of file Tessellator.hpp.

Referenced by tessellate(), tessellateGeometry(), and tessVertexData().

◆ mTessellateIntoSinglePolygon

bool vl::Tessellator::mTessellateIntoSinglePolygon
protected

Definition at line 151 of file Tessellator.hpp.

Referenced by Tessellator().

◆ mTessNormal

fvec3 vl::Tessellator::mTessNormal
protected

Definition at line 143 of file Tessellator.hpp.

Referenced by Tessellator().

◆ mTolerance

double vl::Tessellator::mTolerance
protected

Definition at line 147 of file Tessellator.hpp.

Referenced by Tessellator().

◆ mTriStrips

std::vector< std::vector<fvec3> > vl::Tessellator::mTriStrips
protected

Definition at line 138 of file Tessellator.hpp.

Referenced by tessBeginData(), tessellate(), and tessVertexData().

◆ mWindingRule

ETessellationWinding vl::Tessellator::mWindingRule
protected

Definition at line 149 of file Tessellator.hpp.

Referenced by Tessellator().


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