From ced2be0469537a5d21043325c9bc54762197ec30 Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Sat, 7 Mar 2020 20:30:07 +0100 Subject: qwe --- src/ft_darken_rgb.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'src/ft_darken_rgb.c') diff --git a/src/ft_darken_rgb.c b/src/ft_darken_rgb.c index 3587d72..fe69fa2 100644 --- a/src/ft_darken_rgb.c +++ b/src/ft_darken_rgb.c @@ -15,20 +15,33 @@ #include uint32_t - ft_darken_rgb(t_rgb rgb, t_cub *cl) + ft_darken_ceil(t_rgb rgb, t_cub *cl) { t_rgb darker; - float dist; float calc; - 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; - darker.r /= calc; - darker.g /= calc; - darker.b /= calc; + calc = ((float)(cl->y - (75000.0 / cl->wlist.y_size)) + / (cl->wlist.y_size / 2)); + calc = (calc < 0) ? (0) : (calc); + darker.r *= 1 - calc; + darker.g *= 1 - calc; + darker.b *= 1 - calc; + return (ft_rgb_to_hex(darker)); +} + +uint32_t + ft_darken_floor(t_rgb rgb, t_cub *cl) +{ + t_rgb darker; + float calc; + + calc = ((float)(cl->y + (75000.0 / cl->wlist.y_size)) + / (cl->wlist.y_size / 2)) - 1.0; + calc = (calc < 0) ? (0) : (calc); + darker = rgb; + darker.r *= calc; + darker.g *= calc; + darker.b *= calc; return (ft_rgb_to_hex(darker)); } -- cgit v1.2.3