From afcf54b1086198b7a412bbfdc361f01b302f1d6e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 14 May 2014 16:52:18 +0000 Subject: [PATCH] Fixed the bounding sphere computation and handling of Drawable as the root of the scene graph --- include/osg/Drawable | 2 ++ src/osgUtil/CullVisitor.cpp | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/osg/Drawable b/include/osg/Drawable index 457ed2f01..6b5e02586 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -157,6 +157,8 @@ class OSG_EXPORT Drawable : public Node _boundingSphereComputed = true; } + _boundingSphere.set(_boundingBox.center(), _boundingBox.radius()); + return _boundingBox; } diff --git a/src/osgUtil/CullVisitor.cpp b/src/osgUtil/CullVisitor.cpp index 6535fdeae..764509340 100644 --- a/src/osgUtil/CullVisitor.cpp +++ b/src/osgUtil/CullVisitor.cpp @@ -989,10 +989,7 @@ void CullVisitor::apply(osg::Drawable& drawable) return; } - //else - { - if (getNodePath().back()->isCullingActive() && isCulled(bb)) return; - } + if (!getNodePath().empty() && getNodePath().back()->isCullingActive() && isCulled(bb)) return; if (_computeNearFar && bb.valid())