From Bob Kuehne, add usage of version number to differentiate between
rev's of the LOD.
This commit is contained in:
parent
aa833acfd3
commit
aed65903db
@ -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);
|
||||
|
@ -30,6 +30,7 @@ class DataInputStream{
|
||||
public:
|
||||
DataInputStream(std::istream* istream);
|
||||
~DataInputStream();
|
||||
unsigned int getVersion();
|
||||
bool readBool();
|
||||
char readChar();
|
||||
unsigned char readUChar();
|
||||
|
@ -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
|
||||
|
@ -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();;
|
||||
|
Loading…
Reference in New Issue
Block a user