From John Kelso,"Attached is the ive reader/writer for the 2.x version of the osg::Sequence

node. "
This commit is contained in:
Robert Osfield
2007-12-21 14:13:40 +00:00
parent 0f2959ce69
commit 9a41178439
2 changed files with 51 additions and 1 deletions

View File

@@ -30,8 +30,9 @@
#define VERSION_0019 19
#define VERSION_0020 20
#define VERSION_0021 21
#define VERSION_0022 22
#define VERSION VERSION_0021
#define VERSION VERSION_0022
/* The BYTE_SEX tag is used to check the endian
of the IVE file being read in. The IVE format

View File

@@ -35,6 +35,12 @@ void Sequence::write(DataOutputStream* out)
// Write Sequence's properties.
if (out->getVersion() >= VERSION_0022)
{
// Write default frame time
out->writeFloat(getDefaultTime()) ;
}
// Write frame times.
int size = getNumChildren();
out->writeInt(size);
@@ -42,6 +48,13 @@ void Sequence::write(DataOutputStream* out)
{
out->writeFloat(getTime(i));
}
if (out->getVersion() >= VERSION_0022)
{
// Write last frame time
out->writeFloat(getLastFrameTime()) ;
}
// Write loop mode & interval
osg::Sequence::LoopMode mode;
int begin, end;
@@ -60,6 +73,19 @@ void Sequence::write(DataOutputStream* out)
// Write sequence mode
out->writeInt(getMode());
if (out->getVersion() >= VERSION_0022)
{
// Write sync as an integer
bool sync ;
getSync(sync) ;
out->writeInt((int)sync) ;
// Write clearOnStop as an integer
bool clearOnStop ;
getClearOnStop(clearOnStop) ;
out->writeInt((int)clearOnStop) ;
}
}
void Sequence::read(DataInputStream* in)
@@ -82,12 +108,26 @@ void Sequence::read(DataInputStream* in)
}
// Read Sequence's properties
if (in->getVersion() >= VERSION_0022)
{
// Read default frame time
setDefaultTime(in->readFloat());
}
// Read frame times.
int size = in->readInt();
for(int i=0;i<size;i++)
{
setTime(i, in->readFloat());
}
if (in->getVersion() >= VERSION_0022)
{
// Read last frame time
setLastFrameTime(in->readFloat());
}
// Read loop mode & interval
int mode = in->readInt();
int begin = in->readInt();
@@ -101,6 +141,15 @@ void Sequence::read(DataInputStream* in)
// Read sequence mode
setMode((osg::Sequence::SequenceMode)in->readInt());
if (in->getVersion() >= VERSION_0022)
{
// Read sync from an integer
setSync((in->readInt())!=0) ;
// Read clearOnStop from an integer
setClearOnStop((in->readInt())!=0) ;
}
}
else
{