add parameter to XXXTranformHW to customize reserved texture attribs and vertex attribs

This commit is contained in:
Julien Valentin
2017-08-30 17:07:11 +02:00
parent 705695b41d
commit 86ad54f671
4 changed files with 26 additions and 19 deletions

View File

@@ -38,7 +38,13 @@ namespace osgAnimation
META_Object(osgAnimation,MorphTransformHardware);
virtual void operator()(MorphGeometry&);
void setShader(osg::Shader*);
inline void setShader(osg::Shader*s){_shader=s;}
inline osg::Shader * getShader()const{return _shader;}
///texture unit reserved for morphtarget TBO default is 7
void setReservedTextureUnit(unsigned int t){_reservedTextureUnit=t;}
unsigned int getReservedTextureUnit() const {return _reservedTextureUnit;}
protected:
@@ -49,6 +55,7 @@ namespace osgAnimation
osg::ref_ptr<osg::Shader> _shader;
bool _needInit;
unsigned int _reservedTextureUnit;
};
}

View File

@@ -43,12 +43,16 @@ namespace osgAnimation
typedef std::map<std::string, unsigned int> BoneNamePaletteIndex;
typedef std::vector<osg::Matrix> MatrixPalette;
osg::Vec4Array* getVertexAttrib(unsigned int index);
unsigned int getNumVertexAttrib() const {return _boneWeightAttribArrays.size();}
///set the first Vertex Attribute Array index of the rig generated by this technic (default:11)
void setFirstVertexAttributeTarget(unsigned int i){ _minAttribIndex=i;}
unsigned int getFirstVertexAttributeTarget()const { return _minAttribIndex;}
void setShader(osg::Shader* shader) { _shader = shader; }
osg::Shader* getShader() const { return _shader; }
osg::Vec4Array* getVertexAttrib(unsigned int index);
unsigned int getNumVertexAttrib() const {return _boneWeightAttribArrays.size();}
const unsigned int &getNumBonesPerVertex() const{ return _bonesPerVertex; }
const unsigned int &getNumVertexes() const { return _nbVertexes; }
@@ -74,7 +78,7 @@ namespace osgAnimation
osg::ref_ptr<osg::Shader> _shader;
bool _needInit;
unsigned int _minAttribIndex;
bool buildPalette(const BoneMap& boneMap ,const RigGeometry& rig);
};