add support for generic concave shapes for convex cast.

minor improvement in ray cast demo.
Thanks John McCutchan (JMC)
This commit is contained in:
ejcoumans
2007-12-07 19:21:16 +00:00
parent 9447dfdcfb
commit a4bc26544c
3 changed files with 75 additions and 9 deletions

View File

@@ -967,13 +967,20 @@ void btOptimizedBvh::reportRayOverlappingNodex (btNodeOverlapCallback* nodeCallb
void btOptimizedBvh::reportBoxCastOverlappingNodex(btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget, const btVector3& aabbMin,const btVector3& aabbMax) const
{
bool supported = m_useQuantization && m_traversalMode == TRAVERSAL_STACKLESS;
if (supported)
bool fast_path = m_useQuantization && m_traversalMode == TRAVERSAL_STACKLESS;
if (fast_path)
{
walkStacklessQuantizedTreeAgainstRay(nodeCallback, raySource, rayTarget, aabbMin, aabbMax, 0, m_curNodeIndex);
} else {
//not yet, please implement different paths
btAssert("Box cast on this type of Bvh Tree is not supported yet" && 0);
/* Slow path:
Construct the bounding box for the entire box cast and send that down the tree */
btVector3 qaabbMin = raySource;
btVector3 qaabbMax = raySource;
qaabbMin.setMin(rayTarget);
qaabbMax.setMax(rayTarget);
qaabbMin += aabbMin;
qaabbMax += aabbMax;
reportAabbOverlappingNodex(nodeCallback,qaabbMin,qaabbMax);
}
}