diff options
Diffstat (limited to 'src/ft_draw_verline.c')
-rw-r--r-- | src/ft_draw_verline.c | 63 |
1 files changed, 12 insertions, 51 deletions
diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c index 7f0fd1c..b6729de 100644 --- a/src/ft_draw_verline.c +++ b/src/ft_draw_verline.c @@ -13,56 +13,17 @@ #include <cub3d.h> #include <stdint.h> -static void - ft_draw_floor_tex(t_cub *cl, int32_t y, int32_t x, int32_t tex_y) -{ - cl->img.ptr[x * 4 + (cl->img.sizeline * y)] = - (uint8_t)cl->tlist[6].ptr[cl->tlist[6].tex_x * 4 + 4 * - cl->tlist[6].img_h * tex_y]; - cl->img.ptr[x * 4 + (cl->img.sizeline * y) + 1] = - (uint8_t)cl->tlist[6].ptr[cl->tlist[6].tex_x * 4 + 4 * - cl->tlist[6].img_h * tex_y + 1]; - cl->img.ptr[x * 4 + (cl->img.sizeline * y) + 2] = - (uint8_t)cl->tlist[6].ptr[cl->tlist[6].tex_x * 4 + 4 * - cl->tlist[6].img_h * tex_y + 2]; - cl->img.ptr[x * 4 + cl->wlist.x_size * y + 3] = (int8_t)0; -} - -#include <stdio.h> -static void - ft_draw_floor(t_cub *cl, int32_t y, int32_t x) -{ - float dist_player; - float curr_dist; - float weight; - float curr_floor_x; - float curr_floor_y; - - dist_player = 0.0; - while ((uint32_t)y < cl->wlist.y_size) - { - curr_dist = cl->wlist.y_size / (2.0 * y - cl->wlist.y_size); - weight = (curr_dist - dist_player) - / (cl->rlist.wall_dist - dist_player); - curr_floor_x = weight * cl->rlist.floor_x_wall - + (1.0 - weight) * cl->plist.pos_x; - curr_floor_y = weight * cl->rlist.floor_y_wall - + (1.0 - weight) * cl->plist.pos_y; - cl->tlist[6].tex_x = (int32_t)(curr_floor_x * cl->tlist[6].img_w) - % cl->tlist[6].img_w; - cl->tlist[6].tex_y = (int32_t)(curr_floor_y * cl->tlist[6].img_h) - % cl->tlist[6].img_h; - /* cl->tlist[6].tex_x = (cl->tlist[6].tex_x > 0) */ - /* ? (cl->tlist[6].tex_x) : (-cl->tlist[6].tex_x); */ - /* cl->tlist[6].tex_y = (cl->tlist[6].tex_y > 0) */ - /* ? (cl->tlist[6].tex_y) : (-cl->tlist[6].tex_y); */ - ft_draw_floor_tex(cl, y, x, cl->tlist[6].tex_y); - /* *(int*)(cl->img.ptr + */ - /* (x * 4 + (y * cl->img.sizeline))) */ - /* = ft_darken_floor(cl->f_rgb, weight, cl); */ - y++; - } -} +/* static void */ +/* ft_draw_floor(t_cub *cl, int32_t y, int32_t x) */ +/* { */ +/* while ((uint32_t)y < cl->wlist.y_size) */ +/* { */ +/* *(int*)(cl->img.ptr + */ +/* (x * 4 + (y * cl->img.sizeline))) */ +/* = ft_darken_floor(cl->f_rgb, y, cl); */ +/* y++; */ +/* } */ +/* } */ static void ft_draw_ceil(t_cub *cl, int32_t y, int32_t x) @@ -98,6 +59,6 @@ int8_t ft_draw_texture(cl, x, y, tex_y); y++; } - ft_draw_floor(cl, y, x); + /* ft_draw_floor(cl, y, x); */ return (0); } |