|
Revision 13041, 2.2 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 "Node.h" |
|---|
| 17 | #include "Group.h" |
|---|
| 18 | #include "MatrixTransform.h" |
|---|
| 19 | #include "Geode.h" |
|---|
| 20 | #include "LightSource.h" |
|---|
| 21 | #include "Billboard.h" |
|---|
| 22 | #include "Sequence.h" |
|---|
| 23 | #include "LOD.h" |
|---|
| 24 | #include "PositionAttitudeTransform.h" |
|---|
| 25 | #include "Transform.h" |
|---|
| 26 | |
|---|
| 27 | using namespace ive; |
|---|
| 28 | |
|---|
| 29 | void Group::write(DataOutputStream* out){ |
|---|
| 30 | |
|---|
| 31 | out->writeInt(IVEGROUP); |
|---|
| 32 | |
|---|
| 33 | osg::Node* node = dynamic_cast<osg::Node*>(this); |
|---|
| 34 | if(node){ |
|---|
| 35 | static_cast<ive::Node*>(node)->write(out); |
|---|
| 36 | } |
|---|
| 37 | else |
|---|
| 38 | out_THROW_EXCEPTION("Group::write(): Could not cast this osg::Group to an osg::Node."); |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | out->writeInt(getNumChildren()); |
|---|
| 44 | |
|---|
| 45 | for(unsigned int i=0; i<getNumChildren(); i++){ |
|---|
| 46 | osg::Node* child = getChild(i); |
|---|
| 47 | out->writeNode(child); |
|---|
| 48 | } |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | void Group::read(DataInputStream* in){ |
|---|
| 52 | |
|---|
| 53 | int id = in->peekInt(); |
|---|
| 54 | if(id == IVEGROUP){ |
|---|
| 55 | |
|---|
| 56 | id = in->readInt(); |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | osg::Node* node = dynamic_cast<osg::Node*>(this); |
|---|
| 60 | if(node){ |
|---|
| 61 | ((ive::Node*)(node))->read(in); |
|---|
| 62 | } |
|---|
| 63 | else |
|---|
| 64 | in_THROW_EXCEPTION("Group::read(): Could not cast this osg::Group to an osg::Node."); |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | int size = in->readInt(); |
|---|
| 71 | |
|---|
| 72 | for(int i=0; i<size; i++) |
|---|
| 73 | { |
|---|
| 74 | addChild(in->readNode()); |
|---|
| 75 | } |
|---|
| 76 | } |
|---|
| 77 | else{ |
|---|
| 78 | in_THROW_EXCEPTION("Group::read(): Expected Group identification"); |
|---|
| 79 | } |
|---|
| 80 | } |
|---|