mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
removal: commented old raycaster loop
This commit is contained in:
parent
5161bc4e49
commit
6c5a15915f
1 changed files with 30 additions and 34 deletions
64
src/main.c
64
src/main.c
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */
|
||||
/* Updated: 2025/07/29 11:56:42 by kcolin ### ########.fr */
|
||||
/* Updated: 2025/07/28 17:18:38 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -119,39 +119,35 @@ int game_loop(t_cub3d_data *data)
|
|||
mlx_destroy_image(data->mlx, data->img_data->img);
|
||||
data->img_data->img = mlx_new_image(data->mlx, WIDTH, HEIGHT);
|
||||
|
||||
if (player_intercardinal_dir(data->player) == SOUTHEAST)
|
||||
ft_printf("southeast ");
|
||||
if (player_intercardinal_dir(data->player) == SOUTHWEST)
|
||||
ft_printf("southwest ");
|
||||
if (player_intercardinal_dir(data->player) == NORTHEAST)
|
||||
ft_printf("northeast ");
|
||||
if (player_intercardinal_dir(data->player) == NORTHWEST)
|
||||
ft_printf("northwest ");
|
||||
|
||||
if (player_cardinal_dir(data->player) == SOUTH)
|
||||
ft_printf("south\n");
|
||||
if (player_cardinal_dir(data->player) == EAST)
|
||||
ft_printf("east\n");
|
||||
if (player_cardinal_dir(data->player) == NORTH)
|
||||
ft_printf("north\n");
|
||||
if (player_cardinal_dir(data->player) == WEST)
|
||||
ft_printf("west\n");
|
||||
|
||||
printf("local coord: %f, %f\n", coord_global_to_local(data->player.x), coord_global_to_local(data->player.y));
|
||||
|
||||
|
||||
/* float ray_angle = data->player.yaw - M_PI / 6; // 30 deg clockwise from player */
|
||||
float ray_angle = data->player.yaw; // straight ahead
|
||||
float fraction = M_PI / 3 / WIDTH;
|
||||
int column = 0;
|
||||
while (column < 1)
|
||||
{
|
||||
float first_hline_distance = coord_global_to_local(data->player.y) / cos(ray_angle);
|
||||
printf("first hline distance: %f\n", first_hline_distance);
|
||||
draw_line(data, ray_angle);
|
||||
column++;
|
||||
ray_angle += fraction;
|
||||
}
|
||||
// if (player_intercardinal_dir(data->player) == SOUTHEAST)
|
||||
// ft_printf("southeast ");
|
||||
// if (player_intercardinal_dir(data->player) == SOUTHWEST)
|
||||
// ft_printf("southwest ");
|
||||
// if (player_intercardinal_dir(data->player) == NORTHEAST)
|
||||
// ft_printf("northeast ");
|
||||
// if (player_intercardinal_dir(data->player) == NORTHWEST)
|
||||
// ft_printf("northwest ");
|
||||
//
|
||||
// if (player_cardinal_dir(data->player) == SOUTH)
|
||||
// ft_printf("south\n");
|
||||
// if (player_cardinal_dir(data->player) == EAST)
|
||||
// ft_printf("east\n");
|
||||
// if (player_cardinal_dir(data->player) == NORTH)
|
||||
// ft_printf("north\n");
|
||||
// if (player_cardinal_dir(data->player) == WEST)
|
||||
// ft_printf("west\n");
|
||||
//
|
||||
// float ray_angle = data->player.yaw - M_PI / 6;
|
||||
// float fraction = M_PI / 3 / WIDTH;
|
||||
// int column = 0;
|
||||
// while (column < WIDTH)
|
||||
// {
|
||||
// // hline check
|
||||
// /* float ray_atan = atan(ray_angle); */
|
||||
// draw_line(data, ray_angle);
|
||||
// column++;
|
||||
// ray_angle += fraction;
|
||||
// }
|
||||
|
||||
draw_map(data->map, &data->player, data->img_data);
|
||||
mlx_put_image_to_window(data->mlx, data->mlx_win,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue