Replaced tabs with spaces.
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: AnimationPath.cpp
|
||||
* FILE: AnimationPath.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osg::AnimationPath in binary format to disk.
|
||||
* DESCRIPTION: Read/Write osg::AnimationPath in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Auto generated by iveGenerate
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
* CREATED BY: Auto generated by iveGenerate
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
*
|
||||
* HISTORY: Created 25.3.2003
|
||||
* HISTORY: Created 25.3.2003
|
||||
*
|
||||
* Copyright 2003 VR-C
|
||||
* Copyright 2003 VR-C
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
@@ -19,58 +19,58 @@
|
||||
using namespace ive;
|
||||
|
||||
void AnimationPath::write(DataOutputStream* out){
|
||||
// Write AnimationPath's identification.
|
||||
out->writeInt(IVEANIMATIONPATH);
|
||||
// If the osg class is inherited by any other class we should also write this to file.
|
||||
osg::Object* obj = dynamic_cast<osg::Object*>(this);
|
||||
if(obj){
|
||||
((ive::Object*)(obj))->write(out);
|
||||
}
|
||||
else
|
||||
throw Exception("AnimationPath::write(): Could not cast this osg::AnimationPath to an osg::Object.");
|
||||
// Write AnimationPath's properties.
|
||||
// Write AnimationPath's identification.
|
||||
out->writeInt(IVEANIMATIONPATH);
|
||||
// If the osg class is inherited by any other class we should also write this to file.
|
||||
osg::Object* obj = dynamic_cast<osg::Object*>(this);
|
||||
if(obj){
|
||||
((ive::Object*)(obj))->write(out);
|
||||
}
|
||||
else
|
||||
throw Exception("AnimationPath::write(): Could not cast this osg::AnimationPath to an osg::Object.");
|
||||
// Write AnimationPath's properties.
|
||||
|
||||
// Write loopmode
|
||||
out->writeInt(getLoopMode());
|
||||
// Write control points
|
||||
AnimationPath::TimeControlPointMap tcpm = getTimeControlPointMap();
|
||||
out->writeInt(tcpm.size());
|
||||
// Write loopmode
|
||||
out->writeInt(getLoopMode());
|
||||
// Write control points
|
||||
AnimationPath::TimeControlPointMap tcpm = getTimeControlPointMap();
|
||||
out->writeInt(tcpm.size());
|
||||
for(AnimationPath::TimeControlPointMap::iterator itr=tcpm.begin(); itr!=tcpm.end(); ++itr){
|
||||
out->writeFloat(itr->first);
|
||||
out->writeVec3(itr->second.getPosition());
|
||||
out->writeQuat(itr->second.getRotation());
|
||||
out->writeVec3(itr->second.getScale());
|
||||
out->writeFloat(itr->first);
|
||||
out->writeVec3(itr->second.getPosition());
|
||||
out->writeQuat(itr->second.getRotation());
|
||||
out->writeVec3(itr->second.getScale());
|
||||
}
|
||||
}
|
||||
|
||||
void AnimationPath::read(DataInputStream* in){
|
||||
// Peek on AnimationPath's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVEANIMATIONPATH){
|
||||
// Read AnimationPath's identification.
|
||||
id = in->readInt();
|
||||
// If the osg class is inherited by any other class we should also read this from file.
|
||||
osg::Object* obj = dynamic_cast<osg::Object*>(this);
|
||||
if(obj){
|
||||
((ive::Object*)(obj))->read(in);
|
||||
}
|
||||
else
|
||||
throw Exception("AnimationPath::read(): Could not cast this osg::AnimationPath to an osg::Object.");
|
||||
// Read AnimationPath's properties
|
||||
// Peek on AnimationPath's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVEANIMATIONPATH){
|
||||
// Read AnimationPath's identification.
|
||||
id = in->readInt();
|
||||
// If the osg class is inherited by any other class we should also read this from file.
|
||||
osg::Object* obj = dynamic_cast<osg::Object*>(this);
|
||||
if(obj){
|
||||
((ive::Object*)(obj))->read(in);
|
||||
}
|
||||
else
|
||||
throw Exception("AnimationPath::read(): Could not cast this osg::AnimationPath to an osg::Object.");
|
||||
// Read AnimationPath's properties
|
||||
|
||||
// Read loopmode
|
||||
setLoopMode((osg::AnimationPath::LoopMode)in->readInt());
|
||||
// Read control points
|
||||
int size = in->readInt();
|
||||
for(int i=0;i<size;i++){
|
||||
float time = in->readFloat();
|
||||
osg::Vec3 pos = in->readVec3();
|
||||
osg::Quat rot = in->readQuat();
|
||||
osg::Vec3 scale = in->readVec3();
|
||||
insert(time, osg::AnimationPath::ControlPoint(pos, rot, scale));
|
||||
}
|
||||
}
|
||||
else{
|
||||
throw Exception("AnimationPath::read(): Expected AnimationPath identification.");
|
||||
}
|
||||
// Read loopmode
|
||||
setLoopMode((osg::AnimationPath::LoopMode)in->readInt());
|
||||
// Read control points
|
||||
int size = in->readInt();
|
||||
for(int i=0;i<size;i++){
|
||||
float time = in->readFloat();
|
||||
osg::Vec3 pos = in->readVec3();
|
||||
osg::Quat rot = in->readQuat();
|
||||
osg::Vec3 scale = in->readVec3();
|
||||
insert(time, osg::AnimationPath::ControlPoint(pos, rot, scale));
|
||||
}
|
||||
}
|
||||
else{
|
||||
throw Exception("AnimationPath::read(): Expected AnimationPath identification.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user