summaryrefslogtreecommitdiffstats
path: root/src/animation
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-06-08 13:00:45 +0200
committeraap <aap@papnet.eu>2020-06-08 13:01:23 +0200
commitd5515c9d0efd57348d50e450f5632cdf0ffeca73 (patch)
treece4ee23891a5167e5de15bb5d8fda1d1d5eab480 /src/animation
parentMerge branch 'master' into miami (diff)
downloadre3-d5515c9d0efd57348d50e450f5632cdf0ffeca73.tar
re3-d5515c9d0efd57348d50e450f5632cdf0ffeca73.tar.gz
re3-d5515c9d0efd57348d50e450f5632cdf0ffeca73.tar.bz2
re3-d5515c9d0efd57348d50e450f5632cdf0ffeca73.tar.lz
re3-d5515c9d0efd57348d50e450f5632cdf0ffeca73.tar.xz
re3-d5515c9d0efd57348d50e450f5632cdf0ffeca73.tar.zst
re3-d5515c9d0efd57348d50e450f5632cdf0ffeca73.zip
Diffstat (limited to 'src/animation')
-rw-r--r--src/animation/FrameUpdate.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/animation/FrameUpdate.cpp b/src/animation/FrameUpdate.cpp
index b886e95d..c119d479 100644
--- a/src/animation/FrameUpdate.cpp
+++ b/src/animation/FrameUpdate.cpp
@@ -233,6 +233,7 @@ void
FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg)
{
CVector vec, pos(0.0f, 0.0f, 0.0f);
+ float transBlendAmount = 0.0f;
CQuaternion q, rot(0.0f, 0.0f, 0.0f, 0.0f);
float totalBlendAmount = 0.0f;
RpHAnimStdKeyFrame *xform = frame->hanimFrame;
@@ -256,8 +257,10 @@ FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg)
for(node = updateData->nodes; *node; node++){
if((*node)->sequence){
(*node)->Update(vec, q, 1.0f-totalBlendAmount);
- if((*node)->sequence->HasTranslation())
+ if((*node)->sequence->HasTranslation()){
pos += vec;
+ transBlendAmount += (*node)->association->blendAmount;
+ }
if(DotProduct(rot, q) < 0.0f)
rot -= q;
else
@@ -275,12 +278,12 @@ FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg)
}
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
- xform->t.x = pos.x;
- xform->t.y = pos.y;
- xform->t.z = pos.z;
- xform->t.x += frame->resetPos.x;
- xform->t.y += frame->resetPos.y;
- xform->t.z += frame->resetPos.z;
+ xform->t.x = transBlendAmount*pos.x;
+ xform->t.y = transBlendAmount*pos.y;
+ xform->t.z = transBlendAmount*pos.z;
+ xform->t.x += (1.0f-transBlendAmount)*frame->resetPos.x;
+ xform->t.y += (1.0f-transBlendAmount)*frame->resetPos.y;
+ xform->t.z += (1.0f-transBlendAmount)*frame->resetPos.z;
}
}