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

sglGeoStripSet Class Reference

#include <sglGeoStripSet.hpp>

Inheritance diagram for sglGeoStripSet::

sglGeoSet sglDrawable sglObject sglLineStripSet sglPolygonSet sglQuadStripSet sglTriangleFanSet sglTriangleStripSet sglCylinder List of all members.

Public Methods

 sglGeoStripSet ()
virtual ~sglGeoStripSet ()
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

Unlike the sglGeoSet class, sglGeoStripSet is capable of fully specifying those primitives whose lengths are variable: sglLineStripSet, sglTriangleFanSet, sglTriangleStripSet, sglQuadStripSet or sglPolygonSet. This class extends the sglGeoSet class to include a lengths array with a number of elements equal to the number of primitives set by the setNumPrims() function. Each element of the lengths array specifies how many vertices are used for each primitive (the sum of all the elements in the lengths array defines the required size of the coordinate array and any other attribute array that has an sglGeoSet::ePER_VERTEX binding).

{\bf Concrete subclasses: sglLineStripSet, sglTriangleFanSet, sglTriangleStripSet, sglQuadStripSet, sglPolygonSet}

These are the concrete subclasses of sglGeoStripSet that can be instantiated by the user. The example below illustrates the creation of an sglTriangleStripSet with two strips of lengths 6 and 4 with per primitive normal attributes, and overall color attribute.

{\bf Example:} \begin{verbatim} unsigned int *lengths = new lengths[2]; lengths[0] = 6; // implies use of vertices[0..5] lengths[1] = 4; // implies use of vertices[6..9]

sglVec3f *vertex = new sglVec4f[10]; vertex[0].set(0.0f, 0.0f, 0.0f); // 1st primitive: 4 triangles in a strip vertex[1].set(5.0f, 0.0f, 0.0f); vertex[2].set(0.0f, 4.0f, 0.0f); vertex[3].set(5.0f, 4.0f, 0.0f); vertex[4].set(0.0f, 8.0f, 0.0f); vertex[5].set(5.0f, 8.0f, 0.0f);

vertex[6].set(5.0f, 0.0f, 0.0f); // 2nd primitive: 2 triangles in a strip vertex[7].set(0.0f, 0.0f, 0.0f); vertex[8].set(5.0f, 0.0f, 4.0f); vertex[9].set(0.0f, 0.0f, 4.0f);

sglVec4f *color = new sglVec4f[1]; color[0].set(1.0f, 0.0f, 0.0f, 1.0f); // both strips red

sglVec3f *normal = new sglVec3f[2]; // one normal for each primitive normal[0].set(0.0f,0.0f,1.0f); normal[1].set(0.0f,1.0f,0.0f);

sglTriangleStripSet *tstrip = new sglTriangleStripSet; tstrip->setNumPrims(2); tstrip->setPrimLengths(lengths) tstrip->setCoordList(vertex); // sglGeoSet::ePER_VERTEX is implied tstrip->setColorList(sglGeoSet::eOVERALL, color); tstrip->setNormalList(sglGeoSet::ePER_PRIM, normal); \end{verbatim}

Definition at line 89 of file sglGeoStripSet.hpp.


Constructor & Destructor Documentation

sglGeoStripSet::sglGeoStripSet ( )
 

default constructor.

sglGeoStripSet::~sglGeoStripSet ( ) [virtual]
 

virtual destructor.


Member Function Documentation

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

Not very useful for variable sized primitives.

Reimplemented from sglGeoSet.

Definition at line 98 of file sglGeoStripSet.hpp.

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

Get the lengths array (for strip and poly primitives only).

Definition at line 101 of file sglGeoStripSet.hpp.

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

Set the array of lengths. Deprecated.

Definition at line 104 of file sglGeoStripSet.hpp.

void sglGeoStripSet::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 sglGeoStripSet::getPrimLengthsOffset ( ) const [inline]
 

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

Definition at line 124 of file sglGeoStripSet.hpp.

int sglGeoStripSet::getPrimLengthsStride ( ) const [inline]
 

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

Definition at line 127 of file sglGeoStripSet.hpp.

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

Add this drawable's stats to the given sglStats.

Reimplemented from sglGeoSet.

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


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