From a89f3c192fcfc8db7a7875f7f0aef6e8af320265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Sat, 22 Jun 2019 04:55:00 +0200 Subject: [PATCH] Add fog to level --- programs/level.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/programs/level.c b/programs/level.c index cf61bf7..0dc38b7 100644 --- a/programs/level.c +++ b/programs/level.c @@ -116,6 +116,12 @@ void drawPixel(S3L_PixelInfo *p) sampleTxture(uv[0],uv[1],&r,&g,&b); + S3L_Unit fog = (p->depth * 8) / S3L_FRACTIONS_PER_UNIT; + + r = S3L_clamp(((S3L_Unit) r) - fog,0,255); + g = S3L_clamp(((S3L_Unit) g) - fog,0,255); + b = S3L_clamp(((S3L_Unit) b) - fog,0,255); + setPixel(p->x,p->y,r,g,b); }