aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_floor_cast.c
blob: 1d98e0389a26fa73831039cbf13f0b3b98d27a26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_raycasting.c                                    :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/14 17:22:57 by rbousset          #+#    #+#             */
/*   Updated: 2020/02/14 17:23:42 by rbousset         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#include <cub3d.h>
#include <stdint.h>

void
	ft_floor_cast(uint16_t y, t_cub *cl)
{
	t_ray	*rl;

	rl = &cl->rlist;
	rl->x_f_ray_dir = cl->plist.dir_x - cl->plist.plane_x;
	rl->y_f_ray_dir = cl->plist.dir_y - cl->plist.plane_y;
	rl->x_f_ray_dir_bis = cl->plist.dir_x + cl->plist.plane_x;
	rl->y_f_ray_dir_bis = cl->plist.dir_y + cl->plist.plane_y;
	rl->p = y - cl->wlist.y_size / 2;
	cl->plist.pos_z = 0.5 * cl->wlist.y_size;
}