#include <OSGLineIterator.h>

Public Member Functions | |
Constructors | |
| LineIterator (void) | |
| LineIterator (const LineIterator &source) | |
| LineIterator (const GeometryPtr &geo) | |
| LineIterator (const NodePtr &geo) | |
Destructors | |
| virtual | ~LineIterator (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) |
| LineIterator & | operator= (const LineIterator &source) |
| bool | operator< (const LineIterator &other) const |
| bool | operator== (const LineIterator &other) const |
| bool | operator!= (const LineIterator &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 |
Operators | |
| 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) |
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 | _lineIndex |
| UInt32 | _actPrimIndex |
| Int32 | _linePntIndex [2] |
Static Private Attributes | |
| static char | cvsid [] = "@(#)$Id: OSGLineIterator.cpp,v 1.1 2005/01/14 11:24:22 a-m-z Exp $" |
Friends | |
| class | Geometry |
Definition at line 58 of file OSGLineIterator.h.
typedef PrimitiveIterator osg::LineIterator::Inherited [protected] |
Definition at line 142 of file OSGLineIterator.h.
| LineIterator::LineIterator | ( | void | ) |
Definition at line 103 of file OSGLineIterator.cpp.
00103 : PrimitiveIterator(), 00104 _lineIndex(0), _actPrimIndex(0), _linePntIndex() 00105 { 00106 }
| LineIterator::LineIterator | ( | const LineIterator & | source | ) |
Definition at line 108 of file OSGLineIterator.cpp.
References _linePntIndex.
00108 : 00109 PrimitiveIterator(source), 00110 _lineIndex(source._lineIndex), _actPrimIndex(source._actPrimIndex), 00111 _linePntIndex() 00112 { 00113 _linePntIndex[0] = source._linePntIndex[0]; 00114 _linePntIndex[1] = source._linePntIndex[1]; 00115 }
| LineIterator::LineIterator | ( | 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 123 of file OSGLineIterator.cpp.
References osg::PrimitiveIterator::setGeo().
00123 : 00124 PrimitiveIterator(), 00125 _lineIndex(0), _actPrimIndex(0), _linePntIndex() 00126 { 00127 setGeo(geo); 00128 }
| LineIterator::LineIterator | ( | 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 137 of file OSGLineIterator.cpp.
References osg::PrimitiveIterator::setGeo().
00137 : 00138 PrimitiveIterator(), 00139 _lineIndex(0), _actPrimIndex(0), _linePntIndex() 00140 { 00141 setGeo(geo); 00142 }
| LineIterator::~LineIterator | ( | void | ) | [virtual] |
| static const char* osg::LineIterator::getClassname | ( | void | ) | [inline, static] |
| Int32 osg::LineIterator::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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 54 of file OSGLineIterator.inl.
References _lineIndex.
Referenced by seek().
00055 { 00056 return _lineIndex; 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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 60 of file OSGLineIterator.inl.
References _linePntIndex, and osg::PrimitiveIterator::getPositionIndex().
Referenced by getPosition().
00061 { 00062 return Inherited::getPositionIndex(_linePntIndex[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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 66 of file OSGLineIterator.inl.
References osg::PrimitiveIterator::getGeometry(), and getPositionIndex().
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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 74 of file OSGLineIterator.inl.
References _linePntIndex, and osg::PrimitiveIterator::getNormalIndex().
Referenced by getNormal().
00075 { 00076 return Inherited::getNormalIndex(_linePntIndex[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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 80 of file OSGLineIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getNormalIndex(), and osg::VectorInterface< ValueTypeT, StorageInterfaceT >::Null.
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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 91 of file OSGLineIterator.inl.
References _linePntIndex, and osg::PrimitiveIterator::getColorIndex().
Referenced by getColor().
00092 { 00093 return Inherited::getColorIndex(_linePntIndex[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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 97 of file OSGLineIterator.inl.
References getColorIndex(), osg::PrimitiveIterator::getGeometry(), and osg::Color3< ValueTypeT >::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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 108 of file OSGLineIterator.inl.
References _linePntIndex, and osg::PrimitiveIterator::getSecondaryColorIndex().
Referenced by getSecondaryColor().
00109 { 00110 return Inherited::getSecondaryColorIndex(_linePntIndex[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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 114 of file OSGLineIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getSecondaryColorIndex(), and osg::Color3< ValueTypeT >::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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 126 of file OSGLineIterator.inl.
References _linePntIndex, and osg::PrimitiveIterator::getTexCoordsIndex().
Referenced by getTexCoords().
00127 { 00128 return Inherited::getTexCoordsIndex(_linePntIndex[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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 132 of file OSGLineIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getTexCoordsIndex(), and osg::VectorInterface< ValueTypeT, StorageInterfaceT >::Null.
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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 144 of file OSGLineIterator.inl.
References _linePntIndex, and osg::PrimitiveIterator::getTexCoordsIndex1().
Referenced by getTexCoords1().
00145 { 00146 return Inherited::getTexCoordsIndex1(_linePntIndex[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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 150 of file OSGLineIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getTexCoordsIndex1(), and osg::VectorInterface< ValueTypeT, StorageInterfaceT >::Null.
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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 162 of file OSGLineIterator.inl.
References _linePntIndex, and osg::PrimitiveIterator::getTexCoordsIndex2().
Referenced by getTexCoords2().
00163 { 00164 return Inherited::getTexCoordsIndex2(_linePntIndex[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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 168 of file OSGLineIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getTexCoordsIndex2(), and osg::VectorInterface< ValueTypeT, StorageInterfaceT >::Null.
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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 180 of file OSGLineIterator.inl.
References _linePntIndex, and osg::PrimitiveIterator::getTexCoordsIndex3().
Referenced by getTexCoords3().
00181 { 00182 return Inherited::getTexCoordsIndex3(_linePntIndex[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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 186 of file OSGLineIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getTexCoordsIndex3(), and osg::VectorInterface< ValueTypeT, StorageInterfaceT >::Null.
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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 197 of file OSGLineIterator.inl.
References _linePntIndex, and osg::PrimitiveIterator::getTexCoordsIndex4().
Referenced by getTexCoords4().
00198 { 00199 return Inherited::getTexCoordsIndex4(_linePntIndex[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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 203 of file OSGLineIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getTexCoordsIndex4(), and osg::VectorInterface< ValueTypeT, StorageInterfaceT >::Null.
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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 214 of file OSGLineIterator.inl.
References _linePntIndex, and osg::PrimitiveIterator::getTexCoordsIndex5().
Referenced by getTexCoords5().
00215 { 00216 return Inherited::getTexCoordsIndex5(_linePntIndex[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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 220 of file OSGLineIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getTexCoordsIndex5(), and osg::VectorInterface< ValueTypeT, StorageInterfaceT >::Null.
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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 231 of file OSGLineIterator.inl.
References _linePntIndex, and osg::PrimitiveIterator::getTexCoordsIndex6().
Referenced by getTexCoords6().
00232 { 00233 return Inherited::getTexCoordsIndex6(_linePntIndex[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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 237 of file OSGLineIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getTexCoordsIndex6(), and osg::VectorInterface< ValueTypeT, StorageInterfaceT >::Null.
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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 248 of file OSGLineIterator.inl.
References _linePntIndex, and osg::PrimitiveIterator::getTexCoordsIndex7().
Referenced by getTexCoords7().
00249 { 00250 return Inherited::getTexCoordsIndex7(_linePntIndex[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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 254 of file OSGLineIterator.inl.
References osg::PrimitiveIterator::getGeometry(), getTexCoordsIndex7(), and osg::VectorInterface< ValueTypeT, StorageInterfaceT >::Null.
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::LineIterator::seek.
Reimplemented from osg::PrimitiveIterator.
Definition at line 265 of file OSGLineIterator.inl.
References _linePntIndex, and osg::PrimitiveIterator::getIndexIndex().
00266 { 00267 if(_linePntIndex[which] >= 0) 00268 return Inherited::getIndexIndex(_linePntIndex[which]); 00269 else 00270 return -1; 00271 }
| void LineIterator::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 154 of file OSGLineIterator.cpp.
References _actPrimIndex, _lineIndex, _linePntIndex, osg::PrimitiveIterator::getLength(), osg::PrimitiveIterator::getType(), osg::PrimitiveIterator::isAtEnd(), startPrim(), and SWARNING.
00155 { 00156 // already at end? 00157 if(isAtEnd()) 00158 return; 00159 00160 ++_lineIndex; 00161 00162 // at end of primitive? 00163 if((_actPrimIndex > getLength()) || 00164 (_actPrimIndex == getLength() && getType() != GL_LINE_LOOP)) 00165 { 00166 ++(static_cast<PrimitiveIterator&>(*this)); 00167 startPrim(); 00168 00169 return; 00170 } 00171 00172 00173 switch(getType()) 00174 { 00175 case GL_LINES: _linePntIndex[0] = _actPrimIndex++; 00176 _linePntIndex[1] = _actPrimIndex++; 00177 break; 00178 case GL_LINE_STRIP: _linePntIndex[0] = _linePntIndex[1]; 00179 _linePntIndex[1] = _actPrimIndex++; 00180 break; 00181 case GL_LINE_LOOP: _linePntIndex[0] = _linePntIndex[1]; 00182 if(_actPrimIndex < getLength()) 00183 { 00184 _linePntIndex[1] = _actPrimIndex++; 00185 } 00186 else 00187 { 00188 _linePntIndex[1] = 0; 00189 _actPrimIndex++; 00190 } 00191 break; 00192 default: SWARNING << "LineIterator::++: encountered " 00193 << "unknown primitive type " 00194 << getType() 00195 << ", ignoring!" << std::endl; 00196 startPrim(); 00197 break; 00198 } 00199 }
| void LineIterator::seek | ( | Int32 | index | ) |
Seek the iterator to a specific triangle indicated by its index.
This is primarily used in conjunction with osg::LineIterator::getIndex to record a position in the iteration and later return to it.
Reimplemented from osg::PrimitiveIterator.
Definition at line 253 of file OSGLineIterator.cpp.
References getIndex(), and setToBegin().
00254 { 00255 setToBegin(); 00256 00257 while(getIndex() != index) 00258 ++(*this); 00259 }
| LineIterator & LineIterator::operator= | ( | const LineIterator & | source | ) |
The increment operator steps the iterator to the next triangle. If it is already beyond the last triangle it does not change.
Definition at line 285 of file OSGLineIterator.cpp.
References _actPrimIndex, _lineIndex, and _linePntIndex.
00286 { 00287 if(this == &source) 00288 return *this; 00289 00290 *static_cast<Inherited *>(this) = source; 00291 00292 this->_lineIndex = source._lineIndex; 00293 this->_actPrimIndex = source._actPrimIndex; 00294 this->_linePntIndex[0] = source._linePntIndex[0]; 00295 this->_linePntIndex[1] = source._linePntIndex[1]; 00296 00297 return *this; 00298 }
| bool LineIterator::operator< | ( | const LineIterator & | other | ) | const |
The increment operator steps the iterator to the next triangle. If it is already beyond the last triangle it does not change.
Definition at line 302 of file OSGLineIterator.cpp.
References _actPrimIndex.
00303 { 00304 return 00305 (*static_cast<const Inherited *>(this) < other) || 00306 ( (*static_cast<const Inherited *>(this) == other) && 00307 _actPrimIndex < other._actPrimIndex); 00308 }
| bool LineIterator::operator== | ( | const LineIterator & | other | ) | const |
The increment operator steps the iterator to the next triangle. If it is already beyond the last triangle it does not change.
Definition at line 310 of file OSGLineIterator.cpp.
References _actPrimIndex, and osg::PrimitiveIterator::isAtEnd().
00311 { 00312 if(isAtEnd() && other.isAtEnd()) 00313 return true; 00314 00315 if(isAtEnd() || other.isAtEnd()) 00316 return false; 00317 00318 return 00319 (*static_cast<const Inherited *>(this) == other ) && 00320 _actPrimIndex == other._actPrimIndex; 00321 }
| bool LineIterator::operator!= | ( | const LineIterator & | other | ) | const |
The increment operator steps the iterator to the next triangle. If it is already beyond the last triangle it does not change.
Definition at line 323 of file OSGLineIterator.cpp.
| void LineIterator::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 266 of file OSGLineIterator.cpp.
References _lineIndex, osg::PrimitiveIterator::setToBegin(), and startPrim().
Referenced by osg::Geometry::beginLines(), and seek().
00267 { 00268 PrimitiveIterator::setToBegin(); 00269 _lineIndex = 0; 00270 startPrim(); 00271 }
| void LineIterator::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 277 of file OSGLineIterator.cpp.
References _actPrimIndex, and osg::PrimitiveIterator::setToEnd().
Referenced by osg::Geometry::endLines().
00278 { 00279 PrimitiveIterator::setToEnd(); 00280 _actPrimIndex = 0; 00281 }
| void LineIterator::startPrim | ( | void | ) | [private] |
Helper function to reset all state to the beginning of a new primitive. Also skips non-line primitives(triangles, quads, polygons, points) and primitives with less than 2 points.
Definition at line 206 of file OSGLineIterator.cpp.
References _actPrimIndex, _linePntIndex, osg::PrimitiveIterator::getLength(), osg::PrimitiveIterator::getType(), osg::PrimitiveIterator::isAtEnd(), and SWARNING.
Referenced by operator++(), and setToBegin().
00207 { 00208 // already at end? 00209 if(isAtEnd()) 00210 return; 00211 00212 _linePntIndex[0] = 0; 00213 _linePntIndex[1] = 1; 00214 _actPrimIndex = 2; 00215 00216 // loop until you find a useful primitive or run out 00217 while(! isAtEnd()) 00218 { 00219 switch(getType()) 00220 { 00221 case GL_POINTS: // non-line types: ignored 00222 case GL_TRIANGLES: 00223 case GL_TRIANGLE_STRIP: 00224 case GL_TRIANGLE_FAN: 00225 case GL_QUADS: 00226 case GL_QUAD_STRIP: 00227 case GL_POLYGON: 00228 break; 00229 case GL_LINES: // line types 00230 case GL_LINE_STRIP: 00231 case GL_LINE_LOOP: if(getLength() >= 2) 00232 return; 00233 break; 00234 default: SWARNING << "LineIterator::startPrim: " 00235 << "encountered " 00236 << "unknown primitive type " 00237 << getType() 00238 << ", ignoring!" << std::endl; 00239 break; 00240 } 00241 00242 ++(static_cast<PrimitiveIterator&>(*this)); 00243 } 00244 }
| 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(), LineIterator(), osg::PrimitiveIterator::PrimitiveIterator(), osg::PrimitiveIterator::setGeo(), and osg::TriangleIterator::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 osg::TriangleIterator::operator++(), osg::PrimitiveIterator::operator++(), operator++(), osg::FaceIterator::operator++(), osg::EdgeIterator::operator++(), osg::TriangleIterator::operator==(), operator==(), osg::FaceIterator::operator==(), osg::EdgeIterator::operator==(), osg::SplitGraphOp::splitNode(), osg::TriangleIterator::startPrim(), 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(), osg::TriangleIterator::operator++(), operator++(), osg::FaceIterator::operator++(), osg::EdgeIterator::operator++(), osg::SplitGraphOp::splitNode(), osg::TriangleIterator::startPrim(), 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(), osg::TriangleIterator::operator++(), operator++(), osg::FaceIterator::operator++(), osg::EdgeIterator::operator++(), osg::SplitGraphOp::splitNode(), osg::TriangleIterator::startPrim(), 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 osg::TriangleIterator::getColor(), getColor(), osg::FaceIterator::getColor(), osg::EdgeIterator::getColor(), osg::TriangleIterator::getNormal(), getNormal(), osg::FaceIterator::getNormal(), osg::EdgeIterator::getNormal(), osg::TriangleIterator::getPosition(), getPosition(), osg::FaceIterator::getPosition(), osg::EdgeIterator::getPosition(), osg::TriangleIterator::getSecondaryColor(), getSecondaryColor(), osg::FaceIterator::getSecondaryColor(), osg::EdgeIterator::getSecondaryColor(), osg::TriangleIterator::getTexCoords(), getTexCoords(), osg::FaceIterator::getTexCoords(), osg::EdgeIterator::getTexCoords(), osg::TriangleIterator::getTexCoords1(), getTexCoords1(), osg::FaceIterator::getTexCoords1(), osg::EdgeIterator::getTexCoords1(), osg::TriangleIterator::getTexCoords2(), getTexCoords2(), osg::FaceIterator::getTexCoords2(), osg::EdgeIterator::getTexCoords2(), osg::TriangleIterator::getTexCoords3(), getTexCoords3(), osg::FaceIterator::getTexCoords3(), osg::EdgeIterator::getTexCoords3(), osg::TriangleIterator::getTexCoords4(), getTexCoords4(), osg::FaceIterator::getTexCoords4(), osg::EdgeIterator::getTexCoords4(), osg::TriangleIterator::getTexCoords5(), getTexCoords5(), osg::FaceIterator::getTexCoords5(), osg::EdgeIterator::getTexCoords5(), osg::TriangleIterator::getTexCoords6(), getTexCoords6(), osg::FaceIterator::getTexCoords6(), osg::EdgeIterator::getTexCoords6(), osg::TriangleIterator::getTexCoords7(), getTexCoords7(), osg::FaceIterator::getTexCoords7(), and osg::EdgeIterator::getTexCoords7().
00677 { 00678 return _geo; 00679 }
| bool PrimitiveIterator::operator< | ( | const PrimitiveIterator & | other | ) | const [inherited] |
Compare two iterators. If the iterators are attached to different geometries a comparison in senseless, in that case false will be returned.
Definition at line 539 of file OSGPrimitiveIterator.cpp.
References osg::PrimitiveIterator::_geo, and osg::PrimitiveIterator::_primIndex.
00540 { 00541 return _geo == other._geo && 00542 _primIndex <= other._primIndex; 00543 }
| bool PrimitiveIterator::operator== | ( | const PrimitiveIterator & | other | ) | const [inherited] |
Compare two iterators. If the iterators are attached to different geometries a comparison in senseless, in that case false will be returned.
Definition at line 548 of file OSGPrimitiveIterator.cpp.
References osg::PrimitiveIterator::_ended, osg::PrimitiveIterator::_geo, and osg::PrimitiveIterator::_primIndex.
00549 { 00550 return _ended == other._ended && 00551 _geo == other._geo && 00552 _primIndex == other._primIndex; 00553 }
| bool PrimitiveIterator::operator!= | ( | const PrimitiveIterator & | other | ) | const [inherited] |
Compare two iterators. If the iterators are attached to different geometries a comparison in senseless, in that case false will be returned.
Definition at line 558 of file OSGPrimitiveIterator.cpp.
friend class Geometry [friend] |
char LineIterator::cvsid = "@(#)$Id: OSGLineIterator.cpp,v 1.1 2005/01/14 11:24:22 a-m-z Exp $" [static, private] |
Int32 osg::LineIterator::_lineIndex [private] |
Definition at line 163 of file OSGLineIterator.h.
Referenced by getIndex(), operator++(), operator=(), and setToBegin().
UInt32 osg::LineIterator::_actPrimIndex [private] |
Definition at line 164 of file OSGLineIterator.h.
Referenced by operator++(), operator<(), operator=(), operator==(), setToEnd(), and startPrim().
Int32 osg::LineIterator::_linePntIndex[2] [private] |
Definition at line 165 of file OSGLineIterator.h.
Referenced by getColorIndex(), getIndexIndex(), getNormalIndex(), getPositionIndex(), getSecondaryColorIndex(), getTexCoordsIndex(), getTexCoordsIndex1(), getTexCoordsIndex2(), getTexCoordsIndex3(), getTexCoordsIndex4(), getTexCoordsIndex5(), getTexCoordsIndex6(), getTexCoordsIndex7(), LineIterator(), operator++(), operator=(), and startPrim().
1.5.5