Added support for serailizing and scripting BoundingBox and BoundingSphere objects
This commit is contained in:
@@ -289,6 +289,32 @@ InputStream& InputStream::operator>>( osg::Matrixd& mat )
|
||||
}
|
||||
#endif
|
||||
|
||||
InputStream& InputStream::operator>>( osg::BoundingBoxf& bb)
|
||||
{
|
||||
float p0, p1, p2, p3, p4, p5; *this >> p0 >> p1 >> p2 >> p3>> p4>> p5;
|
||||
bb.set( p0, p1, p2, p3, p4, p5 ); return *this;
|
||||
}
|
||||
|
||||
InputStream& InputStream::operator>>( osg::BoundingBoxd& bb)
|
||||
{
|
||||
double p0, p1, p2, p3, p4, p5; *this >> p0 >> p1 >> p2 >> p3>> p4>> p5;
|
||||
bb.set( p0, p1, p2, p3, p4, p5 ); return *this;
|
||||
}
|
||||
|
||||
InputStream& InputStream::operator>>( osg::BoundingSpheref& bs)
|
||||
{
|
||||
float p0, p1, p2, p3; *this >> p0 >> p1 >> p2 >> p3;
|
||||
bs.set( osg::Vec3f(p0, p1, p2), p3 ); return *this;
|
||||
}
|
||||
|
||||
InputStream& InputStream::operator>>( osg::BoundingSphered& bs)
|
||||
{
|
||||
double p0, p1, p2, p3; *this >> p0 >> p1 >> p2 >> p3;
|
||||
bs.set( osg::Vec3d(p0, p1, p2), p3 ); return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
osg::Array* InputStream::readArray()
|
||||
{
|
||||
osg::ref_ptr<osg::Array> array = NULL;
|
||||
|
||||
@@ -160,6 +160,18 @@ OutputStream& OutputStream::operator<<( const osg::Plane& p )
|
||||
{ *this << (double)p[0] << (double)p[1] << (double)p[2] << (double)p[3]; return *this; }
|
||||
|
||||
|
||||
OutputStream& OutputStream::operator<<( const osg::BoundingBoxf& bb)
|
||||
{ *this << bb.xMin() << bb.yMin() << bb.zMin() << bb.xMax() << bb.yMax() << bb.zMax(); return *this; }
|
||||
|
||||
OutputStream& OutputStream::operator<<( const osg::BoundingBoxd& bb)
|
||||
{ *this << bb.xMin() << bb.yMin() << bb.zMin() << bb.xMax() << bb.yMax() << bb.zMax(); return *this; }
|
||||
|
||||
OutputStream& OutputStream::operator<<( const osg::BoundingSpheref& bs)
|
||||
{ *this << bs.center().x() << bs.center().y() << bs.center().z() << bs.radius(); return *this; }
|
||||
|
||||
OutputStream& OutputStream::operator<<( const osg::BoundingSphered& bs)
|
||||
{ *this << bs.center().x() << bs.center().y() << bs.center().z() << bs.radius(); return *this; }
|
||||
|
||||
#if 0
|
||||
OutputStream& OutputStream::operator<<( const osg::Matrixf& mat )
|
||||
{
|
||||
|
||||
@@ -208,6 +208,13 @@ PropertyInterface::PropertyInterface():
|
||||
TYPENAME(MATRIXF)
|
||||
TYPENAME(MATRIXD)
|
||||
TYPENAME(MATRIX)
|
||||
|
||||
TYPENAME(BOUNDINGBOXF)
|
||||
TYPENAME(BOUNDINGBOXD)
|
||||
|
||||
TYPENAME(BOUNDINGSPHEREF)
|
||||
TYPENAME(BOUNDINGSPHERED)
|
||||
|
||||
TYPENAME(GLENUM)
|
||||
TYPENAME(STRING)
|
||||
TYPENAME(ENUM)
|
||||
@@ -439,6 +446,10 @@ public:
|
||||
virtual void apply(const osg::Plane& /*value*/) { type = osgDB::BaseSerializer::RW_PLANE; }
|
||||
virtual void apply(const osg::Matrixf& /*value*/) { type = osgDB::BaseSerializer::RW_MATRIXF; }
|
||||
virtual void apply(const osg::Matrixd& /*value*/) { type = osgDB::BaseSerializer::RW_MATRIXD; }
|
||||
virtual void apply(const osg::BoundingBoxf& /*value*/) { type = osgDB::BaseSerializer::RW_BOUNDINGBOXF; }
|
||||
virtual void apply(const osg::BoundingBoxd& /*value*/) { type = osgDB::BaseSerializer::RW_BOUNDINGBOXD; }
|
||||
virtual void apply(const osg::BoundingSpheref& /*value*/) { type = osgDB::BaseSerializer::RW_BOUNDINGSPHEREF; }
|
||||
virtual void apply(const osg::BoundingSphered& /*value*/) { type = osgDB::BaseSerializer::RW_BOUNDINGSPHERED; }
|
||||
};
|
||||
|
||||
bool PropertyInterface::getPropertyType(const osg::Object* object, const std::string& propertyName, osgDB::BaseSerializer::Type& type) const
|
||||
|
||||
Reference in New Issue
Block a user