diff --git a/builds/fdf.o b/builds/fdf.o index ed2727f..6946716 100644 Binary files a/builds/fdf.o and b/builds/fdf.o differ diff --git a/fdf b/fdf index c7e91b2..044b1de 100755 Binary files a/fdf and b/fdf differ diff --git a/includes/fdf.h b/includes/fdf.h index 5c668d9..8443a5c 100644 --- a/includes/fdf.h +++ b/includes/fdf.h @@ -53,7 +53,7 @@ typedef struct s_fdf int img_size_y; int map_size_x; int map_size_y; - int map_length; + int map_width; int map_height; int rot_x; int rot_y; diff --git a/srcs/fdf.c b/srcs/fdf.c index 47178f9..d5d70be 100644 --- a/srcs/fdf.c +++ b/srcs/fdf.c @@ -25,16 +25,15 @@ void draw_image(t_fdf *fdf) *(unsigned int*)(fdf->img_addr + i) = 0; // draw image j = -1; - while (++j < fdf->map_size_y) + while (++j < fdf->map_height) { i = -1; - while (++i < fdf->map_size_x) + while (++i < fdf->map_width) { x = i * fdf->offset; y = j * fdf->offset; - // z = fdf->map[j][i]; - z = 1; + z = fdf->map[j][i]; new_x = x * cos(fdf->rad_y) + y * sin(fdf->rad_y); new_y = y * cos(fdf->rad_y) - x * sin(fdf->rad_y); new_y = new_y * cos(fdf->rad_x) - z * sin(fdf->rad_x); @@ -110,7 +109,7 @@ void draw_pixel(t_fdf *fdf, int x, int y, int color) int ymax; xmax = fdf->img_sizel / (fdf->img_bpp / 8); - ymax = fdf->map_size_y; + ymax = fdf->img_size_y; if (x < 0 || y < 0 || x > xmax || y > ymax) return ; position = y * fdf->img_sizel + x * fdf->img_bpp / 8; @@ -182,6 +181,8 @@ int **parse_map(t_fdf *fdf) } map[3][6] = 10; // size map + fdf->map_width = j; + fdf->map_height = i; fdf->map_size_x = --j * fdf->offset + 1; fdf->map_size_y = --i * fdf->offset + 1; return (map);