diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-18 17:45:53 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-18 17:45:53 +0100 |
commit | ded508c2018294c3bcb79b82dcf6874e12569b97 (patch) | |
tree | 10d2a086cdcacf35a8560eae6ac046302ace66d1 /src/ft_floor_cast.c | |
parent | Minimap back (diff) | |
download | 42-cub3d-ded508c2018294c3bcb79b82dcf6874e12569b97.tar.gz 42-cub3d-ded508c2018294c3bcb79b82dcf6874e12569b97.tar.bz2 42-cub3d-ded508c2018294c3bcb79b82dcf6874e12569b97.tar.xz 42-cub3d-ded508c2018294c3bcb79b82dcf6874e12569b97.tar.zst 42-cub3d-ded508c2018294c3bcb79b82dcf6874e12569b97.zip |
Removed bloat
Diffstat (limited to 'src/ft_floor_cast.c')
-rw-r--r-- | src/ft_floor_cast.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ft_floor_cast.c b/src/ft_floor_cast.c index 92dcb07..160a2c1 100644 --- a/src/ft_floor_cast.c +++ b/src/ft_floor_cast.c @@ -25,30 +25,30 @@ static void { float dist; float calc; - t_rgb rgb; dist = (cl->rlist.row_dist > 0) ? (cl->rlist.row_dist) : (0.0001); calc = (dist * 0.1 * cl->mlist.darklvl); calc = (calc >= 255) ? (255) : (calc); calc = (calc < 1) ? (1) : (calc); calc = (cl->mlist.darklvl > 0) ? (calc) : (1); - rgb.r = (uint8_t)cl->tlist[tid].ptr[cl->tlist[tid].tex_x * 4 + 4 * - cl->tlist[tid].img_h * cl->tlist[tid].tex_y + 2] / calc; - rgb.g = (uint8_t)cl->tlist[tid].ptr[cl->tlist[tid].tex_x * 4 + 4 * - cl->tlist[tid].img_h * cl->tlist[tid].tex_y + 1] / calc; - rgb.b = (uint8_t)cl->tlist[tid].ptr[cl->tlist[tid].tex_x * 4 + 4 * - cl->tlist[tid].img_h * cl->tlist[tid].tex_y] / calc; - *(int*)(cl->img.ptr + - (x * 4 + (y * cl->img.sizeline))) = ft_rgb_to_hex(rgb); + *(cl->img.ptr + x * 4 + (cl->img.sizeline * y)) = + (uint8_t)*(cl->tlist[tid].ptr + cl->tlist[tid].tex_x * 4 + 4 * + cl->tlist[tid].img_w * cl->tlist[tid].tex_y) / calc; + *(cl->img.ptr + x * 4 + (cl->img.sizeline * y) + 1) = + (uint8_t)*(cl->tlist[tid].ptr + cl->tlist[tid].tex_x * 4 + 4 * + cl->tlist[tid].img_w * cl->tlist[tid].tex_y + 1) / calc; + *(cl->img.ptr + x * 4 + (cl->img.sizeline * y) + 2) = + (uint8_t)*(cl->tlist[tid].ptr + cl->tlist[tid].tex_x * 4 + 4 * + cl->tlist[tid].img_w * cl->tlist[tid].tex_y + 2) / calc; } static void ft_set_tex_xy(uint8_t tid, t_ray *rl, t_cub *cl) { cl->tlist[tid].tex_y = (int32_t)(cl->tlist[tid].img_w - * (rl->x_floor - rl->x_cell)) % (cl->tlist[tid].img_w); + * (rl->x_floor - rl->x_cell)); cl->tlist[tid].tex_x = (int32_t)(cl->tlist[tid].img_h - * (rl->y_floor - rl->y_cell)) % (cl->tlist[tid].img_h); + * (rl->y_floor - rl->y_cell)); cl->tlist[tid].tex_x = (cl->tlist[tid].tex_x > 0) ? (cl->tlist[tid].tex_x) : (-cl->tlist[tid].tex_x); cl->tlist[tid].tex_y = (cl->tlist[tid].tex_y > 0) |