#include #include #include #include #include #include using namespace osg; using namespace osgDB; // forward declare functions to use later. bool ShapeDrawable_readLocalData(Object& obj, Input& fr); bool ShapeDrawable_writeLocalData(const Object& obj, Output& fw); RegisterDotOsgWrapperProxy g_ShapeDrawableFuncProxy ( new osg::ShapeDrawable, "ShapeDrawable", "Object Drawable ShapeDrawable", &ShapeDrawable_readLocalData, &ShapeDrawable_writeLocalData, DotOsgWrapper::READ_AND_WRITE ); bool ShapeDrawable_readLocalData(Object& obj, Input& fr) { bool iteratorAdvanced = false; ShapeDrawable& geom = static_cast(obj); if (fr.matchSequence("color %f %f %f %f")) { osg::Vec4 color; fr[1].getFloat(color[0]); fr[2].getFloat(color[1]); fr[3].getFloat(color[2]); fr[4].getFloat(color[3]); geom.setColor(color); fr+=5; iteratorAdvanced = true; } ref_ptr readObject = fr.readObjectOfType(type_wrapper()); if (readObject.valid()) { TessellationHints* hints = static_cast(readObject.get()); geom.setTessellationHints(hints); iteratorAdvanced = true; } return iteratorAdvanced; } bool ShapeDrawable_writeLocalData(const Object& obj, Output& fw) { const ShapeDrawable& geom = static_cast(obj); fw.indent() << "color " << geom.getColor() << std::endl; const TessellationHints* hints = geom.getTessellationHints(); if (hints) fw.writeObject(*hints); return true; }