|
Revision 13041, 2.0 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 "TexMat.h" |
|---|
| 17 | #include "Object.h" |
|---|
| 18 | |
|---|
| 19 | using namespace ive; |
|---|
| 20 | |
|---|
| 21 | void TexMat::write(DataOutputStream* out){ |
|---|
| 22 | |
|---|
| 23 | out->writeInt(IVETEXMAT); |
|---|
| 24 | |
|---|
| 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 | |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | out->writeMatrixf(getMatrix()); |
|---|
| 35 | |
|---|
| 36 | if ( out->getVersion() >= VERSION_0017 ) |
|---|
| 37 | { |
|---|
| 38 | out->writeBool(getScaleByTextureRectangleSize()); |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | void TexMat::read(DataInputStream* in){ |
|---|
| 44 | |
|---|
| 45 | int id = in->peekInt(); |
|---|
| 46 | if(id == IVETEXMAT){ |
|---|
| 47 | |
|---|
| 48 | id = in->readInt(); |
|---|
| 49 | |
|---|
| 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 | |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 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 | } |
|---|