Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

GL_IndexedFaceSet.h

Go to the documentation of this file.
00001 
00002 //                            GL_IndexedFaceSet.h                             //
00004 
00005 #ifndef GLINDEXEDFACESET_H
00006 #define GLINDEXEDFACESET_H
00007 
00008 #include "GL_X3DComposedGeometryNode.h"
00009 
00010 #include <vector>
00011 #include <utility>
00012 
00013 namespace X3DTK {
00014 namespace GL {
00015 
00018 
00019 class IndexedFaceSet : public X3DComposedGeometryNode
00020 {
00021 public:
00023   IndexedFaceSet();
00025   virtual SFNode clone() const;
00027   virtual ~IndexedFaceSet();
00028 
00030   void setN3F_V3F_vertexArray(const std::vector<N3F_V3F> &N3F_V3FvertexArray);
00032   void setC4F_N3F_V3F_vertexArray(const std::vector<C4F_N3F_V3F> &C4F_N3F_V3FvertexArray);
00034   void setT2F_N3F_V3F_vertexArray(const std::vector<T2F_N3F_V3F> &T2F_N3F_V3F_vertexArray);
00036   void setT2F_C4F_N3F_V3F_vertexArray(const std::vector<T2F_C4F_N3F_V3F> &T2F_C4F_N3F_V3F_vertexArray);
00038   void setIndexArray(const MFInt32 &indexArray);
00039 
00041   inline std::vector<N3F_V3F> &N3F_V3F_vertexArray() {return _N3F_V3F_vertexArray;};
00043   inline std::vector<C4F_N3F_V3F> &C4F_N3F_V3F_vertexArray() {return _C4F_N3F_V3F_vertexArray;};
00045   inline std::vector<T2F_N3F_V3F> &T2F_N3F_V3F_vertexArray() {return _T2F_N3F_V3F_vertexArray;};
00047   inline std::vector<T2F_C4F_N3F_V3F> &T2F_C4F_N3F_V3F_vertexArray() {return _T2F_C4F_N3F_V3F_vertexArray;};
00049   inline MFInt32 &indexArray() {return _indexArray;};
00051   inline const std::vector<MFInt32> &getX3DToGLIndex() {return _X3DtoGLIndex;};
00053   virtual void computeNormals();
00054 
00056   virtual void update();
00058   virtual void draw() const;
00059     
00060 protected:
00062   IndexedFaceSet(const IndexedFaceSet &G);
00063 
00064 private:   
00066   std::vector<N3F_V3F> _N3F_V3F_vertexArray;
00068   std::vector<C4F_N3F_V3F> _C4F_N3F_V3F_vertexArray;
00070   std::vector<T2F_N3F_V3F> _T2F_N3F_V3F_vertexArray;
00072   std::vector<T2F_C4F_N3F_V3F> _T2F_C4F_N3F_V3F_vertexArray;
00074   MFInt32 _indexArray;
00076   std::vector<MFInt32> _X3DtoGLIndex;
00077   
00079   std::list<std::pair<SFInt32, N3F_V3F> > _N3F_V3F_tesselatedFace;
00081   std::list<std::pair<SFInt32, C4F_N3F_V3F> > _C4F_N3F_V3F_tesselatedFace;
00083   std::list<std::pair<SFInt32, T2F_N3F_V3F> > _T2F_N3F_V3F_tesselatedFace;
00085   std::list<std::pair<SFInt32, T2F_C4F_N3F_V3F> > _T2F_C4F_N3F_V3F_tesselatedFace;
00086       
00088   void emptyArrays();
00090   void computeNoColorNoTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex);
00092   void computeColorNoTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex);
00094   void computeNoColorTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex);
00096   void computeColorTexCoord(const MFVec3f &vertexArray, const MFVec3f &normalArray, const MFInt32 &coordIndex);
00097   
00099   void tesselateNoColorNoTexCoord(const std::list<std::pair<SFInt32, N3F_V3F> > &N3F_V3F_face);
00101   void tesselateColorNoTexCoord(const std::list<std::pair<SFInt32, C4F_N3F_V3F> > &C4F_N3F_V3F_face);
00103   void tesselateNoColorTexCoord(const std::list<std::pair<SFInt32, T2F_N3F_V3F> > &T2F_N3F_V3F_face);
00105   void tesselateColorTexCoord(const std::list<std::pair<SFInt32, T2F_C4F_N3F_V3F> > &T2F_C4F_N3F_V3F_face);
00106   
00108   void computeNoColorNoTexCoordNormals();
00110   void computeColorNoTexCoordNormals();
00112   void computeNoColorTexCoordNormals();
00114   void computeColorTexCoordNormals();
00115   
00116 };
00117 
00118 }
00119 }
00120 
00121 #endif

Generated on Mon Jan 19 10:32:03 2004 for X3DToolKit by doxygen1.2.18