diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2022-04-13 14:41:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-13 14:41:29 +0200 |
| commit | 6123a61a49a928dd79366dabe6f51560566e73f2 (patch) | |
| tree | 42a037317346357e844e1e82d0d6fbf2bc94a39a /include/godot_cpp | |
| parent | 60037decc36e223fbcce78586a26e7dd9468033d (diff) | |
| parent | 24f5cd2d4822f9aaf5e952512fce5aa604ff6aae (diff) | |
| download | redot-cpp-6123a61a49a928dd79366dabe6f51560566e73f2.tar.gz | |
Merge pull request #738 from akien-mga/color-clarify-srgb-linear-conversions
Diffstat (limited to 'include/godot_cpp')
| -rw-r--r-- | include/godot_cpp/variant/color.hpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/godot_cpp/variant/color.hpp b/include/godot_cpp/variant/color.hpp index ec02f1a..608f8af 100644 --- a/include/godot_cpp/variant/color.hpp +++ b/include/godot_cpp/variant/color.hpp @@ -171,14 +171,14 @@ public: return res; } - inline Color to_linear() const { + inline Color srgb_to_linear() const { return Color( r < (real_t)0.04045 ? r * (real_t)(1.0 / 12.92) : Math::pow((r + (real_t)0.055) * (real_t)(1.0 / (1.0 + 0.055)), (real_t)2.4), g < (real_t)0.04045 ? g * (real_t)(1.0 / 12.92) : Math::pow((g + (real_t)0.055) * (real_t)(1.0 / (1.0 + 0.055)), (real_t)2.4), b < (real_t)0.04045 ? b * (real_t)(1.0 / 12.92) : Math::pow((b + (real_t)0.055) * (real_t)(1.0 / (1.0 + 0.055)), (real_t)2.4), a); } - inline Color to_srgb() const { + inline Color linear_to_srgb() const { return Color( r < (real_t)0.0031308 ? (real_t)12.92 * r : (real_t)(1.0 + 0.055) * Math::pow(r, (real_t)(1.0 / 2.4)) - (real_t)0.055, g < (real_t)0.0031308 ? (real_t)12.92 * g : (real_t)(1.0 + 0.055) * Math::pow(g, (real_t)(1.0 / 2.4)) - (real_t)0.055, |
