From 4218ab8ee1a50c83a60c86a454f21d43146b46a0 Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Sat, 7 Mar 2020 19:03:53 +0100 Subject: The sky is nice --- src/ft_darken_rgb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/ft_darken_rgb.c') diff --git a/src/ft_darken_rgb.c b/src/ft_darken_rgb.c index 97d0c0e..3587d72 100644 --- a/src/ft_darken_rgb.c +++ b/src/ft_darken_rgb.c @@ -15,12 +15,15 @@ #include uint32_t - ft_darken_rgb(t_rgb rgb, int32_t y, t_cub *cl) + ft_darken_rgb(t_rgb rgb, t_cub *cl) { t_rgb darker; - uint8_t calc; + float dist; + float calc; - calc = (((cl->wlist.y_size / 2) + y)), + if ((dist = cl->rlist.wall_dist) <= 0) + dist = 0.0001; + calc = (dist * 0.2); calc = (calc >= 255) ? (255) : (calc); calc = (calc < 1) ? (1) : (calc); darker = rgb; -- cgit v1.2.3