fix [#36685] crash calculating tangent space data on degenerate geometry
the error was that the range check was done on the float before converting to an int. now convert to and int first and ensure a valid range on that.
This commit is contained in:
@@ -440,8 +440,8 @@ static const int g_iCells = 2048;
|
||||
static NOINLINE int FindGridCell(const float fMin, const float fMax, const float fVal)
|
||||
{
|
||||
const float fIndex = g_iCells * ((fVal-fMin)/(fMax-fMin));
|
||||
const int iIndex = fIndex<0?0:((int)fIndex);
|
||||
return iIndex<g_iCells?iIndex:(g_iCells-1);
|
||||
const int iIndex = (int)fIndex;
|
||||
return iIndex < g_iCells ? (iIndex >= 0 ? iIndex : 0) : (g_iCells - 1);
|
||||
}
|
||||
|
||||
static void MergeVertsFast(int piTriList_in_and_out[], STmpVert pTmpVert[], const SMikkTSpaceContext * pContext, const int iL_in, const int iR_in);
|
||||
|
Reference in New Issue
Block a user