00001 #ifndef MESH_DRAWER_H 00002 #define MESH_DRAWER_H 00003 00004 #include "MESH_DrawerStateVariables.h" 00005 00006 #include <X3DTK/kernel.h> 00007 #include <X3DTK/MESH/scenegraph.h> 00008 00009 namespace X3DTK { 00010 00011 enum SelectedType {NOTHING, VERTICES, EDGES, FACES}; 00012 00013 namespace MESH { 00014 00015 // Processor drawing the mesh from the Mesh scene graph. 00016 00017 class Drawer : public X3DOnePassProcessor 00018 { 00019 public: 00020 Drawer(); 00021 virtual ~Drawer(); 00022 00023 void changeDrawPoints(); 00024 void changeDrawEdges(); 00025 void changeDrawFaces(); 00026 inline void changeOneColorPerMesh() {stateVariables->changeOneColorPerMesh();}; 00027 00028 void setSelectedType(SelectedType selectedType); 00029 void setSelectedMesh(int selectedMesh); 00030 void setSelectedId(int selectedId); 00031 00032 inline SelectedType getSelectedType() const {return selectedType;}; 00033 inline int getSelectedMesh() const {return selectedMesh;}; 00034 inline int getSelectedId() const {return selectedId;}; 00035 00036 void drawMesh(X3DNode *N, bool selection = false); 00037 void drawSelected(); 00038 00039 protected: 00040 DrawerStateVariables *stateVariables; 00041 00042 bool drawPoints, drawEdges, drawFaces; 00043 SelectedType selectedType; 00044 int selectedMesh; 00045 int selectedId; 00046 00047 // Draw methods. 00048 void drawVertex(const SFVertex *vertex); 00049 void drawEdge(SFEdge *edge); 00050 void drawFace(const SFFace *face); 00051 }; 00052 00053 } 00054 } 00055 00056 #endif 00057