From 7b214503608550dc2853b9e01526723f8c65baf3 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 12 May 2020 14:14:06 +0200 Subject: Added mat4 in libftm, can rotate, scale and translate vector --- src/parse.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/parse.c') diff --git a/src/parse.c b/src/parse.c index b83d9e8..6290b1a 100644 --- a/src/parse.c +++ b/src/parse.c @@ -6,7 +6,7 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/05/09 11:02:00 by charles #+# #+# */ -/* Updated: 2020/05/11 01:29:13 by charles ### ########.fr */ +/* Updated: 2020/05/11 15:55:44 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,7 +21,7 @@ static int st_parse_face(char **indexes_strs, t_ftvec *indices) unsigned int first; unsigned int tmp; - len = ft_split_len(indexes_strs); + len = ft_strslen(indexes_strs); first = ft_atoi(indexes_strs[0]); /* if (ft_vecpush(indices, *(void**)&first) == NULL) */ /* return (-1); */ @@ -64,11 +64,11 @@ static int st_parse_line(char *line, t_ftvec *vertices, t_ftvec *indices) if ((split = ft_split(line + 1, ' ')) == NULL) return (-1); ret = -1; - if (*line == 'v' && ft_split_len(split) == 3) + if (*line == 'v' && ft_strslen(split) == 3) ret = st_parse_vertex(split, vertices); - if (*line == 'f' && ft_split_len(split) >= 3) + if (*line == 'f' && ft_strslen(split) >= 3) ret = st_parse_face(split, indices); - ft_split_destroy(split); + ft_strsdestroy(split); return (ret); } @@ -101,7 +101,8 @@ int parse(char *filepath, t_object *object) t_ftvec *vertices; t_ftvec *indices; - if ((fd = open(filepath, O_RDONLY)) == -1) + if (!has_extension(filepath, ".obj") + || (fd = open(filepath, O_RDONLY)) == -1) return (-1); if ((vertices = ft_vecnew(SCOP_VEC_DEFAULT_SIZE)) == NULL) return (-1); -- cgit