From 6d8fbc2953c6ae29ee5162ca04920d6cef85d0ce Mon Sep 17 00:00:00 2001 From: rodri Date: Thu, 4 Jul 2024 14:57:00 +0000 Subject: rough color space conversion implementation. colors are now properly processed in linear RGB space for lighting, shading and blending. sRGB is assumed for any texture sampled and the destination framebuffer. it's not perfect, but it does the job for now. --- render.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'render.c') diff --git a/render.c b/render.c index 7fb3ae5..563df69 100644 --- a/render.c +++ b/render.c @@ -41,9 +41,9 @@ pixel(Framebuf *fb, Point p, Color c) ulong *dst; dst = fb->cb; - dc = ul2col(dst[Dx(fb->r)*p.y + p.x]); + dc = srgb2linear(ul2col(dst[Dx(fb->r)*p.y + p.x])); c = lerp3(dc, c, c.a); /* SoverD */ - dst[Dx(fb->r)*p.y + p.x] = col2ul(c); + dst[Dx(fb->r)*p.y + p.x] = col2ul(linear2srgb(c)); } static void -- cgit v1.2.3