This commit is contained in:
Ladebeze66
2024-01-22 16:33:54 +01:00
parent 6d8196504c
commit 84c17810af
13 changed files with 49 additions and 63 deletions

View File

@@ -6,7 +6,7 @@
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/12 17:49:42 by fgras-ca #+# #+# */
/* Updated: 2024/01/21 21:17:37 by fgras-ca ### ########.fr */
/* Updated: 2024/01/22 16:15:17 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
@@ -31,7 +31,7 @@ void init_base_params(t_base_params *params, t_structure_main *w)
params->FOV = FOVIEW * (PI / 180);
params->DR = params->FOV / params->numrays;
params->ra = w->s_player.pa - (params->FOV / 2);
//printf("initbaseparams: %d , %f\n", params->tilesize, params->ra);
printf("init_base_params: Player Position: x = %f, y = %f, Angle = %f\n", w->s_player.px, w->s_player.py, w->s_player.pa);
draw_background(w);
}
@@ -61,6 +61,7 @@ void calculate_ray(t_base_params *base, t_ray_state *state,
rayparams->r = calc->r;
rayparams->numRays = base->numrays;
rayparams->color = calc->color;
printf("calculate_ray: Ray #%d, Distance = %f, rx = %f, ry = %f, Wall Direction = %d\n", calc->r, rayparams->disT, rayparams->rx, rayparams->ry, rayparams->wallDir);
}
void drawrays2d(t_structure_main *w) {
@@ -73,7 +74,7 @@ void drawrays2d(t_structure_main *w) {
params.base_params.ra = fmod(params.base_params.ra + 2 * PI, 2 * PI);
// Ajout de logs pour les paramètres du rayon
printf("drawrays2d BEFORE: Ray #%d, Angle (ra) = %f\n", params.ray_calc.r, params.base_params.ra);
//printf("drawrays2d BEFORE: Ray #%d, Angle (ra) = %f\n", params.ray_calc.r, params.base_params.ra);
params.hrayparams = (t_ray_calc_params){w, params.base_params.ra,
&params.ray_state.disH, &params.ray_state.hx,
@@ -85,14 +86,14 @@ void drawrays2d(t_structure_main *w) {
calculateverticalray(&params.vrayparams);
calculate_ray(&params.base_params, &params.ray_state,
&params.ray_calc, &params.rayparams);
printf("drawrays2d AFTER : Ray #%d, ra: %f\n", params.ray_calc.r, params.base_params.ra);
printf("drawrays2d AFTER : Ray #%d, ra: %f\n", params.ray_calc.r, params.base_params.ra);
//Plus de logs après les calculs des rayons
//printf("drawrays2d: Ray #%d, Player Position: x = %f, y = %f, Angle (ra) = %f\n",
// params.ray_calc.r, w->s_player.px, w->s_player.py, params.base_params.ra);
//printf("Horizontal Ray: Distance = %f, x = %f, y = %f\n", params.ray_state.disH, params.ray_state.hx, params.ray_state.hy);
//printf("Vertical Ray: Distance = %f, x = %f, y = %f\n", params.ray_state.disV, params.ray_state.vx, params.ray_state.vy);
//printf("Drawray start\n");
drawray(&params.rayparams);
params.base_params.ra += params.base_params.DR;
}

Binary file not shown.

View File

@@ -6,7 +6,7 @@
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/12 17:35:53 by fgras-ca #+# #+# */
/* Updated: 2024/01/21 19:55:50 by fgras-ca ### ########.fr */
/* Updated: 2024/01/22 15:44:42 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */