diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-08-02 15:34:55 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-08-02 15:43:49 -0300 |
commit | 5c361485db9cb2c6d9f9fb8906ee283ee220aa00 (patch) | |
tree | e9e90e9108605b134b5de46a1c6cf03069e91958 /core/color.h | |
parent | b7d98d4d058388d7eb861abe4aed93c5a9480cf0 (diff) | |
download | redot-engine-5c361485db9cb2c6d9f9fb8906ee283ee220aa00.tar.gz |
-Added GLTF scene support (still missing animations and .glb extension)
-Fixed bugs regarding tangent generation in SurfaceTool
Diffstat (limited to 'core/color.h')
-rw-r--r-- | core/color.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/core/color.h b/core/color.h index c83dcda4b4..9074a0e6d6 100644 --- a/core/color.h +++ b/core/color.h @@ -140,8 +140,16 @@ struct Color { b < 0.04045 ? b * (1.0 / 12.92) : Math::pow((b + 0.055) * (1.0 / (1 + 0.055)), 2.4), a); } + _FORCE_INLINE_ Color to_srgb() const { - static Color hex(uint32_t p_hex); + return Color( + r < 0.0031308 ? 12.92 * r : (1.0 + 0.055) * Math::pow(r, 1.0f / 2.4f) - 0.055, + g < 0.0031308 ? 12.92 * g : (1.0 + 0.055) * Math::pow(g, 1.0f / 2.4f) - 0.055, + b < 0.0031308 ? 12.92 * b : (1.0 + 0.055) * Math::pow(b, 1.0f / 2.4f) - 0.055, a); + } + + static Color + hex(uint32_t p_hex); static Color html(const String &p_color); static bool html_is_valid(const String &p_color); static Color named(const String &p_name); |