From b26fa74e7e698438d2b63dc6da8af267985c7fa2 Mon Sep 17 00:00:00 2001 From: mp3butcher Date: Wed, 26 Jul 2017 23:38:20 +0200 Subject: [PATCH] add untested serializers for PrimitiveSetIndirect --- .../serializers/osg/PrimitiveSetIndirect.cpp | 188 ++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 src/osgWrappers/serializers/osg/PrimitiveSetIndirect.cpp 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