Refactored the handling of readImage/writeImage/readObject/writeObject to avoid double setting of unique ID's, fixing the problem in reading/writing files with images

This commit is contained in:
Robert Osfield
2010-09-23 16:12:05 +00:00
parent 915b38dc25
commit d9a133476a
4 changed files with 194 additions and 152 deletions

View File

@@ -137,6 +137,7 @@ public:
osg::PrimitiveSet* readPrimitiveSet();
osg::Image* readImage();
osg::Object* readObject( osg::Object* existingObj=0 );
osg::Object* readObjectFields( const std::string& className, osg::Object* existingObj=0);
ReadType start( InputIterator* );
void decompress();

View File

@@ -146,6 +146,7 @@ public:
void writePrimitiveSet( const osg::PrimitiveSet* p );
void writeImage( const osg::Image* img );
void writeObject( const osg::Object* obj );
void writeObjectFields( const osg::Object* obj );
void start( OutputIterator* outIterator, WriteType type );
void compress( std::ostream* ostream );
@@ -161,8 +162,8 @@ protected:
template<typename T>
void writeArrayImplementation( const T*, int write_size, unsigned int numInRow=1 );
unsigned int findOrCreateArrayID( const osg::Array* array );
unsigned int findOrCreateObjectID( const osg::Object* obj );
unsigned int findOrCreateArrayID( const osg::Array* array, bool& newID );
unsigned int findOrCreateObjectID( const osg::Object* obj, bool& newID );
ArrayMap _arrayMap;
ObjectMap _objectMap;