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

Revision 13041, 2.0 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:            TexMat.cpp
4 *
5 *    DESCRIPTION:    Read/Write osg::TexMat in binary format to disk.
6 *
7 *    CREATED BY:        Auto generated by iveGenerated
8 *                    and later modified by Rune Schmidt Jensen.
9 *
10 *    HISTORY:        Created 21.3.2003
11 *
12 *    Copyright 2003 VR-C
13 **********************************************************************/
14
15#include "Exception.h"
16#include "TexMat.h"
17#include "Object.h"
18
19using namespace ive;
20
21void TexMat::write(DataOutputStream* out){
22    // Write TexMat's identification.
23    out->writeInt(IVETEXMAT);
24    // If the osg class is inherited by any other class we should also write this to file.
25    osg::Object*  obj = dynamic_cast<osg::Object*>(this);
26    if(obj){
27        ((ive::Object*)(obj))->write(out);
28    }
29    else
30        out_THROW_EXCEPTION("TexMat::write(): Could not cast this osg::TexMat to an osg::Object.");
31    // Write TexMat's properties.
32
33    // Write mode
34    out->writeMatrixf(getMatrix());
35
36    if ( out->getVersion() >= VERSION_0017 )
37    {
38        out->writeBool(getScaleByTextureRectangleSize());
39    }
40
41}
42
43void TexMat::read(DataInputStream* in){
44    // Peek on TexMat's identification.
45    int id = in->peekInt();
46    if(id == IVETEXMAT){
47        // Read TexMat's identification.
48        id = in->readInt();
49        // If the osg class is inherited by any other class we should also read this from file.
50        osg::Object*  obj = dynamic_cast<osg::Object*>(this);
51        if(obj){
52            ((ive::Object*)(obj))->read(in);
53        }
54        else
55            in_THROW_EXCEPTION("TexMat::read(): Could not cast this osg::TexMat to an osg::Object.");
56        // Read TexMat's properties
57
58        // Read matrix
59        setMatrix(in->readMatrixf());
60
61        if ( in->getVersion() >= VERSION_0017 )
62        {
63            setScaleByTextureRectangleSize(in->readBool());
64        }
65
66    }
67    else{
68        in_THROW_EXCEPTION("TexMat::read(): Expected TexMat identification.");
69    }
70}
Note: See TracBrowser for help on using the browser.