From a73c20d7f5abe0cbc3b3daa9b6779c40ca16f67b Mon Sep 17 00:00:00 2001 From: Julien Valentin Date: Fri, 1 Sep 2017 19:13:01 +0200 Subject: [PATCH] update serializer with new properties --- include/osgAnimation/MorphTransformHardware | 12 ++++++++---- include/osgAnimation/RigTransformHardware | 5 ++++- src/osgAnimation/MorphTransformHardware.cpp | 5 +---- src/osgAnimation/RigTransformHardware.cpp | 4 +--- .../serializers/osgAnimation/RigTransform.cpp | 14 ++++++++++---- 5 files changed, 24 insertions(+), 16 deletions(-) diff --git a/include/osgAnimation/MorphTransformHardware b/include/osgAnimation/MorphTransformHardware index b061cccae..650f62efd 100644 --- a/include/osgAnimation/MorphTransformHardware +++ b/include/osgAnimation/MorphTransformHardware @@ -22,6 +22,9 @@ #include #include +///texture unit reserved for morphtarget TBO +#define MORPHTRANSHW_DEFAULTMORPHTEXTUREUNIT 7 + namespace osgAnimation { class MorphGeometry; @@ -39,12 +42,13 @@ namespace osgAnimation virtual void operator()(MorphGeometry&); - inline void setShader(osg::Shader*s){_shader=s;} - inline osg::Shader * getShader()const{return _shader;} + inline void setShader( osg::Shader*s ) { _shader=s; } + inline const osg::Shader * getShader() const{ return _shader; } + inline osg::Shader * getShader() { return _shader; } ///texture unit reserved for morphtarget TBO default is 7 - void setReservedTextureUnit(unsigned int t){_reservedTextureUnit=t;} - unsigned int getReservedTextureUnit() const {return _reservedTextureUnit;} + void setReservedTextureUnit(unsigned int t) { _reservedTextureUnit=t; } + unsigned int getReservedTextureUnit() const { return _reservedTextureUnit;} protected: diff --git a/include/osgAnimation/RigTransformHardware b/include/osgAnimation/RigTransformHardware index 2f7ea868b..f27aa0506 100644 --- a/include/osgAnimation/RigTransformHardware +++ b/include/osgAnimation/RigTransformHardware @@ -23,6 +23,8 @@ #include #include +#define RIGTRANSHW_DEFAULT_FIRST_VERTATTRIB_TARGETTED 11 + namespace osgAnimation { class RigGeometry; @@ -48,7 +50,8 @@ namespace osgAnimation unsigned int getFirstVertexAttributeTarget()const { return _minAttribIndex;} void setShader(osg::Shader* shader) { _shader = shader; } - osg::Shader* getShader() const { return _shader; } + const osg::Shader* getShader() const { return _shader; } + osg::Shader* getShader() { return _shader; } osg::Vec4Array* getVertexAttrib(unsigned int index); unsigned int getNumVertexAttrib() const {return _boneWeightAttribArrays.size();} diff --git a/src/osgAnimation/MorphTransformHardware.cpp b/src/osgAnimation/MorphTransformHardware.cpp index 48119c813..a275d5680 100644 --- a/src/osgAnimation/MorphTransformHardware.cpp +++ b/src/osgAnimation/MorphTransformHardware.cpp @@ -18,14 +18,11 @@ #include #include -///texture unit reserved for morphtarget TBO -#define DEFAULTMORPHTEXTUREUNIT 7 - using namespace osgAnimation; MorphTransformHardware::MorphTransformHardware(): _needInit(true), - _reservedTextureUnit(DEFAULTMORPHTEXTUREUNIT) + _reservedTextureUnit(MORPHTRANSHW_DEFAULTMORPHTEXTUREUNIT) { } diff --git a/src/osgAnimation/RigTransformHardware.cpp b/src/osgAnimation/RigTransformHardware.cpp index c34ec2831..31a0d7631 100644 --- a/src/osgAnimation/RigTransformHardware.cpp +++ b/src/osgAnimation/RigTransformHardware.cpp @@ -20,13 +20,11 @@ using namespace osgAnimation; -#define DEFAULT_FIRST_VERTATTRIB_TARGETTED 11 - RigTransformHardware::RigTransformHardware(): _bonesPerVertex (0), _nbVertices (0), _needInit (true), - _minAttribIndex(DEFAULT_FIRST_VERTATTRIB_TARGETTED) + _minAttribIndex(RIGTRANSHW_DEFAULT_FIRST_VERTATTRIB_TARGETTED) {} RigTransformHardware::RigTransformHardware(const RigTransformHardware& rth, const osg::CopyOp& copyop): diff --git a/src/osgWrappers/serializers/osgAnimation/RigTransform.cpp b/src/osgWrappers/serializers/osgAnimation/RigTransform.cpp index c3e40ca30..f89bd0d6a 100644 --- a/src/osgWrappers/serializers/osgAnimation/RigTransform.cpp +++ b/src/osgWrappers/serializers/osgAnimation/RigTransform.cpp @@ -2,8 +2,8 @@ #include #include #include -#include -#include + #include + #include #include #include @@ -23,7 +23,10 @@ namespace wrap_osgAnimationRigTransformHardWare{ REGISTER_OBJECT_WRAPPER( osgAnimation_RigTransformHardware, new osgAnimation::RigTransformHardware, osgAnimation::RigTransformHardware, - "osg::Object osgAnimation::RigTransform osgAnimation::RigTransformHardware" ){} + "osg::Object osgAnimation::RigTransform osgAnimation::RigTransformHardware" ){ + ADD_OBJECT_SERIALIZER(Shader,osg::Shader,NULL); + ADD_UINT_SERIALIZER(FirstVertexAttributeTarget,RIGTRANSHW_DEFAULT_FIRST_VERTATTRIB_TARGETTED); + } } namespace wrap_osgAnimationMorphTransform{ @@ -42,5 +45,8 @@ namespace wrap_osgAnimationMorphTransformHardware{ REGISTER_OBJECT_WRAPPER( osgAnimation_MorphTransformHardware, new osgAnimation::MorphTransformHardware, osgAnimation::MorphTransformHardware, - "osg::Object osgAnimation::MorphTransform osgAnimation::MorphTransformHardware" ){} + "osg::Object osgAnimation::MorphTransform osgAnimation::MorphTransformHardware" ){ + ADD_OBJECT_SERIALIZER(Shader,osg::Shader,NULL); + ADD_UINT_SERIALIZER(ReservedTextureUnit,MORPHTRANSHW_DEFAULTMORPHTEXTUREUNIT); + } }