Game Development Reference
In-Depth Information
* Checks if this node is at the bottom of the hierarchy.
*/
bool isLeaf() const
{
return (body != NULL);
}
/**
* Checks the potential contacts from this node downward in
* the hierarchy, writing them to the given array (up to the
* given limit). Returns the number of potential contacts it
* found.
*/
unsigned getPotentialContacts(PotentialContact* contacts,
unsigned limit) const;
};
template<class BoundingVolumeClass>
bool BVHNode<BoundingVolumeClass>::overlaps(
const BVHNode<BoundingVolumeClass> * other
) const
{
return volume->overlaps(other->volume);
}
template<class BoundingVolumeClass>
unsigned BVHNode<BoundingVolumeClass>::getPotentialContacts(
PotentialContact* contacts, unsigned limit
) const
{
// Early out if we don't have the room for contacts, or
// if we're a leaf node.
if (isLeaf() || limit == 0) return 0;
// Get the potential contacts of one of our children with
// the other.
return children[0]->getPotentialContactsWith(
children[1], contacts, limit
);
}
template<class BoundingVolumeClass>
unsigned BVHNode<BoundingVolumeClass>::getPotentialContactsWith(
const BVHNode<BoundingVolumeClass> *other,
PotentialContact* contacts,
Search Nedrilad ::




Custom Search