mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-19 05:06:25 -04:00
fix infinite bounds case
This commit is contained in:
parent
3a169d14b1
commit
aeae2e0198
@ -459,28 +459,28 @@ center_trackball(const NodePath &object) {
|
|||||||
gbv = new_gbv;
|
gbv = new_gbv;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine the bounding sphere around the object. The
|
// Determine the bounding sphere around the object.
|
||||||
// BoundingVolume might be a sphere (it's likely), but since it
|
if (gbv->is_infinite()) {
|
||||||
// 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()) {
|
|
||||||
framework_cat.warning()
|
framework_cat.warning()
|
||||||
<< "Infinite bounding volume for " << object << "\n";
|
<< "Infinite bounding volume for " << object << "\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sphere->is_empty()) {
|
if (gbv->is_empty()) {
|
||||||
framework_cat.warning()
|
framework_cat.warning()
|
||||||
<< "Empty bounding volume for " << object << "\n";
|
<< "Empty bounding volume for " << object << "\n";
|
||||||
return;
|
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();
|
LPoint3f center = sphere->get_center();
|
||||||
float radius = sphere->get_radius();
|
float radius = sphere->get_radius();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user