Make culling a bit faster
This commit is contained in:
parent
dab40e47bc
commit
be26ddae63
1 changed files with 10 additions and 11 deletions
21
renderer.h
21
renderer.h
|
@ -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[3] = LCR_renderer.mapVerts + 3 * t2[0];
|
||||
|
||||
if ( // quick manhattan distance bailout condition
|
||||
S3L_abs(vertices[0][0] - vertices[3][0]) +
|
||||
S3L_abs(vertices[0][1] - vertices[3][1]) +
|
||||
S3L_abs(vertices[0][2] - vertices[3][2]) >
|
||||
(3 * LCR_RENDERER_UNIT))
|
||||
if ( // quick chebyshev distance bailout condition
|
||||
S3L_abs(vertices[0][0] - vertices[3][0]) > LCR_RENDERER_UNIT ||
|
||||
S3L_abs(vertices[0][2] - vertices[3][2]) > LCR_RENDERER_UNIT ||
|
||||
S3L_abs(vertices[0][1] - vertices[3][1]) > (LCR_RENDERER_UNIT / 2))
|
||||
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[4] = LCR_renderer.mapVerts + 3 * t2[1];
|
||||
vertices[2] = LCR_renderer.mapVerts + 3 * t1[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;
|
||||
int plane = -1;
|
||||
|
||||
|
|
Loading…
Reference in a new issue