From Wang Rui, "I'd like to submit the changes that will put ObjectProperty and ObjectMark variables into the InputStream/OutputStream class instead of static ones. This should avoid the threading problem and won't repeatedly reallocate memory for the properties. Some of the wrappers will be slightly modified to use the property variable stored in the InputStream/OutputStream as well."
This commit is contained in:
@@ -13,10 +13,10 @@ static bool readInitialBound( osgDB::InputStream& is, osg::Node& node )
|
||||
{
|
||||
osg::Vec3d center;
|
||||
double radius;
|
||||
is >> osgDB::BEGIN_BRACKET;
|
||||
is >> osgDB::PROPERTY("Center") >> center;
|
||||
is >> osgDB::PROPERTY("Radius") >> radius;
|
||||
is >> osgDB::END_BRACKET;
|
||||
is >> is.BEGIN_BRACKET;
|
||||
is >> is.PROPERTY("Center") >> center;
|
||||
is >> is.PROPERTY("Radius") >> radius;
|
||||
is >> is.END_BRACKET;
|
||||
node.setInitialBound( osg::BoundingSphere(center, radius) );
|
||||
return true;
|
||||
}
|
||||
@@ -24,10 +24,10 @@ static bool readInitialBound( osgDB::InputStream& is, osg::Node& node )
|
||||
static bool writeInitialBound( osgDB::OutputStream& os, const osg::Node& node )
|
||||
{
|
||||
const osg::BoundingSphere& bs = node.getInitialBound();
|
||||
os << osgDB::BEGIN_BRACKET << std::endl;
|
||||
os << osgDB::PROPERTY("Center") << osg::Vec3d(bs.center()) << std::endl;
|
||||
os << osgDB::PROPERTY("Radius") << double(bs.radius()) << std::endl;
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
os << os.BEGIN_BRACKET << std::endl;
|
||||
os << os.PROPERTY("Center") << osg::Vec3d(bs.center()) << std::endl;
|
||||
os << os.PROPERTY("Radius") << double(bs.radius()) << std::endl;
|
||||
os << os.END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -39,28 +39,28 @@ static bool checkDescriptions( const osg::Node& node )
|
||||
|
||||
static bool readDescriptions( osgDB::InputStream& is, osg::Node& node )
|
||||
{
|
||||
unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
|
||||
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
std::string value;
|
||||
is.readWrappedString( value );
|
||||
node.addDescription( value );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
is >> is.END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeDescriptions( osgDB::OutputStream& os, const osg::Node& node )
|
||||
{
|
||||
const osg::Node::DescriptionList& slist = node.getDescriptions();
|
||||
os.writeSize(slist.size()); os << osgDB::BEGIN_BRACKET << std::endl;
|
||||
os.writeSize(slist.size()); os << os.BEGIN_BRACKET << std::endl;
|
||||
for ( osg::Node::DescriptionList::const_iterator itr=slist.begin();
|
||||
itr!=slist.end(); ++itr )
|
||||
{
|
||||
os.writeWrappedString( *itr );
|
||||
os << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
os << os.END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user