|
Revision 13041, 1.4 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 | #include "osg/Geode" |
|---|
| 2 | |
|---|
| 3 | #include "osgDB/Registry" |
|---|
| 4 | #include "osgDB/Input" |
|---|
| 5 | #include "osgDB/Output" |
|---|
| 6 | |
|---|
| 7 | using namespace osg; |
|---|
| 8 | using namespace osgDB; |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | bool Geode_readLocalData(Object& obj, Input& fr); |
|---|
| 12 | bool Geode_writeLocalData(const Object& obj, Output& fw); |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | REGISTER_DOTOSGWRAPPER(Geode) |
|---|
| 16 | ( |
|---|
| 17 | new osg::Geode, |
|---|
| 18 | "Geode", |
|---|
| 19 | "Object Node Geode", |
|---|
| 20 | &Geode_readLocalData, |
|---|
| 21 | &Geode_writeLocalData |
|---|
| 22 | ); |
|---|
| 23 | |
|---|
| 24 | bool Geode_readLocalData(Object& obj, Input& fr) |
|---|
| 25 | { |
|---|
| 26 | bool iteratorAdvanced = false; |
|---|
| 27 | |
|---|
| 28 | Geode& geode = static_cast<Geode&>(obj); |
|---|
| 29 | |
|---|
| 30 | int num_drawables; |
|---|
| 31 | if ((fr[0].matchWord("num_drawables") || fr[0].matchWord("num_geosets")) && |
|---|
| 32 | fr[1].getInt(num_drawables)) |
|---|
| 33 | { |
|---|
| 34 | |
|---|
| 35 | fr+=2; |
|---|
| 36 | iteratorAdvanced = true; |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | Drawable* drawable = NULL; |
|---|
| 40 | while((drawable=fr.readDrawable())!=NULL) |
|---|
| 41 | { |
|---|
| 42 | geode.addDrawable(drawable); |
|---|
| 43 | iteratorAdvanced = true; |
|---|
| 44 | } |
|---|
| 45 | |
|---|
| 46 | return iteratorAdvanced; |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | bool Geode_writeLocalData(const osg::Object& obj, Output& fw) |
|---|
| 51 | { |
|---|
| 52 | const Geode& geode = static_cast<const Geode&>(obj); |
|---|
| 53 | |
|---|
| 54 | fw.indent() << "num_drawables " << geode.getNumDrawables() << std::endl; |
|---|
| 55 | |
|---|
| 56 | for(unsigned int i=0;i<geode.getNumDrawables();++i) |
|---|
| 57 | { |
|---|
| 58 | fw.writeObject(*geode.getDrawable(i)); |
|---|
| 59 | } |
|---|
| 60 | |
|---|
| 61 | return true; |
|---|
| 62 | } |
|---|