#include <OSGLineIterator.h>
Inheritance diagram for osg::LineIterator:

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 | 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 |
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.
|
|
Definition at line 134 of file OSGLineIterator.h. |
|
|
Definition at line 103 of file OSGLineIterator.cpp. 00103 : PrimitiveIterator(), 00104 _lineIndex(0), _actPrimIndex(0), _linePntIndex() 00105 { 00106 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
Definition at line 145 of file OSGLineIterator.cpp.
|
|
|
Reimplemented from osg::PrimitiveIterator. Definition at line 67 of file OSGLineIterator.h.
|
|
|
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< Real32, VecStorage3 >::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< 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::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< 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::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< Real32, VecStorage2 >::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< Real32, VecStorage2 >::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< Real32, VecStorage2 >::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< Real32, VecStorage2 >::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 198 of file OSGLineIterator.inl. References _linePntIndex, and osg::PrimitiveIterator::getIndexIndex(). 00199 { 00200 if(_linePntIndex[which] >= 0) 00201 return Inherited::getIndexIndex(_linePntIndex[which]); 00202 else 00203 return -1; 00204 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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.
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
Switch the iterator to a new geometry. Automatically sets it to the beginning. Definition at line 299 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(). 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 }
|
|
|
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 osg::PrimitiveIterator::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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
|
|
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 491 of file OSGPrimitiveIterator.cpp. References osg::PrimitiveIterator::_geo, and osg::PrimitiveIterator::_primIndex. 00492 { 00493 return _geo == other._geo && 00494 _primIndex <= other._primIndex; 00495 }
|
|
|