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 reserveMemoryForGraphElts(
unsigned int nbNodes,
unsigned int nbEdges)
override;
81 void setInputData(GlGraphInputData *inputData);
86 inline bool renderingIsBegin() {
98 void setHaveToComputeAll(
bool compute);
102 void setHaveToComputeLayout(
bool compute);
106 void setHaveToComputeColor(
bool compute);
112 void beginRendering();
123 void pauseRendering(
bool pause);
128 void activate(
bool act);
137 void activateLineEdgeDisplay(GlEdge *edge,
bool selected);
141 void activateQuadEdgeDisplay(GlEdge *edge,
bool selected);
145 void activatePointEdgeDisplay(GlEdge *edge,
bool selected);
149 void activatePointNodeDisplay(GlNode *node,
bool selected);
153 void treatEvent(
const Event &)
override;
155 void clearLayoutData();
156 void clearColorData();
158 void initObservers();
159 void clearObservers(PropertyInterface *deletedProperty =
nullptr);
161 GlGraphInputData *inputData;
164 LayoutProperty *layoutProperty;
165 SizeProperty *sizeProperty;
166 IntegerProperty *shapeProperty;
167 DoubleProperty *rotationProperty;
168 ColorProperty *colorProperty;
169 ColorProperty *borderColorProperty;
170 DoubleProperty *borderWidthProperty;
171 IntegerProperty *srcAnchorShapeProperty;
172 IntegerProperty *tgtAnchorShapeProperty;
173 SizeProperty *srcAnchorSizeProperty;
174 SizeProperty *tgtAnchorSizeProperty;
175 bool graphObserverActivated;
176 bool layoutObserverActivated;
177 bool colorObserverActivated;
182 bool toComputeLayout;
185 bool vectorLayoutSizeInit;
186 bool vectorColorSizeInit;
189 bool colorInterpolate;
190 bool sizeInterpolate;
193 std::vector<Coord> linesCoordsArray;
194 std::vector<Color> linesColorsArray;
196 std::vector<GLuint> linesRenderingIndicesArray;
197 std::vector<GLuint> linesSelectedRenderingIndicesArray;
199 std::vector<Coord> quadsCoordsArray;
200 std::vector<Color> quadsColorsArray;
201 std::vector<Color> quadsOutlineColorsArray;
203 std::vector<GLuint> quadsRenderingIndicesArray;
204 std::vector<GLuint> quadsSelectedRenderingIndicesArray;
206 std::map<float, std::vector<GLuint>> quadsOutlineRenderingIndicesArray;
207 std::map<float, std::vector<GLuint>> quadsSelectedOutlineRenderingIndicesArray;
209 std::vector<Coord> pointsCoordsArray;
210 std::vector<Color> pointsColorsArray;
212 std::vector<GLuint> pointsNodesRenderingIndexArray;
213 std::vector<GLuint> pointsNodesSelectedRenderingIndexArray;
214 std::vector<GLuint> pointsEdgesRenderingIndexArray;
215 std::vector<GLuint> pointsEdgesSelectedRenderingIndexArray;
218 unsigned int nbVertices;
219 unsigned int linesIndex;
220 unsigned int nbQuadVertices;
221 unsigned int quadsIndex;
222 std::vector<GLuint> quadsBottom;
223 std::vector<GLuint> quadsTop;
224 void init(
unsigned int nv,
unsigned int li,
unsigned int nqv,
unsigned int qi) {
227 nbQuadVertices = nqv;
229 quadsBottom.resize(nqv / 2);
230 quadsTop.resize(nqv / 2);
234 std::vector<edgeInfos> edgeInfosVector;
236 GLuint pointsVerticesVBO;
237 GLuint pointsColorsVBO;
238 GLuint linesVerticesVBO;
239 GLuint linesColorsVBO;
240 GLuint quadsVerticesVBO;
241 GLuint quadsColorsVBO;
242 GLuint quadsOutlineColorsVBO;
244 bool pointsVerticesUploaded;
245 bool pointsColorsUploaded;
246 bool linesVerticesUploaded;
247 bool linesColorsUploaded;
248 bool quadsVerticesUploaded;
249 bool quadsColorsUploaded;
250 bool quadsOutlineColorsUploaded;
252 bool verticesUploadNeeded;
253 bool colorsUploadNeeded;
PropertyInterface describes the interface of a graph property.