Fix another culling BS
This commit is contained in:
parent
252bf57e41
commit
8fe4f6b6aa
2 changed files with 64 additions and 17 deletions
15
renderer.h
15
renderer.h
|
@ -519,8 +519,8 @@ S3L_Index _LCR_rendererAddMapVert(S3L_Unit x, S3L_Unit y, S3L_Unit z)
|
|||
return LCR_renderer.mapModel.vertexCount - 1;
|
||||
}
|
||||
|
||||
LCR_LOG0("couldn't add map vertex");
|
||||
return 0;
|
||||
LCR_LOG1("couldn't add vertex");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void _LCR_rendererAddMapTri(S3L_Index a, S3L_Index b, S3L_Index c, uint8_t mat)
|
||||
|
@ -538,6 +538,10 @@ void _LCR_rendererAddMapTri(S3L_Index a, S3L_Index b, S3L_Index c, uint8_t mat)
|
|||
|
||||
LCR_renderer.mapModel.triangleCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
LCR_LOG1("couldn't add triangle");
|
||||
}
|
||||
}
|
||||
|
||||
void _LCR_rendererSwapMapTris(unsigned int index1, unsigned int index2)
|
||||
|
@ -894,8 +898,7 @@ uint8_t _LCR_buildMapModel(void)
|
|||
|
||||
for (int j = 0; j < LCR_currentMap.blockCount; ++j)
|
||||
{
|
||||
if (((j + 1) % LCR_SETTING_CULLING_PERIOD == 0) ||
|
||||
(LCR_renderer.mapModel.triangleCount == LCR_SETTING_MAX_MAP_TRIANGLES))
|
||||
if (((j + 1) % LCR_SETTING_CULLING_PERIOD == 0))
|
||||
_LCR_cullHiddenMapTris();
|
||||
|
||||
S3L_Unit originOffset = -1 * LCR_MAP_SIZE_BLOCKS / 2 * LCR_RENDERER_UNIT;
|
||||
|
@ -947,6 +950,10 @@ uint8_t _LCR_buildMapModel(void)
|
|||
vi++;
|
||||
else // 3 indices => create and add triangle
|
||||
{
|
||||
if (LCR_renderer.mapModel.triangleCount >=
|
||||
LCR_SETTING_MAX_MAP_TRIANGLES)
|
||||
_LCR_cullHiddenMapTris();
|
||||
|
||||
// don't add triangles completely at the boundary of the map
|
||||
if (!edgeBits)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue