update serializer with new properties

This commit is contained in:
Julien Valentin 2017-09-01 19:13:01 +02:00
parent 9560548722
commit a73c20d7f5
5 changed files with 24 additions and 16 deletions

View File

@ -22,6 +22,9 @@
#include <osg/Matrix> #include <osg/Matrix>
#include <osg/Array> #include <osg/Array>
///texture unit reserved for morphtarget TBO
#define MORPHTRANSHW_DEFAULTMORPHTEXTUREUNIT 7
namespace osgAnimation namespace osgAnimation
{ {
class MorphGeometry; class MorphGeometry;
@ -39,12 +42,13 @@ namespace osgAnimation
virtual void operator()(MorphGeometry&); virtual void operator()(MorphGeometry&);
inline void setShader(osg::Shader*s){_shader=s;} inline void setShader( osg::Shader*s ) { _shader=s; }
inline osg::Shader * getShader()const{return _shader;} inline const osg::Shader * getShader() const{ return _shader; }
inline osg::Shader * getShader() { return _shader; }
///texture unit reserved for morphtarget TBO default is 7 ///texture unit reserved for morphtarget TBO default is 7
void setReservedTextureUnit(unsigned int t){_reservedTextureUnit=t;} void setReservedTextureUnit(unsigned int t) { _reservedTextureUnit=t; }
unsigned int getReservedTextureUnit() const {return _reservedTextureUnit;} unsigned int getReservedTextureUnit() const { return _reservedTextureUnit;}
protected: protected:

View File

@ -23,6 +23,8 @@
#include <osg/Matrix> #include <osg/Matrix>
#include <osg/Array> #include <osg/Array>
#define RIGTRANSHW_DEFAULT_FIRST_VERTATTRIB_TARGETTED 11
namespace osgAnimation namespace osgAnimation
{ {
class RigGeometry; class RigGeometry;
@ -48,7 +50,8 @@ namespace osgAnimation
unsigned int getFirstVertexAttributeTarget()const { return _minAttribIndex;} unsigned int getFirstVertexAttributeTarget()const { return _minAttribIndex;}
void setShader(osg::Shader* shader) { _shader = shader; } 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); osg::Vec4Array* getVertexAttrib(unsigned int index);
unsigned int getNumVertexAttrib() const {return _boneWeightAttribArrays.size();} unsigned int getNumVertexAttrib() const {return _boneWeightAttribArrays.size();}

View File

@ -18,14 +18,11 @@
#include <osg/TextureBuffer> #include <osg/TextureBuffer>
#include <sstream> #include <sstream>
///texture unit reserved for morphtarget TBO
#define DEFAULTMORPHTEXTUREUNIT 7
using namespace osgAnimation; using namespace osgAnimation;
MorphTransformHardware::MorphTransformHardware(): MorphTransformHardware::MorphTransformHardware():
_needInit(true), _needInit(true),
_reservedTextureUnit(DEFAULTMORPHTEXTUREUNIT) _reservedTextureUnit(MORPHTRANSHW_DEFAULTMORPHTEXTUREUNIT)
{ {
} }

View File

@ -20,13 +20,11 @@
using namespace osgAnimation; using namespace osgAnimation;
#define DEFAULT_FIRST_VERTATTRIB_TARGETTED 11
RigTransformHardware::RigTransformHardware(): RigTransformHardware::RigTransformHardware():
_bonesPerVertex (0), _bonesPerVertex (0),
_nbVertices (0), _nbVertices (0),
_needInit (true), _needInit (true),
_minAttribIndex(DEFAULT_FIRST_VERTATTRIB_TARGETTED) _minAttribIndex(RIGTRANSHW_DEFAULT_FIRST_VERTATTRIB_TARGETTED)
{} {}
RigTransformHardware::RigTransformHardware(const RigTransformHardware& rth, const osg::CopyOp& copyop): RigTransformHardware::RigTransformHardware(const RigTransformHardware& rth, const osg::CopyOp& copyop):

View File

@ -2,8 +2,8 @@
#include <osgAnimation/RigTransformHardware> #include <osgAnimation/RigTransformHardware>
#include <osgAnimation/RigTransformSoftware> #include <osgAnimation/RigTransformSoftware>
#include <osgAnimation/MorphTransformSoftware> #include <osgAnimation/MorphTransformSoftware>
#include <osgAnimation/MorphTransformHardware> #include <osgAnimation/MorphTransformHardware>
#include <osgDB/ObjectWrapper> #include <osgDB/ObjectWrapper>
#include <osgDB/InputStream> #include <osgDB/InputStream>
#include <osgDB/OutputStream> #include <osgDB/OutputStream>
@ -23,7 +23,10 @@ namespace wrap_osgAnimationRigTransformHardWare{
REGISTER_OBJECT_WRAPPER( osgAnimation_RigTransformHardware, REGISTER_OBJECT_WRAPPER( osgAnimation_RigTransformHardware,
new osgAnimation::RigTransformHardware, new osgAnimation::RigTransformHardware,
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{ namespace wrap_osgAnimationMorphTransform{
@ -42,5 +45,8 @@ namespace wrap_osgAnimationMorphTransformHardware{
REGISTER_OBJECT_WRAPPER( osgAnimation_MorphTransformHardware, REGISTER_OBJECT_WRAPPER( osgAnimation_MorphTransformHardware,
new osgAnimation::MorphTransformHardware, new osgAnimation::MorphTransformHardware,
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);
}
} }