diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-08 00:56:36 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-08 00:56:36 +0100 |
commit | d248cde2309e9aa3f14a10ce2db0019afdf9f0f1 (patch) | |
tree | 3b754dacd2e858c547f9cb95a303a797f39382c8 /src/ft_darken_rgb.c | |
parent | I gotta figure out (diff) | |
download | 42-cub3d-d248cde2309e9aa3f14a10ce2db0019afdf9f0f1.tar.gz 42-cub3d-d248cde2309e9aa3f14a10ce2db0019afdf9f0f1.tar.bz2 42-cub3d-d248cde2309e9aa3f14a10ce2db0019afdf9f0f1.tar.xz 42-cub3d-d248cde2309e9aa3f14a10ce2db0019afdf9f0f1.tar.zst 42-cub3d-d248cde2309e9aa3f14a10ce2db0019afdf9f0f1.zip |
Collision fixed, still galering
Diffstat (limited to 'src/ft_darken_rgb.c')
-rw-r--r-- | src/ft_darken_rgb.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/ft_darken_rgb.c b/src/ft_darken_rgb.c index 7f5e12a..5edfd89 100644 --- a/src/ft_darken_rgb.c +++ b/src/ft_darken_rgb.c @@ -12,23 +12,21 @@ #include <cub3d.h> #include <stdint.h> +#include <stdio.h> uint32_t ft_darken_ceil(t_rgb rgb, int32_t y, t_cub *cl) { t_rgb darker; - float dist; float calc; darker = rgb; - (void)y; - dist = (cl->rlist.ceil_dist > 0) ? (cl->rlist.ceil_dist) : (0.0001); - calc = dist * 0.4; - calc = (calc >= 255) ? (255) : (calc); - calc = (calc < 1) ? (1) : (calc); - darker.r /= calc; - darker.g /= calc; - darker.b /= calc; + calc = ((float)(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)); } @@ -38,9 +36,13 @@ uint32_t t_rgb darker; float calc; - calc = ((float)(y + (75000.0 / cl->wlist.y_size)) - / (cl->wlist.y_size / 2)) - 1.0; - calc = (calc < 0) ? (0) : (calc); + /* calc = ((float)(y + (75000.0 / cl->wlist.y_size)) */ + /* / (cl->wlist.y_size / 2)) - 1.0; */ + /* calc = (calc < 0) ? (0) : (calc); */ + (void)y; + calc = (cl->rlist.row_dist * 0.4); + calc = (calc >= 255) ? (255) : (calc); + calc = (calc < 1) ? (1) : (calc); darker = rgb; darker.r *= calc; darker.g *= calc; |