00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef BVHGroup_hxx
00019 #define BVHGroup_hxx
00020
00021 #include <simgear/structure/SGSharedPtr.hxx>
00022 #include "BVHNode.hxx"
00023 #include "BVHVisitor.hxx"
00024
00025 namespace simgear {
00026
00027 class BVHGroup : public BVHNode {
00028 public:
00029 BVHGroup();
00030 virtual ~BVHGroup();
00031
00032 virtual void accept(BVHVisitor& visitor);
00033
00034 void traverse(BVHVisitor& visitor)
00035 {
00036 ChildList::const_iterator i;
00037 for (i = _children.begin(); i != _children.end(); ++i)
00038 (*i)->accept(visitor);
00039 }
00040
00041 void clear();
00042 void addChild(BVHNode* child);
00043 void removeChild(BVHNode* child);
00044
00045 unsigned getNumChildren() const
00046 { return _children.size(); }
00047 const BVHNode* getChild(unsigned i) const
00048 { if (_children.size() <= i) return 0; return _children[i]; }
00049 BVHNode* getChild(unsigned i)
00050 { if (_children.size() <= i) return 0; return _children[i]; }
00051
00052 virtual SGSphered computeBoundingSphere() const;
00053
00054 private:
00055 typedef std::vector<SGSharedPtr<BVHNode> > ChildList;
00056 ChildList _children;
00057 };
00058
00059 }
00060
00061 #endif