21 #ifndef Tulip_GLLODCALCULATOR_H
22 #define Tulip_GLLODCALCULATOR_H
23 #ifndef DOXYGEN_NOTFOR_DEVEL
25 #include <tulip/BoundingBox.h>
35 class GlGraphInputData;
37 enum RenderingEntitiesFlag {
38 RenderingSimpleEntities =1,
42 RenderingWithoutRemove = 8
45 struct EntityLODUnit {
46 EntityLODUnit(
const BoundingBox &boundingBox):boundingBox(boundingBox),lod(-1) {}
47 BoundingBox boundingBox;
52 struct SimpleEntityLODUnit :
public EntityLODUnit {
53 SimpleEntityLODUnit(GlSimpleEntity *entity,
const BoundingBox &boundingBox):
54 EntityLODUnit(boundingBox),
57 GlSimpleEntity *entity;
61 struct ComplexEntityLODUnit :
public EntityLODUnit {
62 ComplexEntityLODUnit(
unsigned int id,
const BoundingBox &boundingBox):EntityLODUnit(boundingBox),id(id) {}
67 std::vector<SimpleEntityLODUnit> simpleEntitiesLODVector;
68 std::vector<ComplexEntityLODUnit> nodesLODVector;
69 std::vector<ComplexEntityLODUnit> edgesLODVector;
73 typedef std::vector<LayerLODUnit> LayersLODVector;
78 class TLP_GL_SCOPE GlLODCalculator {
82 GlLODCalculator():glScene(NULL),inputData(NULL),attachedLODCalculator(NULL) {}
83 virtual ~GlLODCalculator() {}
84 virtual GlLODCalculator *clone()=0;
89 virtual void setScene(GlScene &scene) {
96 virtual void setInputData(
const GlGraphInputData *inputData) {
97 this->inputData=inputData;
103 virtual void setRenderingEntitiesFlag(RenderingEntitiesFlag flag) {
104 renderingEntitiesFlag=flag;
110 virtual bool needEntities() {
116 virtual void setNeedEntities(
bool) {}
120 virtual void beginNewCamera(Camera* camera)=0;
124 virtual void addSimpleEntityBoundingBox(GlSimpleEntity *entity,
const BoundingBox& bb)=0;
128 virtual void addNodeBoundingBox(
unsigned int id,
const BoundingBox& bb)=0;
132 virtual void addEdgeBoundingBox(
unsigned int id,
const BoundingBox& bb)=0;
137 virtual void reserveMemoryForNodes(
unsigned int) {}
142 virtual void reserveMemoryForEdges(
unsigned int) {}
147 virtual void compute(
const Vector<int,4>& globalViewport,
const Vector<int,4>& currentViewport)=0;
152 LayersLODVector &getResult() {
153 return layersLODVector;
159 virtual void clear() {
160 layersLODVector.clear();
163 virtual BoundingBox getSceneBoundingBox()=0;
165 void setAttachedLODCalculator(GlLODCalculator *calculator) {
166 attachedLODCalculator=calculator;
172 const GlGraphInputData *inputData;
174 RenderingEntitiesFlag renderingEntitiesFlag;
176 LayersLODVector layersLODVector;
178 GlLODCalculator *attachedLODCalculator;
183 #endif // DOXYGEN_NOTFOR_DEVEL
185 #endif // Tulip_GLLODCALCULATOR_H