summaryrefslogtreecommitdiffstats
path: root/core/color.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/color.cpp')
-rw-r--r--core/color.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/color.cpp b/core/color.cpp
index 0d8cad1a5e..17c9e2daeb 100644
--- a/core/color.cpp
+++ b/core/color.cpp
@@ -253,6 +253,21 @@ Color Color::hex64(uint64_t p_hex) {
return Color(r, g, b, a);
}
+Color Color::from_rgbe9995(uint32_t p_rgbe) {
+
+ float r = p_rgbe & 0x1ff;
+ float g = (p_rgbe >> 9) & 0x1ff;
+ float b = (p_rgbe >> 18) & 0x1ff;
+ float e = (p_rgbe >> 27);
+ float m = Math::pow(2, e - 15.0 - 9.0);
+
+ float rd = r * m;
+ float gd = g * m;
+ float bd = b * m;
+
+ return Color(rd, gd, bd, 1.0f);
+}
+
static float _parse_col(const String &p_str, int p_ofs) {
int ig = 0;