From Bob Kuehne, add usage of version number to differentiate between

rev's of the LOD.
This commit is contained in:
Robert Osfield 2004-07-20 07:46:05 +00:00
parent aa833acfd3
commit aed65903db
4 changed files with 12 additions and 2 deletions

View File

@ -113,6 +113,11 @@ bool DataInputStream::readBool(){
return c!=0; return c!=0;
} }
unsigned int DataInputStream::getVersion()
{
return( _version );
}
char DataInputStream::readChar(){ char DataInputStream::readChar(){
char c; char c;
_istream->read(&c, CHARSIZE); _istream->read(&c, CHARSIZE);

View File

@ -30,6 +30,7 @@ class DataInputStream{
public: public:
DataInputStream(std::istream* istream); DataInputStream(std::istream* istream);
~DataInputStream(); ~DataInputStream();
unsigned int getVersion();
bool readBool(); bool readBool();
char readChar(); char readChar();
unsigned char readUChar(); unsigned char readUChar();

View File

@ -8,7 +8,8 @@
compatibility (if implemented). VERSION is compatibility (if implemented). VERSION is
stored in the 2nd 4 bytes of the file */ 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 /* The BYTE_SEX tag is used to check the endian

View File

@ -53,6 +53,7 @@ void LOD::read(DataInputStream* in){
if(id == IVELOD){ if(id == IVELOD){
// Read LOD's identification. // Read LOD's identification.
id = in->readInt(); id = in->readInt();
// If the osg class is inherited by any other class we should also read this from file. // If the osg class is inherited by any other class we should also read this from file.
osg::Group* group = dynamic_cast<osg::Group*>(this); osg::Group* group = dynamic_cast<osg::Group*>(this);
if(group){ 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."); throw Exception("LOD::read(): Could not cast this osg::LOD to an osg::Group.");
// Read LOD's properties // Read LOD's properties
if ( in->getVersion() > VERSION_0002 )
setRadius(in->readFloat()); setRadius(in->readFloat());
// Read centermode // Read centermode
setCenterMode((osg::LOD::CenterMode)in->readInt()); setCenterMode((osg::LOD::CenterMode)in->readInt());
setCenter(in->readVec3()); setCenter(in->readVec3());
setRangeMode((RangeMode)in->readInt()); if ( in->getVersion() > VERSION_0002 )
setRangeMode((RangeMode)in->readInt());
// Read rangelist // Read rangelist
int size = in->readInt();; int size = in->readInt();;