summaryrefslogtreecommitdiffhomepage
path: root/main/draw.cpp
diff options
context:
space:
mode:
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);
}