|
Revision 13041, 1.8 kB
(checked in by robert, 14 months ago)
|
|
Ran script to remove trailing spaces and tabs
|
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | #include "Exception.h" |
|---|
| 14 | #include "Fog.h" |
|---|
| 15 | #include "Object.h" |
|---|
| 16 | |
|---|
| 17 | using namespace ive; |
|---|
| 18 | |
|---|
| 19 | void Fog::write(DataOutputStream* out){ |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | out->writeInt(IVEFOG); |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | osg::Object* obj = dynamic_cast<osg::Object*>(this); |
|---|
| 26 | if(obj) |
|---|
| 27 | ((ive::Object*)(obj))->write(out); |
|---|
| 28 | else |
|---|
| 29 | out_THROW_EXCEPTION("Fog::write(): Could not cast this osg::Fog to an osg::Object."); |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | out->writeInt(getMode()); |
|---|
| 33 | out->writeFloat(getDensity()); |
|---|
| 34 | out->writeFloat(getStart()); |
|---|
| 35 | out->writeFloat(getEnd()); |
|---|
| 36 | out->writeVec4(getColor()); |
|---|
| 37 | out->writeInt(getFogCoordinateSource()); |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | void Fog::read(DataInputStream* in){ |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | int id = in->peekInt(); |
|---|
| 44 | if(id == IVEFOG) |
|---|
| 45 | { |
|---|
| 46 | |
|---|
| 47 | id = in->readInt(); |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | osg::Object* obj = dynamic_cast<osg::Object*>(this); |
|---|
| 51 | if(obj) |
|---|
| 52 | ((ive::Object*)(obj))->read(in); |
|---|
| 53 | else |
|---|
| 54 | in_THROW_EXCEPTION("Fog::read(): Could not cast this osg::Fog to an osg::Object."); |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | setMode(osg::Fog::Mode(in->readInt())); |
|---|
| 58 | setDensity(in->readFloat()); |
|---|
| 59 | setStart(in->readFloat()); |
|---|
| 60 | setEnd(in->readFloat()); |
|---|
| 61 | setColor(in->readVec4()); |
|---|
| 62 | setFogCoordinateSource(in->readInt()); |
|---|
| 63 | } |
|---|
| 64 | else{ |
|---|
| 65 | in_THROW_EXCEPTION("Fog::read(): Expected Fog identification."); |
|---|
| 66 | } |
|---|
| 67 | } |
|---|