From cc1fcec7ea7ae6f9cdd2d03700c87a5d11f51324 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Sun, 29 Jan 2023 12:41:14 +0100 Subject: [PATCH] Also add leaf bounding sphere for optional per-leaf frustum culling. --- main.cpp | 2 +- ps1bsp.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index f9d47b7..e51f906 100644 --- a/main.cpp +++ b/main.cpp @@ -255,7 +255,7 @@ int process_faces(const world_t* world, const std::vector& tex outLeaf.firstLeafFace = leaf->lface_id; outLeaf.numLeafFaces = leaf->lface_num; - //outLeaf.center = convertWorldPosition(leaf->bound.getCenter()); + outLeaf.boundingSphere = leaf->bound.toBoundingSphere(); outLeaves.push_back(outLeaf); } diff --git a/ps1bsp.h b/ps1bsp.h index 38e21aa..ddf7e76 100644 --- a/ps1bsp.h +++ b/ps1bsp.h @@ -143,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;