diff options
Diffstat (limited to 'src/osd/modules/render/bgfx/timeparameter.cpp')
-rw-r--r-- | src/osd/modules/render/bgfx/timeparameter.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/osd/modules/render/bgfx/timeparameter.cpp b/src/osd/modules/render/bgfx/timeparameter.cpp new file mode 100644 index 00000000000..f1f10ce700b --- /dev/null +++ b/src/osd/modules/render/bgfx/timeparameter.cpp @@ -0,0 +1,33 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// timeparameter.cpp - Time-based dynamic shader param +// +//============================================================ + +#include "timeparameter.h" + +bgfx_time_parameter::bgfx_time_parameter(std::string name, parameter_type type, double limit) + : bgfx_parameter(name, type) + , m_current_time(0) + , m_limit(limit) +{ +} + +float bgfx_time_parameter::value() +{ + return float(m_current_time * 1000.0 * 1000.0); +} + +void bgfx_time_parameter::tick(double delta) +{ + m_current_time += delta; + if (m_limit != 0) + { + while (m_current_time >= m_limit) + { + m_current_time -= m_limit; + } + } +} |