00001
00002
00004
00005 #ifndef GLINDEXEDFACESET_H
00006 #define GLINDEXEDFACESET_H
00007
00008 #include "X3DGLComposedGeometryNode.h"
00009
00010 #include <vector>
00011
00012 namespace X3DTK {
00013 namespace GL {
00014
00017
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 render() 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 void emptyArrays();
00080 void computeIndexArray(const MFInt32 &coordIndex);
00082 void computeNoColorNoTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex);
00084 void computeColorNoTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex);
00086 void computeNoColorTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex);
00088 void computeColorTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex);
00090 void computeArrays(const MFVec3f &vertexArray, const MFInt32 &coordIndex, MFVec3f &normalArray);
00091
00093 void computeNoColorNoTexCoordNormals();
00095 void computeColorNoTexCoordNormals();
00097 void computeNoColorTexCoordNormals();
00099 void computeColorTexCoordNormals();
00100
00101 };
00102
00103 }
00104 }
00105
00106 #endif