Tulip  4.2.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
GlGraphLowDetailsRenderer.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef Tulip_GLGRAPHLOWDETAILSRENDERER_H
22 #define Tulip_GLGRAPHLOWDETAILSRENDERER_H
23 
24 #include <tulip/GlGraphRenderer.h>
25 
26 #include <vector>
27 
28 #include <tulip/Observable.h>
29 
30 #include <tulip/GlGraphRenderingParameters.h>
31 #include <tulip/GlGraphInputData.h>
32 #include <tulip/GlNode.h>
33 #include <tulip/GlEdge.h>
34 #include <tulip/GlQuadTreeLODCalculator.h>
35 #include <tulip/GlScene.h>
36 
37 namespace tlp {
38 
39 class Graph;
40 
41 /** \brief Class to display graph with very simple and very fast renderer
42  *
43  * Very high performance renderer
44  * This class display graph with :
45  * - Nodes : quads
46  * - Edges : lines
47  * Warning : this renderer doesn't work for selection
48  *
49  * See GlGraphRenderer documentation for functions documentations
50  */
51 class TLP_GL_SCOPE GlGraphLowDetailsRenderer : public GlGraphRenderer, public Observable {
52 
53 public:
54 
55  GlGraphLowDetailsRenderer(const GlGraphInputData *inputData);
56 
57  ~GlGraphLowDetailsRenderer();
58 
59  virtual void draw(float lod,Camera* camera);
60 
61  void initSelectionRendering(RenderingEntitiesFlag ,std::map<unsigned int, SelectedEntity> &,unsigned int &) {
62  assert (false);
63  }
64 
65 protected:
66 
67  void initEdgesArray();
68  void initTexArray(unsigned int glyph, Vec2f tex[4]);
69  void initNodesArray();
70 
71  void addObservers();
72  void removeObservers();
73  void updateObservers();
74  void treatEvent(const Event &ev);
75 
76  GlScene *fakeScene;
77 
78  bool buildVBO;
79 
80  std::vector<Vec2f> points;
81  std::vector<Color> colors;
82  std::vector<GLuint> indices;
83 
84  std::vector<Vec2f> quad_points;
85  std::vector<Color> quad_colors;
86  std::vector<GLuint> quad_indices;
87 
88  Graph *observedGraph;
89  LayoutProperty *observedLayoutProperty;
90  ColorProperty *observedColorProperty;
91  SizeProperty *observedSizeProperty;
92  BooleanProperty *observedSelectionProperty;
93 };
94 }
95 
96 #endif
97 ///@endcond