ソースを参照

make get_center() return a copy so it won't destruct unexpectedly

David Rose 17 年 前
コミット
ecda56d02b

+ 3 - 3
panda/src/mathutil/boundingSphere.I

@@ -42,10 +42,10 @@ BoundingSphere(const LPoint3f &center, float radius) :
 //       Access: Published
 //  Description: 
 ////////////////////////////////////////////////////////////////////
-INLINE_MATHUTIL const LPoint3f &BoundingSphere::
+INLINE_MATHUTIL LPoint3f BoundingSphere::
 get_center() const {
-  nassertr(!is_empty(), _center);
-  nassertr(!is_infinite(), _center);
+  nassertr(!is_empty(), LPoint3f::zero());
+  nassertr(!is_infinite(), LPoint3f::zero());
   return _center;
 }
 

+ 1 - 1
panda/src/mathutil/boundingSphere.h

@@ -44,7 +44,7 @@ public:
   virtual void output(ostream &out) const;
 
 PUBLISHED:
-  INLINE_MATHUTIL const LPoint3f &get_center() const;
+  INLINE_MATHUTIL LPoint3f get_center() const;
   INLINE_MATHUTIL float get_radius() const;
 
 public: