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 initSelected();
00036   void finish();
00037 
00038   // Pushes the transformation matrix.
00039   void pushMatrix(const SFMatrix34f &transformation);
00040   // Pops the transformation matrix.
00041   void popMatrix();
00042   // Saves current matrix state and returns index in saved vector.
00043   // Call storeMesh() before calling ths function
00044   int getCurrentMeshId();
00045   
00046   // Saves mesh and associated current matrix.
00047   void storeMesh(TemplateMesh<MData, VData, EData, FData, RW> *mesh);
00048   
00049   // Get i Mesh of the model.
00050   inline TemplateMesh<MData, VData, EData, FData, RW> *getMesh(int i) const;
00051   // Gets stored transformation matrix associated with a given Mesh.
00052   inline const SFMatrix34f &getMatrix(int i) const;
00053 
00055   void buildGLNode(X3D::X3DNode *node);
00057   void renderGLNode(X3D::X3DNode *node);
00059   bool getNode(X3D::X3DNode *node);
00061   void clearGLNodes();
00062   
00064   inline void setSelectionMode(bool selectionMode);
00066   inline bool getSelectionMode() const;
00067   
00069   void setDrawingSelected(bool drawingSelected);
00071   inline bool getDrawingSelected() const;
00072   
00074   void setRenderingMode(FaceMode mode);
00076   inline FaceMode getRenderingMode() const;
00077     
00079   void setSelectedNodes(const MFNode &selectedNodes);
00081   MFNode getSelectedNodes() const;
00082   
00083 private: 
00084   std::list<SFMatrix34f> _matrixStack;
00085   std::vector<SFMatrix34f> _matrixVector;
00086   std::vector<TemplateMesh<MData, VData, EData, FData, RW> *> _meshVector;
00087   std::map<X3D::X3DNode *, GL::X3DNode *> _coupleMap;
00088   bool _selectionMode;
00089   bool _drawingSelected;
00090   FaceMode _mode;
00091   MFNode _selectedNodes;
00092 };
00093 
00094 }
00095 }
00096 
00097 #include "MESH_FacesDrawerStateVariables.inl"
00098 
00099 #endif

Generated on Fri Aug 27 13:16:22 2004 for X3DToolKit by doxygen 1.3.6