From 5e315d5fabc24234cc697e1aa3bc3605b718454f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 5 Apr 2012 13:53:47 +0000 Subject: [PATCH] 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." --- include/osgDB/DataTypes | 22 ++--- include/osgDB/InputStream | 5 + include/osgDB/OutputStream | 5 + include/osgDB/Serializer | 42 ++++---- src/osgDB/InputStream.cpp | 3 + src/osgDB/OutputStream.cpp | 3 + .../serializers/osg/AnimationPath.cpp | 28 +++--- src/osgWrappers/serializers/osg/Billboard.cpp | 8 +- src/osgWrappers/serializers/osg/Camera.cpp | 56 +++++------ .../serializers/osg/CompositeShape.cpp | 8 +- .../serializers/osg/ConvexPlanarOccluder.cpp | 20 ++-- src/osgWrappers/serializers/osg/Drawable.cpp | 16 +-- .../serializers/osg/FragmentProgram.cpp | 16 +-- src/osgWrappers/serializers/osg/Geode.cpp | 8 +- src/osgWrappers/serializers/osg/Geometry.cpp | 40 ++++---- src/osgWrappers/serializers/osg/Group.cpp | 8 +- .../serializers/osg/ImageSequence.cpp | 16 +-- src/osgWrappers/serializers/osg/LOD.cpp | 8 +- src/osgWrappers/serializers/osg/Material.cpp | 8 +- src/osgWrappers/serializers/osg/Node.cpp | 24 ++--- src/osgWrappers/serializers/osg/Object.cpp | 8 +- src/osgWrappers/serializers/osg/PagedLOD.cpp | 24 ++--- .../serializers/osg/PolygonMode.cpp | 12 +-- .../serializers/osg/PolygonStipple.cpp | 8 +- src/osgWrappers/serializers/osg/Program.cpp | 20 ++-- src/osgWrappers/serializers/osg/ProxyNode.cpp | 16 +-- src/osgWrappers/serializers/osg/Shader.cpp | 8 +- .../serializers/osg/ShaderBinary.cpp | 8 +- src/osgWrappers/serializers/osg/StateSet.cpp | 56 +++++------ .../serializers/osg/StencilTwoSided.cpp | 16 +-- .../serializers/osg/Texture2DArray.cpp | 8 +- .../serializers/osg/TextureCubeMap.cpp | 8 +- .../serializers/osg/TransferFunction1D.cpp | 8 +- .../serializers/osg/UserDataContainer.cpp | 24 ++--- .../serializers/osg/VertexProgram.cpp | 16 +-- .../serializers/osgAnimation/Animation.cpp | 58 +++++------ .../osgAnimation/AnimationManagerBase.cpp | 8 +- .../osgAnimation/MorphGeometry.cpp | 12 +-- .../serializers/osgAnimation/RigGeometry.cpp | 16 +-- .../osgAnimation/UpdateMatrixTransform.cpp | 8 +- .../serializers/osgFX/MultiTextureControl.cpp | 8 +- .../osgManipulator/CompositeDragger.cpp | 8 +- .../serializers/osgManipulator/Dragger.cpp | 18 ++-- .../osgParticle/CompositePlacer.cpp | 8 +- .../osgParticle/DomainOperator.cpp | 62 ++++++------ .../osgParticle/ModularProgram.cpp | 8 +- .../osgParticle/MultiSegmentPlacer.cpp | 8 +- .../serializers/osgParticle/Particle.cpp | 98 +++++++++---------- .../osgParticle/ParticleEffect.cpp | 8 +- .../osgParticle/ParticleSystem.cpp | 16 +-- .../osgParticle/ParticleSystemUpdater.cpp | 8 +- .../serializers/osgSim/BlinkSequence.cpp | 8 +- .../serializers/osgSim/LightPointNode.cpp | 52 +++++----- .../serializers/osgSim/MultiSwitch.cpp | 20 ++-- .../serializers/osgSim/ObjectRecordData.cpp | 24 ++--- .../serializers/osgSim/ScalarBar.cpp | 54 +++++----- .../serializers/osgSim/ShapeAttributeList.cpp | 16 +-- .../serializers/osgTerrain/CompositeLayer.cpp | 8 +- .../osgTerrain/GeometryTechnique.cpp | 8 +- .../serializers/osgTerrain/ImageLayer.cpp | 8 +- .../serializers/osgTerrain/TerrainTile.cpp | 12 +-- src/osgWrappers/serializers/osgText/Text.cpp | 24 ++--- .../serializers/osgVolume/CompositeLayer.cpp | 8 +- .../osgVolume/CompositeProperty.cpp | 8 +- .../serializers/osgVolume/Locator.cpp | 8 +- 65 files changed, 601 insertions(+), 593 deletions(-) diff --git a/include/osgDB/DataTypes b/include/osgDB/DataTypes index bdfedead6..c6d302871 100644 --- a/include/osgDB/DataTypes +++ b/include/osgDB/DataTypes @@ -88,13 +88,15 @@ struct ObjectGLenum class ObjectProperty { public: + ObjectProperty() : _value(0), _mapProperty(false) {} + ObjectProperty( const char* name, int value=0, bool useMap=false ) : _name(name), _value(value), _mapProperty(useMap) {} ObjectProperty( const ObjectProperty& copy ) : _name(copy._name), _value(copy._value), _mapProperty(copy._mapProperty) {} - ObjectProperty& proto( const char* name ) + ObjectProperty& operator()( const char* name ) { _name = name; return *this; } void set( int v ) { _value = v; } @@ -103,34 +105,24 @@ public: std::string _name; int _value; bool _mapProperty; - -protected: - ObjectProperty():_value(0),_mapProperty(false) {} }; -static ObjectProperty defaultProp(""); - -#define PROPERTY(name) defaultProp.proto(name) #define MAPPEE(pairName, value) osgDB::ObjectProperty(#pairName, value, true) -#define DEF_PROPERTY(name, var) osgDB::ObjectProperty var(name); #define DEF_MAPPEE(pairName, var) osgDB::ObjectProperty var(#pairName, 0, true); class ObjectMark { public: - ObjectMark( const char* name, int delta=0 ) - : _name(name), _indentDelta(delta) {} + ObjectMark() : _indentDelta(0) {} ObjectMark( const ObjectMark& copy ) : _name(copy._name), _indentDelta(copy._indentDelta) {} + void set( const char* name, int delta=0 ) + { _name = name, _indentDelta = delta; } + std::string _name; int _indentDelta; - -protected: - ObjectMark():_indentDelta(0) {} }; -static ObjectMark BEGIN_BRACKET("{", +INDENT_VALUE); -static ObjectMark END_BRACKET ("}", -INDENT_VALUE); } #endif diff --git a/include/osgDB/InputStream b/include/osgDB/InputStream index f2600aeae..20fa279c9 100644 --- a/include/osgDB/InputStream +++ b/include/osgDB/InputStream @@ -157,6 +157,11 @@ public: inline void throwException( const std::string& msg ); const InputException* getException() const { return _exception.get(); } + // Property & mask variables + ObjectProperty PROPERTY; + ObjectMark BEGIN_BRACKET; + ObjectMark END_BRACKET; + protected: inline void checkStream(); void setWrapperSchema( const std::string& name, const std::string& properties ); diff --git a/include/osgDB/OutputStream b/include/osgDB/OutputStream index cd214eda9..f7c8b4286 100644 --- a/include/osgDB/OutputStream +++ b/include/osgDB/OutputStream @@ -164,6 +164,11 @@ public: inline void throwException( const std::string& msg ); const OutputException* getException() const { return _exception.get(); } + // Property & mask variables + ObjectProperty PROPERTY; + ObjectMark BEGIN_BRACKET; + ObjectMark END_BRACKET; + protected: template void writeArrayImplementation( const T*, int write_size, unsigned int numInRow=1 ); diff --git a/include/osgDB/Serializer b/include/osgDB/Serializer index 7b1b376f7..129b38b16 100644 --- a/include/osgDB/Serializer +++ b/include/osgDB/Serializer @@ -177,7 +177,7 @@ public: else { if ( !ok ) return true; - os << PROPERTY(_name.c_str()); + os << os.PROPERTY(_name.c_str()); } return (*_writer)(os, object); } @@ -251,7 +251,7 @@ public: } else if ( ParentType::_defaultValue!=value ) { - os << PROPERTY((ParentType::_name).c_str()); + os << os.PROPERTY((ParentType::_name).c_str()); if ( _useHex ) os << std::hex; os << value; if ( _useHex ) os << std::dec; @@ -308,7 +308,7 @@ public: } else if ( ParentType::_defaultValue!=value ) { - os << PROPERTY((ParentType::_name).c_str()) << value << std::endl; + os << os.PROPERTY((ParentType::_name).c_str()) << value << std::endl; } return true; } @@ -358,7 +358,7 @@ public: } else if ( ParentType::_defaultValue!=value ) { - os << PROPERTY((ParentType::_name).c_str()) << value << std::endl; + os << os.PROPERTY((ParentType::_name).c_str()) << value << std::endl; } return true; } @@ -425,7 +425,7 @@ public: } else if ( ParentType::_defaultValue!=value ) { - os << PROPERTY((ParentType::_name).c_str()) << GLENUM(value) << std::endl; + os << os.PROPERTY((ParentType::_name).c_str()) << GLENUM(value) << std::endl; } return true; } @@ -475,7 +475,7 @@ public: } else if ( ParentType::_defaultValue!=value ) { - os << PROPERTY((ParentType::_name).c_str()); + os << os.PROPERTY((ParentType::_name).c_str()); os.writeWrappedString( value ); os << std::endl; } @@ -517,11 +517,11 @@ public: is >> hasObject; if ( hasObject ) { - is >> BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; P* value = dynamic_cast( is.readObject() ); if ( ParentType::_defaultValue!=value ) (object.*_setter)( value ); - is >> END_BRACKET; + is >> is.END_BRACKET; } } return true; @@ -539,12 +539,12 @@ public: } else if ( ParentType::_defaultValue!=value ) { - os << PROPERTY((ParentType::_name).c_str()) << hasObject; + os << os.PROPERTY((ParentType::_name).c_str()) << hasObject; if ( hasObject ) { - os << BEGIN_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl; os.writeObject( value ); - os << END_BRACKET; + os << os.END_BRACKET; } os << std::endl; } @@ -586,11 +586,11 @@ public: is >> hasObject; if ( hasObject ) { - is >> BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; P* value = dynamic_cast( is.readImage() ); if ( ParentType::_defaultValue!=value ) (object.*_setter)( value ); - is >> END_BRACKET; + is >> is.END_BRACKET; } } return true; @@ -608,12 +608,12 @@ public: } else if ( ParentType::_defaultValue!=value ) { - os << PROPERTY((ParentType::_name).c_str()) << hasObject; + os << os.PROPERTY((ParentType::_name).c_str()) << hasObject; if ( hasObject ) { - os << BEGIN_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl; os.writeImage( value ); - os << END_BRACKET; + os << os.END_BRACKET; } os << std::endl; } @@ -673,7 +673,7 @@ public: } else if ( ParentType::_defaultValue!=value ) { - os << PROPERTY((ParentType::_name).c_str()) << getString(value) << std::endl; + os << os.PROPERTY((ParentType::_name).c_str()) << getString(value) << std::endl; } return true; } @@ -720,7 +720,7 @@ public: else if ( is.matchString(_name) ) { is >> size; - if ( size>0 ) is >> BEGIN_BRACKET; + if ( size>0 ) is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i0 ) { - is >> END_BRACKET; + is >> is.END_BRACKET; (object.*_setter)( list ); } } @@ -752,14 +752,14 @@ public: } else if ( size>0 ) { - os << PROPERTY((_name).c_str()) << size << BEGIN_BRACKET << std::endl; + os << os.PROPERTY((_name).c_str()) << size << os.BEGIN_BRACKET << std::endl; for ( ConstIterator itr=list.begin(); itr!=list.end(); ++itr ) { os << (*itr); } os << std::endl; - os << END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; } return true; } diff --git a/src/osgDB/InputStream.cpp b/src/osgDB/InputStream.cpp index cf1ddcef0..3bace1545 100644 --- a/src/osgDB/InputStream.cpp +++ b/src/osgDB/InputStream.cpp @@ -26,6 +26,9 @@ static std::string s_lastSchema; InputStream::InputStream( const osgDB::Options* options ) : _fileVersion(0), _useSchemaData(false), _forceReadingImage(false), _dataDecompress(0) { + BEGIN_BRACKET.set( "{", +INDENT_VALUE ); + END_BRACKET.set( "}", -INDENT_VALUE ); + if ( !options ) return; _options = options; diff --git a/src/osgDB/OutputStream.cpp b/src/osgDB/OutputStream.cpp index c357fd98e..179c674ac 100644 --- a/src/osgDB/OutputStream.cpp +++ b/src/osgDB/OutputStream.cpp @@ -25,6 +25,9 @@ using namespace osgDB; OutputStream::OutputStream( const osgDB::Options* options ) : _writeImageHint(WRITE_USE_IMAGE_HINT), _useSchemaData(false) { + BEGIN_BRACKET.set( "{", +INDENT_VALUE ); + END_BRACKET.set( "}", -INDENT_VALUE ); + if ( !options ) return; _options = options; diff --git a/src/osgWrappers/serializers/osg/AnimationPath.cpp b/src/osgWrappers/serializers/osg/AnimationPath.cpp index cee1d8804..f96c8367e 100644 --- a/src/osgWrappers/serializers/osg/AnimationPath.cpp +++ b/src/osgWrappers/serializers/osg/AnimationPath.cpp @@ -16,20 +16,20 @@ static bool readTimeControlPointMap( osgDB::InputStream& is, osg::AnimationPath& unsigned int size = is.readSize(); if ( size>0 ) { - is >> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> osgDB::PROPERTY("Time") >> time >> osgDB::BEGIN_BRACKET; - is >> osgDB::PROPERTY("Position") >> pos; - is >> osgDB::PROPERTY("Rotation") >> rot; - is >> osgDB::PROPERTY("Scale") >> scale; - is >> osgDB::END_BRACKET; + is >> is.PROPERTY("Time") >> time >> is.BEGIN_BRACKET; + is >> is.PROPERTY("Position") >> pos; + is >> is.PROPERTY("Rotation") >> rot; + is >> is.PROPERTY("Scale") >> scale; + is >> is.END_BRACKET; path.insert( time, osg::AnimationPath::ControlPoint(pos, rot, scale) ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; } return true; } @@ -40,18 +40,18 @@ static bool writeTimeControlPointMap( osgDB::OutputStream& os, const osg::Animat os.writeSize(map.size()); if ( map.size()>0 ) { - os << osgDB::BEGIN_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl; for ( osg::AnimationPath::TimeControlPointMap::const_iterator itr=map.begin(); itr!=map.end(); ++itr ) { const osg::AnimationPath::ControlPoint& pt = itr->second; - os << osgDB::PROPERTY("Time") << itr->first << osgDB::BEGIN_BRACKET << std::endl; - os << osgDB::PROPERTY("Position") << pt.getPosition() << std::endl; - os << osgDB::PROPERTY("Rotation") << pt.getRotation() << std::endl; - os << osgDB::PROPERTY("Scale") << pt.getScale() << std::endl; - os << osgDB::END_BRACKET << std::endl; + os << os.PROPERTY("Time") << itr->first << os.BEGIN_BRACKET << std::endl; + os << os.PROPERTY("Position") << pt.getPosition() << std::endl; + os << os.PROPERTY("Rotation") << pt.getRotation() << std::endl; + os << os.PROPERTY("Scale") << pt.getScale() << std::endl; + os << os.END_BRACKET << std::endl; } - os << osgDB::END_BRACKET; + os << os.END_BRACKET; } os << std::endl; return true; diff --git a/src/osgWrappers/serializers/osg/Billboard.cpp b/src/osgWrappers/serializers/osg/Billboard.cpp index 40d2fa2fd..fae04bf70 100644 --- a/src/osgWrappers/serializers/osg/Billboard.cpp +++ b/src/osgWrappers/serializers/osg/Billboard.cpp @@ -11,13 +11,13 @@ static bool checkPositionList( const osg::Billboard& node ) static bool readPositionList( osgDB::InputStream& is, osg::Billboard& node ) { unsigned int size = is.readSize(); - is >> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> pos; node.setPosition( i, pos ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } @@ -25,13 +25,13 @@ static bool writePositionList( osgDB::OutputStream& os, const osg::Billboard& no { const osg::Billboard::PositionList& posList = node.getPositionList(); os.writeSize(posList.size()); - os<< osgDB::BEGIN_BRACKET << std::endl; + os<< os.BEGIN_BRACKET << std::endl; for ( osg::Billboard::PositionList::const_iterator itr=posList.begin(); itr!=posList.end(); ++itr ) { os << osg::Vec3d(*itr) << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osg/Camera.cpp b/src/osgWrappers/serializers/osg/Camera.cpp index ac3d51cad..a008de085 100644 --- a/src/osgWrappers/serializers/osg/Camera.cpp +++ b/src/osgWrappers/serializers/osg/Camera.cpp @@ -45,54 +45,54 @@ USER_WRITE_FUNC( BufferComponent, writeBufferComponent ) static osg::Camera::Attachment readBufferAttachment( osgDB::InputStream& is ) { osg::Camera::Attachment attachment; - char type = -1; is >> osgDB::PROPERTY("Type") >> type; + char type = -1; is >> is.PROPERTY("Type") >> type; if ( type==0 ) { - is >> osgDB::PROPERTY("InternalFormat") >> attachment._internalFormat; + is >> is.PROPERTY("InternalFormat") >> attachment._internalFormat; return attachment; } else if ( type==1 ) { - is >> osgDB::PROPERTY("Image"); + is >> is.PROPERTY("Image"); attachment._image = dynamic_cast( is.readObject() ); } else if ( type==2 ) { - is >> osgDB::PROPERTY("Texture"); + is >> is.PROPERTY("Texture"); attachment._texture = dynamic_cast( is.readObject() ); - is >> osgDB::PROPERTY("Level") >> attachment._level; - is >> osgDB::PROPERTY("Face") >> attachment._face; - is >> osgDB::PROPERTY("MipMapGeneration") >> attachment._mipMapGeneration; + is >> is.PROPERTY("Level") >> attachment._level; + is >> is.PROPERTY("Face") >> attachment._face; + is >> is.PROPERTY("MipMapGeneration") >> attachment._mipMapGeneration; } else return attachment; - is >> osgDB::PROPERTY("MultisampleSamples") >> attachment._multisampleSamples; - is >> osgDB::PROPERTY("MultisampleColorSamples") >> attachment._multisampleColorSamples; + is >> is.PROPERTY("MultisampleSamples") >> attachment._multisampleSamples; + is >> is.PROPERTY("MultisampleColorSamples") >> attachment._multisampleColorSamples; return attachment; } static void writeBufferAttachment( osgDB::OutputStream& os, const osg::Camera::Attachment& attachment ) { - os << osgDB::PROPERTY("Type"); + os << os.PROPERTY("Type"); if ( attachment._internalFormat!=GL_NONE ) { os << (char)0 << std::endl; - os << osgDB::PROPERTY("InternalFormat") << GLENUM(attachment._internalFormat) << std::endl; + os << os.PROPERTY("InternalFormat") << GLENUM(attachment._internalFormat) << std::endl; return; } else if ( attachment._image.valid() ) { os << (char)1 << std::endl; - os << osgDB::PROPERTY("Image") << attachment._image.get(); + os << os.PROPERTY("Image") << attachment._image.get(); } else if ( attachment._texture.valid() ) { os << (char)2 << std::endl; - os << osgDB::PROPERTY("Texture") << attachment._texture.get(); - os << osgDB::PROPERTY("Level") << attachment._level << std::endl; - os << osgDB::PROPERTY("Face") << attachment._face << std::endl; - os << osgDB::PROPERTY("MipMapGeneration") << attachment._mipMapGeneration << std::endl; + os << os.PROPERTY("Texture") << attachment._texture.get(); + os << os.PROPERTY("Level") << attachment._level << std::endl; + os << os.PROPERTY("Face") << attachment._face << std::endl; + os << os.PROPERTY("MipMapGeneration") << attachment._mipMapGeneration << std::endl; } else { @@ -100,8 +100,8 @@ static void writeBufferAttachment( osgDB::OutputStream& os, const osg::Camera::A return; } - os << osgDB::PROPERTY("MultisampleSamples") << attachment._multisampleSamples << std::endl; - os << osgDB::PROPERTY("MultisampleColorSamples") << attachment._multisampleColorSamples << std::endl; + os << os.PROPERTY("MultisampleSamples") << attachment._multisampleSamples << std::endl; + os << os.PROPERTY("MultisampleColorSamples") << attachment._multisampleColorSamples << std::endl; } // _clearMask @@ -182,15 +182,15 @@ static bool checkBufferAttachmentMap( const osg::Camera& node ) static bool readBufferAttachmentMap( osgDB::InputStream& is, osg::Camera& 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> osgDB::PROPERTY("Attachment"); + is >> is.PROPERTY("Attachment"); osg::Camera::BufferComponent bufferComponent = static_cast( readBufferComponent(is) ); - is >> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; osg::Camera::Attachment attachment = readBufferAttachment(is); - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; if ( attachment._internalFormat!=GL_NONE ) { @@ -208,23 +208,23 @@ static bool readBufferAttachmentMap( osgDB::InputStream& is, osg::Camera& node ) attachment._multisampleSamples, attachment._multisampleColorSamples ); } } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeBufferAttachmentMap( osgDB::OutputStream& os, const osg::Camera& node ) { const osg::Camera::BufferAttachmentMap& map = node.getBufferAttachmentMap(); - os.writeSize(map.size()); os<< osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(map.size()); os<< os.BEGIN_BRACKET << std::endl; for ( osg::Camera::BufferAttachmentMap::const_iterator itr=map.begin(); itr!=map.end(); ++itr ) { - os << osgDB::PROPERTY("Attachment"); writeBufferComponent( os, itr->first ); - os << osgDB::BEGIN_BRACKET << std::endl; + os << os.PROPERTY("Attachment"); writeBufferComponent( os, itr->first ); + os << os.BEGIN_BRACKET << std::endl; writeBufferAttachment( os, itr->second ); - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osg/CompositeShape.cpp b/src/osgWrappers/serializers/osg/CompositeShape.cpp index 4b040fd08..9cb3e6bb7 100644 --- a/src/osgWrappers/serializers/osg/CompositeShape.cpp +++ b/src/osgWrappers/serializers/osg/CompositeShape.cpp @@ -10,25 +10,25 @@ static bool checkChildren( const osg::CompositeShape& shape ) static bool readChildren( osgDB::InputStream& is, osg::CompositeShape& shape ) { - unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); if ( child ) shape.addChild( child ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeChildren( osgDB::OutputStream& os, const osg::CompositeShape& shape ) { unsigned int size = shape.getNumChildren(); - os << size << osgDB::BEGIN_BRACKET << std::endl; + os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> vertex; polygon.add( vertex ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; } static void writeConvexPlanarPolygon( osgDB::OutputStream& os, const osg::ConvexPlanarPolygon& polygon ) { const osg::ConvexPlanarPolygon::VertexList& vertices = polygon.getVertexList(); - os.writeSize(vertices.size()); os<< osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(vertices.size()); os<< os.BEGIN_BRACKET << std::endl; for ( osg::ConvexPlanarPolygon::VertexList::const_iterator itr=vertices.begin(); itr!=vertices.end(); ++itr ) { os << osg::Vec3d(*itr) << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; } // _occluder @@ -54,29 +54,29 @@ static bool checkHoles( const osg::ConvexPlanarOccluder& obj ) static bool readHoles( osgDB::InputStream& is, osg::ConvexPlanarOccluder& obj ) { - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> osgDB::PROPERTY("Polygon"); + is >> is.PROPERTY("Polygon"); readConvexPlanarPolygon( is, polygon ); obj.addHole( polygon ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeHoles( osgDB::OutputStream& os, const osg::ConvexPlanarOccluder& obj ) { const osg::ConvexPlanarOccluder::HoleList& holes = obj.getHoleList(); - os.writeSize(holes.size()); os<< osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(holes.size()); os<< os.BEGIN_BRACKET << std::endl; for ( osg::ConvexPlanarOccluder::HoleList::const_iterator itr=holes.begin(); itr!=holes.end(); ++itr ) { - os << osgDB::PROPERTY("Polygon"); + os << os.PROPERTY("Polygon"); writeConvexPlanarPolygon( os, *itr ); } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osg/Drawable.cpp b/src/osgWrappers/serializers/osg/Drawable.cpp index a9d14db49..d131a9f21 100644 --- a/src/osgWrappers/serializers/osg/Drawable.cpp +++ b/src/osgWrappers/serializers/osg/Drawable.cpp @@ -11,10 +11,10 @@ static bool checkInitialBound( const osg::Drawable& drawable ) static bool readInitialBound( osgDB::InputStream& is, osg::Drawable& drawable ) { osg::Vec3d min, max; - is >> osgDB::BEGIN_BRACKET; - is >> osgDB::PROPERTY("Minimum") >> min; - is >> osgDB::PROPERTY("Maximum") >> max; - is >> osgDB::END_BRACKET; + is >> is.BEGIN_BRACKET; + is >> is.PROPERTY("Minimum") >> min; + is >> is.PROPERTY("Maximum") >> max; + is >> is.END_BRACKET; drawable.setInitialBound( osg::BoundingBox(min, max) ); return true; } @@ -22,10 +22,10 @@ static bool readInitialBound( osgDB::InputStream& is, osg::Drawable& drawable ) static bool writeInitialBound( osgDB::OutputStream& os, const osg::Drawable& drawable ) { const osg::BoundingBox& bb = drawable.getInitialBound(); - os << osgDB::BEGIN_BRACKET << std::endl; - os << osgDB::PROPERTY("Minimum") << osg::Vec3d(bb._min) << std::endl; - os << osgDB::PROPERTY("Maximum") << osg::Vec3d(bb._max) << std::endl; - os << osgDB::END_BRACKET; + os << os.BEGIN_BRACKET << std::endl; + os << os.PROPERTY("Minimum") << osg::Vec3d(bb._min) << std::endl; + os << os.PROPERTY("Maximum") << osg::Vec3d(bb._max) << std::endl; + os << os.END_BRACKET; os << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osg/FragmentProgram.cpp b/src/osgWrappers/serializers/osg/FragmentProgram.cpp index 99f40ce5e..0e0445e38 100644 --- a/src/osgWrappers/serializers/osg/FragmentProgram.cpp +++ b/src/osgWrappers/serializers/osg/FragmentProgram.cpp @@ -11,27 +11,27 @@ static bool checkLocalParameters( const osg::FragmentProgram& fp ) static bool readLocalParameters( osgDB::InputStream& is, osg::FragmentProgram& fp ) { - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> key >> value; fp.setProgramLocalParameter( key, value ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeLocalParameters( osgDB::OutputStream& os, const osg::FragmentProgram& fp ) { const osg::FragmentProgram::LocalParamList& params = fp.getLocalParameters(); - os.writeSize(params.size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(params.size()); os << os.BEGIN_BRACKET << std::endl; for ( osg::FragmentProgram::LocalParamList::const_iterator itr=params.begin(); itr!=params.end(); ++itr ) { os << itr->first << osg::Vec4d(itr->second) << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } @@ -43,27 +43,27 @@ static bool checkMatrices( const osg::FragmentProgram& fp ) static bool readMatrices( osgDB::InputStream& is, osg::FragmentProgram& fp ) { - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> key >> value; fp.setMatrix( key, value ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeMatrices( osgDB::OutputStream& os, const osg::FragmentProgram& fp ) { const osg::FragmentProgram::MatrixList& matrices = fp.getMatrices(); - os.writeSize(matrices.size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(matrices.size()); os << os.BEGIN_BRACKET << std::endl; for ( osg::FragmentProgram::MatrixList::const_iterator itr=matrices.begin(); itr!=matrices.end(); ++itr ) { os << (unsigned int)itr->first << osg::Matrixd(itr->second) << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osg/Geode.cpp b/src/osgWrappers/serializers/osg/Geode.cpp index e50563f07..8b303338c 100644 --- a/src/osgWrappers/serializers/osg/Geode.cpp +++ b/src/osgWrappers/serializers/osg/Geode.cpp @@ -10,25 +10,25 @@ static bool checkDrawables( const osg::Geode& node ) static bool readDrawables( osgDB::InputStream& is, osg::Geode& node ) { - unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); if ( drawable ) node.addDrawable( drawable ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeDrawables( osgDB::OutputStream& os, const osg::Geode& node ) { unsigned int size = node.getNumDrawables(); - os << size << osgDB::BEGIN_BRACKET << std::endl; + os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> osgDB::PROPERTY("Array") >> hasArray; + is >> is.PROPERTY("Array") >> hasArray; if ( hasArray ) data.array = is.readArray(); bool hasIndices = false; - is >> osgDB::PROPERTY("Indices") >> hasIndices; + is >> is.PROPERTY("Indices") >> hasIndices; if ( hasIndices ) data.indices = dynamic_cast( is.readArray() ); - is >> osgDB::PROPERTY("Binding"); + is >> is.PROPERTY("Binding"); data.binding = (osg::Geometry::AttributeBinding)readAttributeBinding(is); int normalizeValue = 0; - is >> osgDB::PROPERTY("Normalize") >> normalizeValue; + is >> is.PROPERTY("Normalize") >> normalizeValue; data.normalize = normalizeValue; } static void writeArrayData( osgDB::OutputStream& os, const osg::Geometry::ArrayData& data ) { - os << osgDB::PROPERTY("Array") << data.array.valid(); + os << os.PROPERTY("Array") << data.array.valid(); if ( data.array.valid() ) os << data.array.get(); else os << std::endl; - os << osgDB::PROPERTY("Indices") << data.indices.valid(); + os << os.PROPERTY("Indices") << data.indices.valid(); if ( data.indices.valid() ) os << data.indices.get(); else os << std::endl; - os << osgDB::PROPERTY("Binding"); writeAttributeBinding(os, data.binding); os << std::endl; - os << osgDB::PROPERTY("Normalize") << (int)data.normalize << std::endl; + os << os.PROPERTY("Binding"); writeAttributeBinding(os, data.binding); os << std::endl; + os << os.PROPERTY("Normalize") << (int)data.normalize << std::endl; } #define ADD_ARRAYDATA_FUNCTIONS( PROP ) \ @@ -51,15 +51,15 @@ static void writeArrayData( osgDB::OutputStream& os, const osg::Geometry::ArrayD { return geom.get##PROP().array.valid(); } \ static bool read##PROP( osgDB::InputStream& is, osg::Geometry& geom ) { \ osg::Geometry::ArrayData data; \ - is >> osgDB::BEGIN_BRACKET; readArrayData(is, data); \ - is >> osgDB::END_BRACKET; \ + is >> is.BEGIN_BRACKET; readArrayData(is, data); \ + is >> is.END_BRACKET; \ geom.set##PROP(data); \ return true; \ } \ static bool write##PROP( osgDB::OutputStream& os, const osg::Geometry& geom ) { \ - os << osgDB::BEGIN_BRACKET << std::endl; \ + os << os.BEGIN_BRACKET << std::endl; \ writeArrayData(os, geom.get##PROP()); \ - os << osgDB::END_BRACKET << std::endl; \ + os << os.END_BRACKET << std::endl; \ return true; \ } @@ -73,24 +73,24 @@ ADD_ARRAYDATA_FUNCTIONS( FogCoordData ) static bool check##PROP( const osg::Geometry& geom ) \ { return geom.get##LISTNAME().size()>0; } \ static bool read##PROP( osgDB::InputStream& is, osg::Geometry& geom ) { \ - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; \ + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; \ for ( unsigned int i=0; i> osgDB::PROPERTY("Data") >> osgDB::BEGIN_BRACKET; \ + is >> is.PROPERTY("Data") >> is.BEGIN_BRACKET; \ readArrayData(is, data); \ - is >> osgDB::END_BRACKET; geom.set##PROP(i, data); } \ - is >> osgDB::END_BRACKET; \ + is >> is.END_BRACKET; geom.set##PROP(i, data); } \ + is >> is.END_BRACKET; \ return true; \ } \ static bool write##PROP( osgDB::OutputStream& os, const osg::Geometry& geom ) { \ const osg::Geometry::ArrayDataList& LISTNAME = geom.get##LISTNAME(); \ - os.writeSize(LISTNAME.size()); os << osgDB::BEGIN_BRACKET << std::endl; \ + os.writeSize(LISTNAME.size()); os << os.BEGIN_BRACKET << std::endl; \ for ( osg::Geometry::ArrayDataList::const_iterator itr=LISTNAME.begin(); \ itr!=LISTNAME.end(); ++itr ) { \ - os << osgDB::PROPERTY("Data") << osgDB::BEGIN_BRACKET << std::endl; \ - writeArrayData(os, *itr); os << osgDB::END_BRACKET << std::endl; \ + os << os.PROPERTY("Data") << os.BEGIN_BRACKET << std::endl; \ + writeArrayData(os, *itr); os << os.END_BRACKET << std::endl; \ } \ - os << osgDB::END_BRACKET << std::endl; \ + os << os.END_BRACKET << std::endl; \ return true; \ } diff --git a/src/osgWrappers/serializers/osg/Group.cpp b/src/osgWrappers/serializers/osg/Group.cpp index 9c122b519..9e8a40057 100644 --- a/src/osgWrappers/serializers/osg/Group.cpp +++ b/src/osgWrappers/serializers/osg/Group.cpp @@ -10,26 +10,26 @@ static bool checkChildren( const osg::Group& node ) static bool readChildren( osgDB::InputStream& is, osg::Group& node ) { - unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i obj = is.readObject(); osg::Node* child = dynamic_cast( obj.get() ); if ( child ) node.addChild( child ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeChildren( osgDB::OutputStream& os, const osg::Group& node ) { unsigned int size = node.getNumChildren(); - os << size << osgDB::BEGIN_BRACKET << std::endl; + os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> files >> osgDB::BEGIN_BRACKET; + unsigned int files = 0; is >> files >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeFileNames( osgDB::OutputStream& os, const osg::ImageSequence& image ) { const osg::ImageSequence::FileNames& files = image.getFileNames(); - os.writeSize(files.size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(files.size()); os << os.BEGIN_BRACKET << std::endl; for ( osg::ImageSequence::FileNames::const_iterator itr=files.begin(); itr!=files.end(); ++itr ) { os.writeWrappedString( *itr ); os << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } @@ -43,26 +43,26 @@ static bool checkImages( const osg::ImageSequence& image ) static bool readImages( osgDB::InputStream& is, osg::ImageSequence& image ) { - unsigned int images = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int images = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); if ( img ) image.addImage( img ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeImages( osgDB::OutputStream& os, const osg::ImageSequence& image ) { const osg::ImageSequence::Images& images = image.getImages(); - os.writeSize(images.size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(images.size()); os << os.BEGIN_BRACKET << std::endl; for ( osg::ImageSequence::Images::const_iterator itr=images.begin(); itr!=images.end(); ++itr ) { os.writeObject( (*itr).get() ); } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osg/LOD.cpp b/src/osgWrappers/serializers/osg/LOD.cpp index b5cd3b51e..bc47f22f5 100644 --- a/src/osgWrappers/serializers/osg/LOD.cpp +++ b/src/osgWrappers/serializers/osg/LOD.cpp @@ -31,27 +31,27 @@ static bool checkRangeList( const osg::LOD& node ) static bool readRangeList( osgDB::InputStream& is, osg::LOD& 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> min >> max; node.setRange( i, min, max ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeRangeList( osgDB::OutputStream& os, const osg::LOD& node ) { const osg::LOD::RangeList& ranges = node.getRangeList(); - os.writeSize(ranges.size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(ranges.size()); os << os.BEGIN_BRACKET << std::endl; for ( osg::LOD::RangeList::const_iterator itr=ranges.begin(); itr!=ranges.end(); ++itr ) { os << itr->first << itr->second << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osg/Material.cpp b/src/osgWrappers/serializers/osg/Material.cpp index 8ddd9b6cc..94884864b 100644 --- a/src/osgWrappers/serializers/osg/Material.cpp +++ b/src/osgWrappers/serializers/osg/Material.cpp @@ -8,8 +8,8 @@ static bool read##PROP( osgDB::InputStream& is, osg::Material& attr ) { \ bool frontAndBack; TYPE value1, value2; \ is >> frontAndBack; \ - is >> osgDB::PROPERTY("Front") >> value1; \ - is >> osgDB::PROPERTY("Back") >> value2; \ + is >> is.PROPERTY("Front") >> value1; \ + is >> is.PROPERTY("Back") >> value2; \ if ( frontAndBack ) \ attr.set##PROP(osg::Material::FRONT_AND_BACK, value1); \ else { \ @@ -20,8 +20,8 @@ } \ static bool write##PROP( osgDB::OutputStream& os, const osg::Material& attr ) { \ os << attr.get##PROP##FrontAndBack(); \ - os << osgDB::PROPERTY("Front") << TYPE(attr.get##PROP(osg::Material::FRONT)); \ - os << osgDB::PROPERTY("Back") << TYPE(attr.get##PROP(osg::Material::BACK)) << std::endl; \ + os << os.PROPERTY("Front") << TYPE(attr.get##PROP(osg::Material::FRONT)); \ + os << os.PROPERTY("Back") << TYPE(attr.get##PROP(osg::Material::BACK)) << std::endl; \ return true; \ } diff --git a/src/osgWrappers/serializers/osg/Node.cpp b/src/osgWrappers/serializers/osg/Node.cpp index 689c6a7bf..f11c6a1f2 100644 --- a/src/osgWrappers/serializers/osg/Node.cpp +++ b/src/osgWrappers/serializers/osg/Node.cpp @@ -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> 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; } diff --git a/src/osgWrappers/serializers/osg/Object.cpp b/src/osgWrappers/serializers/osg/Object.cpp index e6c6c02b5..56526bbc5 100644 --- a/src/osgWrappers/serializers/osg/Object.cpp +++ b/src/osgWrappers/serializers/osg/Object.cpp @@ -13,18 +13,18 @@ static bool checkUserData( const osg::Object& obj ) static bool readUserData( osgDB::InputStream& is, osg::Object& obj ) { - is >> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; osg::Object* object = is.readObject(); if(object) obj.setUserData(object); - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeUserData( osgDB::OutputStream& os, const osg::Object& obj ) { - os << osgDB::BEGIN_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl; os.writeObject(dynamic_cast(obj.getUserData())); - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osg/PagedLOD.cpp b/src/osgWrappers/serializers/osg/PagedLOD.cpp index 2f7aec4a4..149771509 100644 --- a/src/osgWrappers/serializers/osg/PagedLOD.cpp +++ b/src/osgWrappers/serializers/osg/PagedLOD.cpp @@ -46,15 +46,15 @@ static bool checkRangeDataList( const osg::PagedLOD& node ) static bool readRangeDataList( osgDB::InputStream& is, osg::PagedLOD& node ) { - unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> osgDB::END_BRACKET; + is >> is.END_BRACKET; - size = 0; is >> osgDB::PROPERTY("PriorityList") >> size >> osgDB::BEGIN_BRACKET; + size = 0; is >> is.PROPERTY("PriorityList") >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeRangeDataList( osgDB::OutputStream& os, const osg::PagedLOD& node ) { unsigned int size = node.getNumFileNames(); - os << size << osgDB::BEGIN_BRACKET << std::endl; + os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); if ( child ) node.addChild( child ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } @@ -118,14 +118,14 @@ static bool writeChildren( osgDB::OutputStream& os, const osg::PagedLOD& node ) unsigned int realSize = size-dynamicLoadedSize; os << realSize; if ( realSize>0 ) { - os << osgDB::BEGIN_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> osgDB::PROPERTY("UseFrontAndBack") >> frontAndBack; - is >> osgDB::PROPERTY("Front"); int value1 = readModeValue(is); - is >> osgDB::PROPERTY("Back"); int value2 = readModeValue(is); + is >> is.PROPERTY("UseFrontAndBack") >> frontAndBack; + is >> is.PROPERTY("Front"); int value1 = readModeValue(is); + is >> is.PROPERTY("Back"); int value2 = readModeValue(is); if ( frontAndBack ) attr.setMode( osg::PolygonMode::FRONT_AND_BACK, (osg::PolygonMode::Mode)value1 ); @@ -37,13 +37,13 @@ static bool readMode( osgDB::InputStream& is, osg::PolygonMode& attr ) static bool writeMode( osgDB::OutputStream& os, const osg::PolygonMode& attr ) { - os << osgDB::PROPERTY("UseFrontAndBack") << attr.getFrontAndBack() << std::endl; + os << os.PROPERTY("UseFrontAndBack") << attr.getFrontAndBack() << std::endl; - os << osgDB::PROPERTY("Front"); + os << os.PROPERTY("Front"); writeModeValue( os, (int)attr.getMode(osg::PolygonMode::FRONT) ); os << std::endl; - os << osgDB::PROPERTY("Back"); + os << os.PROPERTY("Back"); writeModeValue( os, (int)attr.getMode(osg::PolygonMode::BACK) ); os << std::endl; return true; diff --git a/src/osgWrappers/serializers/osg/PolygonStipple.cpp b/src/osgWrappers/serializers/osg/PolygonStipple.cpp index d4084e350..c992d949a 100644 --- a/src/osgWrappers/serializers/osg/PolygonStipple.cpp +++ b/src/osgWrappers/serializers/osg/PolygonStipple.cpp @@ -18,12 +18,12 @@ static bool readMask( osgDB::InputStream& is, osg::PolygonStipple& attr ) } else { - is >> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i<128; ++i ) { is >> std::hex >> mask[i] >> std::dec; } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; } attr.setMask( (GLubyte*)mask ); return true; @@ -39,12 +39,12 @@ static bool writeMask( osgDB::OutputStream& os, const osg::PolygonStipple& attr else { const GLubyte* mask = attr.getMask(); - os << osgDB::BEGIN_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i<128; ++i ) { os << std::hex << mask[i] << std::dec << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; } return true; } diff --git a/src/osgWrappers/serializers/osg/Program.cpp b/src/osgWrappers/serializers/osg/Program.cpp index 45a8afefb..809be7c43 100644 --- a/src/osgWrappers/serializers/osg/Program.cpp +++ b/src/osgWrappers/serializers/osg/Program.cpp @@ -7,23 +7,23 @@ static bool check##PROP(const osg::Program& attr) \ { return attr.get##TYPE().size()>0; } \ static bool read##PROP(osgDB::InputStream& is, osg::Program& attr) { \ - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; \ + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; \ for ( unsigned int i=0; i> key >> value; attr.add##DATA(key, value); \ } \ - is >> osgDB::END_BRACKET; \ + is >> is.END_BRACKET; \ return true; \ } \ static bool write##PROP( osgDB::OutputStream& os, const osg::Program& attr ) \ { \ const osg::Program::TYPE& plist = attr.get##TYPE(); \ - os.writeSize(plist.size()); os << osgDB::BEGIN_BRACKET << std::endl; \ + os.writeSize(plist.size()); os << os.BEGIN_BRACKET << std::endl; \ for ( osg::Program::TYPE::const_iterator itr=plist.begin(); \ itr!=plist.end(); ++itr ) { \ os << itr->first << itr->second << std::endl; \ } \ - os << osgDB::END_BRACKET << std::endl; \ + os << os.END_BRACKET << std::endl; \ return true; \ } @@ -34,12 +34,12 @@ PROGRAM_LIST_FUNC( FragDataBinding, FragDataBindingList, BindFragDataLocation ) static bool check##PROP(const osg::Program& attr) \ { return attr.getParameter(NAME)!=GL_NONE; } \ static bool read##PROP(osgDB::InputStream& is, osg::Program& attr) { \ - int value; is >> osgDB::PROPERTY(#NAME) >> value; \ + int value; is >> is.PROPERTY(#NAME) >> value; \ attr.setParameter(NAME, value); \ return true; \ } \ static bool write##PROP(osgDB::OutputStream& os, const osg::Program& attr) { \ - os << osgDB::PROPERTY(#NAME) << (int)attr.getParameter(NAME) << std::endl; \ + os << os.PROPERTY(#NAME) << (int)attr.getParameter(NAME) << std::endl; \ return true; \ } @@ -55,25 +55,25 @@ static bool checkShaders( const osg::Program& attr ) static bool readShaders( osgDB::InputStream& is, osg::Program& attr ) { - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); if ( shader ) attr.addShader( shader ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeShaders( osgDB::OutputStream& os, const osg::Program& attr ) { unsigned int size = attr.getNumShaders(); - os.writeSize(size); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(size); os << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeFileNames( osgDB::OutputStream& os, const osg::ProxyNode& node ) { - os << node.getNumFileNames() << osgDB::BEGIN_BRACKET << std::endl; + os << node.getNumFileNames() << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); if ( child ) node.addChild( child ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } @@ -66,14 +66,14 @@ static bool writeChildren( osgDB::OutputStream& os, const osg::ProxyNode& node ) unsigned int realSize = size-dynamicLoadedSize; os << realSize; if ( realSize>0 ) { - os << osgDB::BEGIN_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> osgDB::END_BRACKET; + is >> is.END_BRACKET; shader.setShaderSource( code ); return true; } @@ -33,14 +33,14 @@ static bool writeShaderSource( osgDB::OutputStream& os, const osg::Shader& shade lines.push_back( line ); } - os.writeSize(lines.size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(lines.size()); os << os.BEGIN_BRACKET << std::endl; for ( std::vector::const_iterator itr=lines.begin(); itr!=lines.end(); ++itr ) { os.writeWrappedString( *itr ); os << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osg/ShaderBinary.cpp b/src/osgWrappers/serializers/osg/ShaderBinary.cpp index 484ed6294..20634d065 100644 --- a/src/osgWrappers/serializers/osg/ShaderBinary.cpp +++ b/src/osgWrappers/serializers/osg/ShaderBinary.cpp @@ -17,12 +17,12 @@ static bool readData( osgDB::InputStream& is, osg::ShaderBinary& sb ) } else { - is >> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> std::hex >> data[i] >> std::dec; } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; } sb.assign( size, (unsigned char*)data ); delete [] data; @@ -40,12 +40,12 @@ static bool writeData( osgDB::OutputStream& os, const osg::ShaderBinary& sb ) { const unsigned char* data = sb.getData(); os << (unsigned int)sb.getSize(); - os << osgDB::BEGIN_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i0 ) { - is >> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> mode; int value = readValue( is ); modes[mode.get()] = (osg::StateAttribute::Values)value; } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; } } @@ -48,16 +48,16 @@ static void readAttributes( osgDB::InputStream& is, osg::StateSet::AttributeList unsigned int size = is.readSize(); if ( size>0 ) { - is >> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); - is >> osgDB::PROPERTY("Value"); + is >> is.PROPERTY("Value"); int value = readValue( is ); if ( sa ) attrs[sa->getTypeMemberPair()] = osg::StateSet::RefAttributePair(sa,value); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; } } @@ -87,7 +87,7 @@ static void writeModes( osgDB::OutputStream& os, const osg::StateSet::ModeList& os.writeSize(modes.size()); if ( modes.size()>0 ) { - os << osgDB::BEGIN_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl; for ( osg::StateSet::ModeList::const_iterator itr=modes.begin(); itr!=modes.end(); ++itr ) { @@ -95,7 +95,7 @@ static void writeModes( osgDB::OutputStream& os, const osg::StateSet::ModeList& writeValue(os, itr->second); os << std::endl; } - os << osgDB::END_BRACKET; + os << os.END_BRACKET; } os << std::endl; } @@ -105,16 +105,16 @@ static void writeAttributes( osgDB::OutputStream& os, const osg::StateSet::Attri os.writeSize(attrs.size()); if ( attrs.size()>0 ) { - os << osgDB::BEGIN_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl; for ( osg::StateSet::AttributeList::const_iterator itr=attrs.begin(); itr!=attrs.end(); ++itr ) { os << itr->second.first.get(); - os << osgDB::PROPERTY("Value"); + os << os.PROPERTY("Value"); writeValue(os, itr->second.second); os << std::endl; } - os << osgDB::END_BRACKET; + os << os.END_BRACKET; } os << std::endl; } @@ -173,11 +173,11 @@ static bool checkTextureModeList( const osg::StateSet& ss ) static bool readTextureModeList( osgDB::InputStream& is, osg::StateSet& ss ) { - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; osg::StateSet::ModeList modes; for ( unsigned int i=0; i> osgDB::PROPERTY("Data"); + is >> is.PROPERTY("Data"); readModes( is, modes ); for ( osg::StateSet::ModeList::iterator itr=modes.begin(); itr!=modes.end(); ++itr ) @@ -186,21 +186,21 @@ static bool readTextureModeList( osgDB::InputStream& is, osg::StateSet& ss ) } modes.clear(); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeTextureModeList( osgDB::OutputStream& os, const osg::StateSet& ss ) { const osg::StateSet::TextureModeList& tml = ss.getTextureModeList(); - os.writeSize(tml.size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(tml.size()); os << os.BEGIN_BRACKET << std::endl; for ( osg::StateSet::TextureModeList::const_iterator itr=tml.begin(); itr!=tml.end(); ++itr ) { - os << osgDB::PROPERTY("Data"); + os << os.PROPERTY("Data"); writeModes( os, *itr ); } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } @@ -212,11 +212,11 @@ static bool checkTextureAttributeList( const osg::StateSet& ss ) static bool readTextureAttributeList( osgDB::InputStream& is, osg::StateSet& ss ) { - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; osg::StateSet::AttributeList attrs; for ( unsigned int i=0; i> osgDB::PROPERTY("Data"); + is >> is.PROPERTY("Data"); readAttributes( is, attrs ); for ( osg::StateSet::AttributeList::iterator itr=attrs.begin(); itr!=attrs.end(); ++itr ) @@ -225,21 +225,21 @@ static bool readTextureAttributeList( osgDB::InputStream& is, osg::StateSet& ss } attrs.clear(); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeTextureAttributeList( osgDB::OutputStream& os, const osg::StateSet& ss ) { const osg::StateSet::TextureAttributeList& tal = ss.getTextureAttributeList(); - os.writeSize(tal.size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(tal.size()); os << os.BEGIN_BRACKET << std::endl; for ( osg::StateSet::TextureAttributeList::const_iterator itr=tal.begin(); itr!=tal.end(); ++itr ) { - os << osgDB::PROPERTY("Data"); + os << os.PROPERTY("Data"); writeAttributes( os, *itr ); } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } @@ -251,32 +251,32 @@ static bool checkUniformList( const osg::StateSet& ss ) static bool readUniformList( osgDB::InputStream& is, osg::StateSet& ss ) { - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); - is >> osgDB::PROPERTY("Value"); + is >> is.PROPERTY("Value"); int value = readValue( is ); if ( uniform ) ss.addUniform( uniform, (osg::StateAttribute::Values)value ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeUniformList( osgDB::OutputStream& os, const osg::StateSet& ss ) { const osg::StateSet::UniformList& ul = ss.getUniformList(); - os.writeSize(ul.size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(ul.size()); os << os.BEGIN_BRACKET << std::endl; for ( osg::StateSet::UniformList::const_iterator itr=ul.begin(); itr!=ul.end(); ++itr ) { os << itr->second.first.get(); - os << osgDB::PROPERTY("Value"); + os << os.PROPERTY("Value"); writeValue(os, itr->second.second); os << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osg/StencilTwoSided.cpp b/src/osgWrappers/serializers/osg/StencilTwoSided.cpp index 4f88953c8..d28c95f9f 100644 --- a/src/osgWrappers/serializers/osg/StencilTwoSided.cpp +++ b/src/osgWrappers/serializers/osg/StencilTwoSided.cpp @@ -34,26 +34,26 @@ USER_WRITE_FUNC( Operation, writeOperation ) #define STENCIL_INT_VALUE_FUNC( PROP, TYPE ) \ static bool check##PROP( const osg::StencilTwoSided& attr ) { return true; } \ static bool read##PROP( osgDB::InputStream& is, osg::StencilTwoSided& attr ) { \ - TYPE value1; is >> osgDB::PROPERTY("Front") >> value1; \ - TYPE value2; is >> osgDB::PROPERTY("Back") >> value2; \ + TYPE value1; is >> is.PROPERTY("Front") >> value1; \ + TYPE value2; is >> is.PROPERTY("Back") >> value2; \ attr.set##PROP(osg::StencilTwoSided::FRONT, value1); \ attr.set##PROP(osg::StencilTwoSided::BACK, value2); return true; } \ static bool write##PROP( osgDB::OutputStream& os, const osg::StencilTwoSided& attr ) { \ - os << osgDB::PROPERTY("Front") << attr.get##PROP(osg::StencilTwoSided::FRONT); \ - os << osgDB::PROPERTY("Back") << attr.get##PROP(osg::StencilTwoSided::BACK); \ + os << os.PROPERTY("Front") << attr.get##PROP(osg::StencilTwoSided::FRONT); \ + os << os.PROPERTY("Back") << attr.get##PROP(osg::StencilTwoSided::BACK); \ os << std::endl; return true; } #define STENCIL_USER_VALUE_FUNC( PROP, TYPE ) \ static bool check##PROP( const osg::StencilTwoSided& attr ) { return true; } \ static bool read##PROP( osgDB::InputStream& is, osg::StencilTwoSided& attr ) { \ - is >> osgDB::PROPERTY("Front"); int value1 = read##TYPE(is); \ - is >> osgDB::PROPERTY("Back"); int value2 = read##TYPE(is); \ + is >> is.PROPERTY("Front"); int value1 = read##TYPE(is); \ + is >> is.PROPERTY("Back"); int value2 = read##TYPE(is); \ attr.set##PROP(osg::StencilTwoSided::FRONT, (osg::StencilTwoSided::TYPE)value1); \ attr.set##PROP(osg::StencilTwoSided::BACK, (osg::StencilTwoSided::TYPE)value2); \ return true; } \ static bool write##PROP( osgDB::OutputStream& os, const osg::StencilTwoSided& attr ) { \ - os << osgDB::PROPERTY("Front"); write##TYPE(os, (int)attr.get##PROP(osg::StencilTwoSided::FRONT)); \ - os << osgDB::PROPERTY("Back"); write##TYPE(os, (int)attr.get##PROP(osg::StencilTwoSided::BACK)); \ + os << os.PROPERTY("Front"); write##TYPE(os, (int)attr.get##PROP(osg::StencilTwoSided::FRONT)); \ + os << os.PROPERTY("Back"); write##TYPE(os, (int)attr.get##PROP(osg::StencilTwoSided::BACK)); \ os << std::endl; return true; } STENCIL_USER_VALUE_FUNC( Function, Function ) diff --git a/src/osgWrappers/serializers/osg/Texture2DArray.cpp b/src/osgWrappers/serializers/osg/Texture2DArray.cpp index d6a091860..5d818024c 100644 --- a/src/osgWrappers/serializers/osg/Texture2DArray.cpp +++ b/src/osgWrappers/serializers/osg/Texture2DArray.cpp @@ -10,26 +10,26 @@ static bool checkImages( const osg::Texture2DArray& tex ) static bool readImages( osgDB::InputStream& is, osg::Texture2DArray& tex ) { - unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; tex.setTextureDepth(size); for ( unsigned int i=0; i> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeImages( osgDB::OutputStream& os, const osg::Texture2DArray& tex ) { unsigned int size = tex.getNumImages(); - os << size << osgDB::BEGIN_BRACKET << std::endl; + os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> hasImage; \ if ( hasImage ) { \ - is >> osgDB::BEGIN_BRACKET; tex.setImage(FACE, is.readImage()); \ - is >> osgDB::END_BRACKET; \ + is >> is.BEGIN_BRACKET; tex.setImage(FACE, is.readImage()); \ + is >> is.END_BRACKET; \ } \ return true; \ } \ @@ -17,8 +17,8 @@ const osg::Image* image = tex.getImage(FACE); \ os << (image!=NULL); \ if ( image!=NULL ) { \ - os << osgDB::BEGIN_BRACKET << std::endl << image; \ - os << osgDB::END_BRACKET; \ + os << os.BEGIN_BRACKET << std::endl << image; \ + os << os.END_BRACKET; \ } \ os << std::endl; \ return true; \ diff --git a/src/osgWrappers/serializers/osg/TransferFunction1D.cpp b/src/osgWrappers/serializers/osg/TransferFunction1D.cpp index 50e7372b7..86729390c 100644 --- a/src/osgWrappers/serializers/osg/TransferFunction1D.cpp +++ b/src/osgWrappers/serializers/osg/TransferFunction1D.cpp @@ -10,7 +10,7 @@ static bool checkColorMap( const osg::TransferFunction1D& func ) static bool readColorMap( osgDB::InputStream& is, osg::TransferFunction1D& func ) { - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> key >> value; func.setColor( key, value ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeColorMap( osgDB::OutputStream& os, const osg::TransferFunction1D& func ) { const osg::TransferFunction1D::ColorMap& map = func.getColorMap(); - os.writeSize(map.size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(map.size()); os << os.BEGIN_BRACKET << std::endl; for ( osg::TransferFunction1D::ColorMap::const_iterator itr=map.begin(); itr!=map.end(); ++itr ) { os << itr->first << itr->second << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osg/UserDataContainer.cpp b/src/osgWrappers/serializers/osg/UserDataContainer.cpp index 2a6263d88..2f011c1ca 100644 --- a/src/osgWrappers/serializers/osg/UserDataContainer.cpp +++ b/src/osgWrappers/serializers/osg/UserDataContainer.cpp @@ -11,18 +11,18 @@ static bool checkUDC_UserData( const osg::DefaultUserDataContainer& udc ) static bool readUDC_UserData( osgDB::InputStream& is, osg::DefaultUserDataContainer& udc ) { - is >> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; osg::Object* object = is.readObject(); if(object) udc.setUserData(object); - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeUDC_UserData( osgDB::OutputStream& os, const osg::DefaultUserDataContainer& udc ) { - os << osgDB::BEGIN_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl; os.writeObject(dynamic_cast(udc.getUserData())); - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } @@ -34,28 +34,28 @@ static bool checkUDC_Descriptions( const osg::DefaultUserDataContainer& udc ) static bool readUDC_Descriptions( osgDB::InputStream& is, osg::DefaultUserDataContainer& udc ) { - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeUDC_Descriptions( osgDB::OutputStream& os, const osg::DefaultUserDataContainer& udc ) { const osg::UserDataContainer::DescriptionList& slist = udc.getDescriptions(); - os.writeSize(slist.size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(slist.size()); os << os.BEGIN_BRACKET << std::endl; for ( osg::UserDataContainer::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; } @@ -67,25 +67,25 @@ static bool checkUDC_UserObjects( const osg::DefaultUserDataContainer& udc ) static bool readUDC_UserObjects( osgDB::InputStream& is, osg::DefaultUserDataContainer& udc ) { - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for( unsigned int i=0; i> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeUDC_UserObjects( osgDB::OutputStream& os, const osg::DefaultUserDataContainer& udc ) { unsigned int numObjects = udc.getNumUserObjects(); - os.writeSize(numObjects); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(numObjects); os << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> key >> value; vp.setProgramLocalParameter( key, value ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeLocalParameters( osgDB::OutputStream& os, const osg::VertexProgram& vp ) { const osg::VertexProgram::LocalParamList& params = vp.getLocalParameters(); - os.writeSize(params.size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(params.size()); os << os.BEGIN_BRACKET << std::endl; for ( osg::VertexProgram::LocalParamList::const_iterator itr=params.begin(); itr!=params.end(); ++itr ) { os << itr->first << osg::Vec4d(itr->second) << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } @@ -43,27 +43,27 @@ static bool checkMatrices( const osg::VertexProgram& vp ) static bool readMatrices( osgDB::InputStream& is, osg::VertexProgram& vp ) { - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> key >> value; vp.setMatrix( key, value ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeMatrices( osgDB::OutputStream& os, const osg::VertexProgram& vp ) { const osg::VertexProgram::MatrixList& matrices = vp.getMatrices(); - os.writeSize(matrices.size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(matrices.size()); os << os.BEGIN_BRACKET << std::endl; for ( osg::VertexProgram::MatrixList::const_iterator itr=matrices.begin(); itr!=matrices.end(); ++itr ) { os << (unsigned int)itr->first << osg::Matrixd(itr->second) << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osgAnimation/Animation.cpp b/src/osgWrappers/serializers/osgAnimation/Animation.cpp index 3a4ba4e5b..028cae635 100644 --- a/src/osgWrappers/serializers/osgAnimation/Animation.cpp +++ b/src/osgWrappers/serializers/osgAnimation/Animation.cpp @@ -8,8 +8,8 @@ static void readChannel( osgDB::InputStream& is, osgAnimation::Channel* ch ) { std::string name, targetName; - is >> osgDB::PROPERTY("Name") >> name; - is >> osgDB::PROPERTY("TargetName") >> targetName; + is >> is.PROPERTY("Name") >> name; + is >> is.PROPERTY("TargetName") >> targetName; ch->setName( name ); ch->setTargetName( targetName ); } @@ -19,11 +19,11 @@ static void readContainer( osgDB::InputStream& is, ContainerType* container ) { typedef typename ContainerType::KeyType KeyType; bool hasContainer = false; - is >> osgDB::PROPERTY("KeyFrameContainer") >> hasContainer; + is >> is.PROPERTY("KeyFrameContainer") >> hasContainer; if ( hasContainer ) { unsigned int size = 0; - size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> time >> value; container->push_back( KeyType(time, value) ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; } } @@ -40,11 +40,11 @@ static void readContainer2( osgDB::InputStream& is, ContainerType* container ) { typedef typename ContainerType::KeyType KeyType; bool hasContainer = false; - is >> osgDB::PROPERTY("KeyFrameContainer") >> hasContainer; + is >> is.PROPERTY("KeyFrameContainer") >> hasContainer; if ( hasContainer ) { unsigned int size = 0; - size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> time >> pos >> ptIn >> ptOut; container->push_back( KeyType(time, ValueType(pos, ptIn, ptOut)) ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; } } @@ -61,7 +61,7 @@ static void readContainer2( osgDB::InputStream& is, ContainerType* container ) CHANNEL* ch = new CHANNEL; \ readChannel( is, ch ); \ readContainer( is, ch->getOrCreateSampler()->getOrCreateKeyframeContainer() ); \ - is >> osgDB::END_BRACKET; \ + is >> is.END_BRACKET; \ if ( ch ) ani.addChannel( ch ); \ continue; \ } @@ -71,7 +71,7 @@ static void readContainer2( osgDB::InputStream& is, ContainerType* container ) CHANNEL* ch = new CHANNEL; \ readChannel( is, ch ); \ readContainer2( is, ch->getOrCreateSampler()->getOrCreateKeyframeContainer() ); \ - is >> osgDB::END_BRACKET; \ + is >> is.END_BRACKET; \ if ( ch ) ani.addChannel( ch ); \ continue; \ } @@ -80,22 +80,22 @@ static void readContainer2( osgDB::InputStream& is, ContainerType* container ) static void writeChannel( osgDB::OutputStream& os, osgAnimation::Channel* ch ) { - os << osgDB::PROPERTY("Name") << ch->getName() << std::endl; - os << osgDB::PROPERTY("TargetName") << ch->getTargetName() << std::endl; + os << os.PROPERTY("Name") << ch->getName() << std::endl; + os << os.PROPERTY("TargetName") << ch->getTargetName() << std::endl; } template static void writeContainer( osgDB::OutputStream& os, ContainerType* container ) { - os << osgDB::PROPERTY("KeyFrameContainer") << (container!=NULL); + os << os.PROPERTY("KeyFrameContainer") << (container!=NULL); if ( container!=NULL ) { - os.writeSize(container->size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(container->size()); os << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; isize(); ++i ) { os << (*container)[i].getTime() << (*container)[i].getValue() << std::endl; } - os << osgDB::END_BRACKET; + os << os.END_BRACKET; } os << std::endl; } @@ -104,10 +104,10 @@ template static void writeContainer2( osgDB::OutputStream& os, ContainerType* container ) { typedef typename ContainerType::KeyType KeyType; - os << osgDB::PROPERTY("KeyFrameContainer") << (container!=NULL); + os << os.PROPERTY("KeyFrameContainer") << (container!=NULL); if ( container!=NULL ) { - os.writeSize(container->size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(container->size()); os << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; isize(); ++i ) { const KeyType& keyframe = (*container)[i]; @@ -115,7 +115,7 @@ static void writeContainer2( osgDB::OutputStream& os, ContainerType* container ) << keyframe.getValue().getControlPointIn() << keyframe.getValue().getControlPointOut() << std::endl; } - os << osgDB::END_BRACKET; + os << os.END_BRACKET; } os << std::endl; } @@ -123,20 +123,20 @@ static void writeContainer2( osgDB::OutputStream& os, ContainerType* container ) #define WRITE_CHANNEL_FUNC( NAME, CHANNEL, CONTAINER ) \ CHANNEL* ch_##NAME = dynamic_cast(ch); \ if ( ch_##NAME ) { \ - os << osgDB::PROPERTY("Type") << std::string(#NAME) << osgDB::BEGIN_BRACKET << std::endl; \ + os << os.PROPERTY("Type") << std::string(#NAME) << os.BEGIN_BRACKET << std::endl; \ writeChannel( os, ch_##NAME ); \ writeContainer( os, ch_##NAME ->getSamplerTyped()->getKeyframeContainerTyped() ); \ - os << osgDB::END_BRACKET << std::endl; \ + os << os.END_BRACKET << std::endl; \ continue; \ } #define WRITE_CHANNEL_FUNC2( NAME, CHANNEL, CONTAINER ) \ CHANNEL* ch_##NAME = dynamic_cast(ch); \ if ( ch_##NAME ) { \ - os << osgDB::PROPERTY("Type") << #NAME << osgDB::BEGIN_BRACKET << std::endl; \ + os << os.PROPERTY("Type") << #NAME << os.BEGIN_BRACKET << std::endl; \ writeChannel( os, ch_##NAME ); \ writeContainer2( os, ch_##NAME ->getSamplerTyped()->getKeyframeContainerTyped() ); \ - os << osgDB::END_BRACKET << std::endl; \ + os << os.END_BRACKET << std::endl; \ continue; \ } @@ -149,11 +149,11 @@ static bool checkChannels( const osgAnimation::Animation& ani ) static bool readChannels( osgDB::InputStream& is, osgAnimation::Animation& ani ) { - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> osgDB::PROPERTY("Type") >> type >> osgDB::BEGIN_BRACKET; + is >> is.PROPERTY("Type") >> type >> is.BEGIN_BRACKET; READ_CHANNEL_FUNC( DoubleStepChannel, osgAnimation::DoubleStepChannel, osgAnimation::DoubleKeyframeContainer, double ); READ_CHANNEL_FUNC( FloatStepChannel, osgAnimation::FloatStepChannel, osgAnimation::FloatKeyframeContainer, float ); @@ -187,14 +187,14 @@ static bool readChannels( osgDB::InputStream& is, osgAnimation::Animation& ani ) osgAnimation::Vec4CubicBezier, osg::Vec4 ); is.advanceToCurrentEndBracket(); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeChannels( osgDB::OutputStream& os, const osgAnimation::Animation& ani ) { const osgAnimation::ChannelList& channels = ani.getChannels(); - os.writeSize(channels.size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(channels.size()); os << os.BEGIN_BRACKET << std::endl; for ( osgAnimation::ChannelList::const_iterator itr=channels.begin(); itr!=channels.end(); ++itr ) { @@ -225,10 +225,10 @@ static bool writeChannels( osgDB::OutputStream& os, const osgAnimation::Animatio WRITE_CHANNEL_FUNC2( Vec4CubicBezierChannel, osgAnimation::Vec4CubicBezierChannel, osgAnimation::Vec4CubicBezierKeyframeContainer ); - os << osgDB::PROPERTY("Type") << std::string("UnknownChannel") << osgDB::BEGIN_BRACKET << std::endl; - os << osgDB::END_BRACKET << std::endl; + os << os.PROPERTY("Type") << std::string("UnknownChannel") << os.BEGIN_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osgAnimation/AnimationManagerBase.cpp b/src/osgWrappers/serializers/osgAnimation/AnimationManagerBase.cpp index d6a14541f..c707a9dc6 100644 --- a/src/osgWrappers/serializers/osgAnimation/AnimationManagerBase.cpp +++ b/src/osgWrappers/serializers/osgAnimation/AnimationManagerBase.cpp @@ -13,26 +13,26 @@ static bool checkAnimations( const osgAnimation::AnimationManagerBase& manager ) static bool readAnimations( osgDB::InputStream& is, osgAnimation::AnimationManagerBase& manager ) { - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); if ( ani ) manager.registerAnimation( ani ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeAnimations( osgDB::OutputStream& os, const osgAnimation::AnimationManagerBase& manager ) { const osgAnimation::AnimationList& animations = manager.getAnimationList(); - os.writeSize(animations.size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(animations.size()); os << os.BEGIN_BRACKET << std::endl; for ( osgAnimation::AnimationList::const_iterator itr=animations.begin(); itr!=animations.end(); ++itr ) { os << itr->get(); } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osgAnimation/MorphGeometry.cpp b/src/osgWrappers/serializers/osgAnimation/MorphGeometry.cpp index 6ece8575b..1d8eec563 100644 --- a/src/osgWrappers/serializers/osgAnimation/MorphGeometry.cpp +++ b/src/osgWrappers/serializers/osgAnimation/MorphGeometry.cpp @@ -10,29 +10,29 @@ static bool checkMorphTargets( const osgAnimation::MorphGeometry& geom ) static bool readMorphTargets( osgDB::InputStream& is, osgAnimation::MorphGeometry& geom ) { - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> osgDB::PROPERTY("MorphTarget") >> weight; + is >> is.PROPERTY("MorphTarget") >> weight; osg::Geometry* target = dynamic_cast( is.readObject() ); if ( target ) geom.addMorphTarget( target, weight ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeMorphTargets( osgDB::OutputStream& os, const osgAnimation::MorphGeometry& geom ) { const osgAnimation::MorphGeometry::MorphTargetList& targets = geom.getMorphTargetList(); - os.writeSize(targets.size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(targets.size()); os << os.BEGIN_BRACKET << std::endl; for ( osgAnimation::MorphGeometry::MorphTargetList::const_iterator itr=targets.begin(); itr!=targets.end(); ++itr ) { - os << osgDB::PROPERTY("MorphTarget") << itr->getWeight() << std::endl; + os << os.PROPERTY("MorphTarget") << itr->getWeight() << std::endl; os << itr->getGeometry(); } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osgAnimation/RigGeometry.cpp b/src/osgWrappers/serializers/osgAnimation/RigGeometry.cpp index 6023b99a7..85ac93280 100644 --- a/src/osgWrappers/serializers/osgAnimation/RigGeometry.cpp +++ b/src/osgWrappers/serializers/osgAnimation/RigGeometry.cpp @@ -11,12 +11,12 @@ static bool checkInfluenceMap( const osgAnimation::RigGeometry& geom ) static bool readInfluenceMap( osgDB::InputStream& is, osgAnimation::RigGeometry& geom ) { osgAnimation::VertexInfluenceMap* map = new osgAnimation::VertexInfluenceMap; - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> osgDB::PROPERTY("VertexInfluence") >> name; viSize = is.readSize(); is >> osgDB::BEGIN_BRACKET; + is >> is.PROPERTY("VertexInfluence") >> name; viSize = is.readSize(); is >> is.BEGIN_BRACKET; osgAnimation::VertexInfluence vi; vi.setName( name ); @@ -29,9 +29,9 @@ static bool readInfluenceMap( osgDB::InputStream& is, osgAnimation::RigGeometry& vi.push_back( osgAnimation::VertexIndexWeight(index, weight) ); } (*map)[name] = vi; - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; if ( !map->empty() ) geom.setInfluenceMap( map ); return true; @@ -40,7 +40,7 @@ static bool readInfluenceMap( osgDB::InputStream& is, osgAnimation::RigGeometry& static bool writeInfluenceMap( osgDB::OutputStream& os, const osgAnimation::RigGeometry& geom ) { const osgAnimation::VertexInfluenceMap* map = geom.getInfluenceMap(); - os.writeSize(map->size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(map->size()); os << os.BEGIN_BRACKET << std::endl; for ( osgAnimation::VertexInfluenceMap::const_iterator itr=map->begin(); itr!=map->end(); ++itr ) { @@ -48,16 +48,16 @@ static bool writeInfluenceMap( osgDB::OutputStream& os, const osgAnimation::RigG const osgAnimation::VertexInfluence& vi = itr->second; if ( name.empty() ) name = "Empty"; - os << osgDB::PROPERTY("VertexInfluence") << name; os.writeSize(vi.size()) ; os << osgDB::BEGIN_BRACKET << std::endl; + os << os.PROPERTY("VertexInfluence") << name; os.writeSize(vi.size()) ; os << os.BEGIN_BRACKET << std::endl; for ( osgAnimation::VertexInfluence::const_iterator vitr=vi.begin(); vitr != vi.end(); ++vitr ) { os << vitr->first << vitr->second << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osgAnimation/UpdateMatrixTransform.cpp b/src/osgWrappers/serializers/osgAnimation/UpdateMatrixTransform.cpp index fc7a4340a..40ff00f9d 100644 --- a/src/osgWrappers/serializers/osgAnimation/UpdateMatrixTransform.cpp +++ b/src/osgWrappers/serializers/osgAnimation/UpdateMatrixTransform.cpp @@ -14,27 +14,27 @@ static bool checkStackedTransforms( const osgAnimation::UpdateMatrixTransform& o static bool readStackedTransforms( osgDB::InputStream& is, osgAnimation::UpdateMatrixTransform& obj ) { osgAnimation::StackedTransform& transform = obj.getStackedTransforms(); - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); if ( element ) transform.push_back( element ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeStackedTransforms( osgDB::OutputStream& os, const osgAnimation::UpdateMatrixTransform& obj ) { const osgAnimation::StackedTransform& transform = obj.getStackedTransforms(); - os.writeSize(transform.size()); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(transform.size()); os << os.BEGIN_BRACKET << std::endl; for ( osgAnimation::StackedTransform::const_iterator itr=transform.begin(); itr!=transform.end(); ++itr ) { os << itr->get(); } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osgFX/MultiTextureControl.cpp b/src/osgWrappers/serializers/osgFX/MultiTextureControl.cpp index 1353b303f..7b4786c6e 100644 --- a/src/osgWrappers/serializers/osgFX/MultiTextureControl.cpp +++ b/src/osgWrappers/serializers/osgFX/MultiTextureControl.cpp @@ -10,25 +10,25 @@ static bool checkTextureWeights( const osgFX::MultiTextureControl& ctrl ) static bool readTextureWeights( osgDB::InputStream& is, osgFX::MultiTextureControl& ctrl ) { - unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> weight; ctrl.setTextureWeight( i, weight ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeTextureWeights( osgDB::OutputStream& os, const osgFX::MultiTextureControl& ctrl ) { unsigned int size = ctrl.getNumTextureWeights(); - os.writeSize(size); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize(size); os << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); if ( child ) dragger.addDragger( child ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeDraggers( osgDB::OutputStream& os, const osgManipulator::CompositeDragger& dragger ) { unsigned int size = dragger.getNumDraggers(); - os << size << osgDB::BEGIN_BRACKET << std::endl; + os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> name >> osgDB::BEGIN_BRACKET; + std::string name; is >> name >> is.BEGIN_BRACKET; if ( name=="DraggerTransformCallback" ) { osg::MatrixTransform* transform = dynamic_cast( is.readObject() ); if ( transform ) dragger.addTransformUpdating( transform ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeTransformUpdating( osgDB::OutputStream& os, const osgManipulator::Dragger& dragger ) { const osgManipulator::Dragger::DraggerCallbacks& callbacks = dragger.getDraggerCallbacks(); - os.writeSize( callbacks.size() ); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize( callbacks.size() ); os << os.BEGIN_BRACKET << std::endl; for ( osgManipulator::Dragger::DraggerCallbacks::const_iterator itr=callbacks.begin(); itr!=callbacks.end(); ++itr ) { @@ -38,16 +38,16 @@ static bool writeTransformUpdating( osgDB::OutputStream& os, const osgManipulato dynamic_cast( itr->get() ); if ( dtcb ) { - os << std::string("DraggerTransformCallback") << osgDB::BEGIN_BRACKET << std::endl; + os << std::string("DraggerTransformCallback") << os.BEGIN_BRACKET << std::endl; os << dtcb->getTransform(); } else { - os << std::string("DraggerCallback") << osgDB::BEGIN_BRACKET << std::endl; + os << std::string("DraggerCallback") << os.BEGIN_BRACKET << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osgParticle/CompositePlacer.cpp b/src/osgWrappers/serializers/osgParticle/CompositePlacer.cpp index 6b79fe446..c0bd0b7f4 100644 --- a/src/osgWrappers/serializers/osgParticle/CompositePlacer.cpp +++ b/src/osgWrappers/serializers/osgParticle/CompositePlacer.cpp @@ -10,25 +10,25 @@ static bool checkPlacers( const osgParticle::CompositePlacer& cp ) static bool readPlacers( osgDB::InputStream& is, osgParticle::CompositePlacer& cp ) { - unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); if ( p ) cp.addPlacer( p ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writePlacers( osgDB::OutputStream& os, const osgParticle::CompositePlacer& cp ) { unsigned int size = cp.getNumPlacers(); - os << size << osgDB::BEGIN_BRACKET << std::endl; + os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> osgDB::PROPERTY("Domain") >> typeName >> osgDB::BEGIN_BRACKET; + is >> is.PROPERTY("Domain") >> typeName >> is.BEGIN_BRACKET; if (typeName=="POINT") type = osgParticle::DomainOperator::Domain::POINT_DOMAIN; else if (typeName=="LINE") type = osgParticle::DomainOperator::Domain::LINE_DOMAIN; else if (typeName=="TRIANGLE") type = osgParticle::DomainOperator::Domain::TRI_DOMAIN; @@ -26,62 +26,62 @@ static bool readDomains( osgDB::InputStream& is, osgParticle::DomainOperator& dp else if (typeName=="DISK") type = osgParticle::DomainOperator::Domain::DISK_DOMAIN; osgParticle::DomainOperator::Domain domain(type); - is >> osgDB::PROPERTY("Plane") >> domain.plane; - is >> osgDB::PROPERTY("Vertices1") >> domain.v1; - is >> osgDB::PROPERTY("Vertices2") >> domain.v2; - is >> osgDB::PROPERTY("Vertices3") >> domain.v3; - is >> osgDB::PROPERTY("Basis1") >> domain.s1; - is >> osgDB::PROPERTY("Basis2") >> domain.s2; - is >> osgDB::PROPERTY("Factors") >> domain.r1 >> domain.r2; + is >> is.PROPERTY("Plane") >> domain.plane; + is >> is.PROPERTY("Vertices1") >> domain.v1; + is >> is.PROPERTY("Vertices2") >> domain.v2; + is >> is.PROPERTY("Vertices3") >> domain.v3; + is >> is.PROPERTY("Basis1") >> domain.s1; + is >> is.PROPERTY("Basis2") >> domain.s2; + is >> is.PROPERTY("Factors") >> domain.r1 >> domain.r2; dp.addDomain(domain); - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeDomains( osgDB::OutputStream& os, const osgParticle::DomainOperator& dp ) { unsigned int size = dp.getNumDomains(); - os << size << osgDB::BEGIN_BRACKET << std::endl; + os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); if ( op ) prog.addOperator( op ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeOperators( osgDB::OutputStream& os, const osgParticle::ModularProgram& prog ) { unsigned int size = prog.numOperators(); - os << size << osgDB::BEGIN_BRACKET << std::endl; + os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> vec; placer.addVertex( vec ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeVertices( osgDB::OutputStream& os, const osgParticle::MultiSegmentPlacer& placer ) { unsigned int size = placer.numVertices(); - os << size << osgDB::BEGIN_BRACKET << std::endl; + os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; - is >> osgDB::PROPERTY("Shape"); + is >> is.PROPERTY("Shape"); p.setShape( static_cast(readShapeValue(is)) ); - double lifeTime; is >> osgDB::PROPERTY("LifeTime") >> lifeTime; + double lifeTime; is >> is.PROPERTY("LifeTime") >> lifeTime; p.setLifeTime( lifeTime ); float min, max; osg::Vec4d minV, maxV; - is >> osgDB::PROPERTY("SizeRange") >> min >> max; p.setSizeRange( osgParticle::rangef(min, max) ); - is >> osgDB::PROPERTY("AlphaRange") >> min >> max; p.setAlphaRange( osgParticle::rangef(min, max) ); - is >> osgDB::PROPERTY("ColorRange") >> minV >> maxV; p.setColorRange( osgParticle::rangev4(minV, maxV) ); + is >> is.PROPERTY("SizeRange") >> min >> max; p.setSizeRange( osgParticle::rangef(min, max) ); + is >> is.PROPERTY("AlphaRange") >> min >> max; p.setAlphaRange( osgParticle::rangef(min, max) ); + is >> is.PROPERTY("ColorRange") >> minV >> maxV; p.setColorRange( osgParticle::rangev4(minV, maxV) ); bool hasInterpolator = false; - is >> osgDB::PROPERTY("SizeInterpolator") >> hasInterpolator; + is >> is.PROPERTY("SizeInterpolator") >> hasInterpolator; if ( hasInterpolator ) { - is >> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; p.setSizeInterpolator( static_cast(is.readObject()) ); - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; } - is >> osgDB::PROPERTY("AlphaInterpolator") >> hasInterpolator; + is >> is.PROPERTY("AlphaInterpolator") >> hasInterpolator; if ( hasInterpolator ) { - is >> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; p.setAlphaInterpolator( static_cast(is.readObject()) ); - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; } - is >> osgDB::PROPERTY("ColorInterpolator") >> hasInterpolator; + is >> is.PROPERTY("ColorInterpolator") >> hasInterpolator; if ( hasInterpolator ) { - is >> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; p.setColorInterpolator( static_cast(is.readObject()) ); - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; } - float radius; is >> osgDB::PROPERTY("Radius") >> radius; - float mass; is >> osgDB::PROPERTY("Mass") >> mass; - osg::Vec3d pos; is >> osgDB::PROPERTY("Position") >> pos; - osg::Vec3d vel; is >> osgDB::PROPERTY("Velocity") >> vel; - osg::Vec3d angle; is >> osgDB::PROPERTY("Angle") >> angle; - osg::Vec3d angleV; is >> osgDB::PROPERTY("AngularVelocity") >> angleV; - int s, t, num; is >> osgDB::PROPERTY("TextureTile") >> s >> t >> num; + float radius; is >> is.PROPERTY("Radius") >> radius; + float mass; is >> is.PROPERTY("Mass") >> mass; + osg::Vec3d pos; is >> is.PROPERTY("Position") >> pos; + osg::Vec3d vel; is >> is.PROPERTY("Velocity") >> vel; + osg::Vec3d angle; is >> is.PROPERTY("Angle") >> angle; + osg::Vec3d angleV; is >> is.PROPERTY("AngularVelocity") >> angleV; + int s, t, num; is >> is.PROPERTY("TextureTile") >> s >> t >> num; p.setRadius( radius ); p.setMass( mass ); @@ -69,57 +69,57 @@ bool readParticle( osgDB::InputStream& is, osgParticle::Particle& p ) p.setAngularVelocity( angleV ); p.setTextureTile( s, t, num ); - bool hasObject = false; is >> osgDB::PROPERTY("Drawable") >> hasObject; + bool hasObject = false; is >> is.PROPERTY("Drawable") >> hasObject; if ( hasObject ) { - is >> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; p.setDrawable( dynamic_cast(is.readObject()) ); - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } bool writeParticle( osgDB::OutputStream& os, const osgParticle::Particle& p ) { - os << osgDB::BEGIN_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl; - os << osgDB::PROPERTY("Shape"); writeShapeValue( os, (int)p.getShape() ); os << std::endl; + os << os.PROPERTY("Shape"); writeShapeValue( os, (int)p.getShape() ); os << std::endl; - os << osgDB::PROPERTY("LifeTime") << p.getLifeTime() << std::endl; - os << osgDB::PROPERTY("SizeRange") << p.getSizeRange().minimum << p.getSizeRange().maximum << std::endl; - os << osgDB::PROPERTY("AlphaRange") << p.getAlphaRange().minimum << p.getAlphaRange().maximum << std::endl; - os << osgDB::PROPERTY("ColorRange") << osg::Vec4d(p.getColorRange().minimum) + os << os.PROPERTY("LifeTime") << p.getLifeTime() << std::endl; + os << os.PROPERTY("SizeRange") << p.getSizeRange().minimum << p.getSizeRange().maximum << std::endl; + os << os.PROPERTY("AlphaRange") << p.getAlphaRange().minimum << p.getAlphaRange().maximum << std::endl; + os << os.PROPERTY("ColorRange") << osg::Vec4d(p.getColorRange().minimum) << osg::Vec4d(p.getColorRange().maximum) << std::endl; - os << osgDB::PROPERTY("SizeInterpolator") << (p.getSizeInterpolator()!=NULL); + os << os.PROPERTY("SizeInterpolator") << (p.getSizeInterpolator()!=NULL); if ( p.getSizeInterpolator()!=NULL ) - os << osgDB::BEGIN_BRACKET << std::endl << p.getSizeInterpolator() << osgDB::END_BRACKET << std::endl; - os << osgDB::PROPERTY("AlphaInterpolator") << (p.getAlphaInterpolator()!=NULL); + os << os.BEGIN_BRACKET << std::endl << p.getSizeInterpolator() << os.END_BRACKET << std::endl; + os << os.PROPERTY("AlphaInterpolator") << (p.getAlphaInterpolator()!=NULL); if ( p.getAlphaInterpolator()!=NULL ) - os << osgDB::BEGIN_BRACKET << std::endl << p.getAlphaInterpolator() << osgDB::END_BRACKET << std::endl; - os << osgDB::PROPERTY("ColorInterpolator") << (p.getColorInterpolator()!=NULL); + os << os.BEGIN_BRACKET << std::endl << p.getAlphaInterpolator() << os.END_BRACKET << std::endl; + os << os.PROPERTY("ColorInterpolator") << (p.getColorInterpolator()!=NULL); if ( p.getColorInterpolator()!=NULL ) - os << osgDB::BEGIN_BRACKET << std::endl << p.getColorInterpolator() << osgDB::END_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl << p.getColorInterpolator() << os.END_BRACKET << std::endl; - os << osgDB::PROPERTY("Radius") << p.getRadius() << std::endl; - os << osgDB::PROPERTY("Mass") << p.getMass() << std::endl; - os << osgDB::PROPERTY("Position") << osg::Vec3d(p.getPosition()) << std::endl; - os << osgDB::PROPERTY("Velocity") << osg::Vec3d(p.getVelocity()) << std::endl; - os << osgDB::PROPERTY("Angle") << osg::Vec3d(p.getAngle()) << std::endl; - os << osgDB::PROPERTY("AngularVelocity") << osg::Vec3d(p.getAngularVelocity()) << std::endl; - os << osgDB::PROPERTY("TextureTile") << p.getTileS() << p.getTileT() << p.getNumTiles() << std::endl; + os << os.PROPERTY("Radius") << p.getRadius() << std::endl; + os << os.PROPERTY("Mass") << p.getMass() << std::endl; + os << os.PROPERTY("Position") << osg::Vec3d(p.getPosition()) << std::endl; + os << os.PROPERTY("Velocity") << osg::Vec3d(p.getVelocity()) << std::endl; + os << os.PROPERTY("Angle") << osg::Vec3d(p.getAngle()) << std::endl; + os << os.PROPERTY("AngularVelocity") << osg::Vec3d(p.getAngularVelocity()) << std::endl; + os << os.PROPERTY("TextureTile") << p.getTileS() << p.getTileT() << p.getNumTiles() << std::endl; - os << osgDB::PROPERTY("Drawable") << (p.getDrawable()!=NULL); + os << os.PROPERTY("Drawable") << (p.getDrawable()!=NULL); if ( p.getDrawable()!=NULL ) { - os << osgDB::BEGIN_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl; os.writeObject( p.getDrawable() ); - os << osgDB::END_BRACKET; + os << os.END_BRACKET; } os << std::endl; - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osgParticle/ParticleEffect.cpp b/src/osgWrappers/serializers/osgParticle/ParticleEffect.cpp index d8e735fe8..804abae6f 100644 --- a/src/osgWrappers/serializers/osgParticle/ParticleEffect.cpp +++ b/src/osgWrappers/serializers/osgParticle/ParticleEffect.cpp @@ -11,18 +11,18 @@ static bool checkParticleSystem( const osgParticle::ParticleEffect& effect ) static bool readParticleSystem( osgDB::InputStream& is, osgParticle::ParticleEffect& effect ) { - is >> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; effect.setUseLocalParticleSystem( false ); effect.setParticleSystem( static_cast(is.readObject()) ); - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeParticleSystem( osgDB::OutputStream& os, const osgParticle::ParticleEffect& effect ) { - os << osgDB::BEGIN_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl; os << effect.getParticleSystem(); - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osgParticle/ParticleSystem.cpp b/src/osgWrappers/serializers/osgParticle/ParticleSystem.cpp index 70163d873..4f8c6af7b 100644 --- a/src/osgWrappers/serializers/osgParticle/ParticleSystem.cpp +++ b/src/osgWrappers/serializers/osgParticle/ParticleSystem.cpp @@ -15,10 +15,10 @@ static bool checkDefaultBoundingBox( const osgParticle::ParticleSystem& ps ) static bool readDefaultBoundingBox( osgDB::InputStream& is, osgParticle::ParticleSystem& ps ) { osg::Vec3d min, max; - is >> osgDB::BEGIN_BRACKET; - is >> osgDB::PROPERTY("Minimum") >> min; - is >> osgDB::PROPERTY("Maximum") >> max; - is >> osgDB::END_BRACKET; + is >> is.BEGIN_BRACKET; + is >> is.PROPERTY("Minimum") >> min; + is >> is.PROPERTY("Maximum") >> max; + is >> is.END_BRACKET; ps.setDefaultBoundingBox( osg::BoundingBox(min, max) ); return true; } @@ -26,10 +26,10 @@ static bool readDefaultBoundingBox( osgDB::InputStream& is, osgParticle::Particl static bool writeDefaultBoundingBox( osgDB::OutputStream& os, const osgParticle::ParticleSystem& ps ) { const osg::BoundingBox& bb = ps.getDefaultBoundingBox(); - os << osgDB::BEGIN_BRACKET << std::endl; - os << osgDB::PROPERTY("Minimum") << osg::Vec3d(bb._min) << std::endl; - os << osgDB::PROPERTY("Maximum") << osg::Vec3d(bb._max) << std::endl; - os << osgDB::END_BRACKET; + os << os.BEGIN_BRACKET << std::endl; + os << os.PROPERTY("Minimum") << osg::Vec3d(bb._min) << std::endl; + os << os.PROPERTY("Maximum") << osg::Vec3d(bb._max) << std::endl; + os << os.END_BRACKET; os << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osgParticle/ParticleSystemUpdater.cpp b/src/osgWrappers/serializers/osgParticle/ParticleSystemUpdater.cpp index 14c42295b..9a263e038 100644 --- a/src/osgWrappers/serializers/osgParticle/ParticleSystemUpdater.cpp +++ b/src/osgWrappers/serializers/osgParticle/ParticleSystemUpdater.cpp @@ -10,25 +10,25 @@ static bool checkParticleSystems( const osgParticle::ParticleSystemUpdater& upda static bool readParticleSystems( osgDB::InputStream& is, osgParticle::ParticleSystemUpdater& updater ) { - unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); if ( ps ) updater.addParticleSystem( ps ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeParticleSystems( osgDB::OutputStream& os, const osgParticle::ParticleSystemUpdater& updater ) { unsigned int size = updater.getNumParticleSystems(); - os << size << osgDB::BEGIN_BRACKET << std::endl; + os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> length >> color; bs.addPulse( length, color ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writePulseData( osgDB::OutputStream& os, const osgSim::BlinkSequence& bs ) { unsigned int size = bs.getNumPulses(); - os << size << osgDB::BEGIN_BRACKET << std::endl; + os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> osgDB::PROPERTY("LightPoint") >> osgDB::BEGIN_BRACKET; - is >> osgDB::PROPERTY("Position") >> pt._position; - is >> osgDB::PROPERTY("Color") >> pt._color; + is >> is.PROPERTY("LightPoint") >> is.BEGIN_BRACKET; + is >> is.PROPERTY("Position") >> pt._position; + is >> is.PROPERTY("Color") >> pt._color; int blendingMode = 0; - is >> osgDB::PROPERTY("Attributes") >> pt._on >> blendingMode >> pt._intensity >> pt._radius; + is >> is.PROPERTY("Attributes") >> pt._on >> blendingMode >> pt._intensity >> pt._radius; pt._blendingMode = (osgSim::LightPoint::BlendingMode)blendingMode; - bool hasObject = false; is >> osgDB::PROPERTY("Sector") >> hasObject; + bool hasObject = false; is >> is.PROPERTY("Sector") >> hasObject; if ( hasObject ) { - is >> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; pt._sector = dynamic_cast( is.readObject() ); - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; } - hasObject = false; is >> osgDB::PROPERTY("BlinkSequence") >> hasObject; + hasObject = false; is >> is.PROPERTY("BlinkSequence") >> hasObject; if ( hasObject ) { - is >> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; pt._blinkSequence = dynamic_cast( is.readObject() ); - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; node.addLightPoint( pt ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeLightPointList( osgDB::OutputStream& os, const osgSim::LightPointNode& node ) { unsigned int size = node.getNumLightPoints(); - os << size << osgDB::BEGIN_BRACKET << std::endl; + os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> osgDB::PROPERTY("SwitchSet"); - unsigned int valueSize = is.readSize(); is >> osgDB::BEGIN_BRACKET; + is >> is.PROPERTY("SwitchSet"); + unsigned int valueSize = is.readSize(); is >> is.BEGIN_BRACKET; osgSim::MultiSwitch::ValueList values; for ( unsigned int j=0; j> osgDB::END_BRACKET; + is >> is.END_BRACKET; } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeValues( osgDB::OutputStream& os, const osgSim::MultiSwitch& node ) { const osgSim::MultiSwitch::SwitchSetList& switches = node.getSwitchSetList(); - os.writeSize( switches.size() ); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize( switches.size() ); os << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> osgDB::PROPERTY("Flags") >> data._flags; - is >> osgDB::PROPERTY("RelativePriority") >> data._relativePriority; - is >> osgDB::PROPERTY("Transparency") >> data._transparency; - is >> osgDB::PROPERTY("EffectID1") >> data._effectID1; - is >> osgDB::PROPERTY("EffectID2") >> data._effectID2; - is >> osgDB::PROPERTY("Significance") >> data._significance; + is >> is.PROPERTY("Flags") >> data._flags; + is >> is.PROPERTY("RelativePriority") >> data._relativePriority; + is >> is.PROPERTY("Transparency") >> data._transparency; + is >> is.PROPERTY("EffectID1") >> data._effectID1; + is >> is.PROPERTY("EffectID2") >> data._effectID2; + is >> is.PROPERTY("Significance") >> data._significance; return true; } static bool writeData( osgDB::OutputStream& os, const osgSim::ObjectRecordData& data ) { - os << osgDB::PROPERTY("Flags") << data._flags << std::endl; - os << osgDB::PROPERTY("RelativePriority") << data._relativePriority << std::endl; - os << osgDB::PROPERTY("Transparency") << data._transparency << std::endl; - os << osgDB::PROPERTY("EffectID1") << data._effectID1 << std::endl; - os << osgDB::PROPERTY("EffectID2") << data._effectID2 << std::endl; - os << osgDB::PROPERTY("Significance") << data._significance << std::endl; + os << os.PROPERTY("Flags") << data._flags << std::endl; + os << os.PROPERTY("RelativePriority") << data._relativePriority << std::endl; + os << os.PROPERTY("Transparency") << data._transparency << std::endl; + os << os.PROPERTY("EffectID1") << data._effectID1 << std::endl; + os << os.PROPERTY("EffectID2") << data._effectID2 << std::endl; + os << os.PROPERTY("Significance") << data._significance << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osgSim/ScalarBar.cpp b/src/osgWrappers/serializers/osgSim/ScalarBar.cpp index 6e7c6578e..d20d312b1 100644 --- a/src/osgWrappers/serializers/osgSim/ScalarBar.cpp +++ b/src/osgWrappers/serializers/osgSim/ScalarBar.cpp @@ -10,12 +10,12 @@ static bool checkScalarsToColors( const osgSim::ScalarBar& bar ) static bool readScalarsToColors( osgDB::InputStream& is, osgSim::ScalarBar& bar ) { float min, max; - is >> osgDB::BEGIN_BRACKET; - is >> osgDB::PROPERTY("Range") >> min >> max; + is >> is.BEGIN_BRACKET; + is >> is.PROPERTY("Range") >> min >> max; bool hasColorRange = false; unsigned int colorSize = 0; - is >> osgDB::PROPERTY("Colors") >> hasColorRange >> colorSize; + is >> is.PROPERTY("Colors") >> hasColorRange >> colorSize; if ( !hasColorRange ) { osgSim::ScalarsToColors* stc = new osgSim::ScalarsToColors(min, max); @@ -23,14 +23,14 @@ static bool readScalarsToColors( osgDB::InputStream& is, osgSim::ScalarBar& bar } else { - is >> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; std::vector colors; for ( unsigned int i=0; i> color; colors.push_back( color ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; osgSim::ColorRange* cr = new osgSim::ColorRange(min, max, colors); bar.setScalarsToColors( cr ); @@ -41,9 +41,9 @@ static bool readScalarsToColors( osgDB::InputStream& is, osgSim::ScalarBar& bar static bool writeScalarsToColors( osgDB::OutputStream& os, const osgSim::ScalarBar& bar ) { const osgSim::ScalarsToColors* stc = bar.getScalarsToColors(); - os << osgDB::BEGIN_BRACKET << std::endl; - os << osgDB::PROPERTY("Range") << stc->getMin() << stc->getMax() << std::endl; - os << osgDB::PROPERTY("Colors"); + os << os.BEGIN_BRACKET << std::endl; + os << os.PROPERTY("Range") << stc->getMin() << stc->getMax() << std::endl; + os << os.PROPERTY("Colors"); unsigned int colorSize = 0; const osgSim::ColorRange* cr = dynamic_cast(stc); @@ -52,16 +52,16 @@ static bool writeScalarsToColors( osgDB::OutputStream& os, const osgSim::ScalarB const std::vector& colors = cr->getColors(); colorSize = colors.size(); - os << true << colorSize << osgDB::BEGIN_BRACKET << std::endl; + os << true << colorSize << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; osgSim::ScalarBar::ScalarPrinter* sp = dynamic_cast( is.readObject() ); if ( sp ) bar.setScalarPrinter( sp ); - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeScalarPrinter( osgDB::OutputStream& os, const osgSim::ScalarBar& bar ) { - os << osgDB::BEGIN_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl; os.writeObject( dynamic_cast(bar.getScalarPrinter()) ); - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } @@ -98,12 +98,12 @@ static bool readTextProperties( osgDB::InputStream& is, osgSim::ScalarBar& bar ) { osgSim::ScalarBar::TextProperties prop; int resX, resY; - is >> osgDB::BEGIN_BRACKET; - is >> osgDB::PROPERTY("Font") >> prop._fontFile; - is >> osgDB::PROPERTY("Resolution") >> resX >> resY; - is >> osgDB::PROPERTY("CharacterSize") >> prop._characterSize; - is >> osgDB::PROPERTY("Color") >> prop._fontFile; - is >> osgDB::END_BRACKET; + is >> is.BEGIN_BRACKET; + is >> is.PROPERTY("Font") >> prop._fontFile; + is >> is.PROPERTY("Resolution") >> resX >> resY; + is >> is.PROPERTY("CharacterSize") >> prop._characterSize; + is >> is.PROPERTY("Color") >> prop._fontFile; + is >> is.END_BRACKET; prop._fontResolution = std::pair(resX, resY); bar.setTextProperties( prop ); @@ -113,13 +113,13 @@ static bool readTextProperties( osgDB::InputStream& is, osgSim::ScalarBar& bar ) static bool writeTextProperties( osgDB::OutputStream& os, const osgSim::ScalarBar& bar ) { const osgSim::ScalarBar::TextProperties& prop = bar.getTextProperties(); - os << osgDB::BEGIN_BRACKET << std::endl; - os << osgDB::PROPERTY("Font") << prop._fontFile << std::endl; - os << osgDB::PROPERTY("Resolution") << prop._fontResolution.first + os << os.BEGIN_BRACKET << std::endl; + os << os.PROPERTY("Font") << prop._fontFile << std::endl; + os << os.PROPERTY("Resolution") << prop._fontResolution.first << prop._fontResolution.second << std::endl; - os << osgDB::PROPERTY("CharacterSize") << prop._characterSize << std::endl; - os << osgDB::PROPERTY("Color") << prop._color << std::endl; - os << osgDB::END_BRACKET << std::endl; + os << os.PROPERTY("CharacterSize") << prop._characterSize << std::endl; + os << os.PROPERTY("Color") << prop._color << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osgSim/ShapeAttributeList.cpp b/src/osgWrappers/serializers/osgSim/ShapeAttributeList.cpp index 74327e37e..8395ecf1a 100644 --- a/src/osgWrappers/serializers/osgSim/ShapeAttributeList.cpp +++ b/src/osgWrappers/serializers/osgSim/ShapeAttributeList.cpp @@ -10,12 +10,12 @@ static bool checkAttributes( const osgSim::ShapeAttributeList& list ) static bool readAttributes( osgDB::InputStream& is, osgSim::ShapeAttributeList& list ) { - unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> osgDB::PROPERTY("ShapeAttribute") >> name; - is >> osgDB::PROPERTY("Type") >> type; + is >> is.PROPERTY("ShapeAttribute") >> name; + is >> is.PROPERTY("Type") >> type; switch ( type ) { case osgSim::ShapeAttribute::INTEGER: @@ -38,19 +38,19 @@ static bool readAttributes( osgDB::InputStream& is, osgSim::ShapeAttributeList& break; } } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeAttributes( osgDB::OutputStream& os, const osgSim::ShapeAttributeList& list ) { unsigned int size = list.size(); - os << size << osgDB::BEGIN_BRACKET << std::endl; + os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeLayers( osgDB::OutputStream& os, const osgTerrain::CompositeLayer& layer ) { unsigned int size = layer.getNumLayers(); - os << size << osgDB::BEGIN_BRACKET << std::endl; + os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> osgDB::BEGIN_BRACKET; + is >> is.BEGIN_BRACKET; for ( int r=0; r<3; ++r ) { is >> matrix(r, 0) >> matrix(r, 1) >> matrix(r, 2); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; tech.setFilterMatrix( matrix ); return true; } @@ -24,12 +24,12 @@ static bool readFilterMatrix( osgDB::InputStream& is, osgTerrain::GeometryTechni static bool writeFilterMatrix( osgDB::OutputStream& os, const osgTerrain::GeometryTechnique& tech ) { const osg::Matrix3& matrix = tech.getFilterMatrix(); - os << osgDB::BEGIN_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl; for ( int r=0; r<3; ++r ) { os << matrix(r, 0) << matrix(r, 1) << matrix(r, 2) << std::endl; } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osgTerrain/ImageLayer.cpp b/src/osgWrappers/serializers/osgTerrain/ImageLayer.cpp index 5f777c7cd..370756224 100644 --- a/src/osgWrappers/serializers/osgTerrain/ImageLayer.cpp +++ b/src/osgWrappers/serializers/osgTerrain/ImageLayer.cpp @@ -12,7 +12,7 @@ static bool checkImage( const osgTerrain::ImageLayer& im ) static bool readImage( osgDB::InputStream& is, osgTerrain::ImageLayer& il ) { - if(!is.isBinary()) is >> osgDB::BEGIN_BRACKET; + if(!is.isBinary()) is >> is.BEGIN_BRACKET; bool deferExternalLayerLoading = osgTerrain::TerrainTile::getTileLoadedCallback().valid() ? osgTerrain::TerrainTile::getTileLoadedCallback()->deferExternalLayerLoading() : false; @@ -26,7 +26,7 @@ static bool readImage( osgDB::InputStream& is, osgTerrain::ImageLayer& il ) il.setImage(image.get()); } } - if(!is.isBinary()) is >> osgDB::END_BRACKET; + if(!is.isBinary()) is >> is.END_BRACKET; return true; } @@ -35,9 +35,9 @@ static bool writeImage( osgDB::OutputStream& os, const osgTerrain::ImageLayer& i { const osg::Image* image = il.getImage(); - if(!os.isBinary()) os << osgDB::BEGIN_BRACKET << std::endl; + if(!os.isBinary()) os << os.BEGIN_BRACKET << std::endl; os.writeImage(image); - if(!os.isBinary()) os << osgDB::END_BRACKET << std::endl; + if(!os.isBinary()) os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osgTerrain/TerrainTile.cpp b/src/osgWrappers/serializers/osgTerrain/TerrainTile.cpp index 32ad4aace..2cdcacacb 100644 --- a/src/osgWrappers/serializers/osgTerrain/TerrainTile.cpp +++ b/src/osgWrappers/serializers/osgTerrain/TerrainTile.cpp @@ -32,14 +32,14 @@ static bool checkColorLayers( const osgTerrain::TerrainTile& tile ) static bool readColorLayers( osgDB::InputStream& is, osgTerrain::TerrainTile& tile ) { - unsigned int numValidLayers = 0; is >> numValidLayers >> osgDB::BEGIN_BRACKET; + unsigned int numValidLayers = 0; is >> numValidLayers >> is.BEGIN_BRACKET; for ( unsigned int i=0; i> osgDB::PROPERTY("Layer") >> layerNum; + unsigned int layerNum=0; is >> is.PROPERTY("Layer") >> layerNum; osgTerrain::Layer* layer = dynamic_cast( is.readObject() ); if ( layer ) tile.setColorLayer( layerNum, layer ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } @@ -51,12 +51,12 @@ static bool writeColorLayers( osgDB::OutputStream& os, const osgTerrain::Terrain if (tile.getColorLayer(i)) ++numValidLayers; } - os << numValidLayers << osgDB::BEGIN_BRACKET << std::endl; + os << numValidLayers << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> osgDB::BEGIN_BRACKET; - is >> osgDB::PROPERTY("TopLeft") >> lt; - is >> osgDB::PROPERTY("BottomLeft") >> lb; - is >> osgDB::PROPERTY("BottomRight") >> rb; - is >> osgDB::PROPERTY("TopRight") >> rt; - is >> osgDB::END_BRACKET; + is >> is.BEGIN_BRACKET; + is >> is.PROPERTY("TopLeft") >> lt; + is >> is.PROPERTY("BottomLeft") >> lb; + is >> is.PROPERTY("BottomRight") >> rb; + is >> is.PROPERTY("TopRight") >> rt; + is >> is.END_BRACKET; text.setColorGradientCorners( lt, lb, rb, rt ); return true; } static bool writeColorGradientCorners( osgDB::OutputStream& os, const osgText::Text& text ) { - os << osgDB::BEGIN_BRACKET << std::endl; - os << osgDB::PROPERTY("TopLeft") << osg::Vec4d(text.getColorGradientTopLeft()) << std::endl; - os << osgDB::PROPERTY("BottomLeft") << osg::Vec4d(text.getColorGradientBottomLeft()) << std::endl; - os << osgDB::PROPERTY("BottomRight") << osg::Vec4d(text.getColorGradientBottomRight()) << std::endl; - os << osgDB::PROPERTY("TopRight") << osg::Vec4d(text.getColorGradientTopRight()) << std::endl; - os << osgDB::END_BRACKET << std::endl; + os << os.BEGIN_BRACKET << std::endl; + os << os.PROPERTY("TopLeft") << osg::Vec4d(text.getColorGradientTopLeft()) << std::endl; + os << os.PROPERTY("BottomLeft") << osg::Vec4d(text.getColorGradientBottomLeft()) << std::endl; + os << os.PROPERTY("BottomRight") << osg::Vec4d(text.getColorGradientBottomRight()) << std::endl; + os << os.PROPERTY("TopRight") << osg::Vec4d(text.getColorGradientTopRight()) << std::endl; + os << os.END_BRACKET << std::endl; return true; } diff --git a/src/osgWrappers/serializers/osgVolume/CompositeLayer.cpp b/src/osgWrappers/serializers/osgVolume/CompositeLayer.cpp index 403410934..f97712b23 100644 --- a/src/osgWrappers/serializers/osgVolume/CompositeLayer.cpp +++ b/src/osgWrappers/serializers/osgVolume/CompositeLayer.cpp @@ -10,25 +10,25 @@ static bool checkLayers( const osgVolume::CompositeLayer& layer ) static bool readLayers( osgDB::InputStream& is, osgVolume::CompositeLayer& layer ) { - unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); if ( child ) layer.addLayer( child ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeLayers( osgDB::OutputStream& os, const osgVolume::CompositeLayer& layer ) { unsigned int size = layer.getNumLayers(); - os << size << osgDB::BEGIN_BRACKET << std::endl; + os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> size >> osgDB::BEGIN_BRACKET; + unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); if ( child ) prop.addProperty( child ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeProperties( osgDB::OutputStream& os, const osgVolume::CompositeProperty& prop ) { unsigned int size = prop.getNumProperties(); - os << size << osgDB::BEGIN_BRACKET << std::endl; + os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i> osgDB::BEGIN_BRACKET; + unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); if ( cb ) locator.addCallback( cb ); } - is >> osgDB::END_BRACKET; + is >> is.END_BRACKET; return true; } static bool writeLocatorCallbacks( osgDB::OutputStream& os, const osgVolume::Locator& locator ) { const osgVolume::Locator::LocatorCallbacks& callbacks = locator.getLocatorCallbacks(); - os.writeSize( callbacks.size() ); os << osgDB::BEGIN_BRACKET << std::endl; + os.writeSize( callbacks.size() ); os << os.BEGIN_BRACKET << std::endl; for ( osgVolume::Locator::LocatorCallbacks::const_iterator itr=callbacks.begin(); itr!=callbacks.end(); ++itr ) { os << itr->get(); } - os << osgDB::END_BRACKET << std::endl; + os << os.END_BRACKET << std::endl; return true; }