|
Revision 13041, 2.3 kB
(checked in by robert, 14 months ago)
|
|
Ran script to remove trailing spaces and tabs
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | #include "Exception.h" |
|---|
| 16 | #include "PositionAttitudeTransform.h" |
|---|
| 17 | #include "Transform.h" |
|---|
| 18 | |
|---|
| 19 | using namespace ive; |
|---|
| 20 | |
|---|
| 21 | void PositionAttitudeTransform::write(DataOutputStream* out){ |
|---|
| 22 | |
|---|
| 23 | out->writeInt(IVEPOSITIONATTITUDETRANSFORM); |
|---|
| 24 | |
|---|
| 25 | osg::Transform* trans = dynamic_cast<osg::Transform*>(this); |
|---|
| 26 | if(trans){ |
|---|
| 27 | ((ive::Transform*)(trans))->write(out); |
|---|
| 28 | } |
|---|
| 29 | else |
|---|
| 30 | out_THROW_EXCEPTION("PositionAttitudeTransform::write(): Could not cast this osg::PositionAttitudeTransform to an osg::Transform."); |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | out->writeVec3(getPosition()); |
|---|
| 34 | out->writeQuat(getAttitude()); |
|---|
| 35 | out->writeVec3(getScale()); |
|---|
| 36 | out->writeVec3(getPivotPoint()); |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | void PositionAttitudeTransform::read(DataInputStream* in){ |
|---|
| 40 | |
|---|
| 41 | int id = in->peekInt(); |
|---|
| 42 | if(id == IVEPOSITIONATTITUDETRANSFORM){ |
|---|
| 43 | |
|---|
| 44 | id = in->readInt(); |
|---|
| 45 | |
|---|
| 46 | osg::Transform* trans = dynamic_cast<osg::Transform*>(this); |
|---|
| 47 | if(trans){ |
|---|
| 48 | ((ive::Transform*)(trans))->read(in); |
|---|
| 49 | } |
|---|
| 50 | else |
|---|
| 51 | in_THROW_EXCEPTION("PositionAttitudeTransform::read(): Could not cast this osg::PositionAttitudeTransform to an osg::Transform."); |
|---|
| 52 | |
|---|
| 53 | setPosition(in->readVec3()); |
|---|
| 54 | setAttitude(in->readQuat()); |
|---|
| 55 | setScale(in->readVec3()); |
|---|
| 56 | setPivotPoint(in->readVec3()); |
|---|
| 57 | |
|---|
| 58 | } |
|---|
| 59 | else{ |
|---|
| 60 | in_THROW_EXCEPTION("PositionAttitudeTransform::read(): Expected PositionAttitudeTransform identification."); |
|---|
| 61 | } |
|---|
| 62 | } |
|---|