From Wang Rui, "I've initially added the XML support of the new native osg format,

using osgDB::XmlParser. The extension for XML-formatted scenes is
.osgx, corresponding to .osgb for binary and .osgt for ascii. It could
either be rendered in osgviewer or edited by common web browsers and
xml editors because of a range of changes to fit the XML syntax. For
example, the recorded class names are slight modified, from
'osg::Geode' to 'osg--Geode'.

To quickly get an XML file:
# ./osgconv cow.osg cow.osgx

The StreamOperator header, InputStreram and OutputStream classes are
modified to be more portable for triple ascii/binary/XML formats. I
also fixed a bug in readImage()/writeImage() to share image objects if
needed.

The ReaderWriterOSG2 class now supports all three formats and
reading/writing scene objects (not nodes or images), thanks to
Torben's advice before.
"
This commit is contained in:
Robert Osfield
2010-03-10 13:48:41 +00:00
parent ce19b37981
commit e082b01f26
9 changed files with 778 additions and 168 deletions

View File

@@ -61,7 +61,8 @@ public:
{
READ_UNKNOWN = 0,
READ_SCENE,
READ_IMAGE
READ_IMAGE,
READ_OBJECT
};
InputStream( const osgDB::Options* options );
@@ -123,9 +124,9 @@ public:
{ ptr = static_cast<T*>(readObject()); return *this; }
// Convenient methods for reading
bool matchString( const std::string& str );
void advanceToCurrentEndBracket();
void readWrappedString( std::string& str );
bool matchString( const std::string& str ) { return _in->matchString(str); }
void advanceToCurrentEndBracket() { _in->advanceToCurrentEndBracket(); }
void readWrappedString( std::string& str ) { _in->readWrappedString(str); checkStream(); }
void readCharArray( char* s, unsigned int size ) { _in->readCharArray(s, size); }
// readSize() use unsigned int for all sizes.