Ported Minkowski Portal Refinement mpr.c from libccd to OpenCL, for bettwe edge-edge performance (and additional contact point for degenerate/high detailed convex shapes)
Removed b3RigidBodyCL, replace by b3RigidBodyData and b3RigidBodyData_t shared between C++ host and OpenCL, Same for b3InertiaCL -> b3InertiaData
This commit is contained in:
@@ -990,7 +990,12 @@ B3_FORCE_INLINE long b3Vector3::maxDot( const b3Vector3 *array, long array_
|
||||
ptIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
b3Assert(ptIndex>=0);
|
||||
if (ptIndex<0)
|
||||
{
|
||||
ptIndex = 0;
|
||||
}
|
||||
dotOut = maxDot;
|
||||
return ptIndex;
|
||||
}
|
||||
|
||||
@@ -68,5 +68,30 @@ inline bool b3IsAlmostZero(b3Float4ConstArg v)
|
||||
}
|
||||
|
||||
|
||||
inline int b3MaxDot( b3Float4ConstArg vec, __global const b3Float4* vecArray, int vecLen, float* dotOut )
|
||||
{
|
||||
float maxDot = -B3_INFINITY;
|
||||
int i = 0;
|
||||
int ptIndex = -1;
|
||||
for( i = 0; i < vecLen; i++ )
|
||||
{
|
||||
float dot = b3Dot3F4(vecArray[i],vec);
|
||||
|
||||
if( dot > maxDot )
|
||||
{
|
||||
maxDot = dot;
|
||||
ptIndex = i;
|
||||
}
|
||||
}
|
||||
b3Assert(ptIndex>=0);
|
||||
if (ptIndex<0)
|
||||
{
|
||||
ptIndex = 0;
|
||||
}
|
||||
*dotOut = maxDot;
|
||||
return ptIndex;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif //B3_FLOAT4_H
|
||||
|
||||
@@ -7,6 +7,8 @@ struct MyTest
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
//#define b3ConstArray(a) const b3AlignedObjectArray<a>&
|
||||
#define b3ConstArray(a) const a*
|
||||
#define b3AtomicInc(a) ((*a)++)
|
||||
|
||||
inline int b3AtomicAdd (volatile int *p, int val)
|
||||
@@ -19,6 +21,11 @@ inline int b3AtomicAdd (volatile int *p, int val)
|
||||
|
||||
#define __global
|
||||
#else
|
||||
//keep B3_LARGE_FLOAT*B3_LARGE_FLOAT < FLT_MAX
|
||||
#define B3_LARGE_FLOAT 1e18f
|
||||
#define B3_INFINITY 1e18f
|
||||
#define b3Assert(a)
|
||||
#define b3ConstArray(a) __global const a*
|
||||
#define b3AtomicInc atomic_inc
|
||||
#define b3AtomicAdd atomic_add
|
||||
#define b3Fabs fabs
|
||||
|
||||
@@ -38,6 +38,8 @@ inline b3Quat b3QuatMul(b3Quat a, b3Quat b);
|
||||
inline b3Quat b3QuatNormalized(b3QuatConstArg in);
|
||||
inline b3Quat b3QuatRotate(b3QuatConstArg q, b3QuatConstArg vec);
|
||||
inline b3Quat b3QuatInvert(b3QuatConstArg q);
|
||||
inline b3Quat b3QuatInverse(b3QuatConstArg q);
|
||||
|
||||
inline b3Quat b3QuatMul(b3QuatConstArg a, b3QuatConstArg b)
|
||||
{
|
||||
b3Quat ans;
|
||||
@@ -74,6 +76,13 @@ inline float4 b3QuatRotate(b3QuatConstArg q, b3QuatConstArg vec)
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline b3Quat b3QuatInverse(b3QuatConstArg q)
|
||||
{
|
||||
return (b3Quat)(-q.xyz, q.w);
|
||||
}
|
||||
|
||||
inline b3Quat b3QuatInvert(b3QuatConstArg q)
|
||||
{
|
||||
return (b3Quat)(-q.xyz, q.w);
|
||||
|
||||
Reference in New Issue
Block a user