add support for compound hulls against concave triangle mesh
This commit is contained in:
@@ -888,7 +888,8 @@ static const char* satKernelsCL= \
|
||||
" }//for (int b=0;b<numChildrenB;b++) \n"
|
||||
" return;\n"
|
||||
" }//if (collidables[collidableIndexB].m_shapeType==SHAPE_COMPOUND_OF_CONVEX_HULLS)\n"
|
||||
" if (collidables[collidableIndexB].m_shapeType==SHAPE_COMPOUND_OF_CONVEX_HULLS)\n"
|
||||
" if ((collidables[collidableIndexA].m_shapeType!=SHAPE_CONCAVE_TRIMESH) \n"
|
||||
" && (collidables[collidableIndexB].m_shapeType==SHAPE_COMPOUND_OF_CONVEX_HULLS))\n"
|
||||
" {\n"
|
||||
" int numChildrenB = collidables[collidableIndexB].m_numChildShapes;\n"
|
||||
" for (int b=0;b<numChildrenB;b++)\n"
|
||||
@@ -1061,9 +1062,8 @@ static const char* satKernelsCL= \
|
||||
" __global const float4* uniqueEdges,\n"
|
||||
" __global const btGpuFace* faces,\n"
|
||||
" __global const int* indices,\n"
|
||||
" __global const btGpuChildShape* gpuChildShapes,\n"
|
||||
" __global btAabbCL* aabbs,\n"
|
||||
" __global volatile float4* separatingNormals,\n"
|
||||
" __global volatile int* hasSeparatingAxis,\n"
|
||||
" __global float4* concaveSeparatingNormalsOut,\n"
|
||||
" int numConcavePairs\n"
|
||||
" )\n"
|
||||
@@ -1083,9 +1083,10 @@ static const char* satKernelsCL= \
|
||||
" int shapeIndexA = collidables[collidableIndexA].m_shapeIndex;\n"
|
||||
" int shapeIndexB = collidables[collidableIndexB].m_shapeIndex;\n"
|
||||
"\n"
|
||||
" if (collidables[collidableIndexB].m_shapeType!=SHAPE_CONVEX_HULL)\n"
|
||||
" if (collidables[collidableIndexB].m_shapeType!=SHAPE_CONVEX_HULL&&\n"
|
||||
" collidables[collidableIndexB].m_shapeType!=SHAPE_COMPOUND_OF_CONVEX_HULLS)\n"
|
||||
" {\n"
|
||||
" concavePairs[pairIdx].w = 0;\n"
|
||||
" concavePairs[pairIdx].w = -1;\n"
|
||||
" return;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
@@ -1231,36 +1232,60 @@ static const char* satKernelsCL= \
|
||||
" float4 c1 = transform(&c1local,&posB,&ornB);\n"
|
||||
" const float4 DeltaC2 = c0 - c1;\n"
|
||||
" \n"
|
||||
" bool sepA = findSeparatingAxisLocalA( &convexPolyhedronA, &convexShapes[shapeIndexB],rigidBodies[bodyIndexA].m_pos,rigidBodies[bodyIndexA].m_quat,\n"
|
||||
" rigidBodies[bodyIndexB].m_pos,rigidBodies[bodyIndexB].m_quat,\n"
|
||||
" DeltaC2,\n"
|
||||
" verticesA,uniqueEdgesA,facesA,indicesA,\n"
|
||||
" vertices,uniqueEdges,faces,indices,\n"
|
||||
" &sepAxis,&dmin);\n"
|
||||
"\n"
|
||||
"\n"
|
||||
" ///////////////////\n"
|
||||
" ///compound shape support\n"
|
||||
"\n"
|
||||
" if (collidables[collidableIndexB].m_shapeType==SHAPE_COMPOUND_OF_CONVEX_HULLS)\n"
|
||||
" {\n"
|
||||
" int compoundChild = concavePairs[pairIdx].w;\n"
|
||||
" int childShapeIndexB = compoundChild;//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"
|
||||
" bool sepA = findSeparatingAxisLocalA( &convexPolyhedronA, &convexShapes[shapeIndexB],\n"
|
||||
" posA,ornA,\n"
|
||||
" posB,ornB,\n"
|
||||
" DeltaC2,\n"
|
||||
" verticesA,uniqueEdgesA,facesA,indicesA,\n"
|
||||
" vertices,uniqueEdges,faces,indices,\n"
|
||||
" &sepAxis,&dmin);\n"
|
||||
" hasSeparatingAxis = 4;\n"
|
||||
" if (!sepA)\n"
|
||||
" {\n"
|
||||
" hasSeparatingAxis = 0;\n"
|
||||
" } else\n"
|
||||
" {\n"
|
||||
" bool sepB = findSeparatingAxisLocalB( &convexShapes[shapeIndexB],&convexPolyhedronA,rigidBodies[bodyIndexB].m_pos,rigidBodies[bodyIndexB].m_quat,\n"
|
||||
" rigidBodies[bodyIndexA].m_pos,rigidBodies[bodyIndexA].m_quat,\n"
|
||||
" DeltaC2,\n"
|
||||
" vertices,uniqueEdges,faces,indices,\n"
|
||||
" verticesA,uniqueEdgesA,facesA,indicesA,\n"
|
||||
" &sepAxis,&dmin);\n"
|
||||
" bool sepB = findSeparatingAxisLocalB( &convexShapes[shapeIndexB],&convexPolyhedronA,\n"
|
||||
" posB,ornB,\n"
|
||||
" posA,ornA,\n"
|
||||
" DeltaC2,\n"
|
||||
" vertices,uniqueEdges,faces,indices,\n"
|
||||
" verticesA,uniqueEdgesA,facesA,indicesA,\n"
|
||||
" &sepAxis,&dmin);\n"
|
||||
"\n"
|
||||
" if (!sepB)\n"
|
||||
" {\n"
|
||||
" hasSeparatingAxis = 0;\n"
|
||||
" } else\n"
|
||||
" {\n"
|
||||
" bool sepEE = findSeparatingAxisEdgeEdgeLocalA( &convexPolyhedronA, &convexShapes[shapeIndexB],rigidBodies[bodyIndexA].m_pos,rigidBodies[bodyIndexA].m_quat,\n"
|
||||
" rigidBodies[bodyIndexB].m_pos,rigidBodies[bodyIndexB].m_quat,\n"
|
||||
" DeltaC2,\n"
|
||||
" verticesA,uniqueEdgesA,facesA,indicesA,\n"
|
||||
" vertices,uniqueEdges,faces,indices,\n"
|
||||
" &sepAxis,&dmin);\n"
|
||||
" bool sepEE = findSeparatingAxisEdgeEdgeLocalA( &convexPolyhedronA, &convexShapes[shapeIndexB],\n"
|
||||
" posA,ornA,\n"
|
||||
" posB,ornB,\n"
|
||||
" DeltaC2,\n"
|
||||
" verticesA,uniqueEdgesA,facesA,indicesA,\n"
|
||||
" vertices,uniqueEdges,faces,indices,\n"
|
||||
" &sepAxis,&dmin);\n"
|
||||
" \n"
|
||||
" if (!sepEE)\n"
|
||||
" {\n"
|
||||
@@ -1279,13 +1304,13 @@ static const char* satKernelsCL= \
|
||||
" } else\n"
|
||||
" { \n"
|
||||
" //mark this pair as in-active\n"
|
||||
" concavePairs[pairIdx].w = 0;\n"
|
||||
" concavePairs[pairIdx].w = -1;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" else\n"
|
||||
" { \n"
|
||||
" //mark this pair as in-active\n"
|
||||
" concavePairs[pairIdx].w = 0;\n"
|
||||
" concavePairs[pairIdx].w = -1;\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
|
||||
Reference in New Issue
Block a user