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

sglIndexedGeoStripSet Class Reference

#include <sglIndexedGeoStripSet.hpp>

Inheritance diagram for sglIndexedGeoStripSet::

sglIndexedGeoSet sglGeoSet sglDrawable sglObject sglIndexedLineStripSet sglIndexedPolygonSet sglIndexedQuadStripSet sglIndexedTriangleFanSet sglIndexedTriangleStripSet List of all members.

Public Methods

 sglIndexedGeoStripSet ()
virtual ~sglIndexedGeoStripSet ()
virtual unsigned int getPrimSize () const
sglDataPtrgetPrimLengths () const
void setPrimLengths (sglIndexType *alist)
void setPrimLengths (sglDataPtr *data, int offset=0, int stride=0)
int getPrimLengthsOffset () const
int getPrimLengthsStride () const
virtual void addStats (sglStats &stats) const

Protected Methods

virtual bool computeBounds ()
virtual void updateDrawFunc ()

Protected Attributes

sglIndexPtr m_lengths

Friends

class  Initializer

Detailed Description

Just as sglGeoStripSet specializes the sglGeoSet class to add a lengths array for specifying the size of variable length primitives, this class specializes the sglIndexedGeoSet to add the same lengths array for the indexed versions of the primitive types.

{\bf Concrete subclasses: sglIndexedLineStripSet, sglIndexedTriangleFanSet, sglIndexedTriangleStripSet, sglIndexedQuadStripSet, sglIndexedPolygonSet}

These are the concrete subclasses of sglIndexedGeoStripSet that implement the line strip, triangle fan, triangle strip, quad strip and polygon primitives.

{\bf Example:} \begin{verbatim} unsigned int *lengths = new unsigned int[1]; lengths[0] = 5;

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

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

unsigned int *vindex = new unsigned int[5]; vindex[0] = 0; // indices for a pentagon (irregular) vindex[1] = 1; vindex[2] = 2; vindex[3] = 3; vindex[4] = 4;

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

sglIndexedPolygonSet *poly_set = new sglIndexedPolygonSet; poly_set->setNumPrims(1); poly_set->setPrimLengths(lengths); poly_set->setCoordList(vertex); poly_set->setCoordIndexList(vindex); poly_set->setColorList(sglGeoSet::ePER_VERTEX, color); poly_set->setColorIndexList(cindex); \end{verbatim}

Definition at line 88 of file sglIndexedGeoStripSet.hpp.


Constructor & Destructor Documentation

sglIndexedGeoStripSet::sglIndexedGeoStripSet ( )
 

default constructor.

sglIndexedGeoStripSet::~sglIndexedGeoStripSet ( ) [virtual]
 

virtual destructor.


Member Function Documentation

unsigned int sglIndexedGeoStripSet::getPrimSize ( ) const [inline, virtual]
 

Not very useful for variable sized primitives.

Reimplemented from sglGeoSet.

Definition at line 97 of file sglIndexedGeoStripSet.hpp.

sglDataPtr * sglIndexedGeoStripSet::getPrimLengths ( ) const [inline]
 

Get the lengths array.

Definition at line 100 of file sglIndexedGeoStripSet.hpp.

void sglIndexedGeoStripSet::setPrimLengths ( sglIndexType * alist ) [inline]
 

Set the array of lengths. Deprecated.

Definition at line 103 of file sglIndexedGeoStripSet.hpp.

void sglIndexedGeoStripSet::setPrimLengths ( sglDataPtr * data,
int offset = 0,
int stride = 0 )
 

Set the array of lengths. 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 lengths must be of type sglIndexType.

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

int sglIndexedGeoStripSet::getPrimLengthsOffset ( ) const [inline]
 

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

Definition at line 123 of file sglIndexedGeoStripSet.hpp.

int sglIndexedGeoStripSet::getPrimLengthsStride ( ) const [inline]
 

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

Definition at line 126 of file sglIndexedGeoStripSet.hpp.

void sglIndexedGeoStripSet::addStats ( sglStats & stats ) const [virtual]
 

Add this drawable's stats to the given sglStats.

Reimplemented from sglGeoSet.

virtual bool sglIndexedGeoStripSet::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 sglIndexedGeoSet.


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