Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_TREENODEOBB_H__
00009 #define __SP_TREENODEOBB_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013 #include "Base/spTreeNode.hpp"
00014
00015
00016 namespace sp
00017 {
00018 namespace scene
00019 {
00020
00021
00023 class SP_EXPORT OBBTreeNode : public TreeNode
00024 {
00025
00026 public:
00027
00028 OBBTreeNode(OBBTreeNode* Parent = 0, const dim::obbox3df &Box = dim::obbox3df());
00029 ~OBBTreeNode();
00030
00031
00032
00033 bool isLeaf() const;
00034
00035 const TreeNode* findLeaf(const dim::vector3df &Point) const;
00036 void findLeafList(std::list<const TreeNode*> &TreeNodeList, const dim::vector3df &Point, f32 Radius) const;
00037 void findLeafList(std::list<const TreeNode*> &TreeNodeList, const dim::line3df &Line) const;
00038 void findLeafList(std::list<const TreeNode*> &TreeNodeList, const dim::line3df &Line, f32 Radius) const;
00039
00046 OBBTreeNode* insertBoundingBox(const dim::obbox3df &Box);
00047
00049 bool insertBoundingBox(OBBTreeNode* Node);
00050
00052 void setBox(const dim::obbox3df &Box);
00053
00055 void update(bool UpdateChildren = true);
00056
00057
00058
00060 inline const std::list<TreeNode*>& getChildren() const
00061 {
00062 return Children_;
00063 }
00064
00066 inline dim::obbox3df getBox() const
00067 {
00068 return Box_;
00069 }
00070
00071 private:
00072
00073
00074
00075 OBBTreeNode* createChild(const dim::obbox3df &Box);
00076
00077 void removeFromParent();
00078 void insertThisUpper(OBBTreeNode* Parent);
00079
00080
00081
00082 inline OBBTreeNode* addChild(OBBTreeNode* Child)
00083 {
00084 Children_.push_back(Child);
00085 return Child;
00086 }
00087
00088
00089
00090 std::list<TreeNode*> Children_;
00091
00092 dim::obbox3df Box_;
00093 dim::matrix4f InvBoxTransformation_;
00094
00095 };
00096
00097
00098 }
00099
00100 }
00101
00102
00103 #endif
00104
00105
00106
00107