00001
00002
00004
00005 #ifndef GLTRIANGLESET_H
00006 #define GLTRIANGLESET_H
00007
00008 #include "X3DGLComposedGeometryNode.h"
00009
00010 #include <vector>
00011
00012 namespace X3DTK {
00013 namespace GL {
00014
00017
00018 class TriangleSet : public X3DComposedGeometryNode
00019 {
00020 public:
00022 TriangleSet();
00024 virtual SFNode clone() const;
00026 virtual ~TriangleSet();
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);
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;};
00045
00047 virtual void update();
00049 virtual void render() const;
00050
00051 protected:
00053 TriangleSet(const TriangleSet &T);
00054
00055 private:
00057 std::vector<N3F_V3F> _N3F_V3F_vertexArray;
00059 std::vector<C4F_N3F_V3F> _C4F_N3F_V3F_vertexArray;
00061 std::vector<T2F_N3F_V3F> _T2F_N3F_V3F_vertexArray;
00063 std::vector<T2F_C4F_N3F_V3F> _T2F_C4F_N3F_V3F_vertexArray;
00064
00066 void computeNoColorNoTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray);
00068 void computeColorNoTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray);
00070 void computeNoColorTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray);
00072 void computeColorTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray);
00074 void computeArrays(const MFVec3f &vertexArray, MFVec3f &normalArray);
00075 };
00076
00077 }
00078 }
00079
00080 #endif