Fix rounding error due to precision loss after optimization.
This commit is contained in:
parent
a425d03b0e
commit
9df3e2e0a6
@ -433,8 +433,8 @@ void dtNavMesh::connectExtLinks(dtMeshTile* tile, dtMeshTile* target, int side)
|
||||
float tmax = (neia[k*2+1]-va[2]) / (vb[2]-va[2]);
|
||||
if (tmin > tmax)
|
||||
dtSwap(tmin,tmax);
|
||||
link->bmin = (unsigned char)(dtClamp(tmin, 0.0f, 1.0f)*255.0f);
|
||||
link->bmax = (unsigned char)(dtClamp(tmax, 0.0f, 1.0f)*255.0f);
|
||||
link->bmin = (unsigned char)roundf(dtClamp(tmin, 0.0f, 1.0f)*255.0f);
|
||||
link->bmax = (unsigned char)roundf(dtClamp(tmax, 0.0f, 1.0f)*255.0f);
|
||||
}
|
||||
else if (dir == 2 || dir == 6)
|
||||
{
|
||||
@ -442,8 +442,8 @@ void dtNavMesh::connectExtLinks(dtMeshTile* tile, dtMeshTile* target, int side)
|
||||
float tmax = (neia[k*2+1]-va[0]) / (vb[0]-va[0]);
|
||||
if (tmin > tmax)
|
||||
dtSwap(tmin,tmax);
|
||||
link->bmin = (unsigned char)(dtClamp(tmin, 0.0f, 1.0f)*255.0f);
|
||||
link->bmax = (unsigned char)(dtClamp(tmax, 0.0f, 1.0f)*255.0f);
|
||||
link->bmin = (unsigned char)roundf(dtClamp(tmin, 0.0f, 1.0f)*255.0f);
|
||||
link->bmax = (unsigned char)roundf(dtClamp(tmax, 0.0f, 1.0f)*255.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user