FInished porting last asset loader types

This commit is contained in:
2026-05-30 07:59:06 -05:00
parent 0bcde064af
commit 3271e8c7d6
11 changed files with 164 additions and 28 deletions
@@ -11,10 +11,40 @@
#include "util/endian.h"
#include "util/memory.h"
#include "asset/loader/assetloading.h"
#include "asset/loader/assetentry.h"
errorret_t assetMeshLoaderNEW(assetloading_t *loading) {
assertNotNull(loading, "Loading cannot be NULL");
assertTrue(loading->type == ASSET_LOADER_TYPE_MESH, "Invalid type.");
assetmeshoutput_t *out = &loading->entry->data.mesh;
assetfile_t *file = &loading->loading.mesh.file;
assetmeshloaderparams_t params = {
.outMesh = &out->mesh,
.outVertices = &out->vertices,
.inputAxis = loading->entry->input->mesh
};
errorChain(assetFileInit(file, loading->entry->name, NULL, &params));
errorChain(assetMeshLoader(file));
assetFileDispose(file);
errorOk();
}
errorret_t assetMeshDisposeNEW(assetentry_t *entry) {
assertNotNull(entry, "Asset entry cannot be NULL");
assertTrue(entry->type == ASSET_LOADER_TYPE_MESH, "Invalid type.");
errorChain(meshDispose(&entry->data.mesh.mesh));
memoryFree(entry->data.mesh.vertices);
errorOk();
}
errorret_t assetMeshLoader(assetfile_t *file) {
assertNotNull(file, "Asset file cannot be null");
assetmeshoutput_t *output = (assetmeshoutput_t *)file->output;
assetmeshloaderparams_t *output = (assetmeshloaderparams_t *)file->output;
assertNotNull(output, "Output cannot be null");
assertNotNull(output->outMesh, "Output mesh cannot be null");
assertNotNull(output->outVertices, "Output vertices cannot be null");