diff options
author | quou <quou@disroot.org> | 2024-12-28 18:27:30 +1100 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-12-28 18:27:30 +1100 |
commit | e31535abfff4c3335dd465e3745a69d3102253a6 (patch) | |
tree | 48ff456b34ea295e3ea45c54cb0c97820f0290ec /model.hpp | |
parent | 86810460eed75c19beb9f524e75c193edfa9ddfd (diff) |
converting, loading and rendering GLTF models
Diffstat (limited to 'model.hpp')
-rw-r--r-- | model.hpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/model.hpp b/model.hpp new file mode 100644 index 0000000..d4c4be3 --- /dev/null +++ b/model.hpp @@ -0,0 +1,39 @@ +#ifndef model_hpp +#define model_hpp + +#include "asset.hpp" +#include "video.hpp" + +struct Mesh { + int offset, vbo_offset, count; + int parent; + Shader_Id shader; +}; + +struct Model : public Asset { + Buffer_Id vbo; + Buffer_Id ibo; + int mesh_count; + + Mesh* get_meshes() { + return (Mesh*)&this[1]; + } + + void destroy(Device* dev); + void render( + Device* dev, + Arena* a, + Render_Pass& pass, + Buffer_Id config + ); +}; + +struct Model_Loader : public Asset_Loader { + Device* dev; + Asset_Arena* shaders; + void init(Device* device, Asset_Arena* shader_arena); + Asset* load(Arena* a, Arena* s, Pack_File* f) override; + void unload(Asset* a); +}; + +#endif |