From aeae2e01987dfb1102be357b947efd1a948cb3c7 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 5 Jun 2007 19:12:54 +0000 Subject: [PATCH] fix infinite bounds case --- panda/src/framework/windowFramework.cxx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/panda/src/framework/windowFramework.cxx b/panda/src/framework/windowFramework.cxx index 3fd18f948b..8a4b155eee 100644 --- a/panda/src/framework/windowFramework.cxx +++ b/panda/src/framework/windowFramework.cxx @@ -459,28 +459,28 @@ center_trackball(const NodePath &object) { gbv = new_gbv; } - // Determine the bounding sphere around the object. The - // BoundingVolume might be a sphere (it's likely), but since it - // might not, we'll take no chances and make our own sphere. - PT(BoundingSphere) sphere = new BoundingSphere(gbv->get_approx_center(), 0.0f); - if (!sphere->extend_by(gbv)) { - framework_cat.warning() - << "Cannot determine bounding volume of " << object << "\n"; - return; - } - - if (sphere->is_infinite()) { + // Determine the bounding sphere around the object. + if (gbv->is_infinite()) { framework_cat.warning() << "Infinite bounding volume for " << object << "\n"; return; } - if (sphere->is_empty()) { + if (gbv->is_empty()) { framework_cat.warning() << "Empty bounding volume for " << object << "\n"; return; } + // The BoundingVolume might be a sphere (it's likely), but since it + // might not, we'll take no chances and make our own sphere. + PT(BoundingSphere) sphere = new BoundingSphere(gbv->get_approx_center(), 0.0f); + if (!sphere->extend_by(gbv)) { + framework_cat.warning() + << "Cannot determine bounding volume of " << object << "\n"; + return; + } + LPoint3f center = sphere->get_center(); float radius = sphere->get_radius();