#include #include #include #include #include #include using namespace osg; using namespace osgDB; ////////////////////////////////////////////////////////////////////////////// // forward declare functions to use later. bool CompositeShape_readLocalData(Object& obj, Input& fr); bool CompositeShape_writeLocalData(const Object& obj, Output& fw); //register the read and write functions with the osgDB::Registry. REGISTER_DOTOSGWRAPPER(CompositeShape) ( new osg::CompositeShape, "CompositeShape", "Object CompositeShape", &CompositeShape_readLocalData, &CompositeShape_writeLocalData, DotOsgWrapper::READ_AND_WRITE ); bool CompositeShape_readLocalData(Object& obj, Input& fr) { bool iteratorAdvanced = false; CompositeShape& composite = static_cast(obj); ref_ptr readObject; if (fr[0].matchWord("Shape")) { readObject = fr.readObject(); if (readObject.valid()) { osg::Shape* shape = dynamic_cast(readObject.get()); if (shape) composite.setShape(shape); else notify(WARN)<<"Warning:: "<className()<<" loaded but cannot not be attached to Drawable."<())).valid()) { osg::Shape* shape = static_cast(readObject.get()); composite.addChild(shape); iteratorAdvanced = true; } return iteratorAdvanced; } bool CompositeShape_writeLocalData(const Object& obj, Output& fw) { const CompositeShape& composite = static_cast(obj); if (composite.getShape()) { fw.indent() << "Shape "; fw.writeObject(*composite.getShape()); } for(unsigned int i=0;i