Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::PrimitiveIterator Class Reference
[Geometry Iterators]

Geometry Iterator for primitives. See Geometry Iterators for a description. More...

#include <OSGPrimitiveIterator.h>

Inheritance diagram for osg::PrimitiveIterator:

osg::EdgeIterator osg::FaceIterator osg::LineIterator osg::TriangleIterator List of all members.

Public Member Functions

Constructors
PrimitiveIterator (void)
 PrimitiveIterator (const PrimitiveIterator &source)
 PrimitiveIterator (const GeometryPtr &geo)
 PrimitiveIterator (const NodePtr &geo)
Destructors
*virtual ~PrimitiveIterator (void)
Set
*void setGeo (const GeometryPtr &geo)
void setGeo (const NodePtr &geo)
void setToBegin (void)
void setToEnd (void)
Get
*bool isAtEnd (void) const
Int32 getIndex (void) const
UInt32 getLength (void) const
UInt32 getType (void) const
Int32 getPositionIndex (Int32 which) const
Pnt3f getPosition (Int32 which) const
Int32 getNormalIndex (Int32 which) const
Vec3f getNormal (Int32 which) const
Int32 getColorIndex (Int32 which) const
Color3f getColor (Int32 which) const
Int32 getSecondaryColorIndex (Int32 which) const
Color3f getSecondaryColor (Int32 which) const
Int32 getTexCoordsIndex (Int32 which) const
Vec2f getTexCoords (Int32 which) const
Int32 getTexCoordsIndex1 (Int32 which) const
Vec2f getTexCoords1 (Int32 which) const
Int32 getTexCoordsIndex2 (Int32 which) const
Vec2f getTexCoords2 (Int32 which) const
Int32 getTexCoordsIndex3 (Int32 which) const
Vec2f getTexCoords3 (Int32 which) const
Int32 getIndexIndex (Int32 which) const
GeometryPtr getGeometry (void) const
Operators
*void operator++ (void)
void seek (Int32 index)
PrimitiveIteratoroperator= (const PrimitiveIterator &source)
bool operator< (const PrimitiveIterator &other) const
bool operator== (const PrimitiveIterator &other) const
bool operator!= (const PrimitiveIterator &other) const

Static Public Member Functions

Class Get
*static const char * getClassname (void)

Private Attributes

Data
*GeometryPtr _geo
bool _ended
UInt32 _primIndex
UInt32 _actPointIndex
UInt32 _actPrimType
UInt32 _actPrimLength
GeoPTypesPtr _types
GeoPLengthsPtr _lengths
GeoIndicesPtr _indices
UInt16 _nmappings
Int16 _positionIndex
Int16 _normalIndex
Int16 _colorIndex
Int16 _secondaryColorIndex
Int16 _texcoordsIndex
Int16 _texcoordsIndex1
Int16 _texcoordsIndex2
Int16 _texcoordsIndex3

Static Private Attributes

static char cvsid [] = "@(#)$Id: OSGPrimitiveIterator.cpp,v 1.17 2001/11/01 05:55:06 vossg Exp $"

Friends

class Geometry

Detailed Description

Geometry Iterator for primitives. See Geometry Iterators for a description.

Definition at line 62 of file OSGPrimitiveIterator.h.


Constructor & Destructor Documentation

PrimitiveIterator::PrimitiveIterator void   ) 
 

Definition at line 188 of file OSGPrimitiveIterator.cpp.

00188                                          :
00189     _geo                (      ), 
00190     _ended              (  true),
00191     _primIndex          (     0), 
00192     _actPointIndex      (     0),
00193     _actPrimType        (     0), 
00194     _actPrimLength      (     0),
00195     _types              (NullFC), 
00196     _lengths            (NullFC), 
00197     _indices            (NullFC), 
00198     _nmappings          (     0),
00199     _positionIndex      (    -1), 
00200     _normalIndex        (    -1), 
00201     _colorIndex         (    -1), 
00202     _secondaryColorIndex(    -1), 
00203     _texcoordsIndex     (    -1),
00204     _texcoordsIndex1    (    -1),
00205     _texcoordsIndex2    (    -1),
00206     _texcoordsIndex3    (    -1)
00207 {
00208 }

PrimitiveIterator::PrimitiveIterator const PrimitiveIterator source  ) 
 

Definition at line 267 of file OSGPrimitiveIterator.cpp.

00267                                                                     :
00268     _geo                (source._geo                ),
00269     _ended              (source._ended              ),
00270     _primIndex          (source._primIndex          ), 
00271     _actPointIndex      (source._actPointIndex      ),
00272     _actPrimType        (source._actPrimType        ), 
00273     _actPrimLength      (source._actPrimLength      ),  
00274     _types              (source._types              ), 
00275     _lengths            (source._lengths            ), 
00276     _indices            (source._indices            ), 
00277     _nmappings          (source._nmappings          ),
00278     _positionIndex      (source._positionIndex      ),
00279     _normalIndex        (source._normalIndex        ),
00280     _colorIndex         (source._colorIndex         ),
00281     _secondaryColorIndex(source._secondaryColorIndex),
00282     _texcoordsIndex     (source._texcoordsIndex     ),
00283     _texcoordsIndex1    (source._texcoordsIndex1    ),
00284     _texcoordsIndex2    (source._texcoordsIndex2    ),
00285     _texcoordsIndex3    (source._texcoordsIndex3    )  
00286 {
00287 }

PrimitiveIterator::PrimitiveIterator const GeometryPtr geo  ) 
 

This constructor creates an iterator for the given node. It is useful to create an iterator to be used to seek() to a specific indexed face. Otherwise, use Geometry::beginPrimitives() resp. Geometry::endPrimitives() to create an iterator.

Definition at line 215 of file OSGPrimitiveIterator.cpp.

References setGeo().

00215                                                            :
00216     _geo                (      ), 
00217     _ended              (  true),
00218     _primIndex          (     0), 
00219     _actPointIndex      (     0),
00220     _actPrimType        (     0), 
00221     _actPrimLength      (     0),
00222     _types              (NullFC), 
00223     _lengths            (NullFC), 
00224     _indices            (NullFC), 
00225     _nmappings          (     0),
00226     _positionIndex      (    -1), 
00227     _normalIndex        (    -1), 
00228     _colorIndex         (    -1), 
00229     _secondaryColorIndex(    -1), 
00230     _texcoordsIndex     (    -1),
00231     _texcoordsIndex1    (    -1),
00232     _texcoordsIndex2    (    -1),
00233     _texcoordsIndex3    (    -1)
00234 {
00235     setGeo(geo);
00236 }

PrimitiveIterator::PrimitiveIterator const NodePtr geo  ) 
 

This constructor creates an iterator for the given Node, which has to have a Geometry core. It is useful to create an iterator to be used to seek() to a specific indexed face. Otherwise, use Geometry::beginPrimitives() resp. Geometry::endPrimitives() to create an iterator.

Definition at line 243 of file OSGPrimitiveIterator.cpp.

References setGeo().

00243                                                        :
00244     _geo                (      ), 
00245     _ended              (  true),
00246     _primIndex          (     0), 
00247     _actPointIndex      (     0),
00248     _actPrimType        (     0), 
00249     _actPrimLength      (     0),
00250     _types              (NullFC), 
00251     _lengths            (NullFC), 
00252     _indices            (NullFC), 
00253     _nmappings          (     0),
00254     _positionIndex      (    -1), 
00255     _normalIndex        (    -1), 
00256     _colorIndex         (    -1), 
00257     _secondaryColorIndex(    -1), 
00258     _texcoordsIndex     (    -1),
00259     _texcoordsIndex1    (    -1),
00260     _texcoordsIndex2    (    -1),
00261     _texcoordsIndex3    (    -1)
00262 {
00263     setGeo(geo);
00264 }

PrimitiveIterator::~PrimitiveIterator void   )  [virtual]
 

Definition at line 289 of file OSGPrimitiveIterator.cpp.

00290 {
00291 }


Member Function Documentation

* static const char* osg::PrimitiveIterator::getClassname void   )  [inline, static]
 

Reimplemented in osg::EdgeIterator, osg::FaceIterator, osg::LineIterator, and osg::TriangleIterator.

Definition at line 71 of file OSGPrimitiveIterator.h.

00071 { return "PrimitiveIterator"; }

void PrimitiveIterator::setGeo const GeometryPtr geo  ) 
 

Switch the iterator to a new geometry. Automatically sets it to the beginning.

Definition at line 299 of file OSGPrimitiveIterator.cpp.

References _geo, _indices, _lengths, _types, osg::NullFC, OSG_ASSERT, and setToBegin().

Referenced by osg::EdgeIterator::EdgeIterator(), osg::FaceIterator::FaceIterator(), osg::LineIterator::LineIterator(), PrimitiveIterator(), setGeo(), and osg::TriangleIterator::TriangleIterator().

00300 {
00301     OSG_ASSERT(geo != NullFC);
00302 
00303     _geo     = geo;
00304     _types   = geo->getTypes();
00305     _lengths = geo->getLengths();
00306     _indices = geo->getIndices();
00307     
00308     setToBegin();
00309 }

void PrimitiveIterator::setGeo const NodePtr geo  ) 
 

Switch the iterator to a new geometry. Automatically sets it to the beginning.

Definition at line 315 of file OSGPrimitiveIterator.cpp.

References osg::AttachmentContainerPtr::dcast(), FWARNING, osg::NodePtr::getCore(), osg::NullFC, and setGeo().

00316 {
00317     GeometryPtr gc = GeometryPtr::dcast(geo->getCore());
00318     
00319     if(gc == NullFC)
00320     {
00321         FWARNING(("PrimitiveIterator::setGeo: called for NodePtr which "
00322                   "is not a Geometry!\n"));
00323     }
00324     else
00325     {
00326         setGeo(gc);
00327     }
00328 }

void PrimitiveIterator::setToBegin void   ) 
 

Set the iterator to the beginning of the attached Geometry. Is primarily used by osg::Geometry::beginPrimitives, but can also be used to quickly recycle an iterator.

Reimplemented in osg::EdgeIterator, osg::FaceIterator, osg::LineIterator, and osg::TriangleIterator.

Definition at line 375 of file OSGPrimitiveIterator.cpp.

References _actPointIndex, _actPrimLength, _actPrimType, _colorIndex, _ended, _geo, _indices, _lengths, _nmappings, _normalIndex, _positionIndex, _primIndex, _secondaryColorIndex, _texcoordsIndex, _texcoordsIndex1, _texcoordsIndex2, _texcoordsIndex3, _types, osg::Geometry::MapColor, osg::Geometry::MapNormal, osg::Geometry::MapPosition, osg::Geometry::MapSecondaryColor, osg::Geometry::MapTexCoords, osg::Geometry::MapTexCoords1, osg::Geometry::MapTexCoords2, osg::Geometry::MapTexCoords3, osg::NullFC, and setToEnd().

Referenced by osg::Geometry::beginPrimitives(), setGeo(), osg::TriangleIterator::setToBegin(), osg::LineIterator::setToBegin(), osg::FaceIterator::setToBegin(), osg::EdgeIterator::setToBegin(), and osg::SplitGraphOp::splitNode().

00376 {
00377     _primIndex           = 0;
00378     _actPointIndex       = 0;
00379     _ended               = false;
00380     _nmappings           = _geo->getIndexMapping().size();
00381     _positionIndex       = _geo->calcMappingIndex(Geometry::MapPosition);
00382     _normalIndex         = _geo->calcMappingIndex(Geometry::MapNormal);
00383     _colorIndex          = _geo->calcMappingIndex(Geometry::MapColor);
00384     _secondaryColorIndex = _geo->calcMappingIndex(Geometry::MapSecondaryColor);
00385     _texcoordsIndex      = _geo->calcMappingIndex(Geometry::MapTexCoords);
00386     _texcoordsIndex1     = _geo->calcMappingIndex(Geometry::MapTexCoords1);
00387     _texcoordsIndex2     = _geo->calcMappingIndex(Geometry::MapTexCoords2);
00388     _texcoordsIndex3     = _geo->calcMappingIndex(Geometry::MapTexCoords3);
00389 
00390     if(_nmappings == 0)
00391         _nmappings = 1;
00392                   
00393     if(_types != NullFC && _types->getSize() > 0)
00394     {
00395         _actPrimType = _types->getValue(_primIndex);
00396         if(_lengths != NullFC)
00397         {
00398             _actPrimLength = _lengths->getValue(_primIndex);
00399         }
00400         else if(_indices != NullFC)
00401         {
00402             _actPrimLength = _indices->getSize() / _nmappings;
00403         }
00404         else
00405         {
00406             _actPrimLength = _geo->getPositions()->getSize() / _nmappings;
00407         }
00408     }
00409     else
00410     {
00411         setToEnd();
00412     }
00413 }

void PrimitiveIterator::setToEnd void   ) 
 

Set the iterator to the end of the attached Geometry. Is primarily used by osg::Geometry::endPrimitives, but can also be used to quickly recycle an iterator.

Reimplemented in osg::EdgeIterator, osg::FaceIterator, osg::LineIterator, and osg::TriangleIterator.

Definition at line 419 of file OSGPrimitiveIterator.cpp.

References _actPointIndex, _ended, _primIndex, _types, and osg::NullFC.

Referenced by osg::Geometry::endPrimitives(), setToBegin(), osg::TriangleIterator::setToEnd(), osg::LineIterator::setToEnd(), osg::FaceIterator::setToEnd(), and osg::EdgeIterator::setToEnd().

00420 {
00421     if(_types != NullFC)
00422         _primIndex = _types->getSize();
00423     else
00424         _primIndex = 0;
00425     _actPointIndex = 0;
00426     _ended = true;
00427 }

bool osg::PrimitiveIterator::isAtEnd void   )  const [inline]
 

Check if the iterator has already reached the end of the geometry.

Definition at line 55 of file OSGPrimitiveIterator.inl.

References _ended.

Referenced by osg::TriangleIterator::operator++(), operator++(), osg::LineIterator::operator++(), osg::FaceIterator::operator++(), osg::EdgeIterator::operator++(), osg::TriangleIterator::operator==(), osg::LineIterator::operator==(), osg::FaceIterator::operator==(), osg::EdgeIterator::operator==(), osg::SplitGraphOp::splitNode(), osg::TriangleIterator::startPrim(), osg::LineIterator::startPrim(), osg::FaceIterator::startPrim(), and osg::EdgeIterator::startPrim().

00056 {
00057     return _ended;
00058 }

Int32 osg::PrimitiveIterator::getIndex void   )  const [inline]
 

Return the index of the current primitive. The index runs from 0 to the number of faces in the geometry. Its main use is as an input to seek().

Reimplemented in osg::EdgeIterator, osg::FaceIterator, osg::LineIterator, and osg::TriangleIterator.

Definition at line 65 of file OSGPrimitiveIterator.inl.

References _primIndex.

Referenced by osg::createConvexPrimitives().

00066 {
00067     return _primIndex;
00068 }

UInt32 osg::PrimitiveIterator::getLength void   )  const [inline]
 

Return the length(i.e. number of used vertices) of the current primitive.

Reimplemented in osg::EdgeIterator, and osg::FaceIterator.

Definition at line 73 of file OSGPrimitiveIterator.inl.

References _actPrimLength.

Referenced by osg::Geometry::adjustVolume(), osg::calcVertexNormalsGeo(), osg::createConvexPrimitives(), osg::EdgeIterator::getLength(), osg::TriangleIterator::operator++(), osg::LineIterator::operator++(), osg::FaceIterator::operator++(), osg::EdgeIterator::operator++(), osg::SplitGraphOp::splitNode(), osg::TriangleIterator::startPrim(), osg::LineIterator::startPrim(), osg::FaceIterator::startPrim(), osg::EdgeIterator::startPrim(), osg::VerifyGraphOp::verifyGeometry(), and osg::VRMLWriteAction::writeLineIndex().

00074 {
00075     return _actPrimLength;
00076 }

UInt32 osg::PrimitiveIterator::getType void   )  const [inline]
 

Return the type of the current primitive.

Definition at line 81 of file OSGPrimitiveIterator.inl.

References _actPrimType.

Referenced by osg::calcFaceNormals(), osg::calcFaceNormalsGeo(), osg::createConvexPrimitives(), osg::EdgeIterator::getColorIndex(), osg::EdgeIterator::getIndexIndex(), osg::EdgeIterator::getLength(), osg::EdgeIterator::getNormalIndex(), osg::EdgeIterator::getPositionIndex(), osg::EdgeIterator::getSecondaryColorIndex(), osg::EdgeIterator::getTexCoordsIndex(), osg::EdgeIterator::getTexCoordsIndex1(), osg::EdgeIterator::getTexCoordsIndex2(), osg::EdgeIterator::getTexCoordsIndex3(), osg::TriangleIterator::operator++(), osg::LineIterator::operator++(), osg::FaceIterator::operator++(), osg::EdgeIterator::operator++(), osg::SplitGraphOp::splitNode(), osg::TriangleIterator::startPrim(), osg::LineIterator::startPrim(), osg::FaceIterator::startPrim(), osg::EdgeIterator::startPrim(), osg::VRMLWriteAction::writeGeoEnter(), and osg::VRMLWriteAction::writeLineIndex().

00082 {
00083     return _actPrimType;
00084 }

Int32 osg::PrimitiveIterator::getPositionIndex Int32  which  )  const [inline]
 

Return the position index (i.e. the number of the entry in the positions property which is used) of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

Reimplemented in osg::EdgeIterator, osg::FaceIterator, osg::LineIterator, and osg::TriangleIterator.

Definition at line 92 of file OSGPrimitiveIterator.inl.

References _actPointIndex, _geo, _indices, _nmappings, _positionIndex, and osg::NullFC.

Referenced by getPosition(), osg::TriangleIterator::getPositionIndex(), osg::LineIterator::getPositionIndex(), osg::FaceIterator::getPositionIndex(), osg::EdgeIterator::getPositionIndex(), osg::VerifyGraphOp::verifyGeometry(), and osg::VRMLWriteAction::writeLineIndex().

00093 {
00094     if(_geo->getIndices() != NullFC)
00095     {
00096         if(_positionIndex != -1)
00097         {
00098             return _indices->getValue((_actPointIndex + which) *
00099                                       _nmappings + _positionIndex);
00100         }
00101         else
00102         {
00103             return _indices->getValue(_actPointIndex * _nmappings + which );
00104         }
00105     }
00106     else
00107     {
00108         return _actPointIndex + which;
00109     }
00110 }

Pnt3f osg::PrimitiveIterator::getPosition Int32  which  )  const [inline]
 

Return the position of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

Reimplemented in osg::EdgeIterator, osg::FaceIterator, osg::LineIterator, and osg::TriangleIterator.

Definition at line 117 of file OSGPrimitiveIterator.inl.

References _geo, and getPositionIndex().

Referenced by osg::Geometry::adjustVolume(), osg::calcVertexNormalsGeo(), and osg::SplitGraphOp::splitNode().

00118 {
00119     Int32 ind = getPositionIndex(which);
00120 
00121     return _geo->getPositions()->getValue(ind);
00122 }

Int32 osg::PrimitiveIterator::getNormalIndex Int32  which  )  const [inline]
 

Return the normal index (i.e. the number of the entry in the normal property which is used) of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no normals, -1 is returned.

Reimplemented in osg::EdgeIterator, osg::FaceIterator, osg::LineIterator, and osg::TriangleIterator.

Definition at line 132 of file OSGPrimitiveIterator.inl.

References _actPointIndex, _geo, _indices, _nmappings, _normalIndex, and osg::NullFC.

Referenced by getNormal(), osg::TriangleIterator::getNormalIndex(), osg::LineIterator::getNormalIndex(), osg::FaceIterator::getNormalIndex(), osg::EdgeIterator::getNormalIndex(), and osg::VerifyGraphOp::verifyGeometry().

00133 {
00134     if(_geo->getNormals() == NullFC)
00135         return -1;
00136 
00137     if(_geo->getIndices() != NullFC)
00138     {
00139         if(_normalIndex != -1)
00140         {
00141             return _indices->getValue((_actPointIndex + which) *
00142                                       _nmappings + _normalIndex);
00143         }
00144         else
00145         {
00146             return _indices->getValue(_actPointIndex * _nmappings + which );
00147         }
00148     }
00149     else
00150     {
00151         return _actPointIndex + which;
00152     }
00153 }

Vec3f osg::PrimitiveIterator::getNormal Int32  which  )  const [inline]
 

Return the normal of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no normals, Vec3f::Null is returned.

Reimplemented in osg::EdgeIterator, osg::FaceIterator, osg::LineIterator, and osg::TriangleIterator.

Definition at line 162 of file OSGPrimitiveIterator.inl.

References _geo, getNormalIndex(), and osg::VectorInterface< Real32, VecStorage3 >::Null.

Referenced by osg::calcVertexNormalsGeo().

00163 {
00164     Int32 ind = getNormalIndex(which);
00165 
00166     if(ind < 0)
00167         return Vec3f::Null;
00168 
00169     return _geo->getNormals()->getValue(ind);
00170 }

Int32 osg::PrimitiveIterator::getColorIndex Int32  which  )  const [inline]
 

Return the color index (i.e. the number of the entry in the color property which is used) of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no colors, -1 is returned.

Reimplemented in osg::EdgeIterator, osg::FaceIterator, osg::LineIterator, and osg::TriangleIterator.

Definition at line 179 of file OSGPrimitiveIterator.inl.

References _actPointIndex, _colorIndex, _geo, _indices, _nmappings, and osg::NullFC.

Referenced by getColor(), osg::TriangleIterator::getColorIndex(), osg::LineIterator::getColorIndex(), osg::FaceIterator::getColorIndex(), osg::EdgeIterator::getColorIndex(), osg::VerifyGraphOp::verifyGeometry(), and osg::VRMLWriteAction::writeLineIndex().

00180 {
00181     if(_geo->getColors() == NullFC)
00182         return -1;
00183 
00184     if(_geo->getIndices() != NullFC)
00185     {
00186         if(_colorIndex != -1)
00187         {
00188             return _indices->getValue((_actPointIndex + which) *
00189                                       _nmappings + _colorIndex);
00190         }
00191         else
00192         {
00193             return _indices->getValue(_actPointIndex * _nmappings + which );
00194         }
00195     }
00196     else
00197     {
00198         return _actPointIndex + which;
00199     }
00200 }

Color3f osg::PrimitiveIterator::getColor Int32  which  )  const [inline]
 

Return the color of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no colors, Color3f::Null is returned.

Reimplemented in osg::EdgeIterator, osg::FaceIterator, osg::LineIterator, and osg::TriangleIterator.

Definition at line 208 of file OSGPrimitiveIterator.inl.

References _geo, getColorIndex(), and osg::Color3< Real32 >::Null.

00209 {
00210     Int32 ind = getColorIndex(which);
00211 
00212     if(ind < 0)
00213         return Color3f::Null;
00214 
00215     return _geo->getColors()->getValue(ind);
00216 }

Int32 osg::PrimitiveIterator::getSecondaryColorIndex Int32  which  )  const [inline]
 

Return the secondary color index (i.e. the number of the entry in the secondary color property which is used) of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no secondary colors, -1 is returned.

Reimplemented in osg::EdgeIterator, osg::FaceIterator, osg::LineIterator, and osg::TriangleIterator.

Definition at line 227 of file OSGPrimitiveIterator.inl.

References _actPointIndex, _geo, _indices, _nmappings, _secondaryColorIndex, and osg::NullFC.

Referenced by getSecondaryColor(), osg::TriangleIterator::getSecondaryColorIndex(), osg::LineIterator::getSecondaryColorIndex(), osg::FaceIterator::getSecondaryColorIndex(), osg::EdgeIterator::getSecondaryColorIndex(), and osg::VerifyGraphOp::verifyGeometry().

00228 {
00229     if(_geo->getSecondaryColors() == NullFC)
00230         return -1;
00231 
00232     if(_geo->getIndices() != NullFC)
00233     {
00234         if(_secondaryColorIndex != -1)
00235         {
00236             return _indices->getValue((_actPointIndex + which) *
00237                                       _nmappings + _secondaryColorIndex);
00238         }
00239         else
00240         {
00241             return _indices->getValue(_actPointIndex * _nmappings + which );
00242         }
00243     }
00244     else
00245     {
00246         return _actPointIndex + which;
00247     }
00248 }

Color3f osg::PrimitiveIterator::getSecondaryColor Int32  which  )  const [inline]
 

Return the secondary color of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no secondary colors, Color3f::Null is returned.

Reimplemented in osg::EdgeIterator, osg::FaceIterator, osg::LineIterator, and osg::TriangleIterator.

Definition at line 256 of file OSGPrimitiveIterator.inl.

References _geo, getSecondaryColorIndex(), and osg::Color3< Real32 >::Null.

00257 {
00258     Int32 ind = getSecondaryColorIndex(which);
00259 
00260     if(ind < 0)
00261         return Color3f::Null;
00262 
00263     return _geo->getSecondaryColors()->getValue(ind);
00264 }

Int32 osg::PrimitiveIterator::getTexCoordsIndex Int32  which  )  const [inline]
 

Return the texture coordinates index (i.e. the number of the entry in the texture coordinates property which is used) of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no texture coordinates, -1 is returned.

Reimplemented in osg::EdgeIterator, osg::FaceIterator, osg::LineIterator, and osg::TriangleIterator.

Definition at line 274 of file OSGPrimitiveIterator.inl.

References _actPointIndex, _geo, _indices, _nmappings, _texcoordsIndex, and osg::NullFC.

Referenced by getTexCoords(), osg::TriangleIterator::getTexCoordsIndex(), osg::LineIterator::getTexCoordsIndex(), osg::FaceIterator::getTexCoordsIndex(), osg::EdgeIterator::getTexCoordsIndex(), and osg::VerifyGraphOp::verifyGeometry().

00275 {
00276     if(_geo->getTexCoords() == NullFC)
00277         return -1;
00278 
00279     if(_geo->getIndices() != NullFC)
00280     {
00281         if(_texcoordsIndex != -1)
00282         {
00283             return _indices->getValue((_actPointIndex + which) *
00284                                       _nmappings + _texcoordsIndex);
00285         }
00286         else
00287         {
00288             return _indices->getValue(_actPointIndex * _nmappings + which );
00289         }
00290     }
00291     else
00292     {
00293         return _actPointIndex + which;
00294     }
00295 }

Vec2f osg::PrimitiveIterator::getTexCoords Int32  which  )  const [inline]
 

Return the texture coordinates of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no texture coordinates, Vec2f::Null is returned.

Reimplemented in osg::EdgeIterator, osg::FaceIterator, osg::LineIterator, and osg::TriangleIterator.

Definition at line 303 of file OSGPrimitiveIterator.inl.

References _geo, getTexCoordsIndex(), and osg::VectorInterface< Real32, VecStorage2 >::Null.

00304 {
00305     Int32 ind = getTexCoordsIndex(which);
00306 
00307     if(ind < 0)
00308         return Vec2f::Null;
00309 
00310     return _geo->getTexCoords()->getValue(ind);
00311 }

Int32 osg::PrimitiveIterator::getTexCoordsIndex1 Int32  which  )  const [inline]
 

Return the second texture coordinates index (i.e. the number of the entry in the textureCoordinates1 property which is used) of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no second texture coordinates, -1 is returned.

Reimplemented in osg::EdgeIterator, osg::FaceIterator, osg::LineIterator, and osg::TriangleIterator.

Definition at line 322 of file OSGPrimitiveIterator.inl.

References _actPointIndex, _geo, _indices, _nmappings, _texcoordsIndex1, and osg::NullFC.

Referenced by getTexCoords1(), osg::TriangleIterator::getTexCoordsIndex1(),