use bone dirtyflag

This commit is contained in:
yangxiao 2014-06-16 18:22:32 +08:00
parent 927d29f334
commit c00cdd0ae3
3 changed files with 14 additions and 13 deletions

View File

@ -12,7 +12,7 @@ void AnimationCurve<componentSize>::evaluate(float time, float* dst, EvaluateTyp
} }
else if (time >= _keytime[_count - 1]) else if (time >= _keytime[_count - 1])
{ {
memcpy(dst, &_value[(_count - 1) * floatSize], _componentSizeByte); memcpy(dst, &_value[(_count - 1) * componentSize], _componentSizeByte);
return; return;
} }

View File

@ -121,6 +121,9 @@ void Bone::setAnimationValue(float* trans, float* rot, float* scale, float weigh
state.localRot.set(rot); state.localRot.set(rot);
if (scale) if (scale)
state.localScale.set(scale); state.localScale.set(scale);
if (_name != "L_side01" && _name != "L_side03" && _name != "L_side02")
CCASSERT(fabs(scale[0] - 1) < 0.001f, "");
state.weight = weight; state.weight = weight;
_blendStates.push_back(state); _blendStates.push_back(state);
@ -224,11 +227,13 @@ void Bone::updateLocalMat()
} }
if (total) if (total)
{ {
if (_blendStates.size() == 1) //if (_blendStates.size() == 1)
if (true)
{ {
translate = _blendStates[0].localTranslate; int cnt = _blendStates.size();
scale = _blendStates[0].localScale; translate = _blendStates[cnt - 1].localTranslate;
quat = _blendStates[0].localRot; scale = _blendStates[cnt - 1].localScale;
quat = _blendStates[cnt - 1].localRot;
} }
else else
{ {
@ -263,13 +268,11 @@ void Bone::updateLocalMat()
_blendStates.clear(); _blendStates.clear();
_localDirty = false; _localDirty = false;
} }
else
{
CCLOG("use cached local");
}
}
void Bone::clearBlendState()
{
_blendStates.clear();
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -131,8 +131,6 @@ protected:
*/ */
void updateLocalMat(); void updateLocalMat();
void clearBlendState();
std::string _name; std::string _name;
/** /**
* The Mat4 representation of the Joint's bind pose. * The Mat4 representation of the Joint's bind pose.