Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglMonoIndexedGeoSet Class Reference

#include <sglMonoIndexedGeoSet.hpp>

Inheritance diagram for sglMonoIndexedGeoSet::

sglGeoSet sglDrawable sglObject sglMonoIndexedGeoStripSet sglMonoIndexedLineSet sglMonoIndexedPointSet sglMonoIndexedQuadSet sglMonoIndexedTriangleSet sglMonoIndexedLineStripSet sglMonoIndexedPolygonSet sglMonoIndexedQuadStripSet sglMonoIndexedTriangleFanSet sglMonoIndexedTriangleStripSet List of all members.

Public Methods

 sglMonoIndexedGeoSet ()
virtual ~sglMonoIndexedGeoSet ()
void setIndexList (sglIndexType *alist)
void setIndexList (sglDataPtr *data, int offset=0, int stride=0)
sglDataPtrgetIndexList () const
int getIndexOffset () const
int getIndexStride () const
void setDisablePrefetch (bool val)
bool getDisablePrefetch ()

Protected Methods

virtual bool computeBounds ()
virtual void computeNoBounds ()
virtual void updateDrawFunc ()

Protected Attributes

sglIndexPtr m_index
bool m_disable_prefetch
vector<sglIndexType> m_index_min
vector<sglIndexType> m_index_max

Friends

class  Initializer

Detailed Description

sglMonoIndexedGeoSet is the abstract base class for all geometry types (strip or otherwise) that use a single index list for all attributes. This class is a variation on the sglIndexedGeoSet class (which allowed a different index list for each attribute). This implies that any attribute array that is be bound as sglGeoSet::ePER_VERTEX (the same as the coordinate array) use the same index array. The advantage of this class, is the possible efficiency gained through the use of vertex arrays (when available). Note that color and normal attribute arrays may still be bound as sglGeoSet::eOVERALL or sglGeoSet::ePER_PRIM but they will not be indexed as they must be in the sglIndexedGeoSet class.

{\bf Concrete subclasses: sglMonoIndexedPointSet, sglMonoIndexedLineSet, sglMonoIndexedTriangleSet, sglMonoIndexedQuadSet}

These are the concrete subclasses of sglMonoIndexedGeoSet class that implement point, line, triangle, and quad primitive types.

{\bf Example:} \begin{verbatim} sglVec3f *vertex = new sglVec3f[6]; vertex[0].set( 0.0f, 0.0f, 0.0f); vertex[1].set( 0.0f, 1.0f, 0.0f); vertex[2].set( 1.0f, 0.0f, 0.0f); vertex[3].set( 1.0f,-1.0f, 0.0f); vertex[4].set(-1.0f,-1.0f, 0.0f); vertex[5].set(-1.0f, 0.0f, 0.0f);

sglVec4f *color = new sglVec4f[5]; color[0].set( 1.0f, 0.0f, 0.0f, 1.0f); color[1].set( 0.0f, 1.0f, 0.0f, 1.0f); color[2].set( 0.0f, 0.0f, 1.0f, 1.0f); color[3].set( 0.0f, 0.0f, 1.0f, 1.0f); color[4].set( 0.0f, 1.0f, 0.0f, 1.0f);

unsigned int *vindex = new unsigned int[10]; vindex[0] = 0; vindex[1] = 1; // indices for a five pointed star (sorta) vindex[2] = 0; vindex[3] = 2; vindex[4] = 0; vindex[5] = 3; vindex[6] = 0; vindex[7] = 4; vindex[8] = 0; vindex[9] = 5;

unsigned int *cindex = new unsigned int[5]; cindex[0] = 0; cindex[1] = 1; cindex[2] = 2; cindex[3] = 2; cindex[4] = 1;

sglMonoIndexedLineSet *line_gset = new sglMonoIndexedPointSet; line_gset->setNumPrims(5); line_gset->setCoordList(vertex); line_gset->setIndexList(vindex); line_gset->setColorList(sglGeoSet::ePER_PRIM, color); // doesn't use index list \end{verbatim}

Definition at line 92 of file sglMonoIndexedGeoSet.hpp.


Constructor & Destructor Documentation

sglMonoIndexedGeoSet::sglMonoIndexedGeoSet ( )
 

default constructor.

sglMonoIndexedGeoSet::~sglMonoIndexedGeoSet ( ) [virtual]
 

virtual destructor.


Member Function Documentation

void sglMonoIndexedGeoSet::setIndexList ( sglIndexType * alist ) [inline]
 

Set the index list for ePER_VERTEX attributes. Deprecated.

Definition at line 101 of file sglMonoIndexedGeoSet.hpp.

void sglMonoIndexedGeoSet::setIndexList ( sglDataPtr * data,
int offset = 0,
int stride = 0 )
 

Set the array of indices for ePER_VERTEX attributes. This will increment the reference count on the given data pointer, and decrement the reference count of the previous data pointer. If the previous data pointer's refernce count goes to zero, it will be deleted. The indices must be of type sglIndexType.

Parameters:
data   Pointer to the list of indices.
offset   Number of bytes in the array before the first index.
stride   Number of bytes from the start of one index to the start of the next index. If zero, the indices are assumed to be tightly packed (i.e. stride == sizeof(type)). Stride must be non-negative.

sglDataPtr * sglMonoIndexedGeoSet::getIndexList ( ) const [inline]
 

Get the index list for ePER_VERTEX attributes.

Definition at line 122 of file sglMonoIndexedGeoSet.hpp.

int sglMonoIndexedGeoSet::getIndexOffset ( ) const [inline]
 

Get the number of bytes in the array before the first index.

Definition at line 125 of file sglMonoIndexedGeoSet.hpp.

int sglMonoIndexedGeoSet::getIndexStride ( ) const [inline]
 

Get the number of bytes from the start of one index to the next.

Definition at line 128 of file sglMonoIndexedGeoSet.hpp.

void sglMonoIndexedGeoSet::setDisablePrefetch ( bool val )
 

If the set of indices above sparsely indexes the vertex data, then it might be best to disable prefetching. This will prevent unnecessarily processing unused vertices.

virtual bool sglMonoIndexedGeoSet::computeBounds ( ) [protected, virtual]
 

Compute the bounding box for this geometry and fill in the member variable, m_bbox, in this class.

Returns:
true if successful (all information is available for computing a bounding box), otherwise false.

Reimplemented from sglGeoSet.

Reimplemented in sglMonoIndexedGeoStripSet.


The documentation for this class was generated from the following file:
Generated at Mon Jul 1 18:00:09 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001