![]() |
Tulip
4.6.0
Better Visualization Through Research
|
00001 /* 00002 * 00003 * This file is part of Tulip (www.tulip-software.org) 00004 * 00005 * Authors: David Auber and the Tulip development Team 00006 * from LaBRI, University of Bordeaux 00007 * 00008 * Tulip is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License 00010 * as published by the Free Software Foundation, either version 3 00011 * of the License, or (at your option) any later version. 00012 * 00013 * Tulip is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 * See the GNU General Public License for more details. 00017 * 00018 */ 00019 00020 #ifndef GLGLYPHRENDERER_H 00021 #define GLGLYPHRENDERER_H 00022 00023 #include <tulip/Coord.h> 00024 #include <tulip/Size.h> 00025 #include <tulip/Color.h> 00026 #include <tulip/Node.h> 00027 #include <tulip/Edge.h> 00028 00029 #include <vector> 00030 00031 namespace tlp { 00032 00033 class GlGraphInputData; 00034 class GlShaderProgram; 00035 class Glyph; 00036 class EdgeExtremityGlyph; 00037 class GlBox; 00038 00039 struct TLP_GL_SCOPE NodeGlyphData { 00040 00041 NodeGlyphData() {} 00042 00043 NodeGlyphData(Glyph *glyph, node n, float lod, const Coord &nodePos, const Size &nodeSize, float nodeRot, bool selected) : 00044 glyph(glyph), n(n), lod(lod), nodePos(nodePos), nodeSize(nodeSize), nodeRot(nodeRot), selected(selected) {} 00045 00046 Glyph *glyph; 00047 node n; 00048 float lod; 00049 Coord nodePos; 00050 Size nodeSize; 00051 float nodeRot; 00052 bool selected; 00053 00054 }; 00055 00056 struct TLP_GL_SCOPE EdgeExtremityGlyphData { 00057 00058 EdgeExtremityGlyphData() {} 00059 00060 EdgeExtremityGlyphData(EdgeExtremityGlyph *glyph, edge e, node source, 00061 Color glyphColor, Color glyphBorderColor, float lod, 00062 Coord beginAnchor, Coord srcAnchor, Size size, bool selected) : 00063 glyph(glyph), e(e), source(source), glyphColor(glyphColor), glyphBorderColor(glyphBorderColor), 00064 lod(lod), beginAnchor(beginAnchor), srcAnchor(srcAnchor), size(size), selected(selected) {} 00065 00066 EdgeExtremityGlyph *glyph; 00067 edge e; 00068 node source; 00069 Color glyphColor; 00070 Color glyphBorderColor; 00071 float lod; 00072 Coord beginAnchor; 00073 Coord srcAnchor; 00074 Size size; 00075 bool selected; 00076 00077 }; 00078 00079 class TLP_GL_SCOPE GlGlyphRenderer { 00080 00081 public: 00082 00083 GlGlyphRenderer(GlGraphInputData *inputData) : 00084 _inputData(inputData), _renderingStarted(false) {} 00085 00086 void startRendering(); 00087 00088 bool renderingHasStarted(); 00089 00090 void addNodeGlyphRendering(Glyph *glyph, node n, float lod, const Coord &nodePos, 00091 const Size &nodeSize, float nodeRot, bool selected); 00092 00093 void addEdgeExtremityGlyphRendering(EdgeExtremityGlyph *glyph, edge e, node source, 00094 Color glyphColor, Color glyphBorderColor, float lod, 00095 Coord beginAnchor, Coord srcAnchor, Size size, bool selected); 00096 00097 void endRendering(); 00098 00099 private: 00100 00101 GlGraphInputData *_inputData; 00102 bool _renderingStarted; 00103 std::vector<NodeGlyphData> _nodeGlyphsToRender; 00104 std::vector<EdgeExtremityGlyphData> _edgeExtremityGlyphsToRender; 00105 static GlShaderProgram *_glyphShader; 00106 static GlBox* _selectionBox; 00107 00108 }; 00109 00110 } 00111 00112 #endif // GLYPHRENDERER_H