00001 #ifndef X3DTK_GL_TRIANGLESET_H 00002 #define X3DTK_GL_TRIANGLESET_H 00003 00004 #include "GL_X3DComposedGeometryNode.h" 00005 00006 #include <vector> 00007 00008 namespace X3DTK { 00009 namespace GL { 00010 00017 class TriangleSet : public X3DComposedGeometryNode 00018 { 00019 public: 00021 TriangleSet(); 00023 virtual SFNode clone() const; 00025 virtual ~TriangleSet(); 00026 00028 void setN3F_V3F_vertexArray(const std::vector<N3F_V3F> &N3F_V3FvertexArray); 00030 void setC4F_N3F_V3F_vertexArray(const std::vector<C4F_N3F_V3F> &C4F_N3F_V3FvertexArray); 00032 void setT2F_N3F_V3F_vertexArray(const std::vector<T2F_N3F_V3F> &T2F_N3F_V3F_vertexArray); 00034 void setT2F_C4F_N3F_V3F_vertexArray(const std::vector<T2F_C4F_N3F_V3F> &T2F_C4F_N3F_V3F_vertexArray); 00035 00037 inline std::vector<N3F_V3F> &N3F_V3F_vertexArray() {return _N3F_V3F_vertexArray;}; 00039 inline std::vector<C4F_N3F_V3F> &C4F_N3F_V3F_vertexArray() {return _C4F_N3F_V3F_vertexArray;}; 00041 inline std::vector<T2F_N3F_V3F> &T2F_N3F_V3F_vertexArray() {return _T2F_N3F_V3F_vertexArray;}; 00043 inline std::vector<T2F_C4F_N3F_V3F> &T2F_C4F_N3F_V3F_vertexArray() {return _T2F_C4F_N3F_V3F_vertexArray;}; 00044 00046 virtual void update(); 00048 virtual void draw() const; 00049 00050 protected: 00052 TriangleSet(const TriangleSet &T); 00053 00054 private: 00056 std::vector<N3F_V3F> _N3F_V3F_vertexArray; 00058 std::vector<C4F_N3F_V3F> _C4F_N3F_V3F_vertexArray; 00060 std::vector<T2F_N3F_V3F> _T2F_N3F_V3F_vertexArray; 00062 std::vector<T2F_C4F_N3F_V3F> _T2F_C4F_N3F_V3F_vertexArray; 00063 00065 void computeNoColorNoTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray); 00067 void computeColorNoTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray); 00069 void computeNoColorTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray); 00071 void computeColorTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray); 00073 void computeArrays(const MFVec3f &vertexArray, MFVec3f &normalArray); 00074 }; 00075 00076 } 00077 } 00078 00079 #endif