OSGTriangleIterator.h

Go to the documentation of this file.
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 _OSGTRIANGLEITERATOR_H_
00041 #define _OSGTRIANGLEITERATOR_H_
00042 #ifdef __sgi
00043 #pragma once
00044 #endif
00045 
00046 #include "OSGBaseTypes.h"
00047 #include "OSGNodeCore.h"
00048 #include "OSGGeoProperty.h"
00049 #include "OSGPrimitiveIterator.h"
00050 
00051 OSG_BEGIN_NAMESPACE
00052 
00057 class OSG_DRAWABLE_DLLMAPPING TriangleIterator : public PrimitiveIterator
00058 {
00059     /*==========================  PUBLIC  =================================*/
00060   public:
00061 
00062     /*---------------------------------------------------------------------*/
00066     static const char *getClassname(void) { return "TriangleIterator"; }
00067 
00069     /*---------------------------------------------------------------------*/
00073     TriangleIterator(void);
00074     TriangleIterator(const TriangleIterator &source);
00075     TriangleIterator(const GeometryConstPtrArg geo);
00076     TriangleIterator(const NodePtr& geo);
00077 
00079     /*---------------------------------------------------------------------*/
00083     virtual ~TriangleIterator(void);
00084 
00086     /*---------------------------------------------------------------------*/
00090     inline Int32        getIndex                (Int32 which) const;
00091     inline Int32        getIndex                (void       ) const;
00092 
00093     inline Int32        getPropertyIndex        (Int32 att, 
00094                                                  Int32 which) const;
00095 
00096     inline Int32        getPositionIndex        (Int32 which) const;
00097     inline Pnt3f        getPosition             (Int32 which) const;
00098 
00099     inline Vec3f        getNormal               (Int32 att,
00100                                                  Int32 which) const;
00101     inline Int32        getNormalIndex          (Int32 which) const;
00102     inline Vec3f        getNormal               (Int32 which) const;
00103 
00104     inline Int32        getColorIndex           (Int32 which) const;
00105     inline Color3f      getColor                (Int32 which) const;
00106 
00107     inline Int32        getSecondaryColorIndex  (Int32 which) const;
00108     inline Color3f      getSecondaryColor       (Int32 which) const;
00109 
00110     inline Vec2f        getTexCoords            (Int32 att,
00111                                                  Int32 which) const;
00112 
00113     inline Int32        getTexCoordsIndex       (Int32 which) const;
00114     inline Vec2f        getTexCoords            (Int32 which) const;
00115     inline Int32        getTexCoordsIndex1      (Int32 which) const;
00116     inline Vec2f        getTexCoords1           (Int32 which) const;
00117     inline Int32        getTexCoordsIndex2      (Int32 which) const;
00118     inline Vec2f        getTexCoords2           (Int32 which) const;
00119     inline Int32        getTexCoordsIndex3      (Int32 which) const;
00120     inline Vec2f        getTexCoords3           (Int32 which) const;
00121 
00122  
00124     /*---------------------------------------------------------------------*/
00128     void operator ++(void);
00129     void seek(Int32 index);
00130 
00131     TriangleIterator & operator =(const TriangleIterator &source);
00132     bool operator < (const TriangleIterator &other) const;
00133     bool operator == (const TriangleIterator &other) const;
00134     bool operator != (const TriangleIterator &other) const;
00135 
00137     /*=========================  PROTECTED  ===============================*/
00138   protected:
00139 
00140     typedef PrimitiveIterator Inherited;
00141     
00142     /*---------------------------------------------------------------------*/
00146     void setToBegin(void);
00147     void setToEnd(void);
00148     
00150     /*==========================  PRIVATE  ================================*/
00151   private:
00152 
00153     friend class Geometry;
00154 
00155     /*---------------------------------------------------------------------*/
00159     Int32           _triIndex;
00160     UInt32          _actPrimIndex;
00161     Int32           _triPntIndex[3];
00162 
00165     void startPrim(void);
00166 };
00167 
00168 typedef TriangleIterator *TriangleIteratorP;
00169 
00170 OSG_END_NAMESPACE
00171 
00172 #include "OSGTriangleIterator.inl"
00173 
00174 #endif /* _OSGTRIANGLEITERATOR_H_ */