diff options
| author | Mikkel Hjortshøj <fyoucon@gmail.com> | 2020-08-29 21:58:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-29 21:58:16 +0200 |
| commit | 32fda798f39a2fc638823d80dfd4d19edb6c8ca8 (patch) | |
| tree | 6e711a4e8ac5105d701043525c7f473e4372bfd8 | |
| parent | 0216ade2f94f4551adef44a8bf58a1f877db4571 (diff) | |
| parent | 12895de9ac899879792f8d5b4c4dd41ae98a6ba3 (diff) | |
Merge pull request #724 from Skytrias/master
fix hsl math.mod to usual hsl conversion
| -rw-r--r-- | core/math/linalg/specific.odin | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/math/linalg/specific.odin b/core/math/linalg/specific.odin index 4eca42000..7aad55a11 100644 --- a/core/math/linalg/specific.odin +++ b/core/math/linalg/specific.odin @@ -120,7 +120,9 @@ vector4_linear_to_srgb :: proc(col: Vector4) -> Vector4 { vector4_hsl_to_rgb :: proc(h, s, l: Float, a: Float = 1) -> Vector4 { hue_to_rgb :: proc(p, q, t0: Float) -> Float { - t := math.mod(t0, 1.0); + t := t; + if t < 0 do t += 1; + if t > 1 do t -= 1; switch { case t < 1.0/6.0: return p + (q - p) * 6.0 * t; case t < 1.0/2.0: return q; |