|
Revision 13041, 2.3 kB
(checked in by robert, 15 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 "DrawArrayLengths.h" |
|---|
| 17 | #include "PrimitiveSet.h" |
|---|
| 18 | |
|---|
| 19 | using namespace ive; |
|---|
| 20 | |
|---|
| 21 | void DrawArrayLengths::write(DataOutputStream* out){ |
|---|
| 22 | |
|---|
| 23 | out->writeInt(IVEDRAWARRAYLENGTHS); |
|---|
| 24 | |
|---|
| 25 | osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this); |
|---|
| 26 | if(prim){ |
|---|
| 27 | ((ive::PrimitiveSet*)(prim))->write(out); |
|---|
| 28 | } |
|---|
| 29 | else |
|---|
| 30 | out_THROW_EXCEPTION("DrawArrayLengths::write(): Could not cast this osg::DrawArrayLengths to an osg::PrimitiveSet."); |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | out->writeInt(getFirst()); |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | out->writeInt(size()); |
|---|
| 37 | for(unsigned int i=0; i<size(); i++){ |
|---|
| 38 | out->writeInt(((*this))[i]); |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | void DrawArrayLengths::read(DataInputStream* in){ |
|---|
| 44 | |
|---|
| 45 | int id = in->peekInt(); |
|---|
| 46 | if(id == IVEDRAWARRAYLENGTHS){ |
|---|
| 47 | |
|---|
| 48 | id = in->readInt(); |
|---|
| 49 | |
|---|
| 50 | osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this); |
|---|
| 51 | if(prim){ |
|---|
| 52 | ((ive::PrimitiveSet*)(prim))->read(in); |
|---|
| 53 | } |
|---|
| 54 | else |
|---|
| 55 | in_THROW_EXCEPTION("DrawArrayLengths::read(): Could not cast this osg::DrawArrayLengths to an osg::PrimitiveSet."); |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | setFirst(in->readInt()); |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | int size = in->readInt(); |
|---|
| 62 | for(int i=0; i<size; i++){ |
|---|
| 63 | push_back(in->readInt()); |
|---|
| 64 | } |
|---|
| 65 | |
|---|
| 66 | } |
|---|
| 67 | else{ |
|---|
| 68 | in_THROW_EXCEPTION("DrawArrayLengths::read(): Expected DrawArrayLengths identification."); |
|---|
| 69 | } |
|---|
| 70 | } |
|---|