Browse Source

Added AABBTreeBuilder::Node::GetChild helper function

Jorrit Rouwe 2 months ago
parent
commit
728b6324a6
1 changed files with 3 additions and 0 deletions
  1. 3 0
      Jolt/AABBTree/AABBTreeBuilder.h

+ 3 - 0
Jolt/AABBTree/AABBTreeBuilder.h

@@ -50,6 +50,9 @@ public:
 		/// Check if this node has any children
 		/// Check if this node has any children
 		inline bool			HasChildren() const						{ return mChild[0] != cInvalidNodeIndex || mChild[1] != cInvalidNodeIndex; }
 		inline bool			HasChildren() const						{ return mChild[0] != cInvalidNodeIndex || mChild[1] != cInvalidNodeIndex; }
 
 
+		/// Get child node
+		inline const Node * GetChild(uint inIdx, const Array<Node> &inNodes) const { return mChild[inIdx] != cInvalidNodeIndex? &inNodes[mChild[inIdx]] : nullptr; }
+
 		/// Min depth of tree
 		/// Min depth of tree
 		uint				GetMinDepth(const Array<Node> &inNodes) const;
 		uint				GetMinDepth(const Array<Node> &inNodes) const;