diff options
| author | Nuno Donato | 2016-02-18 09:43:04 +0000 |
|---|---|---|
| committer | Nuno Donato | 2016-02-18 10:34:45 +0000 |
| commit | b51c720c80fddcf828ef658380255c5169d1dc5d (patch) | |
| tree | f1d38dec683e959ee8205f445ac44b0a6033057d /core/color.cpp | |
| parent | 16b0cf8bcbaacb02533e8f334b30931139b6d6dd (diff) | |
| download | godot-b51c720c80fddcf828ef658380255c5169d1dc5d.tar.gz godot-b51c720c80fddcf828ef658380255c5169d1dc5d.tar.zst godot-b51c720c80fddcf828ef658380255c5169d1dc5d.zip | |
Diffstat (limited to 'core/color.cpp')
| -rw-r--r-- | core/color.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/color.cpp b/core/color.cpp index c53de360b..56a550c02 100644 --- a/core/color.cpp +++ b/core/color.cpp @@ -117,29 +117,31 @@ void Color::set_hsv(float p_h, float p_s, float p_v, float p_alpha) { } p_h *=6.0; + p_h = Math::fmod(p_h,6); i = Math::floor( p_h ); + f = p_h - i; p = p_v * ( 1 - p_s ); q = p_v * ( 1 - p_s * f ); t = p_v * ( 1 - p_s * ( 1 - f ) ); switch( i ) { - case 0: + case 0: // Red is the dominant color r = p_v; g = t; b = p; break; - case 1: + case 1: // Green is the dominant color r = q; g = p_v; b = p; break; - case 2: + case 2: r = p; g = p_v; b = t; break; - case 3: + case 3: // Blue is the dominant color r = p; g = q; b = p_v; @@ -149,7 +151,7 @@ void Color::set_hsv(float p_h, float p_s, float p_v, float p_alpha) { g = p; b = p_v; break; - default: // cap_se 5: + default: // (5) Red is the dominant color r = p_v; g = p; b = q; |
