LDKAssetInfo
typedef struct LDKAssetInfo{
LDKAssetType type;
void *data;
LDKAssetPath asset_path;
u64 load_timestamp;
u64 source_revision;
}LDKAssetInfo;
Create, acquire, query, reload, and release typed runtime assets.
typedef struct LDKAssetInfo{
LDKAssetType type;
void *data;
LDKAssetPath asset_path;
u64 load_timestamp;
u64 source_revision;
}LDKAssetInfo;
Callback invoked for each live asset during enumeration.
typedef bool(*LDKAssetIterFn)(LDKAssetHandle asset, LDKAssetInfo *info, void *user);
assetinfouserTrue if the operation succeeds; false otherwise.
Initialize an asset manager with an asset source and storage capacity.
LDK_API bool ldk_asset_manager_initialize(
LDKAssetManager *manager,
LDKAssetSource *source,
u32 page_capacity,
u32 initial_pages
);
LDKAssetManager *managerLDKAssetSource *sourceu32 page_capacityu32 initial_pagesTrue if the operation succeeds; false otherwise.
Shut down the asset manager.
LDK_API void ldk_asset_manager_terminate(LDKAssetManager *manager);
LDKAssetManager *managerClear manager-owned assets except audio retained by active voices. Audio data still referenced by active voices is retained.
LDK_API void ldk_asset_manager_clear(LDKAssetManager *manager);
LDKAssetManager *managerReturn an invalid handle for the asset handle.
LDK_API LDKAssetHandle ldk_asset_handle_null(void);
An invalid or empty handle.
Check whether the asset handle refers to a live resource.
LDK_API bool ldk_asset_handle_is_alive(
LDKAssetManager *manager,
LDKAssetHandle asset
);
LDKAssetManager *managerLDKAssetHandle assetTrue when the queried condition holds; false otherwise.
Get mutable metadata for an asset handle.
LDK_API LDKAssetInfo * ldk_asset_get_info(
LDKAssetManager *manager,
LDKAssetHandle asset
);
LDKAssetManager *managerLDKAssetHandle assetPointer to the requested object or data; NULL when unavailable.
Get read-only metadata for an asset handle.
LDK_API const LDKAssetInfo * ldk_asset_get_info_const(
LDKAssetManager *manager,
LDKAssetHandle asset
);
LDKAssetManager *managerLDKAssetHandle assetPointer to the requested object or data; NULL when unavailable.
Get the type tag of a live asset.
LDK_API LDKAssetType ldk_asset_get_type(
LDKAssetManager *manager,
LDKAssetHandle asset
);
LDKAssetManager *managerLDKAssetHandle assetHandle to the requested object or resource.
Get the number of currently live asset handles.
LDK_API u32 ldk_asset_alive_count(LDKAssetManager *manager);
LDKAssetManager *managerNumber of matching entries.
Visit active assets with a caller-provided callback.
LDK_API void ldk_asset_foreach(
LDKAssetManager *manager,
LDKAssetIterFn fn,
void *user
);
LDKAssetManager *managerLDKAssetIterFn fnvoid *usertypedef struct LDKAssetTextFileData{
char *text;
u64 byte_count;
}LDKAssetTextFileData;
Return an invalid handle for the asset text file.
LDK_API LDKAssetTextFile ldk_asset_text_file_null(void);
An invalid or empty handle.
Check whether the asset manager text file refers to a live resource.
LDK_API bool ldk_asset_manager_text_file_is_alive(
LDKAssetManager *manager,
LDKAssetTextFile asset
);
LDKAssetManager *managerLDKAssetTextFile assetTrue when the queried condition holds; false otherwise.
Create an in-memory text-file asset by copying source text.
LDK_API LDKAssetTextFile ldk_asset_manager_text_file_create(
LDKAssetManager *manager,
const char *text,
u64 byte_count
);
LDKAssetManager *managerconst char *textu64 byte_countHandle to the requested object or resource.
Load the asset manager text file.
LDK_API LDKAssetTextFile ldk_asset_manager_text_file_load(
LDKAssetManager *manager,
const char *path
);
LDKAssetManager *managerconst char *pathHandle to the requested object or resource.
Unload the asset manager text file.
LDK_API void ldk_asset_manager_text_file_unload(
LDKAssetManager *manager,
LDKAssetTextFile asset
);
LDKAssetManager *managerLDKAssetTextFile assetGet the asset manager text file.
LDK_API LDKAssetTextFileData * ldk_asset_manager_text_file_get(
LDKAssetManager *manager,
LDKAssetTextFile asset
);
LDKAssetManager *managerLDKAssetTextFile assetPointer to the requested object or data; NULL when unavailable.
Get read-only access to the asset manager text file.
LDK_API const LDKAssetTextFileData * ldk_asset_manager_text_file_get_const(
LDKAssetManager *manager,
LDKAssetTextFile asset
);
LDKAssetManager *managerLDKAssetTextFile assetPointer to the requested object or data; NULL when unavailable.
typedef struct LDKAssetKeyframeAnimationData{
LDKKeyframeAnimation clip;
}LDKAssetKeyframeAnimationData;
Return an invalid keyframe-animation asset handle.
LDK_API LDKAssetKeyframeAnimation ldk_asset_keyframe_animation_null(void);
Null handle.
Check whether a handle refers to a live keyframe-animation asset.
LDK_API bool ldk_asset_manager_keyframe_animation_is_alive(
LDKAssetManager *manager,
LDKAssetKeyframeAnimation asset
);
LDKAssetManager *managerLDKAssetKeyframeAnimation assetTrue only for a currently alive asset of the expected type.
Create a transient, manager-owned keyframe asset from a code-authored clip.
LDK_API LDKAssetKeyframeAnimation ldk_asset_manager_keyframe_animation_create(
LDKAssetManager *manager,
const LDKKeyframeAnimation *clip
);
LDKAssetManager *managerconst LDKKeyframeAnimation *clipLive asset handle on success, null handle on failure. Clip is deep-copied. Note: The created asset has no path and is not automatically scene-persistent.
Destroy a keyframe-animation asset and invalidate its handle.
LDK_API void ldk_asset_manager_keyframe_animation_unload(
LDKAssetManager *manager,
LDKAssetKeyframeAnimation asset
);
LDKAssetManager *managerLDKAssetKeyframeAnimation assetNothing. Detach it from all animation sources first.
Load or reuse a version-2 .anim asset by path and source revision.
LDK_API LDKAssetKeyframeAnimation ldk_asset_manager_keyframe_animation_load_shared(
LDKAssetManager *manager,
const char *path
);
LDKAssetManager *managerconst char *pathLive shared handle, or null on failure. Owned by the manager.
Reload a cached shared animation asset from its source.
LDK_API bool ldk_asset_manager_keyframe_animation_reload(
LDKAssetManager *manager,
const char *path
);
LDKAssetManager *managerconst char *pathTrue on successful refresh or if not cached; false on I/O or parsing errors.
Get immutable animation data for a live keyframe asset handle.
LDK_API const LDKAssetKeyframeAnimationData * ldk_asset_manager_keyframe_animation_get_const(
LDKAssetManager *manager,
LDKAssetKeyframeAnimation asset
);
LDKAssetManager *managerLDKAssetKeyframeAnimation assetBorrowed pointer or NULL. Invalidated when the asset is unloaded or reloaded.
typedef struct LDKAssetTextureAtlasData{
LDKTextureAtlas atlas;
LDKAssetImage image;
u64 revision;
}LDKAssetTextureAtlasData;
Return an invalid handle for the asset texture atlas.
LDK_API LDKAssetTextureAtlas ldk_asset_texture_atlas_null(void);
An invalid or empty handle.
Check whether the asset manager texture atlas refers to a live resource.
LDK_API bool ldk_asset_manager_texture_atlas_is_alive(
LDKAssetManager *manager,
LDKAssetTextureAtlas asset
);
LDKAssetManager *managerLDKAssetTextureAtlas assetTrue when the queried condition holds; false otherwise.
Create the asset manager texture atlas.
LDK_API LDKAssetTextureAtlas ldk_asset_manager_texture_atlas_create(
LDKAssetManager *manager,
const LDKTextureAtlas *atlas
);
LDKAssetManager *managerconst LDKTextureAtlas *atlasHandle to the requested object or resource.
Load or reuse shared the asset manager texture atlas.
LDK_API LDKAssetTextureAtlas ldk_asset_manager_texture_atlas_load_shared(
LDKAssetManager *manager,
const char *path
);
LDKAssetManager *managerconst char *pathHandle to the requested object or resource.
Reload the asset manager texture atlas.
LDK_API bool ldk_asset_manager_texture_atlas_reload(
LDKAssetManager *manager,
const char *path
);
LDKAssetManager *managerconst char *pathTrue if the operation succeeds; false otherwise.
Unload the asset manager texture atlas.
LDK_API void ldk_asset_manager_texture_atlas_unload(
LDKAssetManager *manager,
LDKAssetTextureAtlas asset
);
LDKAssetManager *managerLDKAssetTextureAtlas assetGet read-only access to the asset manager texture atlas.
LDK_API const LDKAssetTextureAtlasData * ldk_asset_manager_texture_atlas_get_const(
LDKAssetManager *manager,
LDKAssetTextureAtlas asset
);
LDKAssetManager *managerLDKAssetTextureAtlas assetPointer to the requested object or data; NULL when unavailable.
typedef struct LDKAssetImageData{
LDKImage *image;
bool is_missing;
}LDKAssetImageData;
Return an invalid handle for the asset image.
LDK_API LDKAssetImage ldk_asset_image_null(void);
An invalid or empty handle.
Check whether the asset manager image refers to a live resource.
LDK_API bool ldk_asset_manager_image_is_alive(
LDKAssetManager *manager,
LDKAssetImage asset
);
LDKAssetManager *managerLDKAssetImage assetTrue when the queried condition holds; false otherwise.
Create the asset manager image.
LDK_API LDKAssetImage ldk_asset_manager_image_create(
LDKAssetManager *manager,
u32 width,
u32 height,
const void *pixels
);
LDKAssetManager *manageru32 widthu32 heightconst void *pixelsHandle to the requested object or resource.
Create an image asset using an explicit pixel format.
LDK_API LDKAssetImage ldk_asset_manager_image_create_format(
LDKAssetManager *manager,
u32 width,
u32 height,
LDKImageFormat format,
const void *pixels
);
LDKAssetManager *manageru32 widthu32 heightLDKImageFormat formatconst void *pixelsHandle to the requested object or resource.
Load the asset manager image.
LDK_API LDKAssetImage ldk_asset_manager_image_load(
LDKAssetManager *manager,
const char *path
);
LDKAssetManager *managerconst char *pathHandle to the requested object or resource.
Load or reuse shared the asset manager image.
LDK_API LDKAssetImage ldk_asset_manager_image_load_shared(
LDKAssetManager *manager,
const char *path
);
LDKAssetManager *managerconst char *pathHandle to the requested object or resource.
Create or retrieve a missing-image placeholder asset.
LDK_API LDKAssetImage ldk_asset_manager_image_missing(
LDKAssetManager *manager,
const char *path
);
LDKAssetManager *managerconst char *pathHandle to the requested object or resource.
Unload the asset manager image.
LDK_API void ldk_asset_manager_image_unload(
LDKAssetManager *manager,
LDKAssetImage asset
);
LDKAssetManager *managerLDKAssetImage assetGet the asset manager image.
LDK_API LDKAssetImageData * ldk_asset_manager_image_get(
LDKAssetManager *manager,
LDKAssetImage asset
);
LDKAssetManager *managerLDKAssetImage assetPointer to the requested object or data; NULL when unavailable.
Get read-only access to the asset manager image.
LDK_API const LDKAssetImageData * ldk_asset_manager_image_get_const(
LDKAssetManager *manager,
LDKAssetImage asset
);
LDKAssetManager *managerLDKAssetImage assetPointer to the requested object or data; NULL when unavailable.
typedef struct LDKAssetFontData{
LDKFontFace *face;
}LDKAssetFontData;
Return an invalid handle for the asset font.
LDK_API LDKAssetFont ldk_asset_font_null(void);
An invalid or empty handle.
Check whether the asset manager font refers to a live resource.
LDK_API bool ldk_asset_manager_font_is_alive(
LDKAssetManager *manager,
LDKAssetFont asset
);
LDKAssetManager *managerLDKAssetFont assetTrue when the queried condition holds; false otherwise.
Create the asset manager font.
LDK_API LDKAssetFont ldk_asset_manager_font_create(
LDKAssetManager *manager,
const void *data,
u32 data_size
);
LDKAssetManager *managerconst void *datau32 data_sizeHandle to the requested object or resource.
Load the asset manager font.
LDK_API LDKAssetFont ldk_asset_manager_font_load(
LDKAssetManager *manager,
const char *path
);
LDKAssetManager *managerconst char *pathHandle to the requested object or resource.
Load or reuse shared the asset manager font.
LDK_API LDKAssetFont ldk_asset_manager_font_load_shared(
LDKAssetManager *manager,
const char *path
);
LDKAssetManager *managerconst char *pathHandle to the requested object or resource.
Unload the asset manager font.
LDK_API void ldk_asset_manager_font_unload(
LDKAssetManager *manager,
LDKAssetFont asset
);
LDKAssetManager *managerLDKAssetFont assetGet the asset manager font.
LDK_API LDKAssetFontData * ldk_asset_manager_font_get(
LDKAssetManager *manager,
LDKAssetFont asset
);
LDKAssetManager *managerLDKAssetFont assetPointer to the requested object or data; NULL when unavailable.
Get read-only access to the asset manager font.
LDK_API const LDKAssetFontData * ldk_asset_manager_font_get_const(
LDKAssetManager *manager,
LDKAssetFont asset
);
LDKAssetManager *managerLDKAssetFont assetPointer to the requested object or data; NULL when unavailable.
typedef struct LDKAssetAudioData{
LDKAssetSourceFile source_file;
void *encoded_data;
u64 encoded_size;
u32 ref_count;
}LDKAssetAudioData;
Return an invalid handle for the asset audio.
LDK_API LDKAssetAudio ldk_asset_audio_null(void);
An invalid or empty handle.
Check whether the asset manager audio refers to a live resource.
LDK_API bool ldk_asset_manager_audio_is_alive(
LDKAssetManager *manager,
LDKAssetAudio asset
);
LDKAssetManager *managerLDKAssetAudio assetTrue when the queried condition holds; false otherwise.
Load or reuse shared the asset manager audio.
LDK_API LDKAssetAudio ldk_asset_manager_audio_load_shared(
LDKAssetManager *manager,
const char *path
);
LDKAssetManager *managerconst char *pathHandle to the requested object or resource.
Get the asset manager audio.
LDK_API LDKAssetAudioData * ldk_asset_manager_audio_get(
LDKAssetManager *manager,
LDKAssetAudio asset
);
LDKAssetManager *managerLDKAssetAudio assetPointer to the requested object or data; NULL when unavailable.
Get read-only access to the asset manager audio.
LDK_API const LDKAssetAudioData * ldk_asset_manager_audio_get_const(
LDKAssetManager *manager,
LDKAssetAudio asset
);
LDKAssetManager *managerLDKAssetAudio assetPointer to the requested object or data; NULL when unavailable.
typedef struct LDKAssetMeshEntry{
char name[LDK_MESH_NAME_CAPACITY];
LDKMeshData mesh;
LDKMeshSubmesh *submeshes;
u32 submesh_count;
LDKMeshMaterialSlot *material_slots;
u32 material_slot_count;
}LDKAssetMeshEntry;
typedef struct LDKAssetMeshData{
LDKMeshData mesh;
LDKMeshPrimitive primitive;
LDKAssetMeshEntry *meshes;
u32 mesh_count;
LDKMeshNode *nodes;
u32 node_count;
}LDKAssetMeshData;
Return an invalid handle for the asset mesh.
LDK_API LDKAssetMesh ldk_asset_mesh_null(void);
An invalid or empty handle.
Check whether the asset manager mesh refers to a live resource.
LDK_API bool ldk_asset_manager_mesh_is_alive(
LDKAssetManager *manager,
LDKAssetMesh asset
);
LDKAssetManager *managerLDKAssetMesh assetTrue when the queried condition holds; false otherwise.
Create the asset manager mesh.
LDK_API LDKAssetMesh ldk_asset_manager_mesh_create(
LDKAssetManager *manager,
const LDKMeshVertex *vertices,
u32 vertex_count,
const u32 *indices,
u32 index_count
);
LDKAssetManager *managerconst LDKMeshVertex *verticesu32 vertex_countconst u32 *indicesu32 index_countHandle to the requested object or resource.
Unload the asset manager mesh.
LDK_API void ldk_asset_manager_mesh_unload(
LDKAssetManager *manager,
LDKAssetMesh asset
);
LDKAssetManager *managerLDKAssetMesh assetGet the asset manager mesh.
LDK_API LDKAssetMeshData * ldk_asset_manager_mesh_get(
LDKAssetManager *manager,
LDKAssetMesh asset
);
LDKAssetManager *managerLDKAssetMesh assetPointer to the requested object or data; NULL when unavailable.
Get read-only access to the asset manager mesh.
LDK_API const LDKAssetMeshData * ldk_asset_manager_mesh_get_const(
LDKAssetManager *manager,
LDKAssetMesh asset
);
LDKAssetManager *managerLDKAssetMesh assetPointer to the requested object or data; NULL when unavailable.