Tulip  5.2.1
Large graphs analysis and drawing
GlGraphLowDetailsRenderer.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
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/OpenGlIncludes.h>
25 
26 #include <vector>
27 
28 #include <tulip/Observable.h>
29 #include <tulip/GlGraphRenderer.h>
30 
31 namespace tlp {
32 
33 class Graph;
34 class GlScene;
35 class LayoutProperty;
36 class ColorProperty;
37 class SizeProperty;
38 class BooleanProperty;
39 
40 /** \brief Class to display graph with very simple and very fast renderer
41  *
42  * Very high performance renderer
43  * This class display graph with :
44  * - Nodes : quads
45  * - Edges : lines
46  * Warning : this renderer doesn't work for selection
47  *
48  * See GlGraphRenderer documentation for functions documentations
49  */
50 class TLP_GL_SCOPE GlGraphLowDetailsRenderer : public GlGraphRenderer, public Observable {
51 
52 public:
53  GlGraphLowDetailsRenderer(const GlGraphInputData *inputData);
54 
55  ~GlGraphLowDetailsRenderer() override;
56 
57  void draw(float lod, Camera *camera) override;
58 
59  void initSelectionRendering(RenderingEntitiesFlag, std::map<unsigned int, SelectedEntity> &,
60  unsigned int &) {
61  assert(false);
62  }
63 
64 protected:
65  void initEdgesArray();
66  void initTexArray(unsigned int glyph, Vec2f tex[4]);
67  void initNodesArray();
68 
69  void addObservers();
70  void removeObservers();
71  void updateObservers();
72  void treatEvent(const Event &ev) override;
73 
74  GlScene *fakeScene;
75 
76  bool buildVBO;
77 
78  std::vector<Vec2f> points;
79  std::vector<Color> colors;
80  std::vector<GLuint> indices;
81 
82  std::vector<Vec2f> quad_points;
83  std::vector<Color> quad_colors;
84  std::vector<GLuint> quad_indices;
85 
86  Graph *observedGraph;
87  LayoutProperty *observedLayoutProperty;
88  ColorProperty *observedColorProperty;
89  SizeProperty *observedSizeProperty;
90  BooleanProperty *observedSelectionProperty;
91 };
92 } // namespace tlp
93 
94 #endif
95 ///@endcond