Improve renderer a bit

This commit is contained in:
Miloslav Ciz 2024-07-31 16:07:25 +02:00
parent 6f020c852f
commit 2b4516f408
2 changed files with 58 additions and 29 deletions

View file

@ -25,11 +25,19 @@ static const uint8_t map1[] =
10, 10,
10, 10,
0, 0,
LCR_MAP_BLOCK(LCR_BLOCK_FULL,32,32,32,LCR_BLOCK_MATERIAL_CONCRETE,0), LCR_MAP_BLOCK(LCR_BLOCK_FULL,32,0,32,LCR_BLOCK_MATERIAL_CONCRETE,0),
LCR_MAP_BLOCK(LCR_BLOCK_FULL,33,32,32,LCR_BLOCK_MATERIAL_CONCRETE,0), LCR_MAP_BLOCK(LCR_BLOCK_FULL,33,63,32,LCR_BLOCK_MATERIAL_CONCRETE,0),
LCR_MAP_BLOCK(LCR_BLOCK_RAMP_CURVED_WALL,34,32,32,LCR_BLOCK_MATERIAL_CONCRETE,/*LCR_BLOCK_TRANSFORM_ROT_90*/0), LCR_MAP_BLOCK(LCR_BLOCK_RAMP_CURVED_WALL,34,32,32,LCR_BLOCK_MATERIAL_CONCRETE,/*LCR_BLOCK_TRANSFORM_ROT_90*/0),
LCR_MAP_BLOCK(LCR_BLOCK_RAMP_CURVED_WALL,35,32,32,LCR_BLOCK_MATERIAL_CONCRETE,LCR_BLOCK_TRANSFORM_ROT_90), LCR_MAP_BLOCK(LCR_BLOCK_RAMP_CURVED_WALL,35,32,32,LCR_BLOCK_MATERIAL_CONCRETE,LCR_BLOCK_TRANSFORM_ROT_90),
LCR_MAP_BLOCK(LCR_BLOCK_FULL,38,35,32,LCR_BLOCK_MATERIAL_CONCRETE,0),
LCR_MAP_BLOCK(LCR_BLOCK_FULL,39,35,32,LCR_BLOCK_MATERIAL_CONCRETE,0),
LCR_MAP_BLOCK(LCR_BLOCK_FULL,40,35,32,LCR_BLOCK_MATERIAL_CONCRETE,0),
LCR_MAP_BLOCK(LCR_BLOCK_FULL,41,35,32,LCR_BLOCK_MATERIAL_CONCRETE,0),
LCR_MAP_BLOCK(LCR_BLOCK_FULL,42,35,32,LCR_BLOCK_MATERIAL_CONCRETE,0),
LCR_MAP_BLOCK(LCR_BLOCK_FULL,43,35,32,LCR_BLOCK_MATERIAL_CONCRETE,0),
LCR_MAP_BLOCK(LCR_BLOCK_FULL,44,35,32,LCR_BLOCK_MATERIAL_CONCRETE,0),
LCR_MAP_BLOCK(LCR_BLOCK_BOTTOM_LEFT,34,32,33,LCR_BLOCK_MATERIAL_CONCRETE,LCR_BLOCK_TRANSFORM_ROT_90), LCR_MAP_BLOCK(LCR_BLOCK_BOTTOM_LEFT,34,32,33,LCR_BLOCK_MATERIAL_CONCRETE,LCR_BLOCK_TRANSFORM_ROT_90),
LCR_MAP_BLOCK(LCR_BLOCK_FULL,32,33,32,LCR_BLOCK_MATERIAL_CONCRETE,0), LCR_MAP_BLOCK(LCR_BLOCK_FULL,32,33,32,LCR_BLOCK_MATERIAL_CONCRETE,0),
@ -4803,7 +4811,7 @@ static const uint8_t LCR_images[] =
0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x02,0x00,0x02,0x02,0x02,0x02, 0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x02,0x00,0x02,0x02,0x02,0x02,
0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x02, 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x02,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0xc2,0xc2,0x02,0xc2, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0xc2,0xc2,0x02,0xc2,
0xc2,0xc2,0xc2,0xbe,0xbe,0xc2,0xc2,0xc2,0xc2,0xc2,0xc2,0xc2,0xc2,0x02,0x02,0x00, 0xc2,0xc2,0xc2,0x00,0x00,0xc2,0xc2,0xc2,0xc2,0xc2,0xc2,0xc2,0xc2,0x02,0x02,0x00,
0x00,0x00,0x00,0x02,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00, 0x00,0x00,0x00,0x02,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -4811,7 +4819,7 @@ static const uint8_t LCR_images[] =
0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x02, 0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x02,
0x02,0x02,0x02,0x02,0x02,0xc2,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x02,0x00,0x00, 0x02,0x02,0x02,0x02,0x02,0xc2,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x02,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0xc2,0xc2, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0xc2,0xc2,
0xc2,0xc2,0xbe,0xbe,0xc2,0xc2,0xc2,0xc2,0xc2,0xc2,0xc2,0x02,0x02,0x02,0x02,0x02, 0xc2,0xc2,0x00,0x00,0xc2,0xc2,0xc2,0xc2,0xc2,0xc2,0xc2,0x02,0x02,0x02,0x02,0x02,
0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00, 0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -4865,22 +4873,22 @@ static const uint8_t LCR_images[] =
0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0xbb,0xbb,0xbb, 0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0xbb,0xbb,0xbb,
0xbb,0xbb,0x03,0x03,0x03,0x03,0x3a,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 0xbb,0xbb,0x03,0x03,0x03,0x03,0x3a,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0xc2,0x02,0x02,0x02,0x02,0x02,0x02,0x02, 0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0xc2,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
0x02,0xbe,0x02,0x02,0x02,0xc2,0x02,0x02,0x00,0x00,0x02,0x02,0x01,0x00,0x02,0x02, 0x02,0x00,0x02,0x02,0x02,0xc2,0x02,0x02,0x00,0x00,0x02,0x02,0x01,0x00,0x02,0x02,
0x01,0x02,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0xc2,0x02, 0x01,0x02,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0xc2,0x02,
0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcb,0x00,0x00, 0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcb,0x00,0x00,
0x00,0x00,0x00,0x00,0xcb,0x02,0x02,0xc2,0x02,0xcb,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0xcb,0x02,0x02,0xc2,0x02,0xcb,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0xd2,0x01,0x01,0x01,0x01,0x01,0x03,0x01,0x03,0x03,0x03,0x03,0xd2, 0x00,0x00,0x01,0xd2,0x01,0x01,0x01,0x01,0x01,0x03,0x01,0x03,0x03,0x03,0x03,0xd2,
0x01,0x03,0x03,0xbb,0xbb,0x03,0x03,0xbb,0xbb,0xbb,0x03,0xbb,0xbb,0xbb,0xbb,0xbb, 0x01,0x03,0x03,0xbb,0xbb,0x03,0x03,0xbb,0xbb,0xbb,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,
0xbb,0x97,0x03,0x03,0x03,0x03,0x03,0x03,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, 0xbb,0x97,0x03,0x03,0x03,0x03,0x03,0x03,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0xc2,0x02,0x02,0x02,0xbe, 0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0xc2,0x02,0x02,0x02,0x00,
0x02,0xbe,0xbe,0xc2,0xc2,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x02,0x01,0x01,0x02, 0x02,0x00,0x00,0xc2,0xc2,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x02,0x01,0x01,0x02,
0x02,0x01,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x02,0x02,0x02, 0x02,0x01,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x02,0x02,0x02,
0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xcb,0x00,0x02,0x02,0xcb,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00, 0x00,0x00,0x00,0xcb,0x00,0x02,0x02,0xcb,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,
0x00,0x00,0x00,0xd2,0x01,0x01,0x01,0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, 0x00,0x00,0x00,0xd2,0x01,0x01,0x01,0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0xbb,0xbb,0x03,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x03,0xbb,0xbb, 0x03,0x03,0x03,0xbb,0xbb,0x03,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x03,0xbb,0xbb,
0xbb,0x97,0x97,0x97,0x97,0xbb,0xbb,0x03,0x03,0x01,0x01,0x01,0x01,0x01,0x00,0x00, 0xbb,0x97,0x97,0x97,0x97,0xbb,0xbb,0x03,0x03,0x01,0x01,0x01,0x01,0x01,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x02,0x02,0x02,0x02,0xbe,0x02,0xbe,0x02, 0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x02,0x02,0x02,0x02,0x00,0x02,0x00,0x02,
0x02,0x02,0xc2,0x02,0x02,0x02,0x00,0x01,0x01,0x02,0x00,0x02,0x02,0x02,0x01,0x01, 0x02,0x02,0xc2,0x02,0x02,0x02,0x00,0x01,0x01,0x02,0x00,0x02,0x02,0x02,0x01,0x01,
0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x01,0x01,0x00,0x00,0x02,0x02,0x02, 0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x01,0x01,0x00,0x00,0x02,0x02,0x02,
0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcb, 0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcb,
@ -4888,7 +4896,7 @@ static const uint8_t LCR_images[] =
0x01,0x01,0xd2,0x00,0x01,0xd2,0xd2,0x03,0x03,0x03,0x01,0x01,0x03,0x03,0x03,0x03, 0x01,0x01,0xd2,0x00,0x01,0xd2,0xd2,0x03,0x03,0x03,0x01,0x01,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x03,0xbb,0xbb, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x03,0xbb,0xbb,
0x97,0x97,0xbb,0xbb,0x97,0x97,0x03,0xbb,0x03,0x03,0x03,0x03,0x3a,0x01,0x01,0x01, 0x97,0x97,0xbb,0xbb,0x97,0x97,0x03,0xbb,0x03,0x03,0x03,0x03,0x3a,0x01,0x01,0x01,
0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0xc2,0x02,0x02,0x02,0x02,0x02,0xbe, 0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0xc2,0x02,0x02,0x02,0x02,0x02,0x00,
0x02,0x02,0x02,0x02,0x00,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, 0x02,0x02,0x02,0x02,0x00,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x02,0x02, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x02,0x02,
0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -5848,6 +5856,10 @@ void LCR_loadImage(unsigned int index)
_LCR_currentImagePixel = _LCR_currentImage; _LCR_currentImagePixel = _LCR_currentImage;
} }
/**
Changes currently loaded image's brightness either up or down by modifying
its palette. This can be used for shading.
*/
void LCR_imageChangeBrightness(int up) void LCR_imageChangeBrightness(int up)
{ {
if (up) if (up)
@ -5859,16 +5871,22 @@ void LCR_imageChangeBrightness(int up)
((_LCR_currentImagePalette[i] >> 1) & 0x7bef); ((_LCR_currentImagePalette[i] >> 1) & 0x7bef);
} }
/**
Samples currently loaded image at given pixels coordinates (with wrapping).
This is slower than reading the image pixel by pixel.
*/
uint16_t LCR_sampleImage(int x, int y) uint16_t LCR_sampleImage(int x, int y)
{ {
x = (y * LCR_IMAGE_SIZE + x) % (LCR_IMAGE_SIZE * LCR_IMAGE_SIZE); // TODO: bottleneck, later on optimize here
x = (y % LCR_IMAGE_SIZE) * LCR_IMAGE_SIZE + (x % LCR_IMAGE_SIZE);
if (x < 0) // TODO: optimize x += (x < 0) * (LCR_IMAGE_SIZE * LCR_IMAGE_SIZE);
x += LCR_IMAGE_SIZE * LCR_IMAGE_SIZE;
return _LCR_currentImagePalette[_LCR_currentImage[x]]; return _LCR_currentImagePalette[_LCR_currentImage[x]];
} }
/**
Gets the next pixel of currently loaded image. This is faster than sampling
the image by pixel coordinates.
*/
uint16_t LCR_getNextImagePixel(void) uint16_t LCR_getNextImagePixel(void)
{ {
uint16_t r = _LCR_currentImagePalette[*_LCR_currentImagePixel]; uint16_t r = _LCR_currentImagePalette[*_LCR_currentImagePixel];

View file

@ -138,10 +138,8 @@ void _LCR_addMapTriangle(S3L_Index a, S3L_Index b, S3L_Index c)
{ {
S3L_Index *t = &(LCR_renderer.mapTriangles[LCR_renderer.mapModel->triangleCount * 3]); S3L_Index *t = &(LCR_renderer.mapTriangles[LCR_renderer.mapModel->triangleCount * 3]);
*t = a; *t = a; t++;
t++; *t = b; t++;
*t = b;
t++;
*t = c; *t = c;
LCR_renderer.mapModel->triangleCount++; LCR_renderer.mapModel->triangleCount++;
@ -316,11 +314,11 @@ void _LCR_rendererCullHiddenMapTriangles(void)
/* /*
We'll be moving the covered triangles to the end of the array, then at the We'll be moving the covered triangles to the end of the array, then at the
end we'll just shorten the array. end we'll just shorten the array by number of removed triangles.
*/ */
while (i < LCR_renderer.mapModel->triangleCount - n) while (i < LCR_renderer.mapModel->triangleCount - n)
{ {
t2 = t1 + 3; t2 = t1 + 3; // t2 is the the other triangle against which we check
int t1Covered = 0; int t1Covered = 0;
@ -334,21 +332,22 @@ void _LCR_rendererCullHiddenMapTriangles(void)
{ {
if (j < LCR_renderer.mapModel->triangleCount - n) if (j < LCR_renderer.mapModel->triangleCount - n)
{ {
_LCR_rendererSwapTriangles(t2, _LCR_rendererSwapTriangles(t2,LCR_renderer.mapTriangles +
LCR_renderer.mapTriangles + (LCR_renderer.mapModel->triangleCount - 1 - n) * 3); (LCR_renderer.mapModel->triangleCount - 1 - n) * 3);
n++; n++;
} }
} }
t2 += 3; t2 += 3; // check next triangle
} }
if (t1Covered) if (t1Covered)
{ {
_LCR_rendererSwapTriangles(t1, _LCR_rendererSwapTriangles(t1,LCR_renderer.mapTriangles +
LCR_renderer.mapTriangles + (LCR_renderer.mapModel->triangleCount - 1 - n) * 3); (LCR_renderer.mapModel->triangleCount - 1 - n) * 3);
n++; n++;
// we stay at this position because we've swapped the triangle here
} }
else else
{ {
@ -357,7 +356,7 @@ void _LCR_rendererCullHiddenMapTriangles(void)
} }
} }
LCR_renderer.mapModel->triangleCount -= n; LCR_renderer.mapModel->triangleCount -= n; // cut off the removed triangles
// remove unused vertices: // remove unused vertices:
@ -412,7 +411,9 @@ uint8_t _LCR_rendererBuildMapModel(void)
LCR_mapBlockGetTransform(LCR_currentMap.blocks + j * LCR_BLOCK_SIZE), LCR_mapBlockGetTransform(LCR_currentMap.blocks + j * LCR_BLOCK_SIZE),
blockShapeBytes,&blockShapeByteCount); blockShapeBytes,&blockShapeByteCount);
uint8_t vx, vy, vz, vi = 0; uint8_t vx, vy, vz, vi = 0,
isAtFloor = by == 0,
isAtCeiling = by == LCR_MAP_SIZE_BLOCKS - 1;
S3L_Index triangleIndices[3]; S3L_Index triangleIndices[3];
S3L_Unit originOffset = -1 * LCR_MAP_SIZE_BLOCKS / 2 * LCR_RENDERER_UNIT; S3L_Unit originOffset = -1 * LCR_MAP_SIZE_BLOCKS / 2 * LCR_RENDERER_UNIT;
@ -421,6 +422,9 @@ uint8_t _LCR_rendererBuildMapModel(void)
{ {
LCR_decodeMapBlockCoords(blockShapeBytes[i],&vx,&vy,&vz); LCR_decodeMapBlockCoords(blockShapeBytes[i],&vx,&vy,&vz);
isAtFloor &= vy == 0;
isAtCeiling &= vy == 12;
triangleIndices[vi] = _LCR_addMapVertex( triangleIndices[vi] = _LCR_addMapVertex(
originOffset + (((S3L_Unit) bx) * LCR_RENDERER_UNIT) + (LCR_RENDERER_UNIT * ((S3L_Unit) vx)) / 12, originOffset + (((S3L_Unit) bx) * LCR_RENDERER_UNIT) + (LCR_RENDERER_UNIT * ((S3L_Unit) vx)) / 12,
(originOffset + (((S3L_Unit) by) * LCR_RENDERER_UNIT)) / 2 + (LCR_RENDERER_UNIT / 2 * ((S3L_Unit) vy)) / 12, (originOffset + (((S3L_Unit) by) * LCR_RENDERER_UNIT)) / 2 + (LCR_RENDERER_UNIT / 2 * ((S3L_Unit) vy)) / 12,
@ -430,13 +434,20 @@ uint8_t _LCR_rendererBuildMapModel(void)
vi++; vi++;
else else
{ {
_LCR_addMapTriangle( // don't add triangles completely at the floor or ceiling of the map
triangleIndices[0],triangleIndices[1],triangleIndices[2]); if (!isAtFloor && !isAtCeiling)
_LCR_addMapTriangle(
triangleIndices[0],triangleIndices[1],triangleIndices[2]);
vi = 0; vi = 0;
isAtFloor = by == 0;
isAtCeiling = by == LCR_MAP_SIZE_BLOCKS - 1;
} }
} }
} }
// TODO: also cull the triangles in the loop by some N steps
_LCR_rendererCullHiddenMapTriangles(); _LCR_rendererCullHiddenMapTriangles();
return 1; return 1;