summaryrefslogtreecommitdiff
path: root/src/engine/ModelLoader.h
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2025-01-09 23:46:18 -0700
committerGitHub <noreply@github.com>2025-01-09 23:46:18 -0700
commitaaba052407728b2f13d11900f2e81a85991c1a91 (patch)
tree91d14b8c162a79d7c019454a36374bb3d25a77f4 /src/engine/ModelLoader.h
parent29872e43c7a98550cfa2f896bdc61589f383d705 (diff)
Impl ModelLoader (#150)
* Impl modelloader
Diffstat (limited to 'src/engine/ModelLoader.h')
-rw-r--r--src/engine/ModelLoader.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/engine/ModelLoader.h b/src/engine/ModelLoader.h
new file mode 100644
index 000000000..e89c7c457
--- /dev/null
+++ b/src/engine/ModelLoader.h
@@ -0,0 +1,63 @@
+#pragma once
+
+#include <libultraship.h>
+#include "engine/courses/Course.h"
+
+extern "C" {
+#include "common_structs.h"
+}
+
+class Course;
+
+/**
+ *
+ * Lists are deferred until load time so that models that use the same course may all use the same extraction
+ *
+ * Note ensure that the buffers passed to LoadModelList are big enough for the requested data.
+ *
+ * This class should only be ran once.
+ *
+ *
+ * Usage:
+ *
+ * ModelLoader::LoadModelList bowserStatueList = {
+ .course = gBowsersCastle,
+ .gfxBuffer = &gBowserStatueGfx[0],
+ .gfxBufferSize = 162,
+ .gfxStart = (0x2BB8 / 8), // This is 0x2BB8 / sizeof(N64Gfx) not sizeof(Gfx)
+ .vtxBuffer = &gBowserStatueVtx[0],
+ .vtxBufferSize = 717,
+ .vtxStart = 1942,
+ };
+ *
+ * gModelLoader.Add(bowserStatueList);
+ */
+
+class ModelLoader {
+
+public:
+ struct LoadModelList {
+ Course* course;
+
+ Gfx* gfxBuffer; // buffer for output gfx
+ size_t gfxBufferSize;
+ size_t gfxStart; // The starting point to extract data in NumGfx
+
+ Vtx* vtxBuffer; // buffer for output vtx
+ size_t vtxBufferSize;
+ size_t vtxStart; // The starting point to extract data in NumVtx
+ };
+
+ void Add(LoadModelList list);
+ void Load();
+private:
+ struct CourseMap {
+
+ };
+
+ void Extract(Course* course);
+ void UpdateVtx(LoadModelList list);
+
+ std::vector<LoadModelList> _deferredList;
+ bool _hasRan = false;
+};