59 lines
1.7 KiB
C
59 lines
1.7 KiB
C
/**
|
|
* Copyright (c) 2026 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "error/error.h"
|
|
#include "display/color.h"
|
|
|
|
typedef struct assetloading_s assetloading_t;
|
|
typedef struct assetentry_s assetentry_t;
|
|
|
|
typedef enum {
|
|
ASSET_MODEL_LOADING_STATE_INITIAL,
|
|
ASSET_MODEL_LOADING_STATE_LOCK_ASSETS
|
|
} assetmodelloadingstate_t;
|
|
|
|
typedef struct {
|
|
assetmodelloadingstate_t state;
|
|
} assetmodelloaderloading_t;
|
|
|
|
typedef struct {
|
|
assetentry_t *meshEntry;
|
|
assetentry_t *texEntry;
|
|
color_t color;
|
|
} assetmodeloutput_t;
|
|
|
|
/**
|
|
* Async loader stub for model assets. Model loading is performed entirely
|
|
* on the main thread; this callback is never reached.
|
|
*
|
|
* @param loading Loading information for the asset being loaded.
|
|
* @returns Always success.
|
|
*/
|
|
errorret_t assetModelLoaderAsync(assetloading_t *loading);
|
|
|
|
/**
|
|
* Synchronous loader for model assets. Locks the JSON descriptor file as
|
|
* a sub-asset, waits for it to load, parses the mesh path, optional
|
|
* texture path, and color tint, then releases the JSON entry. Locks and
|
|
* waits for mesh and optional texture sub-assets sequentially to stay
|
|
* within ASSET_LOADING_COUNT_MAX slot limits.
|
|
*
|
|
* @param loading Loading information for the asset being loaded.
|
|
* @returns Error code indicating success or failure.
|
|
*/
|
|
errorret_t assetModelLoaderSync(assetloading_t *loading);
|
|
|
|
/**
|
|
* Disposer for model assets. Releases the locks on the mesh and texture
|
|
* sub-asset entries.
|
|
*
|
|
* @param entry Asset entry containing the model to dispose.
|
|
* @returns Error code indicating success or failure.
|
|
*/
|
|
errorret_t assetModelDispose(assetentry_t *entry);
|