diff options
Diffstat (limited to 'src/ft_draw_verline.c')
-rw-r--r-- | src/ft_draw_verline.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c index 18f7cfe..6fa0d1e 100644 --- a/src/ft_draw_verline.c +++ b/src/ft_draw_verline.c @@ -40,6 +40,19 @@ static void } } +#include <stdio.h> +static void + ft_calc_ceil_dist(int32_t y, t_ray *rl, t_cub *cl) +{ + int16_t p; + + p = y - cl->wlist.y_size / 2; + cl->plist.pos_z = 0.5 * cl->wlist.y_size; + rl->ceil_dist = cl->plist.pos_z / p; + rl->ceil_dist = (rl->ceil_dist > 0) ? (rl->ceil_dist) : (-rl->ceil_dist); + printf("%f\n", rl->ceil_dist); +} + int8_t ft_draw_verline(t_cub *cl, int32_t x, int32_t y, int32_t y2) { @@ -48,6 +61,7 @@ int8_t (y < 0) ? (y = 0) : 0; (y2 < 0) ? (y2 = 0) : 0; + ft_calc_ceil_dist(y, &cl->rlist, cl); ft_draw_ceil(cl, y, x); (cl->rlist.line_h <= 0) ? (cl->rlist.line_h = 1) : 0; while (y < y2) |