Open Inventor Reference
|
Abstract base class for all indexed vertex-based shapes. More...
#include <Inventor/nodes/SoIndexedShape.h>
Static Public Member Functions | |
static void | initClass () |
Initializes base node class. | |
Public Attributes | |
Fields | |
SoMFInt32 | coordIndex |
The indices of the coordinates that the shape uses as its vertices. | |
SoMFInt32 | materialIndex |
Material indices. | |
SoMFInt32 | normalIndex |
Surface normal indices. | |
SoMFInt32 | textureCoordIndex |
Texture Coordinate indices. | |
Protected Member Functions | |
SoIndexedShape () | |
Constructor - makes this abstract. | |
virtual void | computeBBox (SoAction *action, SbBox3f &box, SbVec3f ¢er) |
This handles bounding box computation for all shapes derived from this class. | |
int | getNumVerts (int startCoord) |
Starting at a given index in the coordIndex array, figure out how many vertices there are before either the end of the array or the next 'border' index. | |
void | setupIndices (int numParts, int numFaces, SbBool needNormals, SbBool needTexCoords) |
Setup for fast rendering. | |
const int32_t * | getNormalIndices () |
These must not be called unless setupIndices has been called first: | |
const int32_t * | getColorIndices () |
const int32_t * | getTexCoordIndices () |
virtual void | notify (SoNotList *list) |
Keep indices up to date if things change. | |
virtual | ~SoIndexedShape () |
Static Protected Member Functions | |
static SbBool | areTexCoordsIndexed (SoAction *action) |
Returns TRUE if texture coordinates should be indexed. |
This node is the abstract base class for all vertex-based shapes that are constructed from indices, including SoIndexedFaceSet, SoIndexedTriangleStripSet, and SoIndexedLineSet. SoIndexedShape defines fields that are used in all of its subclasses.
All subclasses of SoNonIndexedShape construct objects by using the coordinates specified by the vertexProperty field (from SoVertexShape), or the current inherited coordinates. The coordIndex field defined by this class contains the indices into the current coordinates of the vertices of the shape. These indices are also used for materials, normals, or texture coordinates when the appropriate binding is PER_VERTEX_INDEXED
.
Material and normal bindings are interpreted as follows for each subclass:
OVERALL One material for the entire shape. PER_PART Specific to the subclass. PER_PART_INDEXED Same as PER_PART, using indices from the materialIndex or normalIndex field. PER_FACE Specific to the subclass. PER_FACE_INDEXED Same as PER_FACE, using indices from the materialIndex or normalIndex field. PER_VERTEX One material per vertex. PER_VERTEX_INDEXED One material per vertex, using indices from the materialIndex or normalIndex field.
When any _INDEXED
binding is used for materials or normals, the materialIndex or normalIndex field is used to determine the indices for the materials or normals. If this field contains a single value of -1 (the default), the coordinate indices from the coordIndex field are used as well for materials or normals. When the binding is PER_VERTEX_INDEXED
, indices in these fields that correspond to negative indices in coordIndex are skipped; for other index bindings all the values in the fields are used, in order.
Explicit texture coordinates (as defined by SoTextureCoordinate2) may be bound to vertices of an indexed shape consecutively (if the texture coordinate binding is PER_VERTEX
) or by using the indices in the textureCoordIndex field (if the binding is PER_VERTEX_INDEXED
). As with all vertex-based shapes, if there is a current texture but no texture coordinates are specified, a default texture coordinate mapping is calculated using the bounding box of the shape.
Be sure that the indices contained in the coordIndex , materialIndex , normalIndex , and textureCoordIndex fields are valid with respect to the current state, or errors will occur.
Definition at line 129 of file SoIndexedShape.h.
SoIndexedShape::SoIndexedShape | ( | ) | [protected] |
virtual SoIndexedShape::~SoIndexedShape | ( | ) | [protected, virtual] |
virtual void SoIndexedShape::computeBBox | ( | SoAction * | action, |
SbBox3f & | box, | ||
SbVec3f & | center | ||
) | [protected, virtual] |
It sets the bounding box to contain all vertices of the shape, assuming that the shape uses the coordinates indexed by all non-negative values in the coordIndex field. It also sets the center to the average of the vertices' coordinates.
Implements SoShape.
const int32_t* SoIndexedShape::getColorIndices | ( | ) | [inline, protected] |
Definition at line 186 of file SoIndexedShape.h.
const int32_t* SoIndexedShape::getNormalIndices | ( | ) | [inline, protected] |
Definition at line 184 of file SoIndexedShape.h.
int SoIndexedShape::getNumVerts | ( | int | startCoord | ) | [protected] |
const int32_t* SoIndexedShape::getTexCoordIndices | ( | ) | [inline, protected] |
Definition at line 188 of file SoIndexedShape.h.
static void SoIndexedShape::initClass | ( | ) | [static] |
Reimplemented from SoVertexShape.
Reimplemented in SoIndexedFaceSet, SoIndexedLineSet, SoIndexedTriangleSet, and SoIndexedTriangleStripSet.
virtual void SoIndexedShape::notify | ( | SoNotList * | list | ) | [protected, virtual] |
Reimplemented from SoVertexShape.
void SoIndexedShape::setupIndices | ( | int | numParts, |
int | numFaces, | ||
SbBool | needNormals, | ||
SbBool | needTexCoords | ||
) | [protected] |
This should be called by subclasses, which can then use the textureI/colorI/normalI arrays (which will either point to one of the coordIndex arrays, or to a consective array of integers. This must be called AFTER the vpCache has been filled in.
The coordinates connect to form faces, lines, or other shapes. Each subclass defines special negative indices to use to indicate separation between faces, lines, and so on.
Definition at line 141 of file SoIndexedShape.h.
Definition at line 143 of file SoIndexedShape.h.
Definition at line 145 of file SoIndexedShape.h.
Definition at line 147 of file SoIndexedShape.h.