From 30f2fb748307ea32000089cecaff4d0c4e3d5d73 Mon Sep 17 00:00:00 2001 From: jvech Date: Sun, 30 Oct 2022 19:44:00 -0500 Subject: feat: mtl file reading added Bugs to Fix: - Reading from standard input cause segmentation error - If the subsequent line to the last f component is a blank line mverse will throw an error - mtl path finding needs to be improved - shaders must be improved --- src/obj.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/obj.h') diff --git a/src/obj.h b/src/obj.h index 864910f..19a156e 100644 --- a/src/obj.h +++ b/src/obj.h @@ -2,6 +2,7 @@ #define __OBJ__ #define OBJ_LINE_MAX_SIZE 1024 +#define OBJ_MAX_NAME 512 typedef struct { float position[3]; @@ -14,13 +15,25 @@ typedef struct { char type[50]; } Texture; +typedef struct { + char name[OBJ_LINE_MAX_SIZE]; + float ka[3], kd[3], ks[3]; + unsigned int illum; + float ns; +} Material; + typedef struct { Vertex *vertices; - Texture *textures; + Material material; unsigned int *indices; unsigned int indexSize, vertexSize; unsigned int VAO, EBO, VBO; } Mesh; -Mesh * objCreateMesh(const char *filename); +typedef struct { + Mesh *mesh; + unsigned int size; +} Obj; + +Obj objCreate(const char *filename); # endif -- cgit v1.2.3-70-g09d2