From: Mikko Rasa Date: Fri, 31 Jan 2025 20:49:32 +0000 (+0200) Subject: Treat an empty bounding sphere as absent for frustum culling X-Git-Url: https://git.tdb.fi/?a=commitdiff_plain;h=d382f7524de37bd07693f0fa1795d3a3085a32ec;p=libs%2Fgl.git 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. --- 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);