|
|
|
@ -85,7 +85,21 @@ static INLINE short world_cull_backface(const world_t *world, const ps1bsp_face_ |
|
|
|
// UPDATE: tessellation does solve this, to an extent. However we must also make sure not to discard faces partially inside the frustum, and force tessellation on those. |
|
|
|
int camDot = m_dot12(&cam_vec, &cam_dir); |
|
|
|
if (camDot < 0) |
|
|
|
{ |
|
|
|
// Check if the face may be partially inside the frustum. If so, we draw it with a high amount of tessellation. |
|
|
|
for (int i = 0; i < 4; ++i) |
|
|
|
{ |
|
|
|
const ps1bsp_vertex_t *vert = &world->vertices[face->bounds[i]]; |
|
|
|
if (frustum_pointInside((SVECTOR*)vert)) |
|
|
|
{ |
|
|
|
// TODO: use a simplified formula with only face area to determine tessellation LOD |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Face really isn't visible |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
// Flip angle for faces that are on the opposite side of their plane |
|
|
|
char flip = 2 * face->side - 1; |
|
|
|
@ -191,7 +205,7 @@ static void world_drawFaces(const world_t *world, const ps1bsp_face_t *firstFace |
|
|
|
for (const ps1bsp_face_t *face = firstFace; face != NULL; face = face->nextFace) |
|
|
|
{ |
|
|
|
// Early primitive buffer check |
|
|
|
if (!mem_checkprim(sizeof(POLY_GT4), face->totalQuads)) |
|
|
|
if (!mem_checkprim(sizeof(POLY_GT4), face->totalPrimitives)) |
|
|
|
break; |
|
|
|
|
|
|
|
world_drawface(world, face, curOT); |
|
|
|
|