#ifndef OBJLOAD_H #define OBJLOAD_H #include typedef enum OBJ_RESULT { OBJ_SUCCESS = 0, OBJ_LINE_UNKNOWN, OBJ_NOT_SUPPORTED_LINE, OBJ_NOT_SUPPORTED_UNKNOWN, OBJ_ERROR_UNKNOWN, } OBJRES; typedef struct objload { size_t nvert; float (*vertices)[3]; size_t nnorm; float (*normals)[3]; size_t nuv; float (*uvcoord)[2]; size_t nfaces; struct face { size_t vertidx; size_t normidx; size_t uvidx; } (*faces)[3]; } objload_t; struct obj_struct_metadata { size_t full_sz; size_t vert_off; size_t norm_off; size_t uvtx_off; enum { OBJ_STRUCT_VERT_EXISTS = 1 << 0, OBJ_STRUCT_NORM_EXISTS = 1 << 1, OBJ_STRUCT_UVTX_EXISTS = 1 << 2, OBJ_STRUCT_ALL_EXIST = 7, } exist_flag; }; typedef uint32_t obj_idx; OBJRES obj_load(FILE *fp, objload_t *obj); void obj_free(objload_t obj); OBJRES obj_transfer_raw(objload_t obj, struct obj_struct_metadata metadata, size_t *nvbo, void *vbo); // OBJRES obj_transfer_indxed(objload_t obj, // size_t *nvbo, obj_vbo vbo, // size_t *nidx, obj_idx ibo); #endif