00001
00002
00003
00005
00006
00011
00016
00021
00023
00024 #ifndef GLINDEXEDFACESET_H
00025 #define GLINDEXEDFACESET_H
00026
00027 #include "X3DGLComposedGeometryNode.h"
00028
00029 #include <vector>
00030
00031 namespace X3DTK {
00032 namespace GL {
00033
00036
00037 class IndexedFaceSet : public X3DComposedGeometryNode
00038 {
00039 public:
00041 IndexedFaceSet();
00043 virtual SFNode clone() const;
00045 virtual ~IndexedFaceSet();
00046
00048 void setN3F_V3F_vertexArray(const std::vector<N3F_V3F> &N3F_V3FvertexArray);
00050 void setC4F_N3F_V3F_vertexArray(const std::vector<C4F_N3F_V3F> &C4F_N3F_V3FvertexArray);
00052 void setT2F_N3F_V3F_vertexArray(const std::vector<T2F_N3F_V3F> &T2F_N3F_V3F_vertexArray);
00054 void setT2F_C4F_N3F_V3F_vertexArray(const std::vector<T2F_C4F_N3F_V3F> &T2F_C4F_N3F_V3F_vertexArray);
00056 void setIndexArray(const MFInt32 &indexArray);
00057
00059 inline std::vector<N3F_V3F> &N3F_V3F_vertexArray() {return _N3F_V3F_vertexArray;};
00061 inline std::vector<C4F_N3F_V3F> &C4F_N3F_V3F_vertexArray() {return _C4F_N3F_V3F_vertexArray;};
00063 inline std::vector<T2F_N3F_V3F> &T2F_N3F_V3F_vertexArray() {return _T2F_N3F_V3F_vertexArray;};
00065 inline std::vector<T2F_C4F_N3F_V3F> &T2F_C4F_N3F_V3F_vertexArray() {return _T2F_C4F_N3F_V3F_vertexArray;};
00067 inline MFInt32 &indexArray() {return _indexArray;};
00069 inline const std::vector<MFInt32> &getX3DToGLIndex() {return _X3DtoGLIndex;};
00071 virtual void computeNormals();
00072
00074 virtual void update();
00076 virtual void render() const;
00077
00078 protected:
00080 IndexedFaceSet(const IndexedFaceSet &G);
00081
00082 private:
00084 std::vector<N3F_V3F> _N3F_V3F_vertexArray;
00086 std::vector<C4F_N3F_V3F> _C4F_N3F_V3F_vertexArray;
00088 std::vector<T2F_N3F_V3F> _T2F_N3F_V3F_vertexArray;
00090 std::vector<T2F_C4F_N3F_V3F> _T2F_C4F_N3F_V3F_vertexArray;
00092 MFInt32 _indexArray;
00094 std::vector<MFInt32> _X3DtoGLIndex;
00095
00097 void emptyArrays();
00099 void computeIndexArray(const MFInt32 &coordIndex);
00101 void computeNoColorNoTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex);
00103 void computeColorNoTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex);
00105 void computeNoColorTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex);
00107 void computeColorTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex);
00109 void computeArrays(const MFVec3f &vertexArray, const MFInt32 &coordIndex, MFVec3f &normalArray);
00110
00112 void computeNoColorNoTexCoordNormals();
00114 void computeColorNoTexCoordNormals();
00116 void computeNoColorTexCoordNormals();
00118 void computeColorTexCoordNormals();
00119
00120 };
00121
00122 }
00123 }
00124
00125 #endif