[1378] | 1 | #ifndef NX_INTERSECTION_RAY_TRIANGLE
|
---|
| 2 | #define NX_INTERSECTION_RAY_TRIANGLE
|
---|
| 3 | /** \addtogroup physics
|
---|
| 4 | @{
|
---|
| 5 | */
|
---|
| 6 |
|
---|
| 7 | #include "Nxp.h"
|
---|
| 8 | #include "PhysXLoader.h"
|
---|
| 9 |
|
---|
| 10 | //namespace NxCollision
|
---|
| 11 | //{
|
---|
| 12 | /**
|
---|
| 13 | \brief Ray-triangle intersection test.
|
---|
| 14 |
|
---|
| 15 | Returns impact distance (t) as well as barycentric coordinates (u,v) of impact point.
|
---|
| 16 | Use NxComputeBarycentricPoint() in Foundation to compute the impact point from the barycentric coordinates.
|
---|
| 17 | The test performs back face culling or not according to 'cull'.
|
---|
| 18 |
|
---|
| 19 | \warning #NxCreatePhysicsSDK() must be called before using this function.
|
---|
| 20 |
|
---|
| 21 | \param[in] orig Origin of the ray. <b>Range:</b> position vector
|
---|
| 22 | \param[in] dir Direction of the ray. <b>Range:</b> direction vector
|
---|
| 23 | \param[in] vert0 First vertex of triangle. <b>Range:</b> position vector
|
---|
| 24 | \param[in] vert1 Second vertex of triangle. <b>Range:</b> position vector
|
---|
| 25 | \param[in] vert2 Third vertex of triangle. <b>Range:</b> position vector
|
---|
| 26 | \param[out] t Distance along the ray from the origin to the impact point.
|
---|
| 27 | \param[out] u Barycentric coordinate.
|
---|
| 28 | \param[out] v Barycentric coordinate.
|
---|
| 29 | \param[in] cull Cull backfaces.
|
---|
| 30 |
|
---|
| 31 | <b>Platform:</b>
|
---|
| 32 | \li PC SW: Yes
|
---|
| 33 | \li PPU : Yes
|
---|
| 34 | \li PS3 : Yes
|
---|
| 35 | \li XB360: Yes
|
---|
| 36 | */
|
---|
| 37 | NX_INLINE bool NX_CALL_CONV NxRayTriIntersect(const NxVec3& orig, const NxVec3& dir, const NxVec3& vert0, const NxVec3& vert1, const NxVec3& vert2, float& t, float& u, float& v, bool cull)
|
---|
| 38 | {
|
---|
| 39 | return NxGetUtilLib()->NxRayTriIntersect(orig,dir,vert0,vert1,vert2,t,u,v,cull);
|
---|
| 40 | }
|
---|
| 41 | //}
|
---|
| 42 |
|
---|
| 43 | /** @} */
|
---|
| 44 | #endif
|
---|
| 45 |
|
---|
| 46 |
|
---|
| 47 | //AGCOPYRIGHTBEGIN
|
---|
| 48 | ///////////////////////////////////////////////////////////////////////////
|
---|
| 49 | // Copyright © 2005 AGEIA Technologies.
|
---|
| 50 | // All rights reserved. www.ageia.com
|
---|
| 51 | ///////////////////////////////////////////////////////////////////////////
|
---|
| 52 | //AGCOPYRIGHTEND
|
---|
| 53 |
|
---|