31 lines
1.5 KiB
C
31 lines
1.5 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: o_ :::::: ::: */
|
|
/* parse_map.c :+: / :+::+: :+: */
|
|
/* +:+ > +:++:+ +:+ */
|
|
/* By: whaffman <whaffman@student.codam.nl> +#+ +:+ +#++#++:++#++ */
|
|
/* +#+ +#+#+ +#++#+ +#+ \o/ */
|
|
/* Created: 2024/12/13 15:23:18 by whaffman #+#+# #+#+# #+# #+# | */
|
|
/* Updated: 2024/12/20 11:21:34 by whaffman ### ### ### ### / \ */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "fdf.h"
|
|
|
|
void parse_map(char *filename, t_fdf *fdf)
|
|
{
|
|
int map_size;
|
|
|
|
if (!get_map_sizes(filename, fdf))
|
|
handle_error(fdf, "Error: failed to get map sizes");
|
|
map_size = fdf->map->width * fdf->map->height;
|
|
fdf->map->orig = malloc(map_size * sizeof(t_point_3d));
|
|
fdf->map->rot = malloc(map_size * sizeof(t_point_3d));
|
|
fdf->map->proj = malloc(map_size * sizeof(t_point_2d));
|
|
if (!fdf->map->orig || !fdf->map->rot || !fdf->map->proj)
|
|
handle_error(fdf, MALLOC_ERROR);
|
|
if (!load_map_from_file(filename, fdf))
|
|
handle_error(fdf, "Error: failed to read map");
|
|
get_z_min_max(fdf);
|
|
}
|