21 #ifndef Tulip_GLVERTEXARRAYMANAGER_H 22 #define Tulip_GLVERTEXARRAYMANAGER_H 24 #include <tulip/OpenGlIncludes.h> 26 #include <tulip/Coord.h> 27 #include <tulip/Color.h> 28 #include <tulip/Observable.h> 29 #include <tulip/GlSceneVisitor.h> 38 class GlGraphInputData;
39 class PropertyInterface;
43 class IntegerProperty;
50 class TLP_GL_SCOPE GlVertexArrayManager :
public GlSceneVisitor,
private Observable {
57 GlVertexArrayManager(GlGraphInputData *inputData);
59 ~GlVertexArrayManager()
override;
64 void visit(GlSimpleEntity *)
override {}
69 void visit(GlNode *glNode)
override;
74 void visit(GlEdge *glEdge)
override;
76 void endOfVisit()
override;
78 void reserveMemoryForGraphElts(
unsigned int nbNodes,
unsigned int nbEdges)
override;
83 void setInputData(GlGraphInputData *inputData);
88 inline bool renderingIsBegin() {
100 void setHaveToComputeAll(
bool compute);
104 void setHaveToComputeLayout(
bool compute);
108 void setHaveToComputeColor(
bool compute);
114 void beginRendering();
125 void pauseRendering(
bool pause);
130 void activate(
bool act);
139 void activateLineEdgeDisplay(GlEdge *edge,
bool selected);
143 void activateQuadEdgeDisplay(GlEdge *edge,
bool selected);
147 void activatePointEdgeDisplay(GlEdge *edge,
bool selected);
151 void activatePointNodeDisplay(GlNode *node,
bool selected);
155 void treatEvent(
const Event &)
override;
157 void clearLayoutData();
158 void clearColorData();
160 void initObservers();
161 void clearObservers(PropertyInterface *deletedProperty =
nullptr);
163 GlGraphInputData *inputData;
166 LayoutProperty *layoutProperty;
167 SizeProperty *sizeProperty;
168 IntegerProperty *shapeProperty;
169 DoubleProperty *rotationProperty;
170 ColorProperty *colorProperty;
171 ColorProperty *borderColorProperty;
172 DoubleProperty *borderWidthProperty;
173 IntegerProperty *srcAnchorShapeProperty;
174 IntegerProperty *tgtAnchorShapeProperty;
175 SizeProperty *srcAnchorSizeProperty;
176 SizeProperty *tgtAnchorSizeProperty;
177 bool graphObserverActivated;
178 bool layoutObserverActivated;
179 bool colorObserverActivated;
184 bool toComputeLayout;
187 bool vectorLayoutSizeInit;
188 bool vectorColorSizeInit;
191 bool colorInterpolate;
192 bool sizeInterpolate;
195 std::vector<Coord> linesCoordsArray;
196 std::vector<Color> linesColorsArray;
198 std::vector<GLuint> linesRenderingIndicesArray;
199 std::vector<GLuint> linesSelectedRenderingIndicesArray;
201 std::vector<Coord> quadsCoordsArray;
202 std::vector<Color> quadsColorsArray;
203 std::vector<Color> quadsOutlineColorsArray;
205 std::vector<GLuint> quadsRenderingIndicesArray;
206 std::vector<GLuint> quadsSelectedRenderingIndicesArray;
208 std::map<float, std::vector<GLuint>> quadsOutlineRenderingIndicesArray;
209 std::map<float, std::vector<GLuint>> quadsSelectedOutlineRenderingIndicesArray;
211 std::vector<Coord> pointsCoordsArray;
212 std::vector<Color> pointsColorsArray;
214 std::vector<GLuint> pointsNodesRenderingIndexArray;
215 std::vector<GLuint> pointsNodesSelectedRenderingIndexArray;
216 std::vector<GLuint> pointsEdgesRenderingIndexArray;
217 std::vector<GLuint> pointsEdgesSelectedRenderingIndexArray;
220 unsigned int linesIndex;
221 std::vector<Coord> lineVertices;
222 unsigned int quadsIndex;
223 std::vector<Coord> quadVertices;
224 std::vector<Color> lineColors;
225 std::vector<Color> quadColors;
226 Color edgeColor, borderColor;
229 std::vector<edgeInfos> edgeInfosVector;
231 GLuint pointsVerticesVBO;
232 GLuint pointsColorsVBO;
233 GLuint linesVerticesVBO;
234 GLuint linesColorsVBO;
235 GLuint quadsVerticesVBO;
236 GLuint quadsColorsVBO;
237 GLuint quadsOutlineColorsVBO;
239 bool pointsVerticesUploaded;
240 bool pointsColorsUploaded;
241 bool linesVerticesUploaded;
242 bool linesColorsUploaded;
243 bool quadsVerticesUploaded;
244 bool quadsColorsUploaded;
245 bool quadsOutlineColorsUploaded;
247 bool verticesUploadNeeded;
248 bool colorsUploadNeeded;
PropertyInterface describes the interface of a graph property.