Geometry Iterator for triangles. See Geometry Iterators for a description. More...
#include <OSGTriangleIterator.h>
Public Member Functions | |
Constructors | |
| TriangleIterator (void) | |
| TriangleIterator (const TriangleIterator &source) | |
| TriangleIterator (const GeometryPtr &geo) | |
| TriangleIterator (const NodePtr &geo) | |
Destructors | |
| virtual | ~TriangleIterator (void) |
Get | |
| Int32 | getIndex (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 | getTexCoordsIndex4 (Int32 which) const |
| Vec2f | getTexCoords4 (Int32 which) const |
| Int32 | getTexCoordsIndex5 (Int32 which) const |
| Vec2f | getTexCoords5 (Int32 which) const |
| Int32 | getTexCoordsIndex6 (Int32 which) const |
| Vec2f | getTexCoords6 (Int32 which) const |
| Int32 | getTexCoordsIndex7 (Int32 which) const |
| Vec2f | getTexCoords7 (Int32 which) const |
| Int32 | getIndexIndex (Int32 which) const |
Operators | |
| void | operator++ (void) |
| void | seek (Int32 index) |
| TriangleIterator & | operator= (const TriangleIterator &source) |
| bool | operator< (const TriangleIterator &other) const |
| bool | operator== (const TriangleIterator &other) const |
| bool | operator!= (const TriangleIterator &other) const |
Set | |
| void | setGeo (const GeometryPtr &geo) |
| void | setGeo (const NodePtr &geo) |
Get | |
| bool | isAtEnd (void) const |
| UInt32 | getLength (void) const |
| UInt32 | getType (void) const |
| GeometryPtr | getGeometry (void) const |
Static Public Member Functions | |
Class Get | |
| static const char * | getClassname (void) |
Protected Types | |
| typedef PrimitiveIterator | Inherited |
Protected Member Functions | |
Set | |
| void | setToBegin (void) |
| void | setToEnd (void) |
Private Member Functions | |
| void | startPrim (void) |
Private Attributes | |
Fields | |
| Int32 | _triIndex |
| UInt32 | _actPrimIndex |
| Int32 | _triPntIndex [3] |
Static Private Attributes | |
| static char | cvsid [] = "@(#)$Id: OSGTriangleIterator.cpp,v 1.13 2001/10/15 04:52:16 vossg Exp $" |
Friends | |
| class | Geometry |
The TriangleIterator iterates through the geometry one triangle at a time. See Triangle Iterator for details.
Definition at line 58 of file OSGTriangleIterator.h.
typedef PrimitiveIterator osg::TriangleIterator::Inherited [protected] |
Definition at line 142 of file OSGTriangleIterator.h.
| TriangleIterator::TriangleIterator | ( | void | ) |
Definition at line 103 of file OSGTriangleIterator.cpp.
00103 : PrimitiveIterator(), 00104 _triIndex(0), _actPrimIndex(0), _triPntIndex() 00105 { 00106 }
| TriangleIterator::TriangleIterator | ( | const TriangleIterator & | source | ) |
Definition at line 108 of file OSGTriangleIterator.cpp.
References _triPntIndex.
00108 : 00109 PrimitiveIterator(source), 00110 _triIndex(source._triIndex), _actPrimIndex(source._actPrimIndex), 00111 _triPntIndex() 00112 { 00113 _triPntIndex[0] = source._triPntIndex[0]; 00114 _triPntIndex[1] = source._triPntIndex[1]; 00115 _triPntIndex[2] = source._triPntIndex[2]; 00116 }
| TriangleIterator::TriangleIterator | ( | const GeometryPtr & | geo | ) |
This constructor creates an iterator for the given geometry. It is useful to create an iterator to be used to seek() to a specific indexed face. Otherwise, use osg::Geometry::beginTriangles() resp. osg::Geometry::endTriangles() to create an iterator.
Definition at line 124 of file OSGTriangleIterator.cpp.
References osg::PrimitiveIterator::setGeo().
00124 : 00125 PrimitiveIterator(), 00126 _triIndex(0), _actPrimIndex(0), _triPntIndex() 00127 { 00128 setGeo(geo); 00129 }
| TriangleIterator::TriangleIterator | ( | const NodePtr & | 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 osg::Geometry::beginTriangles() resp. osg::Geometry::endTriangles() to create an iterator.
Definition at line 138 of file OSGTriangleIterator.cpp.
References osg::PrimitiveIterator::setGeo().
00138 : 00139 PrimitiveIterator(), 00140 _triIndex(0), _actPrimIndex(0), _triPntIndex() 00141 { 00142 setGeo(geo); 00143 }
| TriangleIterator::~TriangleIterator | ( | void | ) | [virtual] |
Definition at line 146 of file OSGTriangleIterator.cpp.
| static const char* osg::TriangleIterator::getClassname | ( | void | ) | [inline, static] |
Reimplemented from osg::PrimitiveIterator.
Definition at line 67 of file OSGTriangleIterator.h.
| Int32 osg::TriangleIterator::getIndex | ( | void | ) | const [inline] |
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 54 of file OSGTriangleIterator.inl.
References _triIndex.
Referenced by osg::calcVertexNormals(), osg::Geometry::intersect(), osg::Geometry::intersectActor(), and seek().
00055 { 00056 return _triIndex; 00057 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 60 of file OSGTriangleIterator.inl.
References _triPntIndex, and osg::PrimitiveIterator::getPositionIndex().
Referenced by osg::calcVertexNormals(), osg::calcVertexTangents(), getPosition(), operator++(), osg::OBJSceneFileType::write(), and osg::VRMLWriteAction::writeIndex().
00061 { 00062 return Inherited::getPositionIndex(_triPntIndex[which]); 00063 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 66 of file OSGTriangleIterator.inl.
References osg::PrimitiveIterator::getGeometry(), and getPositionIndex().
Referenced by osg::calcVertexNormals(), osg::calcVertexTangents(), osg::Geometry::intersect(), osg::Geometry::intersectActor(), and osg::TileGeometryLoad::updateGeometry().
00067 { 00068 Int32 ind = getPositionIndex(which); 00069 00070 return getGeometry()->getPositions()->getValue(ind); 00071 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 74 of file OSGTriangleIterator.inl.
References _triPntIndex, and osg::PrimitiveIterator::getNormalIndex().
Referenced by osg::calcVertexNormals(), getNormal(), osg::OBJSceneFileType::write(), and osg::VRMLWriteAction::writeIndex().
00075 { 00076 return Inherited::getNormalIndex(_triPntIndex[which]); 00077 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 80 of file OSGTriangleIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getNormalIndex(), and osg::Vector< Real32, 3 >::Null.
Referenced by osg::calcVertexTangents().
00081 { 00082 Int32 ind = getNormalIndex(which); 00083 00084 if(ind < 0) 00085 return Vec3f::Null; 00086 00087 return getGeometry()->getNormals()->getValue(ind); 00088 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 91 of file OSGTriangleIterator.inl.
References _triPntIndex, and osg::PrimitiveIterator::getColorIndex().
Referenced by getColor(), and osg::VRMLWriteAction::writeIndex().
00092 { 00093 return Inherited::getColorIndex(_triPntIndex[which]); 00094 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 97 of file OSGTriangleIterator.inl.
References getColorIndex(), osg::PrimitiveIterator::getGeometry(), and osg::Color3< Real32 >::Null.
00098 { 00099 Int32 ind = getColorIndex(which); 00100 00101 if(ind < 0) 00102 return Color3f::Null; 00103 00104 return getGeometry()->getColors()->getValue(ind); 00105 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 108 of file OSGTriangleIterator.inl.
References _triPntIndex, and osg::PrimitiveIterator::getSecondaryColorIndex().
Referenced by getSecondaryColor().
00109 { 00110 return Inherited::getSecondaryColorIndex(_triPntIndex[which]); 00111 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 114 of file OSGTriangleIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getSecondaryColorIndex(), and osg::Color3< Real32 >::Null.
00115 { 00116 Int32 ind = getSecondaryColorIndex(which); 00117 00118 if(ind < 0) 00119 return Color3f::Null; 00120 00121 return getGeometry()->getSecondaryColors()->getValue(ind); 00122 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 126 of file OSGTriangleIterator.inl.
References _triPntIndex, and osg::PrimitiveIterator::getTexCoordsIndex().
Referenced by getTexCoords(), osg::OBJSceneFileType::write(), and osg::VRMLWriteAction::writeIndex().
00127 { 00128 return Inherited::getTexCoordsIndex(_triPntIndex[which]); 00129 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 132 of file OSGTriangleIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getTexCoordsIndex(), and osg::Vector< Real32, 2 >::Null.
Referenced by osg::calcVertexTangents().
00133 { 00134 Int32 ind = getTexCoordsIndex(which); 00135 00136 if(ind < 0) 00137 return Vec2f::Null; 00138 00139 return getGeometry()->getTexCoords()->getValue(ind); 00140 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 144 of file OSGTriangleIterator.inl.
References _triPntIndex, and osg::PrimitiveIterator::getTexCoordsIndex1().
Referenced by getTexCoords1().
00145 { 00146 return Inherited::getTexCoordsIndex1(_triPntIndex[which]); 00147 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 150 of file OSGTriangleIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getTexCoordsIndex1(), and osg::Vector< Real32, 2 >::Null.
Referenced by osg::calcVertexTangents().
00151 { 00152 Int32 ind = getTexCoordsIndex1(which); 00153 00154 if(ind < 0) 00155 return Vec2f::Null; 00156 00157 return getGeometry()->getTexCoords1()->getValue(ind); 00158 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 162 of file OSGTriangleIterator.inl.
References _triPntIndex, and osg::PrimitiveIterator::getTexCoordsIndex2().
Referenced by getTexCoords2().
00163 { 00164 return Inherited::getTexCoordsIndex2(_triPntIndex[which]); 00165 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 168 of file OSGTriangleIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getTexCoordsIndex2(), and osg::Vector< Real32, 2 >::Null.
Referenced by osg::calcVertexTangents().
00169 { 00170 Int32 ind = getTexCoordsIndex2(which); 00171 00172 if(ind < 0) 00173 return Vec2f::Null; 00174 00175 return getGeometry()->getTexCoords2()->getValue(ind); 00176 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 180 of file OSGTriangleIterator.inl.
References _triPntIndex, and osg::PrimitiveIterator::getTexCoordsIndex3().
Referenced by getTexCoords3().
00181 { 00182 return Inherited::getTexCoordsIndex3(_triPntIndex[which]); 00183 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 186 of file OSGTriangleIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getTexCoordsIndex3(), and osg::Vector< Real32, 2 >::Null.
Referenced by osg::calcVertexTangents().
00187 { 00188 Int32 ind = getTexCoordsIndex3(which); 00189 00190 if(ind < 0) 00191 return Vec2f::Null; 00192 00193 return getGeometry()->getTexCoords3()->getValue(ind); 00194 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 197 of file OSGTriangleIterator.inl.
References _triPntIndex, and osg::PrimitiveIterator::getTexCoordsIndex4().
Referenced by getTexCoords4().
00198 { 00199 return Inherited::getTexCoordsIndex4(_triPntIndex[which]); 00200 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 203 of file OSGTriangleIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getTexCoordsIndex4(), and osg::Vector< Real32, 2 >::Null.
Referenced by osg::calcVertexTangents().
00204 { 00205 Int32 ind = getTexCoordsIndex4(which); 00206 00207 if(ind < 0) 00208 return Vec2f::Null; 00209 00210 return getGeometry()->getTexCoords4()->getValue(ind); 00211 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 214 of file OSGTriangleIterator.inl.
References _triPntIndex, and osg::PrimitiveIterator::getTexCoordsIndex5().
Referenced by getTexCoords5().
00215 { 00216 return Inherited::getTexCoordsIndex5(_triPntIndex[which]); 00217 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 220 of file OSGTriangleIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getTexCoordsIndex5(), and osg::Vector< Real32, 2 >::Null.
Referenced by osg::calcVertexTangents().
00221 { 00222 Int32 ind = getTexCoordsIndex5(which); 00223 00224 if(ind < 0) 00225 return Vec2f::Null; 00226 00227 return getGeometry()->getTexCoords5()->getValue(ind); 00228 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 231 of file OSGTriangleIterator.inl.
References _triPntIndex, and osg::PrimitiveIterator::getTexCoordsIndex6().
Referenced by getTexCoords6().
00232 { 00233 return Inherited::getTexCoordsIndex6(_triPntIndex[which]); 00234 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 237 of file OSGTriangleIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getTexCoordsIndex6(), and osg::Vector< Real32, 2 >::Null.
Referenced by osg::calcVertexTangents().
00238 { 00239 Int32 ind = getTexCoordsIndex6(which); 00240 00241 if(ind < 0) 00242 return Vec2f::Null; 00243 00244 return getGeometry()->getTexCoords6()->getValue(ind); 00245 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 248 of file OSGTriangleIterator.inl.
References _triPntIndex, and osg::PrimitiveIterator::getTexCoordsIndex7().
Referenced by getTexCoords7().
00249 { 00250 return Inherited::getTexCoordsIndex7(_triPntIndex[which]); 00251 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 254 of file OSGTriangleIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getTexCoordsIndex7(), and osg::Vector< Real32, 2 >::Null.
Referenced by osg::calcVertexTangents().
00255 { 00256 Int32 ind = getTexCoordsIndex7(which); 00257 00258 if(ind < 0) 00259 return Vec2f::Null; 00260 00261 return getGeometry()->getTexCoords7()->getValue(ind); 00262 }
Return the index of the current face. The index runs from 0 to the number of triangles in the geometry. Its main use is as an input to osg::TriangleIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 265 of file OSGTriangleIterator.inl.
References _triPntIndex, and osg::PrimitiveIterator::getIndexIndex().
Referenced by osg::calcVertexNormals(), and osg::calcVertexTangents().
00266 { 00267 if(_triPntIndex[which] >= 0) 00268 return Inherited::getIndexIndex(_triPntIndex[which]); 00269 else 00270 return -1; 00271 }
| void TriangleIterator::operator++ | ( | void | ) |
The increment operator steps the iterator to the next triangle. If it is already beyond the last triangle it does not change.
Reimplemented from osg::PrimitiveIterator.
Definition at line 155 of file OSGTriangleIterator.cpp.
References _actPrimIndex, _triIndex, _triPntIndex, osg::PrimitiveIterator::getLength(), getPositionIndex(), osg::PrimitiveIterator::getType(), osg::PrimitiveIterator::isAtEnd(), startPrim(), and SWARNING.
00156 { 00157 // already at end? 00158 if(isAtEnd()) 00159 return; 00160 00161 ++_triIndex; 00162 00163 // at end of primitive? 00164 if(_actPrimIndex >= getLength()) 00165 { 00166 ++(static_cast<PrimitiveIterator&>(*this)); 00167 startPrim(); 00168 00169 return; 00170 } 00171 00172 switch(getType()) 00173 { 00174 case GL_TRIANGLES: _triPntIndex[0] = _actPrimIndex++; 00175 _triPntIndex[1] = _actPrimIndex++; 00176 _triPntIndex[2] = _actPrimIndex++; 00177 break; 00178 case GL_QUAD_STRIP: 00179 case GL_TRIANGLE_STRIP: if(_actPrimIndex & 1) 00180 { 00181 _triPntIndex[0] = _triPntIndex[2]; 00182 } 00183 else 00184 { 00185 _triPntIndex[1] = _triPntIndex[2]; 00186 } 00187 _triPntIndex[2] = _actPrimIndex++; 00188 00189 if(getPositionIndex(0) == getPositionIndex(1) || 00190 getPositionIndex(0) == getPositionIndex(2) || 00191 getPositionIndex(1) == getPositionIndex(2)) 00192 { 00193 --_triIndex; 00194 ++(*this); 00195 } 00196 00197 break; 00198 case GL_POLYGON: 00199 case GL_TRIANGLE_FAN: _triPntIndex[1] = _triPntIndex[2]; 00200 _triPntIndex[2] = _actPrimIndex++; 00201 break; 00202 case GL_QUADS: if(_actPrimIndex & 1) 00203 { 00204 _triPntIndex[1] = _triPntIndex[2]; 00205 _triPntIndex[2] = _actPrimIndex++; 00206 } 00207 else 00208 { 00209 _triPntIndex[0] = _actPrimIndex++; 00210 _triPntIndex[1] = _actPrimIndex++; 00211 _triPntIndex[2] = _actPrimIndex++; 00212 } 00213 break; 00214 default: SWARNING << "TriangleIterator::++: encountered " 00215 << "unknown primitive type " 00216 << getType() 00217 << ", ignoring!" << std::endl; 00218 startPrim(); 00219 break; 00220 } 00221 }
| void TriangleIterator::seek | ( | Int32 | index | ) |
Seek the iterator to a specific triangle indicated by its index.
This is primarily used in conjunction with osg::TriangleIterator::getIndex to record a position in the iteration and later return to it.
Reimplemented from osg::PrimitiveIterator.
Definition at line 276 of file OSGTriangleIterator.cpp.
References getIndex(), and setToBegin().
00277 { 00278 setToBegin(); 00279 00280 while(getIndex() != index) 00281 ++(*this); 00282 }
| TriangleIterator & TriangleIterator::operator= | ( | const TriangleIterator & | source | ) |
The increment operator steps the iterator to the next triangle. If it is already beyond the last triangle it does not change.
Reimplemented from osg::PrimitiveIterator.
Definition at line 308 of file OSGTriangleIterator.cpp.
References _actPrimIndex, _triIndex, and _triPntIndex.
00309 { 00310 if(this == &source) 00311 return *this; 00312 00313 *static_cast<Inherited *>(this) = source; 00314 00315 this->_triIndex = source._triIndex; 00316 this->_actPrimIndex = source._actPrimIndex; 00317 this->_triPntIndex[0] = source._triPntIndex[0]; 00318 this->_triPntIndex[1] = source._triPntIndex[1]; 00319 this->_triPntIndex[2] = source._triPntIndex[2]; 00320 00321 return *this; 00322 }
| bool TriangleIterator::operator< | ( | const TriangleIterator & | other | ) | const |
The increment operator steps the iterator to the next triangle. If it is already beyond the last triangle it does not change.
Reimplemented from osg::PrimitiveIterator.
Definition at line 326 of file OSGTriangleIterator.cpp.
References _actPrimIndex.
00327 { 00328 return 00329 (*static_cast<const Inherited *>(this) < other) || 00330 ( (*static_cast<const Inherited *>(this) == other) && 00331 _actPrimIndex < other._actPrimIndex); 00332 }
| bool TriangleIterator::operator== | ( | const TriangleIterator & | other | ) | const |
The increment operator steps the iterator to the next triangle. If it is already beyond the last triangle it does not change.
Reimplemented from osg::PrimitiveIterator.
Definition at line 334 of file OSGTriangleIterator.cpp.
References _actPrimIndex, and osg::PrimitiveIterator::isAtEnd().
00335 { 00336 if(isAtEnd() && other.isAtEnd()) 00337 return true; 00338 00339 if(isAtEnd() || other.isAtEnd()) 00340 return false; 00341 00342 return 00343 (*static_cast<const Inherited *>(this) == other ) && 00344 _actPrimIndex == other._actPrimIndex; 00345 }
| bool TriangleIterator::operator!= | ( | const TriangleIterator & | other | ) | const |
The increment operator steps the iterator to the next triangle. If it is already beyond the last triangle it does not change.
Reimplemented from osg::PrimitiveIterator.
Definition at line 347 of file OSGTriangleIterator.cpp.
| void TriangleIterator::setToBegin | ( | void | ) | [protected] |
Set the iterator to the beginning of the attached Geometry. Is primarily used by osg::Geometry::beginTriangles, but can also be used to quickly recycle an iterator.
Reimplemented from osg::PrimitiveIterator.
Definition at line 289 of file OSGTriangleIterator.cpp.
References _triIndex, and startPrim().
Referenced by osg::Geometry::beginTriangles(), and seek().
00290 { 00291 PrimitiveIterator::setToBegin(); 00292 _triIndex = 0; 00293 startPrim(); 00294 }
| void TriangleIterator::setToEnd | ( | void | ) | [protected] |
Set the iterator to the end of the attached Geometry. Is primarily used by osg::Geometry::endTriangles, but can also be used to quickly recycle an iterator.
Reimplemented from osg::PrimitiveIterator.
Definition at line 300 of file OSGTriangleIterator.cpp.
References _actPrimIndex.
Referenced by osg::Geometry::endTriangles().
00301 { 00302 PrimitiveIterator::setToEnd(); 00303 _actPrimIndex = 0; 00304 }
| void TriangleIterator::startPrim | ( | void | ) | [private] |
Helper function to reset all state to the beginning of a new primitive. Also skips non-polygonal primitives(lines, points) and primitives with less than 3 points.
Definition at line 228 of file OSGTriangleIterator.cpp.
References _actPrimIndex, _triPntIndex, osg::PrimitiveIterator::getLength(), osg::PrimitiveIterator::getType(), osg::PrimitiveIterator::isAtEnd(), and SWARNING.
Referenced by operator++(), and setToBegin().
00229 { 00230 // already at end? 00231 if(isAtEnd()) 00232 return; 00233 00234 _triPntIndex[0] = 0; 00235 _triPntIndex[1] = 1; 00236 _triPntIndex[2] = 2; 00237 _actPrimIndex = 3; 00238 00239 // loop until you find a useful primitive or run out 00240 while(! isAtEnd()) 00241 { 00242 switch(getType()) 00243 { 00244 case GL_POINTS: // non-polygon types: ignored 00245 case GL_LINES: 00246 case GL_LINE_STRIP: 00247 case GL_LINE_LOOP: 00248 break; 00249 case GL_TRIANGLES: // polygon types 00250 case GL_TRIANGLE_STRIP: 00251 case GL_TRIANGLE_FAN: 00252 case GL_QUADS: 00253 case GL_QUAD_STRIP: 00254 case GL_POLYGON: if(getLength() >= 3) 00255 return; 00256 break; 00257 default: SWARNING << "TriangleIterator::startPrim: " 00258 << "encountered " 00259 << "unknown primitive type " 00260 << getType() 00261 << ", ignoring!" << std::endl; 00262 break; 00263 } 00264 00265 ++(static_cast<PrimitiveIterator&>(*this)); 00266 } 00267 }
| void PrimitiveIterator::setGeo | ( | const GeometryPtr & | geo | ) | [inherited] |
Switch the iterator to a new geometry. Automatically sets it to the beginning.
Definition at line 339 of file OSGPrimitiveIterator.cpp.
References osg::PrimitiveIterator::_geo, osg::PrimitiveIterator::_indices, osg::PrimitiveIterator::_lengths, osg::PrimitiveIterator::_types, osg::NullFC, OSG_ASSERT, and osg::PrimitiveIterator::setToBegin().
Referenced by osg::EdgeIterator::EdgeIterator(), osg::FaceIterator::FaceIterator(), osg::LineIterator::LineIterator(), osg::PrimitiveIterator::PrimitiveIterator(), osg::PrimitiveIterator::setGeo(), and TriangleIterator().
00340 { 00341 OSG_ASSERT(geo != NullFC); 00342 00343 _geo = geo; 00344 _types = geo->getTypes(); 00345 _lengths = geo->getLengths(); 00346 _indices = geo->getIndices(); 00347 00348 setToBegin(); 00349 }
| void PrimitiveIterator::setGeo | ( | const NodePtr & | geo | ) | [inherited] |
Switch the iterator to a new geometry. Automatically sets it to the beginning.
Definition at line 355 of file OSGPrimitiveIterator.cpp.
References osg::AttachmentContainerPtr::dcast(), FWARNING, osg::NodePtr::getCore(), osg::NullFC, and osg::PrimitiveIterator::setGeo().
00356 { 00357 GeometryPtr gc = GeometryPtr::dcast(geo->getCore()); 00358 00359 if(gc == NullFC) 00360 { 00361 FWARNING(("PrimitiveIterator::setGeo: called for NodePtr which " 00362 "is not a Geometry!\n")); 00363 } 00364 else 00365 { 00366 setGeo(gc); 00367 } 00368 }
| bool osg::PrimitiveIterator::isAtEnd | ( | void | ) | const [inline, inherited] |
Check if the iterator has already reached the end of the geometry.
Definition at line 55 of file OSGPrimitiveIterator.inl.
References osg::PrimitiveIterator::_ended.
Referenced by operator++(), osg::PrimitiveIterator::operator++(), osg::LineIterator::operator++(), osg::FaceIterator::operator++(), osg::EdgeIterator::operator++(), operator==(), osg::LineIterator::operator==(), osg::FaceIterator::operator==(), osg::EdgeIterator::operator==(), osg::SplitGraphOp::splitNode(), startPrim(), osg::LineIterator::startPrim(), osg::FaceIterator::startPrim(), and osg::EdgeIterator::startPrim().
00056 { 00057 return _ended; 00058 }
| UInt32 osg::PrimitiveIterator::getLength | ( | void | ) | const [inline, inherited] |
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 osg::PrimitiveIterator::_actPrimLength.
Referenced by osg::Geometry::adjustVolume(), osg::calcVertexNormalsGeo(), osg::createConvexPrimitives(), osg::EdgeIterator::getLength(), operator++(), osg::LineIterator::operator++(), osg::FaceIterator::operator++(), osg::EdgeIterator::operator++(), osg::SplitGraphOp::splitNode(), 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, inherited] |
Return the type of the current primitive.
Definition at line 81 of file OSGPrimitiveIterator.inl.
References osg::PrimitiveIterator::_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::EdgeIterator::getTexCoordsIndex4(), osg::EdgeIterator::getTexCoordsIndex5(), osg::EdgeIterator::getTexCoordsIndex6(), osg::EdgeIterator::getTexCoordsIndex7(), operator++(), osg::LineIterator::operator++(), osg::FaceIterator::operator++(), osg::EdgeIterator::operator++(), osg::SplitGraphOp::splitNode(), startPrim(), osg::LineIterator::startPrim(), osg::FaceIterator::startPrim(), osg::EdgeIterator::startPrim(), osg::VRMLWriteAction::writeGeoEnter(), and osg::VRMLWriteAction::writeLineIndex().
00082 { 00083 return _actPrimType; 00084 }
| GeometryPtr osg::PrimitiveIterator::getGeometry | ( | void | ) | const [inline, inherited] |
Return the geometry the iterator is currently attached to.
Definition at line 676 of file OSGPrimitiveIterator.inl.
References osg::PrimitiveIterator::_geo.
Referenced by getColor(), osg::LineIterator::getColor(), osg::FaceIterator::getColor(), osg::EdgeIterator::getColor(), getNormal(), osg::LineIterator::getNormal(), osg::FaceIterator::getNormal(), osg::EdgeIterator::getNormal(), getPosition(), osg::LineIterator::getPosition(), osg::FaceIterator::getPosition(), osg::EdgeIterator::getPosition(), getSecondaryColor(), osg::LineIterator::getSecondaryColor(), osg::FaceIterator::getSecondaryColor(), osg::EdgeIterator::getSecondaryColor(), getTexCoords(), osg::LineIterator::getTexCoords(), osg::FaceIterator::getTexCoords(), osg::EdgeIterator::getTexCoords(), getTexCoords1(), osg::LineIterator::getTexCoords1(), osg::FaceIterator::getTexCoords1(), osg::EdgeIterator::getTexCoords1(), getTexCoords2(), osg::LineIterator::getTexCoords2(), osg::FaceIterator::getTexCoords2(), osg::EdgeIterator::getTexCoords2(), getTexCoords3(), osg::LineIterator::getTexCoords3(), osg::FaceIterator::getTexCoords3(), osg::EdgeIterator::getTexCoords3(), getTexCoords4(), osg::LineIterator::getTexCoords4(), osg::FaceIterator::getTexCoords4(), osg::EdgeIterator::getTexCoords4(), getTexCoords5(), osg::LineIterator::getTexCoords5(), osg::FaceIterator::getTexCoords5(), osg::EdgeIterator::getTexCoords5(), getTexCoords6(), osg::LineIterator::getTexCoords6(), osg::FaceIterator::getTexCoords6(), osg::EdgeIterator::getTexCoords6(), getTexCoords7(), osg::LineIterator::getTexCoords7(), osg::FaceIterator::getTexCoords7(), and osg::EdgeIterator::getTexCoords7().
00677 { 00678 return _geo; 00679 }
friend class Geometry [friend] |
Reimplemented from osg::PrimitiveIterator.
Definition at line 155 of file OSGTriangleIterator.h.
char TriangleIterator::cvsid = "@(#)$Id: OSGTriangleIterator.cpp,v 1.13 2001/10/15 04:52:16 vossg Exp $" [static, private] |
Reimplemented from osg::PrimitiveIterator.
Definition at line 157 of file OSGTriangleIterator.h.
osg::TriangleIterator::_triIndex [private] |
Running index of the triangles iterated.
Definition at line 163 of file OSGTriangleIterator.h.
Referenced by getIndex(), operator++(), operator=(), and setToBegin().
osg::TriangleIterator::_actPrimIndex [private] |
Index of the next point to use in the current primitive.
Definition at line 164 of file OSGTriangleIterator.h.
Referenced by operator++(), operator<(), operator=(), operator==(), setToEnd(), and startPrim().
osg::TriangleIterator::_triPntIndex [private] |
The vertex indices of the current triangle.
Definition at line 165 of file OSGTriangleIterator.h.
Referenced by getColorIndex(), getIndexIndex(), getNormalIndex(), getPositionIndex(), getSecondaryColorIndex(), getTexCoordsIndex(), getTexCoordsIndex1(), getTexCoordsIndex2(), getTexCoordsIndex3(), getTexCoordsIndex4(), getTexCoordsIndex5(), getTexCoordsIndex6(), getTexCoordsIndex7(), operator++(), operator=(), startPrim(), and TriangleIterator().
1.6.1