Added support for serailizing and scripting BoundingBox and BoundingSphere objects
This commit is contained in:
@@ -73,6 +73,9 @@ class BoundingBoxImpl
|
||||
-FLT_MAX);
|
||||
}
|
||||
|
||||
inline bool operator == (const BoundingBoxImpl& rhs) const { return _min==rhs._min && _max==rhs._max; }
|
||||
inline bool operator != (const BoundingBoxImpl& rhs) const { return _min!=rhs._min || _max!=rhs._max; }
|
||||
|
||||
/** Returns true if the bounding box extents are valid, false otherwise. */
|
||||
inline bool valid() const
|
||||
{
|
||||
|
||||
@@ -63,6 +63,9 @@ class BoundingSphereImpl
|
||||
* otherwise. */
|
||||
inline bool valid() const { return _radius>=0.0; }
|
||||
|
||||
inline bool operator == (const BoundingSphereImpl& rhs) const { return _center==rhs._center && _radius==rhs._radius; }
|
||||
inline bool operator != (const BoundingSphereImpl& rhs) const { return _center!=rhs._center || _radius==rhs._radius; }
|
||||
|
||||
/** Set the bounding sphere to the given center/radius using floats. */
|
||||
inline void set(const vec_type& center,value_type radius)
|
||||
{
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
#include <osg/Object>
|
||||
#include <osg/UserDataContainer>
|
||||
#include <osg/BoundingBox>
|
||||
#include <osg/BoundingSphere>
|
||||
|
||||
namespace osg {
|
||||
|
||||
@@ -65,6 +67,10 @@ class ValueObject : public Object
|
||||
virtual void apply(const osg::Plane& /*value*/) {}
|
||||
virtual void apply(const osg::Matrixf& /*value*/) {}
|
||||
virtual void apply(const osg::Matrixd& /*value*/) {}
|
||||
virtual void apply(const osg::BoundingBoxf& /*value*/) {}
|
||||
virtual void apply(const osg::BoundingBoxd& /*value*/) {}
|
||||
virtual void apply(const osg::BoundingSpheref& /*value*/) {}
|
||||
virtual void apply(const osg::BoundingSphered& /*value*/) {}
|
||||
};
|
||||
|
||||
class SetValueVisitor
|
||||
@@ -91,6 +97,10 @@ class ValueObject : public Object
|
||||
virtual void apply(osg::Plane& /*value*/) {}
|
||||
virtual void apply(osg::Matrixf& /*value*/) {}
|
||||
virtual void apply(osg::Matrixd& /*value*/) {}
|
||||
virtual void apply(osg::BoundingBoxf& /*value*/) {}
|
||||
virtual void apply(osg::BoundingBoxd& /*value*/) {}
|
||||
virtual void apply(osg::BoundingSpheref& /*value*/) {}
|
||||
virtual void apply(osg::BoundingSphered& /*value*/) {}
|
||||
};
|
||||
|
||||
virtual bool get(GetValueVisitor& /*gvv*/) const { return false; }
|
||||
@@ -168,6 +178,10 @@ META_ValueObject(Quat, QuatValueObject)
|
||||
META_ValueObject(Plane, PlaneValueObject)
|
||||
META_ValueObject(Matrixf, MatrixfValueObject)
|
||||
META_ValueObject(Matrixd, MatrixdValueObject)
|
||||
META_ValueObject(BoundingBoxf, BoundingBoxfValueObject)
|
||||
META_ValueObject(BoundingBoxd, BoundingBoxdValueObject)
|
||||
META_ValueObject(BoundingSpheref, BoundingSpherefValueObject)
|
||||
META_ValueObject(BoundingSphered, BoundingSpheredValueObject)
|
||||
|
||||
/** provide implementation of osg::Object::getUserValue(..) template*/
|
||||
template<typename T>
|
||||
|
||||
Reference in New Issue
Block a user