diff --git a/src/osgPlugins/ive/DataInputStream.cpp b/src/osgPlugins/ive/DataInputStream.cpp index 7cfabd5f4..13464752d 100644 --- a/src/osgPlugins/ive/DataInputStream.cpp +++ b/src/osgPlugins/ive/DataInputStream.cpp @@ -113,6 +113,11 @@ bool DataInputStream::readBool(){ return c!=0; } +unsigned int DataInputStream::getVersion() +{ + return( _version ); +} + char DataInputStream::readChar(){ char c; _istream->read(&c, CHARSIZE); diff --git a/src/osgPlugins/ive/DataInputStream.h b/src/osgPlugins/ive/DataInputStream.h index b358cc8f9..2cd8af75d 100644 --- a/src/osgPlugins/ive/DataInputStream.h +++ b/src/osgPlugins/ive/DataInputStream.h @@ -30,6 +30,7 @@ class DataInputStream{ public: DataInputStream(std::istream* istream); ~DataInputStream(); + unsigned int getVersion(); bool readBool(); char readChar(); unsigned char readUChar(); diff --git a/src/osgPlugins/ive/IveVersion.h b/src/osgPlugins/ive/IveVersion.h index fea17cad4..c98d9f76a 100644 --- a/src/osgPlugins/ive/IveVersion.h +++ b/src/osgPlugins/ive/IveVersion.h @@ -8,7 +8,8 @@ compatibility (if implemented). VERSION is stored in the 2nd 4 bytes of the file */ -#define VERSION 0x00000002 +#define VERSION_0002 0x00000002 +#define VERSION 0x00000003 /* The BYTE_SEX tag is used to check the endian diff --git a/src/osgPlugins/ive/LOD.cpp b/src/osgPlugins/ive/LOD.cpp index 4d45f0de5..70b78074a 100644 --- a/src/osgPlugins/ive/LOD.cpp +++ b/src/osgPlugins/ive/LOD.cpp @@ -53,6 +53,7 @@ void LOD::read(DataInputStream* in){ if(id == IVELOD){ // Read LOD's identification. id = in->readInt(); + // If the osg class is inherited by any other class we should also read this from file. osg::Group* group = dynamic_cast(this); if(group){ @@ -62,13 +63,15 @@ void LOD::read(DataInputStream* in){ throw Exception("LOD::read(): Could not cast this osg::LOD to an osg::Group."); // Read LOD's properties + if ( in->getVersion() > VERSION_0002 ) setRadius(in->readFloat()); // Read centermode setCenterMode((osg::LOD::CenterMode)in->readInt()); setCenter(in->readVec3()); - setRangeMode((RangeMode)in->readInt()); + if ( in->getVersion() > VERSION_0002 ) + setRangeMode((RangeMode)in->readInt()); // Read rangelist int size = in->readInt();;