diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-23 18:13:59 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-23 18:13:59 +0100 |
commit | 78fb5c553758c748db7662d5f4388f52715e335c (patch) | |
tree | 3c89a485f45bf64e0f9a168a8118c3f605439815 /src/ft_draw_textures.c | |
parent | Fixed (diff) | |
download | 42-cub3d-78fb5c553758c748db7662d5f4388f52715e335c.tar.gz 42-cub3d-78fb5c553758c748db7662d5f4388f52715e335c.tar.bz2 42-cub3d-78fb5c553758c748db7662d5f4388f52715e335c.tar.xz 42-cub3d-78fb5c553758c748db7662d5f4388f52715e335c.tar.zst 42-cub3d-78fb5c553758c748db7662d5f4388f52715e335c.zip |
Fixed sprite shadows
Diffstat (limited to '')
-rw-r--r-- | src/ft_draw_textures.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/ft_draw_textures.c b/src/ft_draw_textures.c index 4bc0b78..0724a6d 100644 --- a/src/ft_draw_textures.c +++ b/src/ft_draw_textures.c @@ -25,20 +25,17 @@ void ft_draw_texture(t_cub *cl, int x, int y, int tex_y) { - float dist; - t_rgb rgb; + float dist; + t_rgb rgb; if ((dist = cl->rlist.wall_dist) <= 0) dist = 0.0001; - rgb.b = - (uint8_t)cl->tlist[cl->w_side].ptr[cl->tlist[cl->w_side].tex_x * 4 + 4 * - cl->tlist[cl->w_side].img_h * tex_y]; - rgb.g = - (uint8_t)cl->tlist[cl->w_side].ptr[cl->tlist[cl->w_side].tex_x * 4 + 4 * - cl->tlist[cl->w_side].img_h * tex_y + 1]; - rgb.r = - (uint8_t)cl->tlist[cl->w_side].ptr[cl->tlist[cl->w_side].tex_x * 4 + 4 * - cl->tlist[cl->w_side].img_h * tex_y + 2]; + rgb.b = (uint8_t)cl->tlist[cl->w_side].ptr[cl->tlist[cl->w_side].tex_x + * 4 + 4 * cl->tlist[cl->w_side].img_h * tex_y]; + rgb.g = (uint8_t)cl->tlist[cl->w_side].ptr[cl->tlist[cl->w_side].tex_x + * 4 + 4 * cl->tlist[cl->w_side].img_h * tex_y + 1]; + rgb.r = (uint8_t)cl->tlist[cl->w_side].ptr[cl->tlist[cl->w_side].tex_x + * 4 + 4 * cl->tlist[cl->w_side].img_h * tex_y + 2]; *(int*)(cl->img.ptr + ((uint16_t)x * 4 + (y * cl->img.sizeline))) = ft_rgb_to_hex(dist, rgb, cl); } |