summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHein-Pieter van Braam <hp@tmm.cx>2018-03-15 22:16:57 +0100
committerGitHub <noreply@github.com>2018-03-15 22:16:57 +0100
commitf8706cbdf2133744174490c4f27eca0ebd3a6480 (patch)
treec53622c57bb409922d3dabe61cef308a64e1a752
parent9bb1b554862fb3547a4992892be10aa52cd3d611 (diff)
parent1d3b5d5a2fcce5fcb1a429ff6e6e89f5a3133fdb (diff)
Merge pull request #17407 from poke1024/fix-hsv-mismatch
Fix mismatch between Color.h and Color.from_hsv()
-rw-r--r--core/color.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/color.cpp b/core/color.cpp
index 27d8e9b891..b2f5889166 100644
--- a/core/color.cpp
+++ b/core/color.cpp
@@ -402,6 +402,10 @@ String Color::to_html(bool p_alpha) const {
Color Color::from_hsv(float p_h, float p_s, float p_v, float p_a) {
+ p_h = Math::fmod(p_h * 360.0f, 360.0f);
+ if (p_h < 0.0)
+ p_h += 360.0f;
+
const float h_ = p_h / 60.0f;
const float c = p_v * p_s;
const float x = c * (1.0f - Math::abs(Math::fmod(h_, 2.0f) - 1.0f));