Add backface culling and option to keep unflipped hit normal in case a ray hits a back-facing triangle.

Usage: set RayResultCallback.m_flags to kF_FilterBackfaces, optionally combined with kF_KeepUnflippedNormal.
Thanks Andy O'Neil for the patch!

Remove the force_inline for some internal constraint solver methods, it makes re-use easier.
Workaround/avoid MSVC 2005 compiler error in LibXML/trionan.c
This commit is contained in:
erwin.coumans
2009-02-28 01:25:23 +00:00
parent a216ce4bf6
commit 210fe36106
6 changed files with 48 additions and 14 deletions

View File

@@ -29,9 +29,20 @@ public:
btVector3 m_from;
btVector3 m_to;
//@BP Mod - allow backface filtering and unflipped normals
enum EFlags
{
kF_None = 0,
kF_FilterBackfaces = 1 << 0,
kF_KeepUnflippedNormal = 1 << 1, // Prevents returned face normal getting flipped when a ray hits a back-facing triangle
kF_Terminator = 0xFFFFFFFF
};
unsigned int m_flags;
btScalar m_hitFraction;
btTriangleRaycastCallback(const btVector3& from,const btVector3& to);
btTriangleRaycastCallback(const btVector3& from,const btVector3& to, unsigned int flags=0);
virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex);