Make culling a bit faster

This commit is contained in:
Miloslav Ciz 2025-02-20 17:25:53 +01:00
parent dab40e47bc
commit be26ddae63

View file

@ -590,24 +590,23 @@ uint8_t _LCR_rendererCheckMapTriCover(const S3L_Index *t1, const S3L_Index *t2)
vertices[0] = LCR_renderer.mapVerts + 3 * t1[0]; vertices[0] = LCR_renderer.mapVerts + 3 * t1[0];
vertices[3] = LCR_renderer.mapVerts + 3 * t2[0]; vertices[3] = LCR_renderer.mapVerts + 3 * t2[0];
if ( // quick manhattan distance bailout condition if ( // quick chebyshev distance bailout condition
S3L_abs(vertices[0][0] - vertices[3][0]) + S3L_abs(vertices[0][0] - vertices[3][0]) > LCR_RENDERER_UNIT ||
S3L_abs(vertices[0][1] - vertices[3][1]) + S3L_abs(vertices[0][2] - vertices[3][2]) > LCR_RENDERER_UNIT ||
S3L_abs(vertices[0][2] - vertices[3][2]) > S3L_abs(vertices[0][1] - vertices[3][1]) > (LCR_RENDERER_UNIT / 2))
(3 * LCR_RENDERER_UNIT))
return 0; return 0;
if ( // same vert indices?
(((t1[0] == t2[0]) || (t1[0] == t2[1]) || (t1[0] == t2[2]))) &&
(((t1[1] == t2[0]) || (t1[1] == t2[1]) || (t1[1] == t2[2]))) &&
(((t1[2] == t2[0]) || (t1[2] == t2[1]) || (t1[2] == t2[2]))))
return 0x03;
vertices[1] = LCR_renderer.mapVerts + 3 * t1[1]; vertices[1] = LCR_renderer.mapVerts + 3 * t1[1];
vertices[4] = LCR_renderer.mapVerts + 3 * t2[1]; vertices[4] = LCR_renderer.mapVerts + 3 * t2[1];
vertices[2] = LCR_renderer.mapVerts + 3 * t1[2]; vertices[2] = LCR_renderer.mapVerts + 3 * t1[2];
vertices[5] = LCR_renderer.mapVerts + 3 * t2[2]; vertices[5] = LCR_renderer.mapVerts + 3 * t2[2];
if ( // same vert indices?
(((t1[0] == t2[0]) | (t1[0] == t2[1]) | (t1[0] == t2[2]))) &
(((t1[1] == t2[0]) | (t1[1] == t2[1]) | (t1[1] == t2[2]))) &
(((t1[2] == t2[0]) | (t1[2] == t2[1]) | (t1[2] == t2[2]))))
return 0x03;
uint8_t result = 0; uint8_t result = 0;
int plane = -1; int plane = -1;