Enable MPR by default
Add the contact point from MPR, in addition to SAT/clipping contacts. Added a new kernel to clear/reset the number of contacts in pairs (stored in the z component) Always sample unit sphere directions, if there are more edge-edge combinations than unit sphere directions (162 by default) Remember last running demo for Bullet 3 (and save it in a text file, Bullet Enable the testFileFracture.bullet in the Bullet2FileDemo
This commit is contained in:
@@ -42,6 +42,7 @@ bool gDumpContactStats = false;
|
||||
bool gCalcWorldSpaceAabbOnCpu = false;
|
||||
bool gUseCalculateOverlappingPairsHost = false;
|
||||
bool gIntegrateOnCpu = false;
|
||||
bool gClearPairsOnGpu = true;
|
||||
|
||||
#define TEST_OTHER_GPU_SOLVER 1
|
||||
#ifdef TEST_OTHER_GPU_SOLVER
|
||||
@@ -106,6 +107,11 @@ b3GpuRigidBodyPipeline::b3GpuRigidBodyPipeline(cl_context ctx,cl_device_id devic
|
||||
b3Assert(errNum==CL_SUCCESS);
|
||||
m_data->m_updateAabbsKernel = b3OpenCLUtils::compileCLKernelFromString(m_data->m_context, m_data->m_device,updateAabbsKernelCL, "initializeGpuAabbsFull",&errNum,prog);
|
||||
b3Assert(errNum==CL_SUCCESS);
|
||||
|
||||
|
||||
m_data->m_clearOverlappingPairsKernel = b3OpenCLUtils::compileCLKernelFromString(m_data->m_context, m_data->m_device,updateAabbsKernelCL, "clearOverlappingPairsKernel",&errNum,prog);
|
||||
b3Assert(errNum==CL_SUCCESS);
|
||||
|
||||
clReleaseProgram(prog);
|
||||
}
|
||||
|
||||
@@ -114,8 +120,14 @@ b3GpuRigidBodyPipeline::b3GpuRigidBodyPipeline(cl_context ctx,cl_device_id devic
|
||||
|
||||
b3GpuRigidBodyPipeline::~b3GpuRigidBodyPipeline()
|
||||
{
|
||||
clReleaseKernel(m_data->m_integrateTransformsKernel);
|
||||
|
||||
if (m_data->m_integrateTransformsKernel)
|
||||
clReleaseKernel(m_data->m_integrateTransformsKernel);
|
||||
|
||||
if (m_data->m_updateAabbsKernel)
|
||||
clReleaseKernel(m_data->m_updateAabbsKernel);
|
||||
|
||||
if (m_data->m_clearOverlappingPairsKernel)
|
||||
clReleaseKernel(m_data->m_clearOverlappingPairsKernel);
|
||||
delete m_data->m_raycaster;
|
||||
delete m_data->m_solver;
|
||||
delete m_data->m_allAabbsGPU;
|
||||
@@ -247,6 +259,7 @@ void b3GpuRigidBodyPipeline::stepSimulation(float deltaTime)
|
||||
m_data->m_broadphaseDbvt->calculateOverlappingPairs();
|
||||
}
|
||||
numPairs = m_data->m_broadphaseDbvt->getOverlappingPairCache()->getNumOverlappingPairs();
|
||||
|
||||
} else
|
||||
{
|
||||
if (gUseCalculateOverlappingPairsHost)
|
||||
@@ -283,7 +296,44 @@ void b3GpuRigidBodyPipeline::stepSimulation(float deltaTime)
|
||||
pairs = m_data->m_broadphaseSap->getOverlappingPairBuffer();
|
||||
aabbsWS = m_data->m_broadphaseSap->getAabbBufferWS();
|
||||
}
|
||||
|
||||
|
||||
m_data->m_overlappingPairsGPU->resize(numPairs);
|
||||
|
||||
//mark the contacts for each pair as 'unused'
|
||||
if (numPairs)
|
||||
{
|
||||
b3OpenCLArray<b3BroadphasePair> gpuPairs(this->m_data->m_context,m_data->m_queue);
|
||||
gpuPairs.setFromOpenCLBuffer(pairs,numPairs);
|
||||
|
||||
if (gClearPairsOnGpu)
|
||||
{
|
||||
|
||||
|
||||
//b3AlignedObjectArray<b3BroadphasePair> hostPairs;//just for debugging
|
||||
//gpuPairs.copyToHost(hostPairs);
|
||||
|
||||
b3LauncherCL launcher(m_data->m_queue,m_data->m_clearOverlappingPairsKernel,"clearOverlappingPairsKernel");
|
||||
launcher.setBuffer(pairs);
|
||||
launcher.setConst(numPairs);
|
||||
launcher.launch1D(numPairs);
|
||||
|
||||
|
||||
//gpuPairs.copyToHost(hostPairs);
|
||||
|
||||
|
||||
} else
|
||||
{
|
||||
b3AlignedObjectArray<b3BroadphasePair> hostPairs;
|
||||
gpuPairs.copyToHost(hostPairs);
|
||||
|
||||
for (int i=0;i<hostPairs.size();i++)
|
||||
{
|
||||
hostPairs[i].z = 0xffffffff;
|
||||
}
|
||||
|
||||
gpuPairs.copyFromHost(hostPairs);
|
||||
}
|
||||
}
|
||||
|
||||
m_data->m_narrowphase->computeContacts(pairs,numPairs,aabbsWS,numBodies);
|
||||
numContacts = m_data->m_narrowphase->getNumContactsGpu();
|
||||
|
||||
@@ -41,6 +41,7 @@ struct b3GpuRigidBodyPipelineInternalData
|
||||
|
||||
cl_kernel m_integrateTransformsKernel;
|
||||
cl_kernel m_updateAabbsKernel;
|
||||
cl_kernel m_clearOverlappingPairsKernel;
|
||||
|
||||
class b3PgsJacobiSolver* m_solver;
|
||||
|
||||
|
||||
@@ -24,6 +24,11 @@ static const char* batchingKernelsCL= \
|
||||
"};\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else\n"
|
||||
"//keep B3_LARGE_FLOAT*B3_LARGE_FLOAT < FLT_MAX\n"
|
||||
"#define B3_LARGE_FLOAT 1e18f\n"
|
||||
"#define B3_INFINITY 1e18f\n"
|
||||
"#define b3Assert(a)\n"
|
||||
"#define b3ConstArray(a) __global const a*\n"
|
||||
"#define b3AtomicInc atomic_inc\n"
|
||||
"#define b3AtomicAdd atomic_add\n"
|
||||
"#define b3Fabs fabs\n"
|
||||
@@ -60,6 +65,29 @@ static const char* batchingKernelsCL= \
|
||||
" return false;\n"
|
||||
" return true;\n"
|
||||
"}\n"
|
||||
"inline int b3MaxDot( b3Float4ConstArg vec, __global const b3Float4* vecArray, int vecLen, float* dotOut )\n"
|
||||
"{\n"
|
||||
" float maxDot = -B3_INFINITY;\n"
|
||||
" int i = 0;\n"
|
||||
" int ptIndex = -1;\n"
|
||||
" for( i = 0; i < vecLen; i++ )\n"
|
||||
" {\n"
|
||||
" float dot = b3Dot3F4(vecArray[i],vec);\n"
|
||||
" \n"
|
||||
" if( dot > maxDot )\n"
|
||||
" {\n"
|
||||
" maxDot = dot;\n"
|
||||
" ptIndex = i;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" b3Assert(ptIndex>=0);\n"
|
||||
" if (ptIndex<0)\n"
|
||||
" {\n"
|
||||
" ptIndex = 0;\n"
|
||||
" }\n"
|
||||
" *dotOut = maxDot;\n"
|
||||
" return ptIndex;\n"
|
||||
"}\n"
|
||||
"#endif //B3_FLOAT4_H\n"
|
||||
"typedef struct b3Contact4Data b3Contact4Data_t;\n"
|
||||
"struct b3Contact4Data\n"
|
||||
|
||||
@@ -24,6 +24,11 @@ static const char* batchingKernelsNewCL= \
|
||||
"};\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else\n"
|
||||
"//keep B3_LARGE_FLOAT*B3_LARGE_FLOAT < FLT_MAX\n"
|
||||
"#define B3_LARGE_FLOAT 1e18f\n"
|
||||
"#define B3_INFINITY 1e18f\n"
|
||||
"#define b3Assert(a)\n"
|
||||
"#define b3ConstArray(a) __global const a*\n"
|
||||
"#define b3AtomicInc atomic_inc\n"
|
||||
"#define b3AtomicAdd atomic_add\n"
|
||||
"#define b3Fabs fabs\n"
|
||||
@@ -60,6 +65,29 @@ static const char* batchingKernelsNewCL= \
|
||||
" return false;\n"
|
||||
" return true;\n"
|
||||
"}\n"
|
||||
"inline int b3MaxDot( b3Float4ConstArg vec, __global const b3Float4* vecArray, int vecLen, float* dotOut )\n"
|
||||
"{\n"
|
||||
" float maxDot = -B3_INFINITY;\n"
|
||||
" int i = 0;\n"
|
||||
" int ptIndex = -1;\n"
|
||||
" for( i = 0; i < vecLen; i++ )\n"
|
||||
" {\n"
|
||||
" float dot = b3Dot3F4(vecArray[i],vec);\n"
|
||||
" \n"
|
||||
" if( dot > maxDot )\n"
|
||||
" {\n"
|
||||
" maxDot = dot;\n"
|
||||
" ptIndex = i;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" b3Assert(ptIndex>=0);\n"
|
||||
" if (ptIndex<0)\n"
|
||||
" {\n"
|
||||
" ptIndex = 0;\n"
|
||||
" }\n"
|
||||
" *dotOut = maxDot;\n"
|
||||
" return ptIndex;\n"
|
||||
"}\n"
|
||||
"#endif //B3_FLOAT4_H\n"
|
||||
"typedef struct b3Contact4Data b3Contact4Data_t;\n"
|
||||
"struct b3Contact4Data\n"
|
||||
|
||||
@@ -24,6 +24,11 @@ static const char* integrateKernelCL= \
|
||||
"};\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else\n"
|
||||
"//keep B3_LARGE_FLOAT*B3_LARGE_FLOAT < FLT_MAX\n"
|
||||
"#define B3_LARGE_FLOAT 1e18f\n"
|
||||
"#define B3_INFINITY 1e18f\n"
|
||||
"#define b3Assert(a)\n"
|
||||
"#define b3ConstArray(a) __global const a*\n"
|
||||
"#define b3AtomicInc atomic_inc\n"
|
||||
"#define b3AtomicAdd atomic_add\n"
|
||||
"#define b3Fabs fabs\n"
|
||||
@@ -60,6 +65,29 @@ static const char* integrateKernelCL= \
|
||||
" return false;\n"
|
||||
" return true;\n"
|
||||
"}\n"
|
||||
"inline int b3MaxDot( b3Float4ConstArg vec, __global const b3Float4* vecArray, int vecLen, float* dotOut )\n"
|
||||
"{\n"
|
||||
" float maxDot = -B3_INFINITY;\n"
|
||||
" int i = 0;\n"
|
||||
" int ptIndex = -1;\n"
|
||||
" for( i = 0; i < vecLen; i++ )\n"
|
||||
" {\n"
|
||||
" float dot = b3Dot3F4(vecArray[i],vec);\n"
|
||||
" \n"
|
||||
" if( dot > maxDot )\n"
|
||||
" {\n"
|
||||
" maxDot = dot;\n"
|
||||
" ptIndex = i;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" b3Assert(ptIndex>=0);\n"
|
||||
" if (ptIndex<0)\n"
|
||||
" {\n"
|
||||
" ptIndex = 0;\n"
|
||||
" }\n"
|
||||
" *dotOut = maxDot;\n"
|
||||
" return ptIndex;\n"
|
||||
"}\n"
|
||||
"#endif //B3_FLOAT4_H\n"
|
||||
"#ifndef B3_QUAT_H\n"
|
||||
"#define B3_QUAT_H\n"
|
||||
@@ -89,6 +117,7 @@ static const char* integrateKernelCL= \
|
||||
"inline b3Quat b3QuatNormalized(b3QuatConstArg in);\n"
|
||||
"inline b3Quat b3QuatRotate(b3QuatConstArg q, b3QuatConstArg vec);\n"
|
||||
"inline b3Quat b3QuatInvert(b3QuatConstArg q);\n"
|
||||
"inline b3Quat b3QuatInverse(b3QuatConstArg q);\n"
|
||||
"inline b3Quat b3QuatMul(b3QuatConstArg a, b3QuatConstArg b)\n"
|
||||
"{\n"
|
||||
" b3Quat ans;\n"
|
||||
@@ -123,6 +152,10 @@ static const char* integrateKernelCL= \
|
||||
" float4 out = b3QuatMul(b3QuatMul(q,vcpy),qInv);\n"
|
||||
" return out;\n"
|
||||
"}\n"
|
||||
"inline b3Quat b3QuatInverse(b3QuatConstArg q)\n"
|
||||
"{\n"
|
||||
" return (b3Quat)(-q.xyz, q.w);\n"
|
||||
"}\n"
|
||||
"inline b3Quat b3QuatInvert(b3QuatConstArg q)\n"
|
||||
"{\n"
|
||||
" return (b3Quat)(-q.xyz, q.w);\n"
|
||||
|
||||
@@ -24,6 +24,11 @@ static const char* solverSetupCL= \
|
||||
"};\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else\n"
|
||||
"//keep B3_LARGE_FLOAT*B3_LARGE_FLOAT < FLT_MAX\n"
|
||||
"#define B3_LARGE_FLOAT 1e18f\n"
|
||||
"#define B3_INFINITY 1e18f\n"
|
||||
"#define b3Assert(a)\n"
|
||||
"#define b3ConstArray(a) __global const a*\n"
|
||||
"#define b3AtomicInc atomic_inc\n"
|
||||
"#define b3AtomicAdd atomic_add\n"
|
||||
"#define b3Fabs fabs\n"
|
||||
@@ -60,6 +65,29 @@ static const char* solverSetupCL= \
|
||||
" return false;\n"
|
||||
" return true;\n"
|
||||
"}\n"
|
||||
"inline int b3MaxDot( b3Float4ConstArg vec, __global const b3Float4* vecArray, int vecLen, float* dotOut )\n"
|
||||
"{\n"
|
||||
" float maxDot = -B3_INFINITY;\n"
|
||||
" int i = 0;\n"
|
||||
" int ptIndex = -1;\n"
|
||||
" for( i = 0; i < vecLen; i++ )\n"
|
||||
" {\n"
|
||||
" float dot = b3Dot3F4(vecArray[i],vec);\n"
|
||||
" \n"
|
||||
" if( dot > maxDot )\n"
|
||||
" {\n"
|
||||
" maxDot = dot;\n"
|
||||
" ptIndex = i;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" b3Assert(ptIndex>=0);\n"
|
||||
" if (ptIndex<0)\n"
|
||||
" {\n"
|
||||
" ptIndex = 0;\n"
|
||||
" }\n"
|
||||
" *dotOut = maxDot;\n"
|
||||
" return ptIndex;\n"
|
||||
"}\n"
|
||||
"#endif //B3_FLOAT4_H\n"
|
||||
"typedef struct b3Contact4Data b3Contact4Data_t;\n"
|
||||
"struct b3Contact4Data\n"
|
||||
@@ -151,6 +179,7 @@ static const char* solverSetupCL= \
|
||||
"inline b3Quat b3QuatNormalized(b3QuatConstArg in);\n"
|
||||
"inline b3Quat b3QuatRotate(b3QuatConstArg q, b3QuatConstArg vec);\n"
|
||||
"inline b3Quat b3QuatInvert(b3QuatConstArg q);\n"
|
||||
"inline b3Quat b3QuatInverse(b3QuatConstArg q);\n"
|
||||
"inline b3Quat b3QuatMul(b3QuatConstArg a, b3QuatConstArg b)\n"
|
||||
"{\n"
|
||||
" b3Quat ans;\n"
|
||||
@@ -185,6 +214,10 @@ static const char* solverSetupCL= \
|
||||
" float4 out = b3QuatMul(b3QuatMul(q,vcpy),qInv);\n"
|
||||
" return out;\n"
|
||||
"}\n"
|
||||
"inline b3Quat b3QuatInverse(b3QuatConstArg q)\n"
|
||||
"{\n"
|
||||
" return (b3Quat)(-q.xyz, q.w);\n"
|
||||
"}\n"
|
||||
"inline b3Quat b3QuatInvert(b3QuatConstArg q)\n"
|
||||
"{\n"
|
||||
" return (b3Quat)(-q.xyz, q.w);\n"
|
||||
|
||||
@@ -24,6 +24,11 @@ static const char* solverSetup2CL= \
|
||||
"};\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else\n"
|
||||
"//keep B3_LARGE_FLOAT*B3_LARGE_FLOAT < FLT_MAX\n"
|
||||
"#define B3_LARGE_FLOAT 1e18f\n"
|
||||
"#define B3_INFINITY 1e18f\n"
|
||||
"#define b3Assert(a)\n"
|
||||
"#define b3ConstArray(a) __global const a*\n"
|
||||
"#define b3AtomicInc atomic_inc\n"
|
||||
"#define b3AtomicAdd atomic_add\n"
|
||||
"#define b3Fabs fabs\n"
|
||||
@@ -60,6 +65,29 @@ static const char* solverSetup2CL= \
|
||||
" return false;\n"
|
||||
" return true;\n"
|
||||
"}\n"
|
||||
"inline int b3MaxDot( b3Float4ConstArg vec, __global const b3Float4* vecArray, int vecLen, float* dotOut )\n"
|
||||
"{\n"
|
||||
" float maxDot = -B3_INFINITY;\n"
|
||||
" int i = 0;\n"
|
||||
" int ptIndex = -1;\n"
|
||||
" for( i = 0; i < vecLen; i++ )\n"
|
||||
" {\n"
|
||||
" float dot = b3Dot3F4(vecArray[i],vec);\n"
|
||||
" \n"
|
||||
" if( dot > maxDot )\n"
|
||||
" {\n"
|
||||
" maxDot = dot;\n"
|
||||
" ptIndex = i;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" b3Assert(ptIndex>=0);\n"
|
||||
" if (ptIndex<0)\n"
|
||||
" {\n"
|
||||
" ptIndex = 0;\n"
|
||||
" }\n"
|
||||
" *dotOut = maxDot;\n"
|
||||
" return ptIndex;\n"
|
||||
"}\n"
|
||||
"#endif //B3_FLOAT4_H\n"
|
||||
"typedef struct b3Contact4Data b3Contact4Data_t;\n"
|
||||
"struct b3Contact4Data\n"
|
||||
|
||||
@@ -24,6 +24,11 @@ static const char* solverUtilsCL= \
|
||||
"};\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else\n"
|
||||
"//keep B3_LARGE_FLOAT*B3_LARGE_FLOAT < FLT_MAX\n"
|
||||
"#define B3_LARGE_FLOAT 1e18f\n"
|
||||
"#define B3_INFINITY 1e18f\n"
|
||||
"#define b3Assert(a)\n"
|
||||
"#define b3ConstArray(a) __global const a*\n"
|
||||
"#define b3AtomicInc atomic_inc\n"
|
||||
"#define b3AtomicAdd atomic_add\n"
|
||||
"#define b3Fabs fabs\n"
|
||||
@@ -60,6 +65,29 @@ static const char* solverUtilsCL= \
|
||||
" return false;\n"
|
||||
" return true;\n"
|
||||
"}\n"
|
||||
"inline int b3MaxDot( b3Float4ConstArg vec, __global const b3Float4* vecArray, int vecLen, float* dotOut )\n"
|
||||
"{\n"
|
||||
" float maxDot = -B3_INFINITY;\n"
|
||||
" int i = 0;\n"
|
||||
" int ptIndex = -1;\n"
|
||||
" for( i = 0; i < vecLen; i++ )\n"
|
||||
" {\n"
|
||||
" float dot = b3Dot3F4(vecArray[i],vec);\n"
|
||||
" \n"
|
||||
" if( dot > maxDot )\n"
|
||||
" {\n"
|
||||
" maxDot = dot;\n"
|
||||
" ptIndex = i;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" b3Assert(ptIndex>=0);\n"
|
||||
" if (ptIndex<0)\n"
|
||||
" {\n"
|
||||
" ptIndex = 0;\n"
|
||||
" }\n"
|
||||
" *dotOut = maxDot;\n"
|
||||
" return ptIndex;\n"
|
||||
"}\n"
|
||||
"#endif //B3_FLOAT4_H\n"
|
||||
"typedef struct b3Contact4Data b3Contact4Data_t;\n"
|
||||
"struct b3Contact4Data\n"
|
||||
|
||||
@@ -11,3 +11,12 @@ __kernel void initializeGpuAabbsFull( const int numNodes, __global b3RigidBodyD
|
||||
b3ComputeWorldAabb(nodeID, gBodies, collidables, plocalShapeAABB,pAABB);
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void clearOverlappingPairsKernel( __global int4* pairs, int numPairs)
|
||||
{
|
||||
int pairId = get_global_id(0);
|
||||
if( pairId< numPairs )
|
||||
{
|
||||
pairs[pairId].z = 0xffffffff;
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,11 @@ static const char* updateAabbsKernelCL= \
|
||||
"};\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else\n"
|
||||
"//keep B3_LARGE_FLOAT*B3_LARGE_FLOAT < FLT_MAX\n"
|
||||
"#define B3_LARGE_FLOAT 1e18f\n"
|
||||
"#define B3_INFINITY 1e18f\n"
|
||||
"#define b3Assert(a)\n"
|
||||
"#define b3ConstArray(a) __global const a*\n"
|
||||
"#define b3AtomicInc atomic_inc\n"
|
||||
"#define b3AtomicAdd atomic_add\n"
|
||||
"#define b3Fabs fabs\n"
|
||||
@@ -50,6 +55,29 @@ static const char* updateAabbsKernelCL= \
|
||||
" return false;\n"
|
||||
" return true;\n"
|
||||
"}\n"
|
||||
"inline int b3MaxDot( b3Float4ConstArg vec, __global const b3Float4* vecArray, int vecLen, float* dotOut )\n"
|
||||
"{\n"
|
||||
" float maxDot = -B3_INFINITY;\n"
|
||||
" int i = 0;\n"
|
||||
" int ptIndex = -1;\n"
|
||||
" for( i = 0; i < vecLen; i++ )\n"
|
||||
" {\n"
|
||||
" float dot = b3Dot3F4(vecArray[i],vec);\n"
|
||||
" \n"
|
||||
" if( dot > maxDot )\n"
|
||||
" {\n"
|
||||
" maxDot = dot;\n"
|
||||
" ptIndex = i;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" b3Assert(ptIndex>=0);\n"
|
||||
" if (ptIndex<0)\n"
|
||||
" {\n"
|
||||
" ptIndex = 0;\n"
|
||||
" }\n"
|
||||
" *dotOut = maxDot;\n"
|
||||
" return ptIndex;\n"
|
||||
"}\n"
|
||||
"#endif //B3_FLOAT4_H\n"
|
||||
"#ifndef B3_MAT3x3_H\n"
|
||||
"#define B3_MAT3x3_H\n"
|
||||
@@ -81,6 +109,7 @@ static const char* updateAabbsKernelCL= \
|
||||
"inline b3Quat b3QuatNormalized(b3QuatConstArg in);\n"
|
||||
"inline b3Quat b3QuatRotate(b3QuatConstArg q, b3QuatConstArg vec);\n"
|
||||
"inline b3Quat b3QuatInvert(b3QuatConstArg q);\n"
|
||||
"inline b3Quat b3QuatInverse(b3QuatConstArg q);\n"
|
||||
"inline b3Quat b3QuatMul(b3QuatConstArg a, b3QuatConstArg b)\n"
|
||||
"{\n"
|
||||
" b3Quat ans;\n"
|
||||
@@ -115,6 +144,10 @@ static const char* updateAabbsKernelCL= \
|
||||
" float4 out = b3QuatMul(b3QuatMul(q,vcpy),qInv);\n"
|
||||
" return out;\n"
|
||||
"}\n"
|
||||
"inline b3Quat b3QuatInverse(b3QuatConstArg q)\n"
|
||||
"{\n"
|
||||
" return (b3Quat)(-q.xyz, q.w);\n"
|
||||
"}\n"
|
||||
"inline b3Quat b3QuatInvert(b3QuatConstArg q)\n"
|
||||
"{\n"
|
||||
" return (b3Quat)(-q.xyz, q.w);\n"
|
||||
@@ -422,4 +455,12 @@ static const char* updateAabbsKernelCL= \
|
||||
" b3ComputeWorldAabb(nodeID, gBodies, collidables, plocalShapeAABB,pAABB);\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"__kernel void clearOverlappingPairsKernel( __global int4* pairs, int numPairs)\n"
|
||||
"{\n"
|
||||
" int pairId = get_global_id(0);\n"
|
||||
" if( pairId< numPairs )\n"
|
||||
" {\n"
|
||||
" pairs[pairId].z = 0xffffffff;\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user