MESH_FacesDrawerStateVariables.h

Go to the documentation of this file.
00001 #ifndef X3DTK_MESH_FACESDRAWERSTATEVARIABLES_H
00002 #define X3DTK_MESH_FACESDRAWERSTATEVARIABLES_H
00003 
00004 #include "MESH_SceneGraphTypes.h"
00005 #include "MESH_Mesh.h"
00006 #include "X3D_GLBuilder.h"
00007 #include "GL_Renderer.h"
00008 #include "MemReleaser.h"
00009 
00010 #include <list>
00011 #include <vector>
00012 
00013 namespace X3DTK {
00014 namespace MESH {
00015 
00016 typedef enum {REAL, IFS, CONNCOMS} FaceMode;
00017 
00024 template<class MData, class VData, class EData, class FData, bool RW>
00025 class TemplateFacesDrawerStateVariables : public StateVariables
00026 {
00027 public:
00029   TemplateFacesDrawerStateVariables();
00030 
00032   void init();
00034   void finish();
00035 
00036   // Pushes the transformation matrix.
00037   void pushMatrix(const SFMatrix34f &transformation);
00038   // Pops the transformation matrix.
00039   void popMatrix();
00040   // Saves current matrix state and returns index in saved vector.
00041   // Call storeMesh() before calling ths function
00042   int getCurrentMeshId();
00043   
00044   // Saves mesh and associated current matrix.
00045   void storeMesh(TemplateMesh<MData, VData, EData, FData, RW> *mesh);
00046   
00047   // Get i Mesh of the model.
00048   inline TemplateMesh<MData, VData, EData, FData, RW> *getMesh(int i) const;
00049   // Gets stored transformation matrix associated with a given Mesh.
00050   inline const SFMatrix34f &getMatrix(int i) const;
00051 
00053   void buildGLNode(X3D::X3DNode *node);
00055   void renderGLNode(X3D::X3DNode *node);
00057   bool getNode(X3D::X3DNode *node);
00059   void clearGLNodes();
00060   
00061   // Whether or not primitive IDs are pushed.
00062   inline void setSelectionMode(bool selectionMode);
00063   inline bool getSelectionMode() const;
00064   
00066   void setRenderingMode(FaceMode mode);
00068   inline FaceMode getRenderingMode() const;
00069     
00071   void setSelectedNodes(const MFNode &selectedNodes);
00073   MFNode getSelectedNodes() const;
00074   
00075 private: 
00076   std::list<SFMatrix34f> _matrixStack;
00077   std::vector<SFMatrix34f> _matrixVector;
00078   std::vector<TemplateMesh<MData, VData, EData, FData, RW> *> _meshVector;
00079   std::map<X3D::X3DNode *, GL::X3DNode *> _coupleMap;
00080   bool _selectionMode;
00081   FaceMode _mode;
00082   MFNode _selectedNodes;
00083 };
00084 
00085 }
00086 }
00087 
00088 #include "MESH_FacesDrawerStateVariables.inl"
00089 
00090 #endif

Generated on Fri Jul 30 12:02:28 2004 for X3DToolKit by doxygen 1.3.6