diff --git a/src/osgWrappers/serializers/osg/PrimitiveSetIndirect.cpp b/src/osgWrappers/serializers/osg/PrimitiveSetIndirect.cpp new file mode 100644 index 000000000..1d732cdb8 --- /dev/null +++ b/src/osgWrappers/serializers/osg/PrimitiveSetIndirect.cpp @@ -0,0 +1,188 @@ +#include +#include +#include +#include +#include + +namespace DACommandsArrays { +REGISTER_OBJECT_WRAPPER( IndirectCommandDrawArrays, + 0, + osg::IndirectCommandDrawArrays, + "osg::Object osg::BufferData osg::IndirectCommandDrawArrays" ) +{ + { + UPDATE_TO_VERSION_SCOPED( 147 ) + ADDED_ASSOCIATE("osg::BufferData") + } +} +} +namespace DECommandsArrays { +REGISTER_OBJECT_WRAPPER( IndirectCommandDrawElements, + 0, + osg::IndirectCommandDrawElements, + "osg::Object osg::BufferData osg::IndirectCommandDrawElements" ) +{ + { + UPDATE_TO_VERSION_SCOPED( 147 ) + ADDED_ASSOCIATE("osg::BufferData") + } +} +} +namespace DefaultDACommandsArrays { + + +static bool checkDACommands( const osg::DefaultIndirectCommandDrawArrays& node ) +{ + return node.size()>0; +} + +static bool readDACommands( osgDB::InputStream& is, osg::DefaultIndirectCommandDrawArrays& node ) +{ + unsigned int elmt, size = 0; is >> size >> is.BEGIN_BRACKET; + node.resize(size); + for ( unsigned int i=0; i>elmt; node.count(i) = elmt; + is >>elmt; node.instanceCount(i) = elmt; + is >>elmt; node.first(i) = elmt; + is >>elmt; node.baseInstance(i) = elmt; + } + is >> is.END_BRACKET; + return true; +} + +static bool writeDACommands( osgDB::OutputStream& os, const osg::DefaultIndirectCommandDrawArrays& node ) +{ + unsigned int size = node.getNumElements(); + osg::DefaultIndirectCommandDrawArrays& nonconstnode =const_cast(node); + os << size << os.BEGIN_BRACKET << std::endl; + for ( unsigned int i=0; i0; +} + +static bool readDECommands( osgDB::InputStream& is, osg::DefaultIndirectCommandDrawElements& node ) +{ + unsigned int elmt, size = 0; is >> size >> is.BEGIN_BRACKET; + node.resize(size); + for ( unsigned int i=0; i>elmt; node.count(i) = elmt; + is >>elmt; node.instanceCount(i) = elmt; + is >>elmt; node.firstIndex(i) = elmt; + is >>elmt; node.baseVertex(i) = elmt; + is >>elmt; node.baseInstance(i) = elmt; + } + is >> is.END_BRACKET; + return true; +} + +static bool writeDECommands( osgDB::OutputStream& os, const osg::DefaultIndirectCommandDrawElements& node ) +{ + unsigned int size = node.getNumElements(); + osg::DefaultIndirectCommandDrawElements& nonconstnode =const_cast(node); + os << size << os.BEGIN_BRACKET << std::endl; + for ( unsigned int i=0; i