From 213c3a4e99c3085ee89fda550897213abbc888ad Mon Sep 17 00:00:00 2001 From: rodri Date: Mon, 10 Jun 2024 15:59:57 +0000 Subject: add spotlight params and a light color shading routine. other things. among these other things are clamping the color channels to [0,1] internally, and adding a modulation function for mixing colors/points. --- render.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'render.c') diff --git a/render.c b/render.c index 91cf039..469605e 100644 --- a/render.c +++ b/render.c @@ -15,10 +15,10 @@ col2ul(Color c) { uchar cbuf[4]; - cbuf[0] = c.a*0xFF; - cbuf[1] = c.b*0xFF; - cbuf[2] = c.g*0xFF; - cbuf[3] = c.r*0xFF; + cbuf[0] = fclamp(c.a, 0, 1)*0xFF; + cbuf[1] = fclamp(c.b, 0, 1)*0xFF; + cbuf[2] = fclamp(c.g, 0, 1)*0xFF; + cbuf[3] = fclamp(c.r, 0, 1)*0xFF; return cbuf[3]<<24 | cbuf[2]<<16 | cbuf[1]<<8 | cbuf[0]; } -- cgit v1.2.3