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>
39 class GlGraphInputData;
40 class PropertyInterface;
44 class IntegerProperty;
51 class TLP_GL_SCOPE GlVertexArrayManager :
public GlSceneVisitor,
private Observable {
58 GlVertexArrayManager(GlGraphInputData *inputData);
60 ~GlVertexArrayManager()
override;
65 void visit(GlSimpleEntity *)
override {}
70 void visit(GlNode *glNode)
override;
75 void visit(GlEdge *glEdge)
override;
77 void endOfVisit()
override;
79 void reserveMemoryForGraphElts(
unsigned int nbNodes,
unsigned int nbEdges)
override;
84 void setInputData(GlGraphInputData *inputData);
89 inline bool renderingIsBegin() {
101 void setHaveToComputeAll(
bool compute);
105 void setHaveToComputeLayout(
bool compute);
109 void setHaveToComputeColor(
bool compute);
115 void beginRendering();
126 void pauseRendering(
bool pause);
131 void activate(
bool act);
140 void activateLineEdgeDisplay(GlEdge *edge,
bool selected);
144 void activateQuadEdgeDisplay(GlEdge *edge,
bool selected);
148 void activatePointEdgeDisplay(GlEdge *edge,
bool selected);
152 void activatePointNodeDisplay(GlNode *node,
bool selected);
156 void treatEvent(
const Event &)
override;
158 void clearLayoutData();
159 void clearColorData();
161 void initObservers();
162 void clearObservers(PropertyInterface *deletedProperty =
nullptr);
164 GlGraphInputData *inputData;
167 LayoutProperty *layoutProperty;
168 SizeProperty *sizeProperty;
169 IntegerProperty *shapeProperty;
170 DoubleProperty *rotationProperty, *lengthRatioProperty;
171 ColorProperty *colorProperty;
172 ColorProperty *borderColorProperty;
173 DoubleProperty *borderWidthProperty;
174 IntegerProperty *srcAnchorShapeProperty;
175 IntegerProperty *tgtAnchorShapeProperty;
176 SizeProperty *srcAnchorSizeProperty;
177 SizeProperty *tgtAnchorSizeProperty;
178 bool graphObserverActivated;
179 bool layoutObserverActivated;
180 bool colorObserverActivated;
185 bool toComputeLayout;
188 bool vectorLayoutSizeInit;
189 bool vectorColorSizeInit;
192 bool colorInterpolate;
193 bool sizeInterpolate;
196 std::vector<Coord> linesCoordsArray;
197 std::vector<Color> linesColorsArray;
199 std::vector<GLuint> linesRenderingIndicesArray;
200 std::vector<GLuint> linesSelectedRenderingIndicesArray;
202 std::vector<Coord> quadsCoordsArray;
203 std::vector<Color> quadsColorsArray;
204 std::vector<Color> quadsOutlineColorsArray;
206 std::vector<GLuint> quadsRenderingIndicesArray;
207 std::vector<GLuint> quadsSelectedRenderingIndicesArray;
209 std::map<float, std::vector<GLuint>> quadsOutlineRenderingIndicesArray;
210 std::map<float, std::vector<GLuint>> quadsSelectedOutlineRenderingIndicesArray;
212 std::vector<Coord> pointsCoordsArray;
213 std::vector<Color> pointsColorsArray;
215 std::vector<GLuint> pointsNodesRenderingIndexArray;
216 std::vector<GLuint> pointsNodesSelectedRenderingIndexArray;
217 std::vector<GLuint> pointsEdgesRenderingIndexArray;
218 std::vector<GLuint> pointsEdgesSelectedRenderingIndexArray;
221 unsigned int linesIndex;
222 std::vector<Coord> lineVertices;
223 unsigned int quadsIndex;
224 std::vector<Coord> quadVertices;
225 std::vector<Color> lineColors;
226 std::vector<Color> quadColors;
227 Color edgeColor, borderColor;
230 std::vector<edgeInfos> edgeInfosVector;
232 GLuint pointsVerticesVBO;
233 GLuint pointsColorsVBO;
234 GLuint linesVerticesVBO;
235 GLuint linesColorsVBO;
236 GLuint quadsVerticesVBO;
237 GLuint quadsColorsVBO;
238 GLuint quadsOutlineColorsVBO;
240 bool pointsVerticesUploaded;
241 bool pointsColorsUploaded;
242 bool linesVerticesUploaded;
243 bool linesColorsUploaded;
244 bool quadsVerticesUploaded;
245 bool quadsColorsUploaded;
246 bool quadsOutlineColorsUploaded;
248 bool verticesUploadNeeded;
249 bool colorsUploadNeeded;
PropertyInterface describes the interface of a graph property.