]> git.tdb.fi Git - libs/gl.git/commitdiff
Treat an empty bounding sphere as absent for frustum culling
authorMikko Rasa <tdb@tdb.fi>
Fri, 31 Jan 2025 20:49:32 +0000 (22:49 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 31 Jan 2025 20:49:32 +0000 (22:49 +0200)
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

index 67fa4f517920561b01716715f676b507028638a8..d0a5963cd24fc0d36e5a1f4e20aa17c10cdc4740 100644 (file)
@@ -129,7 +129,7 @@ bool Camera::is_in_frustum(const Renderable &renderable) const
 {
        const Matrix *rmatrix = renderable.get_matrix();
        const Geometry::BoundingSphere<float, 3> *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);