root/OpenSceneGraph/trunk/src/osgPlugins/ive/PositionAttitudeTransform.cpp @ 13041

Revision 13041, 2.3 kB (checked in by robert, 3 years 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 *    FILE:            PositionAttitudeTransform.cpp
4 *
5 *    DESCRIPTION:    Read/Write osg::PositionAttitudeTransform in binary format to disk.
6 *
7 *    CREATED BY:        Auto generated by iveGenerate
8 *                    and later modified by Rune Schmidt Jensen.
9 *
10 *    HISTORY:        Created 25.3.2003
11 *
12 *    Copyright 2003 VR-C
13 **********************************************************************/
14
15#include "Exception.h"
16#include "PositionAttitudeTransform.h"
17#include "Transform.h"
18
19using namespace ive;
20
21void PositionAttitudeTransform::write(DataOutputStream* out){
22    // Write PositionAttitudeTransform's identification.
23    out->writeInt(IVEPOSITIONATTITUDETRANSFORM);
24    // If the osg class is inherited by any other class we should also write this to file.
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    // Write PositionAttitudeTransform's properties.
32
33    out->writeVec3(getPosition());
34    out->writeQuat(getAttitude());
35    out->writeVec3(getScale());
36    out->writeVec3(getPivotPoint());
37}
38
39void PositionAttitudeTransform::read(DataInputStream* in){
40    // Peek on PositionAttitudeTransform's identification.
41    int id = in->peekInt();
42    if(id == IVEPOSITIONATTITUDETRANSFORM){
43        // Read PositionAttitudeTransform's identification.
44        id = in->readInt();
45        // If the osg class is inherited by any other class we should also read this from file.
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        // Read PositionAttitudeTransform's properties
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}
Note: See TracBrowser for help on using the browser.