summaryrefslogtreecommitdiffhomepage
path: root/main/draw.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-17 18:07:53 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-17 18:07:53 +0200
commit6cadd1270b8ac5c5f49f5c07e74e7bd236dd0eb3 (patch)
treef705ecd3e5ff75fdc393daf59a20ae00dfb19bb3 /main/draw.cpp
parent5dd1ade46d1c21b840cfdd4acfaf3012a2955f7c (diff)
a
Diffstat (limited to 'main/draw.cpp')
-rw-r--r--main/draw.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/main/draw.cpp b/main/draw.cpp
index e2bcdd31..82c4efc9 100644
--- a/main/draw.cpp
+++ b/main/draw.cpp
@@ -7,8 +7,20 @@
namespace floormat {
void app::drawEvent() {
+
+ if (const float dt = timeline.previousFrameDuration(); dt > 0)
+ {
+ constexpr float RC = 0.5f;
+ const float alpha = dt/(dt + RC);
+
+ if (_frame_time > 0)
+ _frame_time = _frame_time*(1-alpha) + alpha*dt;
+ else
+ _frame_time = dt;
+ }
+
{
- const float dt = std::min(1.f/10, timeline.previousFrameDuration());
+ const float dt = std::clamp(timeline.previousFrameDuration(), 1e-3f, 1e-1f);
update(dt);
}