|
Revision 7648, 2.1 kB
(checked in by robert, 5 years ago)
|
|
From Roland Smeenk, "Attached you will find a large set of small typo fixes (mainly in the comments)."
|
-
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 "DrawElementsUByte.h" |
|---|
| 17 | #include "PrimitiveSet.h" |
|---|
| 18 | |
|---|
| 19 | using namespace ive; |
|---|
| 20 | |
|---|
| 21 | void DrawElementsUByte::write(DataOutputStream* out){ |
|---|
| 22 | |
|---|
| 23 | out->writeInt(IVEDRAWELEMENTSUBYTE); |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this); |
|---|
| 27 | if(prim){ |
|---|
| 28 | ((ive::PrimitiveSet*)(prim))->write(out); |
|---|
| 29 | } |
|---|
| 30 | else |
|---|
| 31 | throw Exception("DrawElementsUByte::write(): Could not cast this osg::DrawElementsUByte to an osg::PrimitiveSet."); |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | out->writeInt(size()); |
|---|
| 36 | out->writeCharArray((const char*)&front(), size() * CHARSIZE); |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | void DrawElementsUByte::read(DataInputStream* in){ |
|---|
| 40 | |
|---|
| 41 | int id = in->peekInt(); |
|---|
| 42 | if(id == IVEDRAWELEMENTSUBYTE){ |
|---|
| 43 | |
|---|
| 44 | id = in->readInt(); |
|---|
| 45 | |
|---|
| 46 | osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this); |
|---|
| 47 | if(prim){ |
|---|
| 48 | ((ive::PrimitiveSet*)(prim))->read(in); |
|---|
| 49 | } |
|---|
| 50 | else |
|---|
| 51 | throw Exception("DrawElementsUByte::read(): Could not cast this osg::DrawElementsUByte to an osg::PrimitiveSet."); |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | int size = in->readInt(); |
|---|
| 55 | resize(size); |
|---|
| 56 | in->readCharArray((char*)&front(), size * CHARSIZE); |
|---|
| 57 | |
|---|
| 58 | } |
|---|
| 59 | else{ |
|---|
| 60 | throw Exception("DrawElementsUByte::read(): Expected DrawElementsUByte identification."); |
|---|
| 61 | } |
|---|
| 62 | } |
|---|