Main Page | Modules | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages

GL_IndexedFaceSet.h

Go to the documentation of this file.
00001 #ifndef X3DTK_GL_INDEXEDFACESET_H
00002 #define X3DTK_GL_INDEXEDFACESET_H
00003 
00004 #include "GL_X3DComposedGeometryNode.h"
00005 
00006 #include <vector>
00007 #include <utility>
00008 
00009 namespace X3DTK {
00010 namespace GL {
00011 
00018 class IndexedFaceSet : public X3DComposedGeometryNode
00019 {
00020 public:
00022   IndexedFaceSet();
00024   virtual SFNode clone() const;
00026   virtual ~IndexedFaceSet();
00027 
00029   void setN3F_V3F_vertexArray(const std::vector<N3F_V3F> &N3F_V3FvertexArray);
00031   void setC4F_N3F_V3F_vertexArray(const std::vector<C4F_N3F_V3F> &C4F_N3F_V3FvertexArray);
00033   void setT2F_N3F_V3F_vertexArray(const std::vector<T2F_N3F_V3F> &T2F_N3F_V3F_vertexArray);
00035   void setT2F_C4F_N3F_V3F_vertexArray(const std::vector<T2F_C4F_N3F_V3F> &T2F_C4F_N3F_V3F_vertexArray);
00037   void setIndexArray(const MFInt32 &indexArray);
00038 
00040   inline std::vector<N3F_V3F> &N3F_V3F_vertexArray() {return _N3F_V3F_vertexArray;};
00042   inline std::vector<C4F_N3F_V3F> &C4F_N3F_V3F_vertexArray() {return _C4F_N3F_V3F_vertexArray;};
00044   inline std::vector<T2F_N3F_V3F> &T2F_N3F_V3F_vertexArray() {return _T2F_N3F_V3F_vertexArray;};
00046   inline std::vector<T2F_C4F_N3F_V3F> &T2F_C4F_N3F_V3F_vertexArray() {return _T2F_C4F_N3F_V3F_vertexArray;};
00048   inline MFInt32 &indexArray() {return _indexArray;};
00050   inline const std::vector<MFInt32> &getX3DToGLIndex() {return _X3DtoGLIndex;};
00052   virtual void computeNormals();
00053 
00055   virtual void update();
00057   virtual void draw() const;
00058     
00059 protected:
00061   IndexedFaceSet(const IndexedFaceSet &G);
00062 
00063 private:   
00065   std::vector<N3F_V3F> _N3F_V3F_vertexArray;
00067   std::vector<C4F_N3F_V3F> _C4F_N3F_V3F_vertexArray;
00069   std::vector<T2F_N3F_V3F> _T2F_N3F_V3F_vertexArray;
00071   std::vector<T2F_C4F_N3F_V3F> _T2F_C4F_N3F_V3F_vertexArray;
00073   MFInt32 _indexArray;
00075   std::vector<MFInt32> _X3DtoGLIndex;
00076   
00078   std::list<std::pair<SFInt32, N3F_V3F> > _N3F_V3F_tesselatedFace;
00080   std::list<std::pair<SFInt32, C4F_N3F_V3F> > _C4F_N3F_V3F_tesselatedFace;
00082   std::list<std::pair<SFInt32, T2F_N3F_V3F> > _T2F_N3F_V3F_tesselatedFace;
00084   std::list<std::pair<SFInt32, T2F_C4F_N3F_V3F> > _T2F_C4F_N3F_V3F_tesselatedFace;
00085       
00087   void emptyArrays();
00089   void computeNoColorNoTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex);
00091   void computeColorNoTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex);
00093   void computeNoColorTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex);
00095   void computeColorTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex);
00096   
00098   void tesselateNoColorNoTexCoord(const std::list<std::pair<SFInt32, N3F_V3F> > &N3F_V3F_face);
00100   void tesselateColorNoTexCoord(const std::list<std::pair<SFInt32, C4F_N3F_V3F> > &C4F_N3F_V3F_face);
00102   void tesselateNoColorTexCoord(const std::list<std::pair<SFInt32, T2F_N3F_V3F> > &T2F_N3F_V3F_face);
00104   void tesselateColorTexCoord(const std::list<std::pair<SFInt32, T2F_C4F_N3F_V3F> > &T2F_C4F_N3F_V3F_face);
00105   
00107   void computeNoColorNoTexCoordNormals();
00109   void computeColorNoTexCoordNormals();
00111   void computeNoColorTexCoordNormals();
00113   void computeColorTexCoordNormals();
00114   
00115 };
00116 
00117 }
00118 }
00119 
00120 #endif

Generated on Wed Apr 7 12:15:19 2004 for X3DToolKit by doxygen 1.3.3