fix issue (apparently closestFaceA/B can be -1, need to figure out how that can ever happen (it shouldn’t)

This commit is contained in:
Erwin Coumans 2013-12-17 16:50:50 -08:00
parent 7964f2d8c1
commit 7bde13be62
4 changed files with 18 additions and 8 deletions

View File

@ -1539,7 +1539,7 @@ inline int findClippingFaces(const float4 separatingNormal,
int numWorldVertsB1= 0;
int closestFaceB=-1;
int closestFaceB=0;
float dmax = -FLT_MAX;
{
@ -1573,7 +1573,7 @@ inline int findClippingFaces(const float4 separatingNormal,
}
}
int closestFaceA=-1;
int closestFaceA=0;
{
float dmin = FLT_MAX;
for(int face=0;face<hullA->m_numFaces;face++)

View File

@ -597,7 +597,7 @@ inline int findClippingFaces(const float4 separatingNormal,
int numWorldVertsB1= 0;
int closestFaceB=-1;
int closestFaceB=0;
float dmax = -FLT_MAX;
{
@ -620,6 +620,8 @@ inline int findClippingFaces(const float4 separatingNormal,
int numVertices = polyB.m_numIndices;
if (numVertices>capacityWorldVerts)
numVertices = capacityWorldVerts;
if (numVertices<0)
numVertices = 0;
for(int e0=0;e0<numVertices;e0++)
{
@ -631,7 +633,7 @@ inline int findClippingFaces(const float4 separatingNormal,
}
}
int closestFaceA=-1;
int closestFaceA=0;
{
float dmin = FLT_MAX;
for(int face=0;face<hullA->m_numFaces;face++)
@ -656,6 +658,8 @@ inline int findClippingFaces(const float4 separatingNormal,
int numVerticesA = facesA[hullA->m_faceOffset+closestFaceA].m_numIndices;
if (numVerticesA>capacityWorldVerts)
numVerticesA = capacityWorldVerts;
if (numVerticesA<0)
numVerticesA=0;
for(int e0=0;e0<numVerticesA;e0++)
{
@ -1179,6 +1183,7 @@ __kernel void findConcaveSeparatingAxisEdgeEdgeKernel( __global int4* concaveP
float minDist = -1e30f;
float maxDist = 0.02f;
findClippingFaces(sepAxis,
&convexPolyhedronA,
&convexShapes[shapeIndexB],

View File

@ -809,7 +809,7 @@ static const char* satConcaveKernelsCL= \
" int numWorldVertsB1= 0;\n"
" \n"
" \n"
" int closestFaceB=-1;\n"
" int closestFaceB=0;\n"
" float dmax = -FLT_MAX;\n"
" \n"
" {\n"
@ -832,6 +832,8 @@ static const char* satConcaveKernelsCL= \
" int numVertices = polyB.m_numIndices;\n"
" if (numVertices>capacityWorldVerts)\n"
" numVertices = capacityWorldVerts;\n"
" if (numVertices<0)\n"
" numVertices = 0;\n"
" \n"
" for(int e0=0;e0<numVertices;e0++)\n"
" {\n"
@ -843,7 +845,7 @@ static const char* satConcaveKernelsCL= \
" }\n"
" }\n"
" \n"
" int closestFaceA=-1;\n"
" int closestFaceA=0;\n"
" {\n"
" float dmin = FLT_MAX;\n"
" for(int face=0;face<hullA->m_numFaces;face++)\n"
@ -868,6 +870,8 @@ static const char* satConcaveKernelsCL= \
" int numVerticesA = facesA[hullA->m_faceOffset+closestFaceA].m_numIndices;\n"
" if (numVerticesA>capacityWorldVerts)\n"
" numVerticesA = capacityWorldVerts;\n"
" if (numVerticesA<0)\n"
" numVerticesA=0;\n"
" \n"
" for(int e0=0;e0<numVerticesA;e0++)\n"
" {\n"
@ -1382,6 +1386,7 @@ static const char* satConcaveKernelsCL= \
" \n"
" float minDist = -1e30f;\n"
" float maxDist = 0.02f;\n"
" \n"
" findClippingFaces(sepAxis,\n"
" &convexPolyhedronA,\n"
" &convexShapes[shapeIndexB],\n"

View File

@ -1642,7 +1642,7 @@ static const char* satKernelsCL= \
" int numWorldVertsB1= 0;\n"
" \n"
" \n"
" int closestFaceB=-1;\n"
" int closestFaceB=0;\n"
" float dmax = -FLT_MAX;\n"
" \n"
" {\n"
@ -1676,7 +1676,7 @@ static const char* satKernelsCL= \
" }\n"
" }\n"
" \n"
" int closestFaceA=-1;\n"
" int closestFaceA=0;\n"
" {\n"
" float dmin = FLT_MAX;\n"
" for(int face=0;face<hullA->m_numFaces;face++)\n"