21 #ifndef Tulip_QLQUADTREELODCALCULATOR_H
22 #define Tulip_QLQUADTREELODCALCULATOR_H
27 #include <tulip/GlCPULODCalculator.h>
28 #include <tulip/Observable.h>
29 #include <tulip/GlGraphRenderingParameters.h>
34 template <
class TYPE>
class QuadTreeNode;
36 class PropertyInterface;
43 class TLP_GL_SCOPE GlQuadTreeLODCalculator :
public GlCPULODCalculator,
private Observable {
47 GlQuadTreeLODCalculator();
48 ~GlQuadTreeLODCalculator();
53 void setScene(GlScene &scene);
62 void setNeedEntities(
bool);
67 void addSimpleEntityBoundingBox(GlSimpleEntity * entity,
const BoundingBox& bb);
71 void addNodeBoundingBox(
unsigned int id,
const BoundingBox& bb);
75 void addEdgeBoundingBox(
unsigned int id,
const BoundingBox& bb);
82 void compute(
const Vector<int,4>& globalViewport,
const Vector<int,4>& currentViewport);
87 void computeFor3DCamera(LayerLODUnit *layerLODUnit,
const Coord &eye,
88 const Matrix<float, 4>& transformMatrix,
89 const Vector<int,4>& globalViewport,
90 const Vector<int,4>& currentViewport);
95 void setInputData(
const GlGraphInputData *newInputData);
100 virtual GlLODCalculator *clone() {
101 GlQuadTreeLODCalculator *newCalculator=
new GlQuadTreeLODCalculator();
102 newCalculator->setScene(*glScene);
103 newCalculator->setInputData(inputData);
104 return newCalculator;
109 void update(PropertyInterface *property);
110 void treatEvent(
const Event &ev);
112 void removeObservers();
115 void initCamerasObservers();
116 void clearCamerasObservers();
118 void setHaveToCompute();
120 std::vector<QuadTreeNode<unsigned int> *> nodesQuadTree;
121 std::vector<QuadTreeNode<unsigned int> *> edgesQuadTree;
122 std::vector<QuadTreeNode<GlSimpleEntity *> *> entitiesQuadTree;
123 std::vector<std::vector<SimpleEntityLODUnit> > simpleEntities;
126 bool haveToInitObservers;
128 BoundingBox nodesGlobalBoundingBox;
129 BoundingBox edgesGlobalBoundingBox;
130 BoundingBox entitiesGlobalBoundingBox;
132 std::vector<Camera *> cameras;
133 std::map<GlLayer*, Camera> layerToCamera;
134 Camera *currentCamera;
136 PropertyInterface *layoutProperty;
137 PropertyInterface *sizeProperty;
138 PropertyInterface *selectionProperty;
139 GlGraphRenderingParameters oldParameters;
141 int quadTreesVectorPosition;
142 int simpleEntitiesVectorPosition;
147 #endif // Tulip_QTQUADTREELODCALCULATOR_H