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

sglIndexedGeoSet Class Reference

#include <sglIndexedGeoSet.hpp>

Inheritance diagram for sglIndexedGeoSet::

sglGeoSet sglDrawable sglObject sglIndexedGeoStripSet sglIndexedLineSet sglIndexedPointSet sglIndexedQuadSet sglIndexedTriangleSet sglIndexedLineStripSet sglIndexedPolygonSet sglIndexedQuadStripSet sglIndexedTriangleFanSet sglIndexedTriangleStripSet List of all members.

Public Methods

 sglIndexedGeoSet ()
virtual ~sglIndexedGeoSet ()
void setCoordIndexList (sglIndexType *alist)
void setCoordIndexList (sglDataPtr *data, int offset=0, int stride=0)
void setNormalIndexList (sglIndexType *alist)
void setNormalIndexList (sglDataPtr *data, int offset=0, int stride=0)
void setTexCoordIndexList (sglIndexType *alist)
void setTexCoordIndexList (sglDataPtr *data, int offset=0, int stride=0)
void setColorIndexList (sglIndexType *alist)
void setColorIndexList (sglDataPtr *data, int offset=0, int stride=0)
sglDataPtrgetCoordIndexList () const
sglDataPtrgetNormalIndexList () const
sglDataPtrgetTexCoordIndexList () const
sglDataPtrgetColorIndexList () const
int getCoordIndexOffset () const
int getNormalIndexOffset () const
int getTexCoordIndexOffset () const
int getColorIndexOffset () const
int getCoordIndexStride () const
int getNormalIndexStride () const
int getTexCoordIndexStride () const
int getColorIndexStride () const

Protected Methods

virtual bool computeBounds ()

Protected Attributes

sglIndexPtr m_vindex
sglIndexPtr m_nindex
sglIndexPtr m_tindex
sglIndexPtr m_cindex

Detailed Description

sglIndexedGeoSet is the abstract base class for all indexed geometry classes. Sometimes the vertices in the geometry is used more than once. In the concrete subclasses of sglGeoSet and sglGeoStripSet, these vertices would have to be present in the array once for each time the primitives reference it. This can lead to higher storage requirements. This can potentially be reduced in the sglIndexedGeoSet class (and its subclasses) by using indexing into the attribute arrays.

Note that if one attribute array (coord, normal, color, and texcoord) is indexed, then all of them have to be indexed. The exception to this rule is if the color or normal attributes are bound as sglGeoSet::eOVERALL (that is, no index array is needed in this case). Each attribute can have its own index array or share them in any combination.

The index arrays consist of unsigned ints. Should the indexed arrays be unsigned shorts to reduce storage requirements? The original need for index arrays that could index into attribute arrays larger than 2^16 may no longer be there.

{\bf Concrete subclasses: sglIndexedPointSet, sglIndexedLineSet, sglIndexedTriangleSet, sglIndexedQuadSet}

These are the concrete subclasses of sglIndexedGeoSet that implement the point, line segment, triangle and quad primitives.

{\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[3]; 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);

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;

sglIndexedLineSet *line_gset = new sglIndexedLineSet; line_gset->setNumPrims(5); line_gset->setCoordList(vertex); line_gset->setCoordIndexList(vindex); line_gset->setColorList(sglGeoSet::ePER_PRIM, color); line_gset->setColorIndexList(cindex); \end{verbatim}

Definition at line 100 of file sglIndexedGeoSet.hpp.


Constructor & Destructor Documentation

sglIndexedGeoSet::sglIndexedGeoSet ( )
 

default constructor.

sglIndexedGeoSet::~sglIndexedGeoSet ( ) [virtual]
 

virtual destructor.


Member Function Documentation

void sglIndexedGeoSet::setCoordIndexList ( sglIndexType * alist ) [inline]
 

Set the array of vertex indices. Deprecated.

Definition at line 109 of file sglIndexedGeoSet.hpp.

void sglIndexedGeoSet::setCoordIndexList ( sglDataPtr * data,
int offset = 0,
int stride = 0 )
 

Set the array of vertex indices. 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.

void sglIndexedGeoSet::setNormalIndexList ( sglIndexType * alist ) [inline]
 

Set the array of normal indices. Deprecated.

Definition at line 130 of file sglIndexedGeoSet.hpp.

void sglIndexedGeoSet::setNormalIndexList ( sglDataPtr * data,
int offset = 0,
int stride = 0 )
 

Set the array of vertex indices. 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.

void sglIndexedGeoSet::setTexCoordIndexList ( sglIndexType * alist ) [inline]
 

Set the array of texture coordinate indices. Deprecated.

Definition at line 151 of file sglIndexedGeoSet.hpp.

void sglIndexedGeoSet::setTexCoordIndexList ( sglDataPtr * data,
int offset = 0,
int stride = 0 )
 

Set the array of texture coordinate indices. 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.

void sglIndexedGeoSet::setColorIndexList ( sglIndexType * alist ) [inline]
 

Set the array of color indices. Deprecated.

Definition at line 172 of file sglIndexedGeoSet.hpp.

void sglIndexedGeoSet::setColorIndexList ( sglDataPtr * data,
int offset = 0,
int stride = 0 )
 

Set the array of color indices. 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 * sglIndexedGeoSet::getCoordIndexList ( ) const [inline]
 

get the current vertex, normal, color, texcoord attribute lists.

Definition at line 193 of file sglIndexedGeoSet.hpp.

int sglIndexedGeoSet::getCoordIndexOffset ( ) const [inline]
 

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

Definition at line 202 of file sglIndexedGeoSet.hpp.

int sglIndexedGeoSet::getCoordIndexStride ( ) const [inline]
 

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

Definition at line 211 of file sglIndexedGeoSet.hpp.

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


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