#pragma once #include #include #include "animation.h" #include "util.h" #include "util_image.h" // NOTE: wrapper tinygltf https://github.com/syoyo/tinygltf // https://github.com/KhronosGroup/glTF struct mesh { GLenum draw_mode; // NOTE: GL_LINES, GL_TRIANGLES GLenum usage; // NOTE: GL_STATIC_DRAW, GL_DYNAMIC_DRAW uint num_vertices; uint num_indices; glm::vec3* vertices; glm::vec3* normals; uint* indices; // FIXME: will have to use vec2 here to be able to use memcpy // this will break render_object::initGLFLoatBuffer logic which expects // vec3 glm::vec2* texture_coords; glm::mat4* xform; }; #define MAX_PATH_SIZE 256 struct model { uint num_meshes; char* filepath; uint64_t filepath_hash; mesh* meshes; // NOTE: fixed sized array // NOTE: pointer to a texture in render_state->textures util_image* diffuse_texture; // FIXME: node_animation has a pointer to a render_object. need to decouple // that somehow //node_animation* node_anim; }; struct model_assets { model* models; uint count; uint max; }; model_assets* assetInitBlock(memory_arena* arena, uint asset_count); model* assetLoadFromFile(model_assets* assets, memory_arena* arena, const char* filename);