osg::TriangleFunctor< T > Class Template Reference

Inheritance diagram for osg::TriangleFunctor< T >:

osg::PrimitiveFunctor List of all members.

Public Member Functions

 TriangleFunctor ()
virtual ~TriangleFunctor ()
void setTreatVertexDataAsTemporary (bool treatVertexDataAsTemporary)
bool getTreatVertexDataAsTemporary () const
virtual void setVertexArray (unsigned int, const Vec2 *)
virtual void setVertexArray (unsigned int count, const Vec3 *vertices)
virtual void setVertexArray (unsigned int, const Vec4 *)
virtual void drawArrays (GLenum mode, GLint first, GLsizei count)
 Mimics the OpenGL glDrawArrays() function.
virtual void drawElements (GLenum mode, GLsizei count, const GLubyte *indices)
 Mimics the OpenGL glDrawElements() function.
virtual void drawElements (GLenum mode, GLsizei count, const GLushort *indices)
 Mimics the OpenGL glDrawElements() function.
virtual void drawElements (GLenum mode, GLsizei count, const GLuint *indices)
 Mimics the OpenGL glDrawElements() function.
virtual void begin (GLenum mode)
virtual void vertex (const Vec2 &vert)
 Mimics the OpenGL glVertex() "family of functions".
virtual void vertex (const Vec3 &vert)
 Mimics the OpenGL glVertex() "family of functions".
virtual void vertex (const Vec4 &vert)
 Mimics the OpenGL glVertex() "family of functions".
virtual void vertex (float x, float y)
 Mimics the OpenGL glVertex() "family of functions".
virtual void vertex (float x, float y, float z)
 Mimics the OpenGL glVertex() "family of functions".
virtual void vertex (float x, float y, float z, float w)
 Mimics the OpenGL glVertex() "family of functions".
virtual void end ()
 Mimics the OpenGL glEnd() function.

Protected Attributes

unsigned int _vertexArraySize
const Vec3_vertexArrayPtr
GLenum _modeCache
std::vector< Vec3_vertexCache
bool _treatVertexDataAsTemporary

Detailed Description

template<class T>
class osg::TriangleFunctor< T >

Provides access to the triangles that compose an osg::Drawable. If the Drawable is not composed of triangles, the TriangleFunctor will convert the primitives to triangles whenever possible.

Notice that TriangleFunctor is a class template, and that it inherits from its template parameter T. This template parameter must implement T::operator() (const osg::Vec3 v1, const osg::Vec3 v2, const osg::Vec3 v3, bool treatVertexDataAsTemporary), which will be called for every triangle when the functor is applied to a Drawable. Parameters v1, v2, and v3 are the triangle vertices. The fourth parameter, treatVertexDataAsTemporary, indicates whether these vertices are coming from a "real" vertex array, or from a temporary vertex array, created by the TriangleFunctor from some other geometry representation.

See also:
PrimitiveFunctor for general usage hints.


Constructor & Destructor Documentation

template<class T>
osg::TriangleFunctor< T >::TriangleFunctor (  )  [inline]

template<class T>
virtual osg::TriangleFunctor< T >::~TriangleFunctor (  )  [inline, virtual]


Member Function Documentation

template<class T>
virtual void osg::TriangleFunctor< T >::begin ( GLenum  mode  )  [inline, virtual]

Note: begin(..),vertex(..) & end() are convenience methods for adapting non vertex array primitives to vertex array based primitives. This is done to simplify the implementation of primtive functor subclasses - users only need override drawArray and drawElements.

Implements osg::PrimitiveFunctor.

template<class T>
virtual void osg::TriangleFunctor< T >::drawArrays ( GLenum  mode,
GLint  first,
GLsizei  count 
) [inline, virtual]

Mimics the OpenGL glDrawArrays() function.

Implements osg::PrimitiveFunctor.

template<class T>
virtual void osg::TriangleFunctor< T >::drawElements ( GLenum  mode,
GLsizei  count,
const GLuint *  indices 
) [inline, virtual]

Mimics the OpenGL glDrawElements() function.

Implements osg::PrimitiveFunctor.

template<class T>
virtual void osg::TriangleFunctor< T >::drawElements ( GLenum  mode,
GLsizei  count,
const GLushort *  indices 
) [inline, virtual]

Mimics the OpenGL glDrawElements() function.

Implements osg::PrimitiveFunctor.

template<class T>
virtual void osg::TriangleFunctor< T >::drawElements ( GLenum  mode,
GLsizei  count,
const GLubyte *  indices 
) [inline, virtual]

Mimics the OpenGL glDrawElements() function.

Implements osg::PrimitiveFunctor.

template<class T>
virtual void osg::TriangleFunctor< T >::end (  )  [inline, virtual]

Mimics the OpenGL glEnd() function.

Implements osg::PrimitiveFunctor.

template<class T>
bool osg::TriangleFunctor< T >::getTreatVertexDataAsTemporary (  )  const [inline]

template<class T>
void osg::TriangleFunctor< T >::setTreatVertexDataAsTemporary ( bool  treatVertexDataAsTemporary  )  [inline]

template<class T>
virtual void osg::TriangleFunctor< T >::setVertexArray ( unsigned  int,
const Vec4  
) [inline, virtual]

Sets the array of vertices used to describe the primitives. Somehow mimics the OpenGL glVertexPointer() function.

Implements osg::PrimitiveFunctor.

template<class T>
virtual void osg::TriangleFunctor< T >::setVertexArray ( unsigned int  count,
const Vec3 vertices 
) [inline, virtual]

Sets the array of vertices used to describe the primitives. Somehow mimics the OpenGL glVertexPointer() function.

Implements osg::PrimitiveFunctor.

template<class T>
virtual void osg::TriangleFunctor< T >::setVertexArray ( unsigned  int,
const Vec2  
) [inline, virtual]

Sets the array of vertices used to describe the primitives. Somehow mimics the OpenGL glVertexPointer() function.

Implements osg::PrimitiveFunctor.

template<class T>
virtual void osg::TriangleFunctor< T >::vertex ( float  x,
float  y,
float  z,
float  w 
) [inline, virtual]

Mimics the OpenGL glVertex() "family of functions".

Implements osg::PrimitiveFunctor.

template<class T>
virtual void osg::TriangleFunctor< T >::vertex ( float  x,
float  y,
float  z 
) [inline, virtual]

Mimics the OpenGL glVertex() "family of functions".

Implements osg::PrimitiveFunctor.

template<class T>
virtual void osg::TriangleFunctor< T >::vertex ( float  x,
float  y 
) [inline, virtual]

Mimics the OpenGL glVertex() "family of functions".

Implements osg::PrimitiveFunctor.

template<class T>
virtual void osg::TriangleFunctor< T >::vertex ( const Vec4 vert  )  [inline, virtual]

Mimics the OpenGL glVertex() "family of functions".

Implements osg::PrimitiveFunctor.

template<class T>
virtual void osg::TriangleFunctor< T >::vertex ( const Vec3 vert  )  [inline, virtual]

Mimics the OpenGL glVertex() "family of functions".

Implements osg::PrimitiveFunctor.

template<class T>
virtual void osg::TriangleFunctor< T >::vertex ( const Vec2 vert  )  [inline, virtual]

Mimics the OpenGL glVertex() "family of functions".

Implements osg::PrimitiveFunctor.


Member Data Documentation

template<class T>
GLenum osg::TriangleFunctor< T >::_modeCache [protected]

template<class T>
bool osg::TriangleFunctor< T >::_treatVertexDataAsTemporary [protected]

template<class T>
const Vec3* osg::TriangleFunctor< T >::_vertexArrayPtr [protected]

template<class T>
unsigned int osg::TriangleFunctor< T >::_vertexArraySize [protected]

template<class T>
std::vector<Vec3> osg::TriangleFunctor< T >::_vertexCache [protected]


The documentation for this class was generated from the following file:
Generated on Sun Oct 1 13:17:08 2006 for openscenegraph by  doxygen 1.4.7