add support for compound hulls against concave triangle mesh

This commit is contained in:
erwin coumans
2013-04-05 18:29:58 -07:00
parent 358f4f97a2
commit c8fcf779bb
12 changed files with 361 additions and 82 deletions

View File

@@ -1258,6 +1258,7 @@ static const char* satClipKernelsCL= \
" __global const float4* uniqueEdges,\n"
" __global const btGpuFace* faces,\n"
" __global const int* indices,\n"
" __global const btGpuChildShape* gpuChildShapes,\n"
" __global const float4* separatingNormals,\n"
" __global Contact4* restrict globalContactsOut,\n"
" counter32_t nGlobalContactsOut,\n"
@@ -1279,8 +1280,8 @@ static const char* satClipKernelsCL= \
"\n"
" if (i<numConcavePairs)\n"
" {\n"
" //magic value to detect that pair is invalid\n"
" if (concavePairsIn[i].w!=3)\n"
" //negative value means that the pair is invalid\n"
" if (concavePairsIn[i].w<0)\n"
" return;\n"
"\n"
" int bodyIndexA = concavePairsIn[i].x;\n"
@@ -1415,6 +1416,22 @@ static const char* satClipKernelsCL= \
"\n"
" float4 sepAxis = separatingNormals[i];\n"
" \n"
" int shapeTypeB = collidables[collidableIndexB].m_shapeType;\n"
" if (shapeTypeB==SHAPE_COMPOUND_OF_CONVEX_HULLS)\n"
" {\n"
" ///////////////////\n"
" ///compound shape support\n"
" int compoundChild = concavePairsIn[pairIndex].w;\n"
" int childShapeIndexB = collidables[collidableIndexB].m_shapeIndex+compoundChild;\n"
" int childColIndexB = gpuChildShapes[childShapeIndexB].m_shapeIndex;\n"
" float4 childPosB = gpuChildShapes[childShapeIndexB].m_childPosition;\n"
" float4 childOrnB = gpuChildShapes[childShapeIndexB].m_childOrientation;\n"
" float4 newPosB = transform(&childPosB,&posB,&ornB);\n"
" float4 newOrnB = qtMul(ornB,childOrnB);\n"
" posB = newPosB;\n"
" ornB = newOrnB;\n"
" shapeIndexB = collidables[childColIndexB].m_shapeIndex;\n"
" }\n"
" \n"
" ////////////////////////////////////////\n"
" \n"
@@ -1422,8 +1439,8 @@ static const char* satClipKernelsCL= \
" \n"
" int numLocalContactsOut = clipHullAgainstHullLocalA(sepAxis,\n"
" &convexPolyhedronA, &convexShapes[shapeIndexB],\n"
" rigidBodies[bodyIndexA].m_pos,rigidBodies[bodyIndexA].m_quat,\n"
" rigidBodies[bodyIndexB].m_pos,rigidBodies[bodyIndexB].m_quat,\n"
" posA,ornA,\n"
" posB,ornB,\n"
" worldVertsB1,worldVertsB2,capacityWorldVerts,\n"
" minDist, maxDist,\n"
" &verticesA,&facesA,&indicesA,\n"