|
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 "Stencil.h" |
|---|
| 17 | #include "Object.h" |
|---|
| 18 | |
|---|
| 19 | using namespace ive; |
|---|
| 20 | |
|---|
| 21 | void Stencil::write(DataOutputStream* out){ |
|---|
| 22 | |
|---|
| 23 | out->writeInt(IVESTENCIL); |
|---|
| 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("Stencil::write(): Could not cast this osg::Stencil to an osg::Object."); |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | out->writeInt(getFunction()); |
|---|
| 34 | out->writeInt(getFunctionRef()); |
|---|
| 35 | out->writeUInt(getFunctionMask()); |
|---|
| 36 | |
|---|
| 37 | out->writeInt(getStencilFailOperation()); |
|---|
| 38 | out->writeInt(getStencilPassAndDepthFailOperation()); |
|---|
| 39 | out->writeInt(getStencilPassAndDepthPassOperation()); |
|---|
| 40 | |
|---|
| 41 | out->writeUInt(getWriteMask()); |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | } |
|---|
| 45 | |
|---|
| 46 | void Stencil::read(DataInputStream* in){ |
|---|
| 47 | |
|---|
| 48 | int id = in->peekInt(); |
|---|
| 49 | if(id == IVESTENCIL) |
|---|
| 50 | { |
|---|
| 51 | |
|---|
| 52 | id = in->readInt(); |
|---|
| 53 | |
|---|
| 54 | osg::Object* obj = dynamic_cast<osg::Object*>(this); |
|---|
| 55 | if(obj){ |
|---|
| 56 | ((ive::Object*)(obj))->read(in); |
|---|
| 57 | } |
|---|
| 58 | else |
|---|
| 59 | in_THROW_EXCEPTION("Stencil::read(): Could not cast this osg::Stencil to an osg::Object."); |
|---|
| 60 | |
|---|
| 61 | setFunction((Function)in->readInt()); |
|---|
| 62 | setFunctionRef(in->readInt()); |
|---|
| 63 | setFunctionMask(in->readUInt()); |
|---|
| 64 | |
|---|
| 65 | setStencilFailOperation((Operation)in->readInt()); |
|---|
| 66 | setStencilPassAndDepthFailOperation((Operation)in->readInt()); |
|---|
| 67 | setStencilPassAndDepthPassOperation((Operation)in->readInt()); |
|---|
| 68 | |
|---|
| 69 | setWriteMask(in->readUInt()); |
|---|
| 70 | |
|---|
| 71 | } |
|---|
| 72 | else{ |
|---|
| 73 | in_THROW_EXCEPTION("Stencil::read(): Expected Stencil identification."); |
|---|
| 74 | } |
|---|
| 75 | } |
|---|