diff --git a/ps1bsp.h b/ps1bsp.h index 7b79a99..d9bd4c6 100755 --- a/ps1bsp.h +++ b/ps1bsp.h @@ -135,7 +135,6 @@ typedef struct int planeId; short children[2]; - // TODO: add bounding box for frustum culling (or bounding sphere, might be cheaper) SVECTOR boundingSphere; } ps1bsp_node_t; @@ -144,8 +143,7 @@ typedef struct int type; int vislist; - // TODO: add bounding box for frustum culling (or do we? could save half the number of bounds checks if we only check nodes) - //SVECTOR center; + SVECTOR boundingSphere; u_short firstLeafFace; u_short numLeafFaces; diff --git a/test.ps1bsp b/test.ps1bsp index a78b035..60d25db 100755 Binary files a/test.ps1bsp and b/test.ps1bsp differ diff --git a/world.c b/world.c index ab179ca..8865ba0 100644 --- a/world.c +++ b/world.c @@ -193,8 +193,11 @@ static void world_drawnode(const world_t *world, short nodeIdx, u_char *pvs) if ((pvs[test >> 3] & (1 << (test & 0x7))) == 0) return; - u_long frameNum = time_getFrameNumber(); const ps1bsp_leaf_t *leaf = &world->leaves[~nodeIdx]; + // if (!frustum_sphereInside(&leaf->boundingSphere)) // TODO: not sure if it's actually faster to do all these additional frustum checks + // return; + + u_long frameNum = time_getFrameNumber(); const u_short *leafFace = &world->leafFaces[leaf->firstLeafFace]; for (u_short leafFaceIdx = 0; leafFaceIdx < leaf->numLeafFaces; ++leafFaceIdx, ++leafFace)