summaryrefslogtreecommitdiffstats
path: root/core/color.h
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-06-16 10:22:26 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-06-16 10:22:26 -0300
commit703004f830f39adcde9b9565f1aa49d1b10e8d27 (patch)
treeb8fd669af9dee07177ff658f0ebca83aff836598 /core/color.h
parent64e83bfd1404ea593f0c79b478d196a3fcde42a8 (diff)
downloadredot-engine-703004f830f39adcde9b9565f1aa49d1b10e8d27.tar.gz
More 3D Work
-=-=-=-=-=- -ESM Shadow Mapping for softer and less glitchy shadows -HDR Pipeline (convert to Linear on texture import, convert to SRGB at the end) -Fix to xml parse bug
Diffstat (limited to 'core/color.h')
-rw-r--r--core/color.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/color.h b/core/color.h
index 9b5850f56b..491c72d449 100644
--- a/core/color.h
+++ b/core/color.h
@@ -30,6 +30,7 @@
#define COLOR_H
#include "ustring.h"
+#include "math_funcs.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
@@ -97,6 +98,16 @@ struct Color {
return res;
}
+ _FORCE_INLINE_ Color to_linear() const {
+
+ return Color(
+ r<0.04045 ? r * (1.0 / 12.92) : Math::pow((r + 0.055) * (1.0 / (1 + 0.055)), 2.4),
+ g<0.04045 ? g * (1.0 / 12.92) : Math::pow((g + 0.055) * (1.0 / (1 + 0.055)), 2.4),
+ b<0.04045 ? b * (1.0 / 12.92) : Math::pow((b + 0.055) * (1.0 / (1 + 0.055)), 2.4),
+ a
+ );
+ }
+
static Color hex(uint32_t p_hex);
static Color html(const String& p_color);
static bool html_is_valid(const String& p_color);