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

MESH_MeshVerticesDrawerStateVariables.h

Go to the documentation of this file.
00001 
00002 //                            MESH_MeshVerticesDrawerStateVariables.h         //
00004 
00005 #ifndef MESH_VERTICESDRAWERSTATEVARIABLES_H
00006 #define MESH_VERTICESDRAWERSTATEVARIABLES_H
00007 
00008 #include "MESH_SceneGraphTypes.h"
00009 #include "MESH_Mesh.h"
00010 
00011 #include <list>
00012 #include <vector>
00013 
00014 namespace X3DTK {
00015 namespace MESH {
00016 
00017 // State variables for the Drawer processor.
00018 
00019 class MeshVerticesDrawerStateVariables : public StateVariables
00020 {
00021 public:
00022   MeshVerticesDrawerStateVariables();
00023 
00024   // Initializes and finishes the traversal.
00025   void init();
00026   void finish();
00027 
00028   // Pushes the transformation matrix.
00029   void pushMatrix(const SFMatrix34f &transformation);  
00030   
00031   // Pops the transformation matrix.
00032   void popMatrix();
00033 
00034   // Saves current matrix state and returns index in saved vector.
00035   // Call storeMesh() before calling ths function
00036   int getCurrentMeshId();
00037   // Saves mesh and associated current matrix.
00038   void storeMesh(Mesh *mesh);
00039   
00040   // Get i Mesh of the model.
00041   inline Mesh *getMesh(int i) const {return _meshVector[i];};
00042   // Gets stored transformation matrix associated with a given Mesh.
00043   inline const SFMatrix34f &getMatrix(int i) const {return _matrixVector[i];};
00044 
00045   // Whether or not primitive IDs are pushed.
00046   inline void setSelectionMode(bool selectionMode) {_selectionMode = selectionMode;};
00047   inline bool getSelectionMode() const {return _selectionMode;};
00048     
00049   // Whether each mesh is displayed with a specific color
00050   void changeOneColorPerMesh() {_oneColorPerMesh = !_oneColorPerMesh;};
00051   inline bool getOneColorPerMesh() const {return _oneColorPerMesh;};
00052   
00053 private: 
00054   std::list<SFMatrix34f> _matrixStack;
00055   std::vector<SFMatrix34f> _matrixVector;
00056   std::vector<Mesh *> _meshVector;
00057   bool _selectionMode;
00058   bool _oneColorPerMesh;
00059 };
00060 
00061 }
00062 }
00063 
00064 #endif

Generated on Thu Dec 4 13:25:46 2003 for X3DToolKit by doxygen1.2.18