aboutsummaryrefslogtreecommitdiff
path: root/src/parse.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-05-12 14:14:06 +0200
committerCharles <sircharlesaze@gmail.com>2020-05-12 14:14:06 +0200
commit7b214503608550dc2853b9e01526723f8c65baf3 (patch)
treeddbc37eb2627b43eb33774bd2bf205336cd1a9e6 /src/parse.c
parentd07d87964f13d3c1e6ad8c2f6d7db21101f1ef34 (diff)
downloadscop-7b214503608550dc2853b9e01526723f8c65baf3.tar.gz
scop-7b214503608550dc2853b9e01526723f8c65baf3.tar.bz2
scop-7b214503608550dc2853b9e01526723f8c65baf3.zip
Added mat4 in libftm, can rotate, scale and translate vector
Diffstat (limited to 'src/parse.c')
-rw-r--r--src/parse.c13
1 files changed, 7 insertions, 6 deletions
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 <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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);