00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000-2002 by the OpenSG Forum * 00006 * * 00007 * www.opensg.org * 00008 * * 00009 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 00010 * * 00011 \*---------------------------------------------------------------------------*/ 00012 /*---------------------------------------------------------------------------*\ 00013 * License * 00014 * * 00015 * This library is free software; you can redistribute it and/or modify it * 00016 * under the terms of the GNU Library General Public License as published * 00017 * by the Free Software Foundation, version 2. * 00018 * * 00019 * This library is distributed in the hope that it will be useful, but * 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00022 * Library General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU Library General Public * 00025 * License along with this library; if not, write to the Free Software * 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00027 * * 00028 \*---------------------------------------------------------------------------*/ 00029 /*---------------------------------------------------------------------------*\ 00030 * Changes * 00031 * * 00032 * * 00033 * * 00034 * * 00035 * * 00036 * * 00037 \*---------------------------------------------------------------------------*/ 00038 00039 00040 #ifndef _OSGPRIMITIVEITERATOR_H_ 00041 #define _OSGPRIMITIVEITERATOR_H_ 00042 #ifdef __sgi 00043 #pragma once 00044 #endif 00045 00046 #include <OSGBaseTypes.h> 00047 #include <OSGFieldContainerPtr.h> 00048 #include <OSGNodeCore.h> 00049 #include <OSGSystemDef.h> 00050 #include <OSGGeoProperty.h> 00051 #include <OSGMaterialDrawable.h> 00052 00053 OSG_BEGIN_NAMESPACE 00054 00055 class Geometry; 00056 typedef FCPtr<MaterialDrawablePtr, Geometry> GeometryPtr; 00057 00062 class OSG_SYSTEMLIB_DLLMAPPING PrimitiveIterator 00063 { 00064 /*========================== PUBLIC =================================*/ 00065 public: 00066 00067 /*---------------------------------------------------------------------*/ 00071 static const char *getClassname(void) { return "PrimitiveIterator"; } 00072 00074 /*---------------------------------------------------------------------*/ 00078 PrimitiveIterator(void); 00079 00080 PrimitiveIterator(const PrimitiveIterator &source); 00081 00082 PrimitiveIterator(const GeometryPtr& geo); 00083 PrimitiveIterator(const NodePtr& geo); 00084 00086 /*---------------------------------------------------------------------*/ 00090 virtual ~PrimitiveIterator(void); 00091 00093 /*---------------------------------------------------------------------*/ 00097 void setGeo(const GeometryPtr& geo); 00098 void setGeo(const NodePtr& geo); 00099 00100 void setToBegin(void); 00101 void setToEnd (void); 00102 00104 /*---------------------------------------------------------------------*/ 00108 inline bool isAtEnd (void ) const; 00109 00110 inline Int32 getIndex (void ) const; 00111 inline UInt32 getLength (void ) const; 00112 inline UInt32 getType (void ) const; 00113 00114 inline Int32 getPositionIndex (Int32 which) const; 00115 inline Pnt3f getPosition (Int32 which) const; 00116 00117 inline Int32 getNormalIndex (Int32 which) const; 00118 inline Vec3f getNormal (Int32 which) const; 00119 00120 inline Int32 getColorIndex (Int32 which) const; 00121 inline Color3f getColor (Int32 which) const; 00122 00123 inline Int32 getSecondaryColorIndex (Int32 which) const; 00124 inline Color3f getSecondaryColor (Int32 which) const; 00125 00126 inline Int32 getTexCoordsIndex (Int32 which) const; 00127 inline Vec2f getTexCoords (Int32 which) const; 00128 00129 inline Int32 getTexCoordsIndex1 (Int32 which) const; 00130 inline Vec2f getTexCoords1 (Int32 which) const; 00131 00132 inline Int32 getTexCoordsIndex2 (Int32 which) const; 00133 inline Vec2f getTexCoords2 (Int32 which) const; 00134 00135 inline Int32 getTexCoordsIndex3 (Int32 which) const; 00136 inline Vec2f getTexCoords3 (Int32 which) const; 00137 00138 inline Int32 getTexCoordsIndex4 (Int32 which) const; 00139 inline Vec2f getTexCoords4 (Int32 which) const; 00140 00141 inline Int32 getTexCoordsIndex5 (Int32 which) const; 00142 inline Vec2f getTexCoords5 (Int32 which) const; 00143 00144 inline Int32 getTexCoordsIndex6 (Int32 which) const; 00145 inline Vec2f getTexCoords6 (Int32 which) const; 00146 00147 inline Int32 getTexCoordsIndex7 (Int32 which) const; 00148 inline Vec2f getTexCoords7 (Int32 which) const; 00149 00150 inline Int32 getIndexIndex (Int32 which) const; 00151 00152 inline GeometryPtr getGeometry (void ) const; 00153 00155 /*---------------------------------------------------------------------*/ 00159 void operator ++(void); 00160 void seek(Int32 index); 00161 00162 PrimitiveIterator & operator =(const PrimitiveIterator &source); 00163 00164 bool operator < (const PrimitiveIterator &other) const; 00165 00166 bool operator == (const PrimitiveIterator &other) const; 00167 bool operator != (const PrimitiveIterator &other) const; 00168 00170 /*========================= PROTECTED ===============================*/ 00171 protected: 00172 00173 00174 /*========================== PRIVATE ================================*/ 00175 private: 00176 00177 friend class Geometry; 00178 00179 static char cvsid[]; 00180 00181 /*---------------------------------------------------------------------*/ 00185 GeometryPtr _geo; 00186 bool _ended; 00187 UInt32 _primIndex; 00188 UInt32 _actPointIndex; 00189 UInt32 _actPrimType; 00190 UInt32 _actPrimLength; 00191 GeoPTypesPtr _types; 00192 GeoPLengthsPtr _lengths; 00193 GeoIndicesPtr _indices; 00194 UInt16 _nmappings; 00195 Int16 _positionIndex; 00196 Int16 _normalIndex; 00197 Int16 _colorIndex; 00198 Int16 _secondaryColorIndex; 00199 Int16 _texcoordsIndex; 00200 Int16 _texcoordsIndex1; 00201 Int16 _texcoordsIndex2; 00202 Int16 _texcoordsIndex3; 00203 Int16 _texcoordsIndex4; 00204 Int16 _texcoordsIndex5; 00205 Int16 _texcoordsIndex6; 00206 Int16 _texcoordsIndex7; 00207 00209 }; 00210 00211 typedef PrimitiveIterator *PrimitiveIteratorP; 00212 00213 OSG_END_NAMESPACE 00214 00215 #include "OSGPrimitiveIterator.inl" 00216 00217 #endif /* _OSGPRIMITIVEITERATOR_H_ */
1.5.5