From Wang Rui, "I'd like to submit the changes that will put ObjectProperty and ObjectMark variables into the InputStream/OutputStream class instead of static ones. This should avoid the threading problem and won't repeatedly reallocate memory for the properties. Some of the wrappers will be slightly modified to use the property variable stored in the InputStream/OutputStream as well."

This commit is contained in:
Robert Osfield
2012-04-05 13:53:47 +00:00
parent 28a9a235b6
commit 5e315d5fab
65 changed files with 601 additions and 593 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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<size; ++i )
{
double time = 0.0;
osg::Vec3d pos, scale;
osg::Quat rot;
is >> 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;

View File

@@ -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<size; ++i )
{
osg::Vec3d pos; is >> 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;
}

View File

@@ -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<osg::Image*>( is.readObject() );
}
else if ( type==2 )
{
is >> osgDB::PROPERTY("Texture");
is >> is.PROPERTY("Texture");
attachment._texture = dynamic_cast<osg::Texture*>( 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<size; ++i )
{
is >> osgDB::PROPERTY("Attachment");
is >> is.PROPERTY("Attachment");
osg::Camera::BufferComponent bufferComponent =
static_cast<osg::Camera::BufferComponent>( 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;
}

View File

@@ -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<size; ++i )
{
osg::Shape* child = dynamic_cast<osg::Shape*>( 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<size; ++i )
{
os << shape.getChild(i);
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -5,25 +5,25 @@
static void readConvexPlanarPolygon( osgDB::InputStream& is, osg::ConvexPlanarPolygon& polygon )
{
unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osg::Vec3d vertex; is >> 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<size; ++i )
{
osg::ConvexPlanarPolygon polygon;
is >> 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;
}

View File

@@ -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;
}

View File

@@ -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<size; ++i )
{
GLuint key; osg::Vec4d value;
is >> 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<size; ++i )
{
unsigned int key; osg::Matrixd value;
is >> 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;
}

View File

@@ -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<size; ++i )
{
osg::Drawable* drawable = dynamic_cast<osg::Drawable*>( 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<size; ++i )
{
os << node.getDrawable(i);
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -17,33 +17,33 @@ USER_WRITE_FUNC( AttributeBinding, writeAttributeBinding )
static void readArrayData( osgDB::InputStream& is, osg::Geometry::ArrayData& data )
{
bool hasArray = false;
is >> 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<osg::IndexArray*>( 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<size; ++i ) { \
osg::Geometry::ArrayData data; \
is >> 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; \
}

View File

@@ -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<size; ++i )
{
osg::ref_ptr<osg::Object> obj = is.readObject();
osg::Node* child = dynamic_cast<osg::Node*>( 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<size; ++i )
{
os << node.getChild(i);
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -11,27 +11,27 @@ static bool checkFileNames( const osg::ImageSequence& image )
static bool readFileNames( osgDB::InputStream& is, osg::ImageSequence& image )
{
unsigned int files = 0; is >> files >> osgDB::BEGIN_BRACKET;
unsigned int files = 0; is >> files >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<files; ++i )
{
std::string filename; is.readWrappedString( filename );
image.addImageFile( filename );
}
is >> 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<images; ++i )
{
osg::Image* img = dynamic_cast<osg::Image*>( 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;
}

View File

@@ -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<size; ++i )
{
float min, max;
is >> 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;
}

View File

@@ -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; \
}

View File

@@ -13,10 +13,10 @@ static bool readInitialBound( osgDB::InputStream& is, osg::Node& node )
{
osg::Vec3d center;
double radius;
is >> osgDB::BEGIN_BRACKET;
is >> osgDB::PROPERTY("Center") >> center;
is >> osgDB::PROPERTY("Radius") >> radius;
is >> osgDB::END_BRACKET;
is >> is.BEGIN_BRACKET;
is >> is.PROPERTY("Center") >> center;
is >> is.PROPERTY("Radius") >> radius;
is >> is.END_BRACKET;
node.setInitialBound( osg::BoundingSphere(center, radius) );
return true;
}
@@ -24,10 +24,10 @@ static bool readInitialBound( osgDB::InputStream& is, osg::Node& node )
static bool writeInitialBound( osgDB::OutputStream& os, const osg::Node& node )
{
const osg::BoundingSphere& bs = node.getInitialBound();
os << osgDB::BEGIN_BRACKET << std::endl;
os << osgDB::PROPERTY("Center") << osg::Vec3d(bs.center()) << std::endl;
os << osgDB::PROPERTY("Radius") << double(bs.radius()) << std::endl;
os << osgDB::END_BRACKET << std::endl;
os << os.BEGIN_BRACKET << std::endl;
os << os.PROPERTY("Center") << osg::Vec3d(bs.center()) << std::endl;
os << os.PROPERTY("Radius") << double(bs.radius()) << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}
@@ -39,28 +39,28 @@ static bool checkDescriptions( const osg::Node& node )
static bool readDescriptions( osgDB::InputStream& is, osg::Node& node )
{
unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
std::string value;
is.readWrappedString( value );
node.addDescription( value );
}
is >> osgDB::END_BRACKET;
is >> is.END_BRACKET;
return true;
}
static bool writeDescriptions( osgDB::OutputStream& os, const osg::Node& node )
{
const osg::Node::DescriptionList& slist = node.getDescriptions();
os.writeSize(slist.size()); os << osgDB::BEGIN_BRACKET << std::endl;
os.writeSize(slist.size()); os << os.BEGIN_BRACKET << std::endl;
for ( osg::Node::DescriptionList::const_iterator itr=slist.begin();
itr!=slist.end(); ++itr )
{
os.writeWrappedString( *itr );
os << std::endl;
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -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<const osg::Object*>(obj.getUserData()));
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -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<size; ++i )
{
std::string name; is.readWrappedString( name );
node.setFileName( i, name );
}
is >> 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<size; ++i )
{
float offset, scale;
@@ -63,28 +63,28 @@ static bool readRangeDataList( osgDB::InputStream& is, osg::PagedLOD& node )
node.setPriorityOffset( i, offset );
node.setPriorityScale( i, scale );
}
is >> 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; ++i )
{
os.writeWrappedString( node.getFileName(i) );
os << std::endl;
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
size = node.getNumPriorityOffsets();
os << osgDB::PROPERTY("PriorityList") << size << osgDB::BEGIN_BRACKET << std::endl;
os << os.PROPERTY("PriorityList") << size << os.BEGIN_BRACKET << std::endl;
for ( unsigned int i=0; i<size; ++i )
{
os << node.getPriorityOffset(i) << node.getPriorityScale(i) << std::endl;
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}
@@ -96,13 +96,13 @@ static bool checkChildren( const osg::PagedLOD& node )
static bool readChildren( 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<size; ++i )
{
osg::Node* child = dynamic_cast<osg::Node*>( 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<size; ++i )
{
if ( !node.getFileName(i).empty() ) continue;
if ( i<node.getNumChildren() )
os << node.getChild(i);
}
os << osgDB::END_BRACKET;
os << os.END_BRACKET;
}
os << std::endl;
return true;

View File

@@ -21,9 +21,9 @@ static bool checkMode( const osg::PolygonMode& attr )
static bool readMode( osgDB::InputStream& is, osg::PolygonMode& attr )
{
bool frontAndBack;
is >> 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;

View File

@@ -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;
}

View File

@@ -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<size; ++i ) { \
std::string key; unsigned int value; \
is >> 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<size; ++i )
{
osg::Shader* shader = dynamic_cast<osg::Shader*>( 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; ++i )
{
os << attr.getShader(i);
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -13,26 +13,26 @@ static bool checkFileNames( const osg::ProxyNode& node )
static bool readFileNames( osgDB::InputStream& is, osg::ProxyNode& 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<size; ++i )
{
std::string value;
is.readWrappedString( value );
node.setFileName( i, value );
}
is >> 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<node.getNumFileNames(); ++i )
{
os.writeWrappedString( node.getFileName(i) );
os << std::endl;
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}
@@ -44,13 +44,13 @@ static bool checkChildren( const osg::ProxyNode& node )
static bool readChildren( osgDB::InputStream& is, osg::ProxyNode& 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<size; ++i )
{
osg::Node* child = dynamic_cast<osg::Node*>( 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<size; ++i )
{
if ( !node.getFileName(i).empty() ) continue;
if ( i<node.getNumChildren() )
os << node.getChild(i);
}
os << osgDB::END_BRACKET;
os << os.END_BRACKET;
}
os << std::endl;
return true;

View File

@@ -11,14 +11,14 @@ static bool checkShaderSource( const osg::Shader& shader )
static bool readShaderSource( osgDB::InputStream& is, osg::Shader& shader )
{
std::string code;
unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
std::string line;
is.readWrappedString( line );
code.append( line ); code.append( 1, '\n' );
}
is >> 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<std::string>::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;
}

View File

@@ -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<size; ++i )
{
is >> 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; i<sb.getSize(); ++i )
{
os << std::hex << data[i] << std::dec << std::endl;
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
}
return true;
}

View File

@@ -32,14 +32,14 @@ static void readModes( osgDB::InputStream& is, osg::StateSet::ModeList& modes )
unsigned int size = is.readSize();
if ( size>0 )
{
is >> osgDB::BEGIN_BRACKET;
is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
DEF_GLENUM(mode); is >> 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<size; ++i )
{
osg::StateAttribute* sa = dynamic_cast<osg::StateAttribute*>( 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<size; ++i )
{
is >> 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<size; ++i )
{
is >> 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<size; ++i )
{
osg::Uniform* uniform = dynamic_cast<osg::Uniform*>( 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;
}

View File

@@ -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 )

View File

@@ -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<size; ++i )
{
osg::Image* image = is.readImage();
if ( image ) tex.setImage( i, image );
}
is >> 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<size; ++i )
{
os << tex.getImage(i);
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -8,8 +8,8 @@
static bool read##PROP( osgDB::InputStream& is, osg::TextureCubeMap& tex ) { \
bool hasImage; is >> 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; \

View File

@@ -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<size; ++i )
{
float key = 0.0f;
@@ -18,20 +18,20 @@ static bool readColorMap( osgDB::InputStream& is, osg::TransferFunction1D& func
is >> 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;
}

View File

@@ -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<const osg::Object*>(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<size; ++i )
{
std::string value;
is.readWrappedString( value );
udc.addDescription( value );
}
is >> 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<size; ++i )
{
osg::Object* read_object = is.readObject();
if (read_object) udc.addUserObject( read_object );
}
is >> 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<numObjects; ++i )
{
os << udc.getUserObject(i);
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -11,27 +11,27 @@ static bool checkLocalParameters( const osg::VertexProgram& vp )
static bool readLocalParameters( 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<size; ++i )
{
GLuint key; osg::Vec4d value;
is >> 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<size; ++i )
{
unsigned int key; osg::Matrixd value;
is >> 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;
}

View File

@@ -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<size; ++i )
{
double time = 0.0f;
@@ -31,7 +31,7 @@ static void readContainer( osgDB::InputStream& is, ContainerType* container )
is >> 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<size; ++i )
{
double time = 0.0f;
@@ -52,7 +52,7 @@ static void readContainer2( osgDB::InputStream& is, ContainerType* container )
is >> 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<CONTAINER, VALUE>( 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<CONTAINER, VALUE, INVALUE>( 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 <typename ContainerType>
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; i<container->size(); ++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 <typename ContainerType>
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; i<container->size(); ++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<CHANNEL*>(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<CONTAINER>( 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<CHANNEL*>(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<CONTAINER>( 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<size; ++i )
{
std::string type;
is >> 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;
}

View File

@@ -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<size; ++i )
{
osgAnimation::Animation* ani = dynamic_cast<osgAnimation::Animation*>( 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;
}

View File

@@ -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<size; ++i )
{
float weight = 0.0f;
is >> osgDB::PROPERTY("MorphTarget") >> weight;
is >> is.PROPERTY("MorphTarget") >> weight;
osg::Geometry* target = dynamic_cast<osg::Geometry*>( 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;
}

View File

@@ -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<size; ++i )
{
std::string name;
unsigned int viSize = 0;
is >> 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;
}

View File

@@ -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<size; ++i )
{
osgAnimation::StackedTransformElement* element =
dynamic_cast<osgAnimation::StackedTransformElement*>( 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;
}

View File

@@ -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<size; ++i )
{
float weight = 0.0f; is >> 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; ++i )
{
os << ctrl.getTextureWeight(i);
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -10,25 +10,25 @@ static bool checkDraggers( const osgManipulator::CompositeDragger& dragger )
static bool readDraggers( osgDB::InputStream& is, osgManipulator::CompositeDragger& dragger )
{
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osgManipulator::Dragger* child = dynamic_cast<osgManipulator::Dragger*>( 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<size; ++i )
{
os << dragger.getDragger(i);
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -12,25 +12,25 @@ static bool checkTransformUpdating( const osgManipulator::Dragger& dragger )
static bool readTransformUpdating( osgDB::InputStream& is, osgManipulator::Dragger& dragger )
{
unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
std::string name; is >> name >> osgDB::BEGIN_BRACKET;
std::string name; is >> name >> is.BEGIN_BRACKET;
if ( name=="DraggerTransformCallback" )
{
osg::MatrixTransform* transform = dynamic_cast<osg::MatrixTransform*>( 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<osgManipulator::DraggerTransformCallback*>( 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;
}

View File

@@ -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<size; ++i )
{
osgParticle::Placer* p = dynamic_cast<osgParticle::Placer*>( 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; ++i )
{
os << cp.getPlacer(i);
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -11,11 +11,11 @@ static bool checkDomains( const osgParticle::DomainOperator& dp )
static bool readDomains( osgDB::InputStream& is, osgParticle::DomainOperator& dp )
{
osgParticle::DomainOperator::Domain::Type type = osgParticle::DomainOperator::Domain::UNDEFINED_DOMAIN;
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
std::string typeName;
is >> 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; ++i )
{
const osgParticle::DomainOperator::Domain& domain = dp.getDomain(i);
os << osgDB::PROPERTY("Domain");
os << os.PROPERTY("Domain");
switch (domain.type)
{
case osgParticle::DomainOperator::Domain::POINT_DOMAIN:
os << std::string("POINT") << osgDB::BEGIN_BRACKET << std::endl; break;
os << std::string("POINT") << os.BEGIN_BRACKET << std::endl; break;
case osgParticle::DomainOperator::Domain::LINE_DOMAIN:
os << std::string("LINE") << osgDB::BEGIN_BRACKET << std::endl; break;
os << std::string("LINE") << os.BEGIN_BRACKET << std::endl; break;
case osgParticle::DomainOperator::Domain::TRI_DOMAIN:
os << std::string("TRIANGLE") << osgDB::BEGIN_BRACKET << std::endl; break;
os << std::string("TRIANGLE") << os.BEGIN_BRACKET << std::endl; break;
case osgParticle::DomainOperator::Domain::RECT_DOMAIN:
os << std::string("RECTANGLE") << osgDB::BEGIN_BRACKET << std::endl; break;
os << std::string("RECTANGLE") << os.BEGIN_BRACKET << std::endl; break;
case osgParticle::DomainOperator::Domain::PLANE_DOMAIN:
os << std::string("PLANE") << osgDB::BEGIN_BRACKET << std::endl; break;
os << std::string("PLANE") << os.BEGIN_BRACKET << std::endl; break;
case osgParticle::DomainOperator::Domain::SPHERE_DOMAIN:
os << std::string("SPHERE") << osgDB::BEGIN_BRACKET << std::endl; break;
os << std::string("SPHERE") << os.BEGIN_BRACKET << std::endl; break;
case osgParticle::DomainOperator::Domain::BOX_DOMAIN:
os << std::string("BOX") << osgDB::BEGIN_BRACKET << std::endl; break;
os << std::string("BOX") << os.BEGIN_BRACKET << std::endl; break;
case osgParticle::DomainOperator::Domain::DISK_DOMAIN:
os << std::string("DISK") << osgDB::BEGIN_BRACKET << std::endl; break;
os << std::string("DISK") << os.BEGIN_BRACKET << std::endl; break;
default:
os << std::string("UNDEFINED") << osgDB::BEGIN_BRACKET << std::endl; break;
os << std::string("UNDEFINED") << os.BEGIN_BRACKET << std::endl; break;
}
os << osgDB::PROPERTY("Plane") << domain.plane << std::endl;
os << osgDB::PROPERTY("Vertices1") << domain.v1 << std::endl;
os << osgDB::PROPERTY("Vertices2") << domain.v2 << std::endl;
os << osgDB::PROPERTY("Vertices3") << domain.v3 << std::endl;
os << osgDB::PROPERTY("Basis1") << domain.s1 << std::endl;
os << osgDB::PROPERTY("Basis2") << domain.s2 << std::endl;
os << osgDB::PROPERTY("Factors") << domain.r1 << domain.r2 << std::endl;
os << osgDB::END_BRACKET << std::endl;
os << os.PROPERTY("Plane") << domain.plane << std::endl;
os << os.PROPERTY("Vertices1") << domain.v1 << std::endl;
os << os.PROPERTY("Vertices2") << domain.v2 << std::endl;
os << os.PROPERTY("Vertices3") << domain.v3 << std::endl;
os << os.PROPERTY("Basis1") << domain.s1 << std::endl;
os << os.PROPERTY("Basis2") << domain.s2 << std::endl;
os << os.PROPERTY("Factors") << domain.r1 << domain.r2 << std::endl;
os << os.END_BRACKET << std::endl;
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -10,25 +10,25 @@ static bool checkOperators( const osgParticle::ModularProgram& prog )
static bool readOperators( osgDB::InputStream& is, osgParticle::ModularProgram& prog )
{
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osgParticle::Operator* op = dynamic_cast<osgParticle::Operator*>( 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; ++i )
{
os << prog.getOperator(i);
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -10,26 +10,26 @@ static bool checkVertices( const osgParticle::MultiSegmentPlacer& placer )
static bool readVertices( osgDB::InputStream& is, osgParticle::MultiSegmentPlacer& placer )
{
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osg::Vec3d vec; is >> 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<size; ++i )
{
os << osg::Vec3d(placer.getVertex(i));
}
os << std::endl;
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -17,49 +17,49 @@ USER_WRITE_FUNC( Shape, writeShapeValue )
bool readParticle( osgDB::InputStream& is, osgParticle::Particle& p )
{
is >> osgDB::BEGIN_BRACKET;
is >> is.BEGIN_BRACKET;
is >> osgDB::PROPERTY("Shape");
is >> is.PROPERTY("Shape");
p.setShape( static_cast<osgParticle::Particle::Shape>(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<osgParticle::Interpolator*>(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<osgParticle::Interpolator*>(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<osgParticle::Interpolator*>(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<osg::Drawable*>(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;
}

View File

@@ -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<osgParticle::ParticleSystem*>(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;
}

View File

@@ -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;
}

View File

@@ -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<size; ++i )
{
osgParticle::ParticleSystem* ps = dynamic_cast<osgParticle::ParticleSystem*>( 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; ++i )
{
os << updater.getParticleSystem(i);
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -10,7 +10,7 @@ static bool checkPulseData( const osgSim::BlinkSequence& bs )
static bool readPulseData( osgDB::InputStream& is, osgSim::BlinkSequence& bs )
{
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
double length = 0.0;
@@ -18,14 +18,14 @@ static bool readPulseData( osgDB::InputStream& is, osgSim::BlinkSequence& bs )
is >> 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; ++i )
{
double length = 0.0;
@@ -33,7 +33,7 @@ static bool writePulseData( osgDB::OutputStream& os, const osgSim::BlinkSequence
bs.getPulse( i, length, color );
os << length << color << std::endl;
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -10,68 +10,68 @@ static bool checkLightPointList( const osgSim::LightPointNode& node )
static bool readLightPointList( osgDB::InputStream& is, osgSim::LightPointNode& 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<size; ++i )
{
osgSim::LightPoint pt;
is >> 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<osgSim::Sector*>( 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<osgSim::BlinkSequence*>( 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<size; ++i )
{
const osgSim::LightPoint& pt = node.getLightPoint(i);
os << osgDB::PROPERTY("LightPoint") << osgDB::BEGIN_BRACKET << std::endl;
os << osgDB::PROPERTY("Position") << pt._position << std::endl;
os << osgDB::PROPERTY("Color") << pt._color << std::endl;
os << osgDB::PROPERTY("Attributes") << pt._on << (int)pt._blendingMode
os << os.PROPERTY("LightPoint") << os.BEGIN_BRACKET << std::endl;
os << os.PROPERTY("Position") << pt._position << std::endl;
os << os.PROPERTY("Color") << pt._color << std::endl;
os << os.PROPERTY("Attributes") << pt._on << (int)pt._blendingMode
<< pt._intensity << pt._radius << std::endl;
os << osgDB::PROPERTY("Sector") << (pt._sector!=NULL);
os << os.PROPERTY("Sector") << (pt._sector!=NULL);
if ( pt._sector!=NULL )
{
os << osgDB::BEGIN_BRACKET << std::endl;
os << os.BEGIN_BRACKET << std::endl;
os.writeObject( pt._sector.get() );
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
}
os << osgDB::PROPERTY("BlinkSequence") << (pt._blinkSequence!=NULL);
os << os.PROPERTY("BlinkSequence") << (pt._blinkSequence!=NULL);
if ( pt._blinkSequence!=NULL )
{
os << osgDB::BEGIN_BRACKET << std::endl;
os << os.BEGIN_BRACKET << std::endl;
os.writeObject( pt._blinkSequence.get() );
os << osgDB::END_BRACKET << std::endl;
os << os.END_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;
}

View File

@@ -10,11 +10,11 @@ static bool checkValues( const osgSim::MultiSwitch& node )
static bool readValues( osgDB::InputStream& is, osgSim::MultiSwitch& node )
{
unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
is >> 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<valueSize; ++j )
@@ -23,29 +23,29 @@ static bool readValues( osgDB::InputStream& is, osgSim::MultiSwitch& node )
values.push_back( value );
}
node.setValueList( i, values );
is >> 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<switches.size(); ++i )
{
const osgSim::MultiSwitch::ValueList& values = node.getValueList(i);
os << osgDB::PROPERTY("SwitchSet"); os.writeSize( values.size() );
os << osgDB::BEGIN_BRACKET << std::endl;
os << os.PROPERTY("SwitchSet"); os.writeSize( values.size() );
os << os.BEGIN_BRACKET << std::endl;
for ( osgSim::MultiSwitch::ValueList::const_iterator itr=values.begin();
itr!=values.end(); ++itr )
{
os << *itr << 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;
}

View File

@@ -10,23 +10,23 @@ static bool checkData( const osgSim::ObjectRecordData& data )
static bool readData( osgDB::InputStream& is, osgSim::ObjectRecordData& data )
{
is >> 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;
}

View File

@@ -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<osg::Vec4> colors;
for ( unsigned int i=0; i<colorSize; ++i )
{
osg::Vec4 color; is >> 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<const osgSim::ColorRange*>(stc);
@@ -52,16 +52,16 @@ static bool writeScalarsToColors( osgDB::OutputStream& os, const osgSim::ScalarB
const std::vector<osg::Vec4>& 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<colorSize; ++i )
{
os << colors[i] << std::endl;
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
}
else
os << false << colorSize << std::endl;
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}
@@ -74,19 +74,19 @@ static bool checkScalarPrinter( const osgSim::ScalarBar& bar )
static bool readScalarPrinter( osgDB::InputStream& is, osgSim::ScalarBar& bar )
{
is >> osgDB::BEGIN_BRACKET;
is >> is.BEGIN_BRACKET;
osgSim::ScalarBar::ScalarPrinter* sp =
dynamic_cast<osgSim::ScalarBar::ScalarPrinter*>( 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<const osg::Object*>(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<int, int>(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;
}

View File

@@ -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<size; ++i )
{
std::string name; int type;
is >> 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; ++i )
{
const osgSim::ShapeAttribute& sa = list[i];
os << osgDB::PROPERTY("ShapeAttribute") << sa.getName();
os << osgDB::PROPERTY("Type") << (int)sa.getType();
os << os.PROPERTY("ShapeAttribute") << sa.getName();
os << os.PROPERTY("Type") << (int)sa.getType();
switch ( sa.getType() )
{
case osgSim::ShapeAttribute::INTEGER: os << sa.getInt() << std::endl; break;
@@ -58,7 +58,7 @@ static bool writeAttributes( osgDB::OutputStream& os, const osgSim::ShapeAttribu
default: os << std::string(sa.getString()) << std::endl; break;
}
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -10,7 +10,7 @@ static bool checkLayers( const osgTerrain::CompositeLayer& layer )
static bool readLayers( osgDB::InputStream& is, osgTerrain::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<size; ++i )
{
std::string type;
@@ -27,14 +27,14 @@ static bool readLayers( osgDB::InputStream& is, osgTerrain::CompositeLayer& laye
layer.addLayer( compoundname );
}
}
is >> 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<size; ++i )
{
const osgTerrain::Layer* child = layer.getLayer(i);
@@ -50,7 +50,7 @@ static bool writeLayers( osgDB::OutputStream& os, const osgTerrain::CompositeLay
os << std::endl;
}
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -11,12 +11,12 @@ static bool checkFilterMatrix( const osgTerrain::GeometryTechnique& tech )
static bool readFilterMatrix( osgDB::InputStream& is, osgTerrain::GeometryTechnique& tech )
{
osg::Matrix3 matrix;
is >> 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;
}

View File

@@ -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;
}

View File

@@ -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<numValidLayers; ++i )
{
unsigned int layerNum=0; is >> osgDB::PROPERTY("Layer") >> layerNum;
unsigned int layerNum=0; is >> is.PROPERTY("Layer") >> layerNum;
osgTerrain::Layer* layer = dynamic_cast<osgTerrain::Layer*>( 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<tile.getNumColorLayers(); ++i )
{
if (tile.getColorLayer(i)) os << osgDB::PROPERTY("Layer") << i << tile.getColorLayer(i);
if (tile.getColorLayer(i)) os << os.PROPERTY("Layer") << i << tile.getColorLayer(i);
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -32,24 +32,24 @@ static bool checkColorGradientCorners( const osgText::Text& text )
static bool readColorGradientCorners( osgDB::InputStream& is, osgText::Text& text )
{
osg::Vec4d lt, lb, rb, rt;
is >> 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;
}

View File

@@ -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<size; ++i )
{
osgVolume::Layer* child = dynamic_cast<osgVolume::Layer*>( 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; ++i )
{
os << layer.getLayer(i);
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -10,25 +10,25 @@ static bool checkProperties( const osgVolume::CompositeProperty& prop )
static bool readProperties( osgDB::InputStream& is, osgVolume::CompositeProperty& prop )
{
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osgVolume::Property* child = dynamic_cast<osgVolume::Property*>( 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<size; ++i )
{
os << prop.getProperty(i);
}
os << osgDB::END_BRACKET << std::endl;
os << os.END_BRACKET << std::endl;
return true;
}

View File

@@ -10,27 +10,27 @@ static bool checkLocatorCallbacks( const osgVolume::Locator& locator )
static bool readLocatorCallbacks( osgDB::InputStream& is, osgVolume::Locator& locator )
{
unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osgVolume::Locator::LocatorCallback* cb =
dynamic_cast<osgVolume::Locator::LocatorCallback*>( 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;
}