X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fscene%2Futil%2FQuadTreeBuilder.hxx;h=ff16fb46f1da543f4bbab6a0346fb43d07961161;hb=4b63bc051e701835a12f6f1eca5437b6abd58593;hp=6a0e2dd1992f38a4146cc8c16bb72245527078bb;hpb=a098ba5e79e281aa6f5438f943e300eed0691f0b;p=simgear.git diff --git a/simgear/scene/util/QuadTreeBuilder.hxx b/simgear/scene/util/QuadTreeBuilder.hxx index 6a0e2dd1..ff16fb46 100644 --- a/simgear/scene/util/QuadTreeBuilder.hxx +++ b/simgear/scene/util/QuadTreeBuilder.hxx @@ -22,23 +22,28 @@ #include #include #include +#include + +#define QUAD_TREE_LEAVES 4 namespace simgear { +typedef std::map,int> LodMap; + // Create a quad tree based on x, y extents class QuadTreeBuilder { public: QuadTreeBuilder(const osg::Vec2& min, const osg::Vec2& max); ~QuadTreeBuilder() {} osg::Group* getRoot() { return _root.get(); } - // Add node to the quadtree using its x, y - void addNode(osg::Node* node, const osg::Matrix& transform); - // Make a quadtree of nodes from a vector of nodes - static osg::Group* makeQuadTree(std::vector >& nodes, + // Add node to the quadtree using its x, y and LoD + void addNode(osg::Node* node, int lod, const osg::Matrix& transform); + // Make a quadtree of nodes from a map of nodes and LOD values + static osg::Group* makeQuadTree(LodMap& nodes, const osg::Matrix& transform); protected: osg::ref_ptr _root; - osg::Group* _leaves[4][4]; + osg::LOD* _leaves[QUAD_TREE_LEAVES][QUAD_TREE_LEAVES]; osg::Vec2 _min; osg::Vec2 _max; };