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;
}
unsigned int DataInputStream::getVersion()
{
return( _version );
}
char DataInputStream::readChar(){
char c;
_istream->read(&c, CHARSIZE);

View File

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

View File

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

View File

@ -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<osg::Group*>(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();;