refactoring and fixes
only change in design: decouplage between MorphGeometry and MorphTransform technique no real change in behavior (i hope)
This commit is contained in:
@@ -38,37 +38,36 @@ namespace osgAnimation
|
||||
META_Object(osgAnimation,RigTransformHardware);
|
||||
|
||||
typedef osg::Matrix MatrixType;
|
||||
typedef osgAnimation::Bone BoneType;
|
||||
typedef std::vector<osg::ref_ptr<osg::Vec4Array> > BoneWeightAttribList;
|
||||
typedef std::vector<osg::ref_ptr<BoneType> > BonePalette;
|
||||
typedef std::map<std::string, int> BoneNamePaletteIndex;
|
||||
typedef std::vector<osg::ref_ptr<Bone> > BonePalette;
|
||||
typedef std::map<std::string, unsigned int> BoneNamePaletteIndex;
|
||||
|
||||
typedef std::vector<osg::Matrix> MatrixPalette;
|
||||
struct IndexWeightEntry
|
||||
{
|
||||
int _boneIndex;
|
||||
IndexWeightEntry(unsigned int index=0, float weight=0.0f): _boneIndex(index), _boneWeight(weight){}
|
||||
IndexWeightEntry(const IndexWeightEntry&o): _boneIndex(o._boneIndex), _boneWeight(o._boneWeight){}
|
||||
bool operator <(const IndexWeightEntry &o)const{return (_boneIndex<o._boneIndex);}
|
||||
const unsigned int &getBoneIndex() const { return _boneIndex; }
|
||||
const float &getWeight() const { return _boneWeight; }
|
||||
unsigned int _boneIndex;
|
||||
float _boneWeight;
|
||||
IndexWeightEntry() { _boneIndex = 0; _boneWeight = 0;}
|
||||
IndexWeightEntry(int index, float weight) { _boneIndex = index; _boneWeight = weight;}
|
||||
int getIndex() const { return _boneIndex; }
|
||||
float getWeight() const { return _boneWeight; }
|
||||
};
|
||||
typedef std::vector<std::vector<IndexWeightEntry> > VertexIndexWeightList;
|
||||
|
||||
|
||||
|
||||
osg::Vec4Array* getVertexAttrib(int index);
|
||||
int getNumVertexAttrib();
|
||||
osg::Vec4Array* getVertexAttrib(unsigned int index);
|
||||
unsigned int getNumVertexAttrib();
|
||||
|
||||
osg::Uniform* getMatrixPaletteUniform();
|
||||
void computeMatrixPaletteUniform(const osg::Matrix& transformFromSkeletonToGeometry, const osg::Matrix& invTransformFromSkeletonToGeometry);
|
||||
|
||||
int getNumBonesPerVertex() const;
|
||||
int getNumVertexes() const;
|
||||
unsigned int getNumBonesPerVertex() const;
|
||||
unsigned int getNumVertexes() const;
|
||||
|
||||
bool createPalette(int nbVertexes, BoneMap boneMap, const VertexInfluenceSet::VertexIndexToBoneWeightMap& vertexIndexToBoneWeightMap);
|
||||
bool createPalette(unsigned int nbVertexes,const BoneMap& boneMap, const VertexInfluenceSet::VertIDToBoneWeightList& vertexIndexToBoneWeightMap);
|
||||
|
||||
virtual void operator()(RigGeometry&);
|
||||
|
||||
void setShader(osg::Shader*);
|
||||
|
||||
const BoneNamePaletteIndex& getBoneNameToPalette() {
|
||||
@@ -78,13 +77,11 @@ namespace osgAnimation
|
||||
protected:
|
||||
|
||||
bool init(RigGeometry&);
|
||||
osg::Uniform* createVertexUniform();
|
||||
|
||||
BoneWeightAttribList createVertexAttribList();
|
||||
osg::Uniform* createVertexUniform();
|
||||
unsigned int _bonesPerVertex;
|
||||
unsigned int _nbVertexes;
|
||||
|
||||
int _bonesPerVertex;
|
||||
int _nbVertexes;
|
||||
VertexIndexWeightList _vertexIndexMatrixWeightList;
|
||||
BonePalette _bonePalette;
|
||||
BoneNamePaletteIndex _boneNameToPalette;
|
||||
BoneWeightAttribList _boneWeightAttribArrays;
|
||||
|
||||
Reference in New Issue
Block a user