Skip to content

Commit

Permalink
Use our own Pi constant, as the Windows cmath header doesn't have the…
Browse files Browse the repository at this point in the history
… definition.
  • Loading branch information
kblaschke committed Nov 7, 2023
1 parent 0a69461 commit 43dbf9d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/libprojectM/Renderer/PresetTransition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <cmath>
#include <cstddef>

constexpr double PI = 3.14159265358979323846;

PresetTransition::PresetTransition(const std::shared_ptr<Shader>& transitionShader, double durationSeconds)
: m_transitionShader(transitionShader)
, m_durationSeconds(durationSeconds)
Expand Down Expand Up @@ -59,7 +61,7 @@ void PresetTransition::Draw(const Preset& oldPreset,
if (m_durationSeconds > 0.0)
{
linearProgress = secondsSinceStart / m_durationSeconds;
cosineProgress = (-std::cos(linearProgress * M_PI) + 1.0) * 0.5;
cosineProgress = (-std::cos(linearProgress * PI) + 1.0) * 0.5;
bicubicProgress = linearProgress < 0.5 ? 4.0 * linearProgress * linearProgress * linearProgress : 1.0 - pow(-2.0 * linearProgress + 2.0, 3.0) / 2.0;
}

Expand Down

0 comments on commit 43dbf9d

Please sign in to comment.