Oct tree (or rather OcTree) node class used for collision detection and intersection optimization. More...
#include <spTreeNodeOct.hpp>
Public Member Functions | |
| OcTreeNode (TreeNode *Parent=0) | |
| ~OcTreeNode () | |
| bool | isLeaf () const |
| Returns true if this is a leaf node. In this case it has no children. | |
| void | addChildren () |
| Creates the children if it currently has none. | |
| void | removeChildren () |
| Deletes the children if it currently has some. | |
| void | createTree (Mesh *Model, s8 ForksCount=DEF_TREENODE_FORKSCOUNT) |
| void | createTree (const std::list< SceneNode * > &NodeList, s8 ForksCount=DEF_TREENODE_FORKSCOUNT) |
| void | findTreeNodes (std::list< const OcTreeNode * > &TreeNodeList, const dim::vector3df &Pos) const |
| void | findTreeNodes (std::list< const OcTreeNode * > &TreeNodeList, const dim::vector3df &Pos, const dim::vector3df &Radius) const |
| void | findTreeNodes (std::list< const OcTreeNode * > &TreeNodeList, const dim::line3df &Ray) const |
| OcTreeNode * | getChild (u32 Index) const |
| Returns pointer the the specified OcTreeNode child object (index must be in a range of [0, 7]). | |
Oct tree (or rather OcTree) node class used for collision detection and intersection optimization.
| sp::scene::OcTreeNode::OcTreeNode | ( | TreeNode * | Parent = 0 |
) |
| sp::scene::OcTreeNode::~OcTreeNode | ( | ) |
| void sp::scene::OcTreeNode::addChildren | ( | ) | [virtual] |
Creates the children if it currently has none.
Reimplemented from sp::scene::TreeNode.
Creates a complete tree for a Mesh object with the specified count of forks. By this creation the tree nodes' user data will be "std::list<STreeNodeTriangleData>*".
| Model,: | Pointer to the Mesh object for which the tree is to be created. | |
| ForksCount,: | Count of forks the tree shall has. If the count is 0 only one OcTreeNode object will be created. This would be pointless for optimization purposes. By default the count amounts 3. It can not be greater than 8 because this will occurs a tree with 8^8 (16.777.216) tree nodes! |
| void sp::scene::OcTreeNode::createTree | ( | const std::list< SceneNode * > & | NodeList, | |
| s8 | ForksCount = DEF_TREENODE_FORKSCOUNT | |||
| ) |
Creates a complete tree for the Node objects with the specified count of forks. By this creation the tree nodes' user data will be "std::list<SceneNode*>*". This function does not effect the Node objects but it will result a tree hierarchy where the Node objects are sorted by their position.
| NodeList,: | List of all Node objects which shall be placed into a tree hierarchy. | |
| ForksCount,: | Count of forks the tree shall has. |
| void sp::scene::OcTreeNode::findTreeNodes | ( | std::list< const OcTreeNode * > & | TreeNodeList, | |
| const dim::vector3df & | Pos, | |||
| const dim::vector3df & | Radius | |||
| ) | const |
Does the same like the first "findTreeNodes" function but considers the radius which occurs that sometimes more than one tree node can be found.
| void sp::scene::OcTreeNode::findTreeNodes | ( | std::list< const OcTreeNode * > & | TreeNodeList, | |
| const dim::line3df & | Ray | |||
| ) | const |
Searchs each oct node where the specified line intersects with. Only those oct nodes are searched which have no children. This function is used for mesh picking.
| TreeNodeList,: | Resulting list with all found OcTreeNode objects. | |
| Ray,: | Intersection ray (or rather line). |
| void sp::scene::OcTreeNode::findTreeNodes | ( | std::list< const OcTreeNode * > & | TreeNodeList, | |
| const dim::vector3df & | Pos | |||
| ) | const |
Searchs each oct node where the specified position is inside. Only those oct nodes are searched which have no children.
| TreeNodeList,: | Resulting list with all found OcTreeNode objects. This must be a reference and no function's return value because it will be called recursive for each next tree node child. |
| OcTreeNode* sp::scene::OcTreeNode::getChild | ( | u32 | Index | ) | const [inline] |
Returns pointer the the specified OcTreeNode child object (index must be in a range of [0, 7]).
| bool sp::scene::OcTreeNode::isLeaf | ( | ) | const [virtual] |
Returns true if this is a leaf node. In this case it has no children.
Implements sp::scene::TreeNode.
| void sp::scene::OcTreeNode::removeChildren | ( | ) | [virtual] |
Deletes the children if it currently has some.
Reimplemented from sp::scene::TreeNode.
1.7.1