|
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 "Object.h" |
|---|
| 17 | #include "PrimitiveSet.h" |
|---|
| 18 | |
|---|
| 19 | using namespace ive; |
|---|
| 20 | |
|---|
| 21 | void PrimitiveSet::write(DataOutputStream* out){ |
|---|
| 22 | |
|---|
| 23 | out->writeInt(IVEPRIMITIVESET); |
|---|
| 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("PrimitiveSet::write(): Could not cast this osg::PrimitiveSet to an osg::Object."); |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | if ( out->getVersion() >= VERSION_0038 ) |
|---|
| 34 | { |
|---|
| 35 | out->writeInt(getNumInstances()); |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | out->writeInt(getMode()); |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | void PrimitiveSet::read(DataInputStream* in){ |
|---|
| 43 | |
|---|
| 44 | int id = in->peekInt(); |
|---|
| 45 | if(id == IVEPRIMITIVESET){ |
|---|
| 46 | |
|---|
| 47 | id = in->readInt(); |
|---|
| 48 | |
|---|
| 49 | osg::Object* obj = dynamic_cast<osg::Object*>(this); |
|---|
| 50 | if(obj){ |
|---|
| 51 | ((ive::Object*)(obj))->read(in); |
|---|
| 52 | } |
|---|
| 53 | else |
|---|
| 54 | in_THROW_EXCEPTION("PrimitiveSet::read(): Could not cast this osg::PrimitiveSet to an osg::Object."); |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | if ( in->getVersion() >= VERSION_0038 ) |
|---|
| 58 | { |
|---|
| 59 | setNumInstances(in->readInt()); |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | setMode(in->readInt()); |
|---|
| 64 | } |
|---|
| 65 | else{ |
|---|
| 66 | in_THROW_EXCEPTION("PrimitiveSet::read(): Expected PrimitiveSet identification."); |
|---|
| 67 | } |
|---|
| 68 | } |
|---|