From 3ea5ffd9398bfc289459d94ad060431c9f60a798 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 31 Dec 2021 18:01:19 +0100 Subject: [PATCH] Use in-out easing for better animation interpolation The difference is mainly noticeable on high refresh-rate monitors and only affects third-person animations. The animation interpolation duration has been slightly lengthened to better make use of the new easing. --- source/src/rendermodel.cpp | 3 ++- source/src/vertmodel.h | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/src/rendermodel.cpp b/source/src/rendermodel.cpp index 1890d4580a..8539a8642d 100644 --- a/source/src/rendermodel.cpp +++ b/source/src/rendermodel.cpp @@ -1,6 +1,7 @@ #include "cube.h" -VARP(animationinterpolationtime, 0, 150, 1000); +// 165 is the highest value that does not break player animations when firing the SMG +VARP(animationinterpolationtime, 0, 165, 1000); model *loadingmodel = NULL; mapmodelattributes loadingattributes; diff --git a/source/src/vertmodel.h b/source/src/vertmodel.h index 08d5133139..1fc6fcc565 100644 --- a/source/src/vertmodel.h +++ b/source/src/vertmodel.h @@ -887,7 +887,9 @@ struct vertmodel : model if(doai) { prev.setframes(d->prev[index]); - ai_t = (lastmillis-d->lastanimswitchtime[index])/(float)animationinterpolationtime; + // use easeInOutSine easing for smoother appearance + // https://easings.net/#easeInOutSine + ai_t = -(cos(M_PI * (lastmillis-d->lastanimswitchtime[index])/(float)animationinterpolationtime) - 1) / 2; } glPushMatrix();