few refactoring and fixes
This commit is contained in:
@@ -53,7 +53,6 @@ namespace osgAnimation
|
||||
osg::observer_ptr< Bone > _boneptr;
|
||||
};
|
||||
typedef std::vector<BonePtrWeight> BonePtrWeightList;
|
||||
typedef std::vector<unsigned int> IndexList;
|
||||
|
||||
/// map a set of boneinfluence to a list of vertex indices sharing this set
|
||||
class VertexGroup
|
||||
@@ -61,7 +60,7 @@ namespace osgAnimation
|
||||
public:
|
||||
inline BonePtrWeightList& getBoneWeights() { return _boneweights; }
|
||||
|
||||
inline IndexList& getVertexes() { return _vertexes; }
|
||||
inline IndexList& getVertices() { return _vertexes; }
|
||||
|
||||
inline void resetMatrix()
|
||||
{
|
||||
@@ -122,9 +121,8 @@ namespace osgAnimation
|
||||
osg::Matrix _result;
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <class V> void compute(const osg::Matrix& transform, const osg::Matrix& invTransform, const V* src, V* dst)
|
||||
template <class V>
|
||||
inline void compute(const osg::Matrix& transform, const osg::Matrix& invTransform, const V* src, V* dst)
|
||||
{
|
||||
// the result of matrix mult should be cached to be used for vertexes transform and normal transform and maybe other computation
|
||||
for(VertexGroupList::iterator itvg=_uniqInfluenceSet2VertIDList.begin(); itvg!=_uniqInfluenceSet2VertIDList.end(); ++itvg)
|
||||
@@ -133,7 +131,7 @@ namespace osgAnimation
|
||||
uniq.computeMatrixForVertexSet();
|
||||
osg::Matrix matrix = transform * uniq.getMatrix() * invTransform;
|
||||
|
||||
const IndexList& vertexes = uniq.getVertexes();
|
||||
const IndexList& vertexes = uniq.getVertices();
|
||||
for(IndexList::const_iterator vertIDit=vertexes.begin(); vertIDit!=vertexes.end(); ++vertIDit)
|
||||
{
|
||||
dst[*vertIDit] = src[*vertIDit] * matrix;
|
||||
@@ -143,7 +141,8 @@ namespace osgAnimation
|
||||
}
|
||||
|
||||
|
||||
template <class V> void computeNormal(const osg::Matrix& transform, const osg::Matrix& invTransform, const V* src, V* dst)
|
||||
template <class V>
|
||||
inline void computeNormal(const osg::Matrix& transform, const osg::Matrix& invTransform, const V* src, V* dst)
|
||||
{
|
||||
for(VertexGroupList::iterator itvg=_uniqInfluenceSet2VertIDList.begin(); itvg!=_uniqInfluenceSet2VertIDList.end(); ++itvg)
|
||||
{
|
||||
@@ -151,7 +150,7 @@ namespace osgAnimation
|
||||
uniq.computeMatrixForVertexSet();
|
||||
osg::Matrix matrix = transform * uniq.getMatrix() * invTransform;
|
||||
|
||||
const IndexList& vertexes = uniq.getVertexes();
|
||||
const IndexList& vertexes = uniq.getVertices();
|
||||
for(IndexList::const_iterator vertIDit=vertexes.begin(); vertIDit!=vertexes.end(); ++vertIDit)
|
||||
{
|
||||
dst[*vertIDit] = osg::Matrix::transform3x3(src[*vertIDit],matrix);
|
||||
|
||||
Reference in New Issue
Block a user