瀏覽代碼

fix infinite bounds case

David Rose 18 年之前
父節點
當前提交
aeae2e0198
共有 1 個文件被更改,包括 10 次插入10 次删除
  1. 10 10
      panda/src/framework/windowFramework.cxx

+ 10 - 10
panda/src/framework/windowFramework.cxx

@@ -459,25 +459,25 @@ 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)) {
+  // Determine the bounding sphere around the object.
+  if (gbv->is_infinite()) {
     framework_cat.warning()
-      << "Cannot determine bounding volume of " << object << "\n";
+      << "Infinite bounding volume for " << object << "\n";
     return;
   }
 
-  if (sphere->is_infinite()) {
+  if (gbv->is_empty()) {
     framework_cat.warning()
-      << "Infinite bounding volume for " << object << "\n";
+      << "Empty bounding volume for " << object << "\n";
     return;
   }
 
-  if (sphere->is_empty()) {
+  // 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()
-      << "Empty bounding volume for " << object << "\n";
+      << "Cannot determine bounding volume of " << object << "\n";
     return;
   }