summaryrefslogtreecommitdiff
path: root/graphics.c
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2025-04-07 01:33:07 +0200
committerMitya Selivanov <automainint@guattari.tech>2025-04-07 01:33:07 +0200
commit1b72dceae8427a7e43bef44c7dbb47f53c0cb865 (patch)
tree0ccb209a12dcd733367a43b7d1899463234704c6 /graphics.c
parent068e4f94310953bf3d2ead074997b55d4c3c0091 (diff)
downloadreduced_system_layer-1b72dceae8427a7e43bef44c7dbb47f53c0cb865.zip
Rewrite antialiasing downscale code
Diffstat (limited to 'graphics.c')
-rwxr-xr-xgraphics.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/graphics.c b/graphics.c
index bb800ad..e46dca5 100755
--- a/graphics.c
+++ b/graphics.c
@@ -961,6 +961,18 @@ vec4_f32 vec4_f32_lerp(vec4_f32 a, vec4_f32 b, f32 t) {
// ================================================================
+static f64 gamma_(f64 x) {
+ if (x >= 0.0031308)
+ return 1.055 * pow(x, 1.0 / 2.4) - 0.055;
+ return 12.92 * x;
+}
+
+static f64 gamma_re_(f64 x) {
+ if (x >= 0.04045)
+ return pow((x + 0.055) / 1.055, 2.4);
+ return x / 12.92;
+}
+
vec3_f32 rgb_gamma_add(vec3_f32 rgb) {
return (vec3_f32) {
.x = (f32) gamma_(rgb.x),