|
Revision 3525, 1.9 kB
(checked in by robert, 9 years ago)
|
|
fixes to 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 "DrawArrays.h" |
|---|
| 17 | #include "PrimitiveSet.h" |
|---|
| 18 | |
|---|
| 19 | using namespace ive; |
|---|
| 20 | |
|---|
| 21 | void DrawArrays::write(DataOutputStream* out){ |
|---|
| 22 | |
|---|
| 23 | out->writeInt(IVEDRAWARRAYS); |
|---|
| 24 | |
|---|
| 25 | osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this); |
|---|
| 26 | if(prim){ |
|---|
| 27 | ((ive::PrimitiveSet*)(prim))->write(out); |
|---|
| 28 | } |
|---|
| 29 | else |
|---|
| 30 | throw Exception("DrawArrays::write(): Could not cast this osg::DrawArrays to an osg::PrimitiveSet."); |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | out->writeInt(getFirst()); |
|---|
| 35 | out->writeInt(getCount()); |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | void DrawArrays::read(DataInputStream* in){ |
|---|
| 39 | |
|---|
| 40 | int id = in->peekInt(); |
|---|
| 41 | if(id == IVEDRAWARRAYS){ |
|---|
| 42 | |
|---|
| 43 | id = in->readInt(); |
|---|
| 44 | |
|---|
| 45 | osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this); |
|---|
| 46 | if(prim){ |
|---|
| 47 | ((ive::PrimitiveSet*)(prim))->read(in); |
|---|
| 48 | } |
|---|
| 49 | else |
|---|
| 50 | throw Exception("DrawArrays::read(): Could not cast this osg::DrawArrays to an osg::PrimitiveSet."); |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | setFirst(in->readInt()); |
|---|
| 55 | setCount(in->readInt()); |
|---|
| 56 | } |
|---|
| 57 | else{ |
|---|
| 58 | throw Exception("DrawArrays::read(): Expected DrawArrays identification."); |
|---|
| 59 | } |
|---|
| 60 | } |
|---|