From Wang Rui, merged from svn/trunk revision 12688. "The files attached should be separately put into the directories

src/osgPlugins/osg and src/osgWrappers/serializers/osgSim. They fix a
serious infinite loop problem that may be caused by the stream buffer
mechanism under Windows and some osgSim wrapper bugs pointed by
Andreas. I've asked the community to help test them and hope now we
can solve these recent .osgt file reading issues."
This commit is contained in:
Robert Osfield
2011-07-15 09:16:33 +00:00
parent 902c4aa1e9
commit 9529b14f3c
3 changed files with 69 additions and 32 deletions

View File

@@ -22,10 +22,20 @@ static bool readLightPointList( osgDB::InputStream& is, osgSim::LightPointNode&
is >> osgDB::PROPERTY("Attributes") >> pt._on >> blendingMode >> pt._intensity >> pt._radius;
pt._blendingMode = (osgSim::LightPoint::BlendingMode)blendingMode;
is >> osgDB::PROPERTY("Sector");
pt._sector = dynamic_cast<osgSim::Sector*>( is.readObject() );
is >> osgDB::PROPERTY("BlinkSequence");
pt._blinkSequence = dynamic_cast<osgSim::BlinkSequence*>( is.readObject() );
bool hasObject = false; is >> osgDB::PROPERTY("Sector") >> hasObject;
if ( hasObject )
{
is >> osgDB::BEGIN_BRACKET;
pt._sector = dynamic_cast<osgSim::Sector*>( is.readObject() );
is >> osgDB::END_BRACKET;
}
hasObject = false; is >> osgDB::PROPERTY("BlinkSequence") >> hasObject;
if ( hasObject )
{
is >> osgDB::BEGIN_BRACKET;
pt._blinkSequence = dynamic_cast<osgSim::BlinkSequence*>( is.readObject() );
is >> osgDB::END_BRACKET;
}
is >> osgDB::END_BRACKET;
node.addLightPoint( pt );
}
@@ -45,8 +55,20 @@ static bool writeLightPointList( osgDB::OutputStream& os, const osgSim::LightPoi
os << osgDB::PROPERTY("Color") << pt._color << std::endl;
os << osgDB::PROPERTY("Attributes") << pt._on << (int)pt._blendingMode
<< pt._intensity << pt._radius << std::endl;
os << osgDB::PROPERTY("Sector"); os.writeObject( pt._sector.get() );
os << osgDB::PROPERTY("BlinkSequence"); os.writeObject( pt._blinkSequence.get() );
os << osgDB::PROPERTY("Sector") << (pt._sector!=NULL);
if ( pt._sector!=NULL )
{
os << osgDB::BEGIN_BRACKET << std::endl;
os.writeObject( pt._sector.get() );
os << osgDB::END_BRACKET << std::endl;
}
os << osgDB::PROPERTY("BlinkSequence") << (pt._blinkSequence!=NULL);
if ( pt._blinkSequence!=NULL )
{
os << osgDB::BEGIN_BRACKET << std::endl;
os.writeObject( pt._blinkSequence.get() );
os << osgDB::END_BRACKET << std::endl;
}
os << osgDB::END_BRACKET << std::endl;
}
os << osgDB::END_BRACKET << std::endl;

View File

@@ -23,6 +23,7 @@ static bool readValues( osgDB::InputStream& is, osgSim::MultiSwitch& node )
values.push_back( value );
}
node.setValueList( i, values );
is >> osgDB::END_BRACKET;
}
is >> osgDB::END_BRACKET;
return true;
@@ -40,7 +41,7 @@ static bool writeValues( osgDB::OutputStream& os, const osgSim::MultiSwitch& nod
for ( osgSim::MultiSwitch::ValueList::const_iterator itr=values.begin();
itr!=values.end(); ++itr )
{
os << *itr;
os << *itr << std::endl;
}
os << osgDB::END_BRACKET << std::endl;
}