#include <OSGPrimitiveIterator.h>
Inheritance diagram for osg::PrimitiveIterator:

Definition at line 62 of file OSGPrimitiveIterator.h.
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
Definition at line 289 of file OSGPrimitiveIterator.cpp.
|
|
|
Reimplemented in osg::EdgeIterator, osg::FaceIterator, osg::LineIterator, and osg::TriangleIterator. Definition at line 71 of file OSGPrimitiveIterator.h.
|
|
|
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 }
|
|
|
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 }
|
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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(), |