diff --git a/cocos/3d/CCMeshSkin.cpp b/cocos/3d/CCMeshSkin.cpp index ae6b6ce738..3962fbd14f 100644 --- a/cocos/3d/CCMeshSkin.cpp +++ b/cocos/3d/CCMeshSkin.cpp @@ -87,7 +87,7 @@ const Mat4& Bone::getWorldMat() /** * Set AnimationValue. set to its transform */ -void Bone::setAnimationValueTranslation(float* value) +void Bone::setAnimationValueTranslation(float* value, float weight) { static const int bytes = 3 * sizeof(float); if (memcmp(&_localTranslate.x, value, bytes) != 0) @@ -96,7 +96,7 @@ void Bone::setAnimationValueTranslation(float* value) _localTranslate.set(value); } } -void Bone::setAnimationValueRotation(float* value) +void Bone::setAnimationValueRotation(float* value, float weight) { static const int bytes = 4 * sizeof(float); if (memcmp(&_localRot.x, value, bytes) != 0) @@ -105,7 +105,7 @@ void Bone::setAnimationValueRotation(float* value) _localRot.set(value); } } -void Bone::setAnimationValueScale(float* value) +void Bone::setAnimationValueScale(float* value, float weight) { static const int bytes = 3 * sizeof(float); if (memcmp(&_localScale.x, value, bytes) != 0) @@ -220,6 +220,11 @@ void Bone::updateLocalMat() _dirtyFlag = 0; } +void Bone::clearBlendState() +{ + _blendStates.clear(); +} + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// static int PALETTE_ROWS = 3; diff --git a/cocos/3d/CCMeshSkin.h b/cocos/3d/CCMeshSkin.h index 0fb32d9d82..cba1e844ae 100644 --- a/cocos/3d/CCMeshSkin.h +++ b/cocos/3d/CCMeshSkin.h @@ -62,9 +62,9 @@ public: /** * Set AnimationValue. set to its transform */ - void setAnimationValueTranslation(float* value); - void setAnimationValueRotation(float* value); - void setAnimationValueScale(float* value); + void setAnimationValueTranslation(float* value, float weight = 1.0f); + void setAnimationValueRotation(float* value, float weight = 1.0f); + void setAnimationValueScale(float* value, float weight = 1.0f); /** * Creates C3DBone. @@ -98,6 +98,7 @@ public: protected: + enum DirtyFlag { Dirty_Translate = 1, @@ -126,6 +127,8 @@ protected: */ void updateLocalMat(); + void clearBlendState(); + std::string _name; /** * The Mat4 representation of the Joint's bind pose. @@ -151,7 +154,7 @@ protected: Mat4 _world; Mat4 _local; - BoneBlendState _blendState; + std::vector _blendStates; Vec3 _localTranslate; Quaternion _localRot; Vec3 _localScale;