mirror of
https://github.com/godotengine/godot
synced 2024-09-05 15:59:35 +00:00
Fix mismatch between Color.h and Color.from_hsv()
This commit is contained in:
parent
47addcf9d0
commit
1d3b5d5a2f
|
@ -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) {
|
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 h_ = p_h / 60.0f;
|
||||||
const float c = p_v * p_s;
|
const float c = p_v * p_s;
|
||||||
const float x = c * (1.0f - Math::abs(Math::fmod(h_, 2.0f) - 1.0f));
|
const float x = c * (1.0f - Math::abs(Math::fmod(h_, 2.0f) - 1.0f));
|
||||||
|
|
Loading…
Reference in a new issue