stuff
This commit is contained in:
parent
5e66410346
commit
9022563247
|
@ -37,7 +37,8 @@ enum e_gl_buf_type {
|
|||
UV,
|
||||
NORMAL,
|
||||
INDEX,
|
||||
OTHER
|
||||
OTHER,
|
||||
INVALID
|
||||
};
|
||||
|
||||
typedef struct s_cam t_cam;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
v -10 -10 -10
|
||||
v 10 10 10
|
||||
v 0 0 0
|
||||
v 30 30 30
|
||||
v -20 10 30
|
||||
f 1 2 3
|
||||
f 1 2 4
|
||||
f 3 2 4
|
||||
f 1 3 5
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gbrochar <gbrochar@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2020/12/22 18:41:28 by gbrochar #+# #+# */
|
||||
/* Updated: 2020/12/23 21:15:54 by gbrochar ### ########.fr */
|
||||
/* Updated: 2024/10/04 18:09:40 by gbrochar ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -22,7 +22,15 @@ t_gl_buf_type parse_gl_buf_type(char *token)
|
|||
return (NORMAL);
|
||||
if (strcmp(token, "f") == SUCCESS)
|
||||
return (INDEX);
|
||||
return (OTHER);
|
||||
if (strcmp(token, "#") == SUCCESS
|
||||
|| strcmp(token, "l") == SUCCESS
|
||||
|| strcmp(token, "o") == SUCCESS
|
||||
|| strcmp(token, "mtllib") == SUCCESS
|
||||
|| strcmp(token, "s") == SUCCESS
|
||||
|| strcmp(token, "g") == SUCCESS
|
||||
|| strcmp(token, "usemtl") == SUCCESS)
|
||||
return (OTHER);
|
||||
return INVALID;
|
||||
}
|
||||
|
||||
void parse_append_data_tmp(
|
||||
|
@ -91,11 +99,11 @@ void parse_triangulate2(t_buf_ui *indices, int vertex_count)
|
|||
|
||||
void parse_triangulate_dispatcher(t_env *e, int vertex_count) {
|
||||
if (e->object.properties & VERTEX_FLAG)
|
||||
parse_triangulate(&(e->object.vertices_indices), vertex_count);
|
||||
parse_triangulate(&(e->object.vertices_indices), vertex_count);
|
||||
if (e->object.properties & UV_FLAG)
|
||||
parse_triangulate2(&(e->object.uvs_indices), vertex_count);
|
||||
parse_triangulate2(&(e->object.uvs_indices), vertex_count);
|
||||
if (e->object.properties & NORMAL_FLAG)
|
||||
parse_triangulate(&(e->object.normals_indices), vertex_count);
|
||||
parse_triangulate(&(e->object.normals_indices), vertex_count);
|
||||
}
|
||||
|
||||
void strtrim(char *line) {
|
||||
|
@ -129,7 +137,6 @@ int parse_line(t_env *e, char *line)
|
|||
token_count++;
|
||||
}
|
||||
if (gl_buf_type == INDEX && token_count > 4) {
|
||||
//printf("spongebob squared face\n");
|
||||
parse_triangulate_dispatcher(e, token_count - 1);
|
||||
}
|
||||
return (SUCCESS);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gbrochar <gbrochar@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2020/12/23 17:33:33 by gbrochar #+# #+# */
|
||||
/* Updated: 2024/04/25 16:33:25 by gbrochar ### ########.fr */
|
||||
/* Updated: 2024/10/04 17:47:15 by gbrochar ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -71,6 +71,8 @@ int parse_token(
|
|||
|
||||
if (gl_buf_type == OTHER)
|
||||
ret = BREAK;
|
||||
if (gl_buf_type == INVALID)
|
||||
ret = FAILURE;
|
||||
if (gl_buf_type == VERTEX)
|
||||
ret = parse_append_data_d(&(e->object.vertices), token);
|
||||
if (gl_buf_type == UV && token_count < 3)
|
||||
|
|
Loading…
Reference in New Issue