shithub: tinyrend

Download patch

ref: 66ce5ae042207689a912bd5b2362905c22d534be
parent: c0dd49ba85d180293a6537b7f815df930f8cba15
author: rodri <rgl@antares-labs.eu>
date: Wed Nov 15 12:57:29 EST 2023

correct zfb color rendering.

--- a/main.c
+++ b/main.c
@@ -488,9 +488,9 @@
 				zbuf[sp->p.x+sp->p.y*Dx(fb->r)] = z;
 
 				cbuf[0] = 0xFF;
-				cbuf[1] = 0xFF*z;
-				cbuf[2] = 0xFF*z;
-				cbuf[3] = 0xFF*z;
+				cbuf[1] = 0xFF*fabs(z);
+				cbuf[2] = 0xFF*fabs(z);
+				cbuf[3] = 0xFF*fabs(z);
 				memfillcolor(sp->frag, *(ulong*)cbuf);
 				pixel(zfb, sp->p, sp->frag);