From d382f7524de37bd07693f0fa1795d3a3085a32ec Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 31 Jan 2025 22:49:32 +0200 Subject: [PATCH] Treat an empty bounding sphere as absent for frustum culling Dynamically created objects don't have their bounding sphere filled in, so they got culled when the center of the object was outside the frustum. --- source/render/camera.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/render/camera.cpp b/source/render/camera.cpp index 67fa4f51..d0a5963c 100644 --- a/source/render/camera.cpp +++ b/source/render/camera.cpp @@ -129,7 +129,7 @@ bool Camera::is_in_frustum(const Renderable &renderable) const { const Matrix *rmatrix = renderable.get_matrix(); const Geometry::BoundingSphere *bsphere = renderable.get_bounding_sphere(); - if(!rmatrix || !bsphere) + if(!rmatrix || !bsphere || bsphere->is_empty()) return true; Vector4 center = *rmatrix*compose(bsphere->get_center(), 1.0f); -- 2.45.2