Fix a very nasty bug
This commit is contained in:
parent
abd68ce0ae
commit
dae47de5f9
4 changed files with 24 additions and 18 deletions
|
@ -297,7 +297,7 @@ int _LCR_rendererQuadLooksConvex(S3L_Unit quad[8])
|
|||
r = (3 * r) / 32;
|
||||
|
||||
for (int i = 0; i < 8; i += 2)
|
||||
if (S3L_abs(cx - quad[i]) <= r && S3L_abs(cy - quad[i + 1]) <= r)
|
||||
if ((S3L_abs(cx - quad[i]) <= r) && (S3L_abs(cy - quad[i + 1]) <= r))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
|
@ -688,7 +688,7 @@ int _LCR_rendererQuadCoversTri(const S3L_Unit quad[8], const S3L_Unit tri[6])
|
|||
|
||||
for (int k = 0; k < 3; ++k) // for each subtriangle side
|
||||
{
|
||||
char w =
|
||||
int w =
|
||||
_LCR_triangleWinding(
|
||||
quad[(2 * (j + (k + 1) % 3)) % 8],
|
||||
quad[(2 * (j + ((k + 1) % 3))) % 8 + 1],
|
||||
|
@ -924,8 +924,8 @@ void _LCR_cullHiddenMapTris(void)
|
|||
else
|
||||
{
|
||||
for (int j = 0; j < 3; ++j)
|
||||
LCR_renderer.mapVerts[3 * i + j] =
|
||||
LCR_renderer.mapVerts[(LCR_renderer.mapModel.vertexCount - 1) * 3 + j];
|
||||
LCR_renderer.mapVerts[3 * i + j] = LCR_renderer.mapVerts[
|
||||
(LCR_renderer.mapModel.vertexCount - 1) * 3 + j];
|
||||
|
||||
for (int j = 0; j < LCR_renderer.mapModel.triangleCount * 3; ++j)
|
||||
if (LCR_renderer.mapTris[j] == LCR_renderer.mapModel.vertexCount - 1)
|
||||
|
@ -1037,6 +1037,7 @@ uint8_t _LCR_buildMapModel(void)
|
|||
blockShapeBytes,&blockShapeByteCount);
|
||||
|
||||
// When nearing limit, cull (can't be inside the loop sadly, trust me).
|
||||
|
||||
if (
|
||||
LCR_renderer.mapModel.vertexCount >= LCR_SETTING_MAX_MAP_VERTICES - 16 ||
|
||||
LCR_renderer.mapModel.triangleCount >= LCR_SETTING_MAX_MAP_TRIANGLES - 16)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue