21 #ifndef Tulip_GLLODCALCULATOR_H
22 #define Tulip_GLLODCALCULATOR_H
23 #ifndef DOXYGEN_NOTFOR_DEVEL
25 #include <tulip/tulipconf.h>
27 #include <tulip/Matrix.h>
28 #include <tulip/Vector.h>
29 #include <tulip/BoundingBox.h>
37 class GlGraphInputData;
39 enum RenderingEntitiesFlag {
40 RenderingSimpleEntities =1,
44 RenderingWithoutRemove = 8
47 struct EntityLODUnit {
48 EntityLODUnit(
const BoundingBox &boundingBox):boundingBox(boundingBox),lod(-1) {}
49 BoundingBox boundingBox;
54 struct SimpleEntityLODUnit :
public EntityLODUnit {
55 SimpleEntityLODUnit(GlSimpleEntity *entity,
const BoundingBox &boundingBox):
56 EntityLODUnit(boundingBox),
59 GlSimpleEntity *entity;
63 struct ComplexEntityLODUnit :
public EntityLODUnit {
64 ComplexEntityLODUnit(
unsigned int id,
const BoundingBox &boundingBox):EntityLODUnit(boundingBox),id(id) {}
69 std::vector<SimpleEntityLODUnit> simpleEntitiesLODVector;
70 std::vector<ComplexEntityLODUnit> nodesLODVector;
71 std::vector<ComplexEntityLODUnit> edgesLODVector;
75 typedef std::vector<LayerLODUnit> LayersLODVector;
80 class TLP_GL_SCOPE GlLODCalculator {
84 GlLODCalculator():glScene(NULL),inputData(NULL),attachedLODCalculator(NULL) {}
85 virtual ~GlLODCalculator() {}
86 virtual GlLODCalculator *clone()=0;
91 virtual void setScene(GlScene &scene) {
98 virtual void setInputData(
const GlGraphInputData *inputData) {
99 this->inputData=inputData;
105 virtual void setRenderingEntitiesFlag(RenderingEntitiesFlag flag) {
106 renderingEntitiesFlag=flag;
112 virtual bool needEntities() {
118 virtual void setNeedEntities(
bool) {}
122 virtual void beginNewCamera(Camera* camera)=0;
126 virtual void addSimpleEntityBoundingBox(GlSimpleEntity *entity,
const BoundingBox& bb)=0;
130 virtual void addNodeBoundingBox(
unsigned int id,
const BoundingBox& bb)=0;
134 virtual void addEdgeBoundingBox(
unsigned int id,
const BoundingBox& bb)=0;
139 virtual void reserveMemoryForNodes(
unsigned int) {}
144 virtual void reserveMemoryForEdges(
unsigned int) {}
149 virtual void compute(
const Vector<int,4>& globalViewport,
const Vector<int,4>& currentViewport)=0;
154 LayersLODVector &getResult() {
155 return layersLODVector;
161 virtual void clear() {
162 layersLODVector.clear();
165 virtual BoundingBox getSceneBoundingBox()=0;
167 void setAttachedLODCalculator(GlLODCalculator *calculator) {
168 attachedLODCalculator=calculator;
174 const GlGraphInputData *inputData;
176 RenderingEntitiesFlag renderingEntitiesFlag;
178 LayersLODVector layersLODVector;
180 GlLODCalculator *attachedLODCalculator;
185 #endif // DOXYGEN_NOTFOR_DEVEL
187 #endif // Tulip_GLLODCALCULATOR_H