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 SFAbstractNode 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 computeColorRGBANoTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex); 00093 void computeColorNoTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex); 00095 void computeNoColorTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex); 00097 void computeColorRGBATexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex); 00099 void computeColorTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex); 00100 00102 void tesselateNoColorNoTexCoord(const std::list<std::pair<SFInt32, N3F_V3F> > &N3F_V3F_face); 00104 void tesselateColorNoTexCoord(const std::list<std::pair<SFInt32, C4F_N3F_V3F> > &C4F_N3F_V3F_face); 00106 void tesselateNoColorTexCoord(const std::list<std::pair<SFInt32, T2F_N3F_V3F> > &T2F_N3F_V3F_face); 00108 void tesselateColorTexCoord(const std::list<std::pair<SFInt32, T2F_C4F_N3F_V3F> > &T2F_C4F_N3F_V3F_face); 00109 00111 void computeNoColorNoTexCoordNormals(); 00113 void computeColorNoTexCoordNormals(); 00115 void computeNoColorTexCoordNormals(); 00117 void computeColorTexCoordNormals(); 00118 00119 }; 00120 00121 } 00122 } 00123 00124 #endif