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 ~IndexedFaceSet(); 00025 00027 void setN3F_V3F_vertexArray(const std::vector<N3F_V3F> &N3F_V3FvertexArray); 00029 void setC4F_N3F_V3F_vertexArray(const std::vector<C4F_N3F_V3F> &C4F_N3F_V3FvertexArray); 00031 void setT2F_N3F_V3F_vertexArray(const std::vector<T2F_N3F_V3F> &T2F_N3F_V3F_vertexArray); 00033 void setT2F_C4F_N3F_V3F_vertexArray(const std::vector<T2F_C4F_N3F_V3F> &T2F_C4F_N3F_V3F_vertexArray); 00035 void setIndexArray(const MFInt32 &indexArray); 00036 00038 inline std::vector<N3F_V3F> &N3F_V3F_vertexArray() {return _N3F_V3F_vertexArray;}; 00040 inline std::vector<C4F_N3F_V3F> &C4F_N3F_V3F_vertexArray() {return _C4F_N3F_V3F_vertexArray;}; 00042 inline std::vector<T2F_N3F_V3F> &T2F_N3F_V3F_vertexArray() {return _T2F_N3F_V3F_vertexArray;}; 00044 inline std::vector<T2F_C4F_N3F_V3F> &T2F_C4F_N3F_V3F_vertexArray() {return _T2F_C4F_N3F_V3F_vertexArray;}; 00046 inline MFInt32 &indexArray() {return _indexArray;}; 00048 inline const std::vector<MFInt32> &getX3DToGLIndex() const {return _X3DtoGLIndex;}; 00050 virtual void computeNormals(); 00051 00053 virtual void update(); 00055 virtual void draw() const; 00056 00057 private: 00059 std::vector<N3F_V3F> _N3F_V3F_vertexArray; 00061 std::vector<C4F_N3F_V3F> _C4F_N3F_V3F_vertexArray; 00063 std::vector<T2F_N3F_V3F> _T2F_N3F_V3F_vertexArray; 00065 std::vector<T2F_C4F_N3F_V3F> _T2F_C4F_N3F_V3F_vertexArray; 00067 MFInt32 _indexArray; 00069 std::vector<MFInt32> _X3DtoGLIndex; 00070 00072 std::list<std::pair<SFInt32, N3F_V3F> > _N3F_V3F_tesselatedFace; 00074 std::list<std::pair<SFInt32, C4F_N3F_V3F> > _C4F_N3F_V3F_tesselatedFace; 00076 std::list<std::pair<SFInt32, T2F_N3F_V3F> > _T2F_N3F_V3F_tesselatedFace; 00078 std::list<std::pair<SFInt32, T2F_C4F_N3F_V3F> > _T2F_C4F_N3F_V3F_tesselatedFace; 00079 00081 void emptyArrays(); 00083 void computeNoColorNoTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex); 00085 void computeColorRGBANoTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex); 00087 void computeColorNoTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex); 00089 void computeNoColorTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex); 00091 void computeColorRGBATexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex); 00093 void computeColorTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex); 00094 00096 void tesselateNoColorNoTexCoord(const std::list<std::pair<SFInt32, N3F_V3F> > &N3F_V3F_face); 00098 void tesselateColorNoTexCoord(const std::list<std::pair<SFInt32, C4F_N3F_V3F> > &C4F_N3F_V3F_face); 00100 void tesselateNoColorTexCoord(const std::list<std::pair<SFInt32, T2F_N3F_V3F> > &T2F_N3F_V3F_face); 00102 void tesselateColorTexCoord(const std::list<std::pair<SFInt32, T2F_C4F_N3F_V3F> > &T2F_C4F_N3F_V3F_face); 00103 00105 void computeNoColorNoTexCoordNormals(); 00107 void computeColorNoTexCoordNormals(); 00109 void computeNoColorTexCoordNormals(); 00111 void computeColorTexCoordNormals(); 00112 00113 }; 00114 00115 } 00116 } 00117 00118 #endif