Changed Asset struct name tot AssetStruct to avoid name collisions with the Asset namespace

Signed-off-by: Robear Selwans <robear.selwans@outlook.com>
This commit is contained in:
2021-07-01 22:49:00 +02:00
parent b084a83644
commit 574eb3590e
7 changed files with 13 additions and 13 deletions

View File

@@ -14,7 +14,7 @@ ImageAsset
ev_imageloader_loadasset( ev_imageloader_loadasset(
AssetHandle handle) AssetHandle handle)
{ {
const Asset *asset = ev_asset_getfromhandle(handle); const AssetStruct *asset = ev_asset_getfromhandle(handle);
uint32_t jsonLength = ((U32*)asset->data)[0]; uint32_t jsonLength = ((U32*)asset->data)[0];
uint32_t blobLength = ((U32*)asset->data)[1]; uint32_t blobLength = ((U32*)asset->data)[1];

View File

@@ -10,7 +10,7 @@ JSONAsset
ev_jsonloader_loadasset( ev_jsonloader_loadasset(
AssetHandle handle) AssetHandle handle)
{ {
const Asset *asset = ev_asset_getfromhandle(handle); const AssetStruct *asset = ev_asset_getfromhandle(handle);
JSONAsset inter = (JSONAsset) { JSONAsset inter = (JSONAsset) {
.json_data = evjs_init(), .json_data = evjs_init(),
}; };

View File

@@ -8,14 +8,14 @@ typedef struct {
U32 ref_count; U32 ref_count;
U32 ticks_left; U32 ticks_left;
} Asset; } AssetStruct;
static struct { static struct {
GenericHandle assetType; GenericHandle assetType;
} LoaderData; } LoaderData;
const Asset * const AssetStruct *
ev_asset_getfromhandle( ev_asset_getfromhandle(
AssetHandle handle); AssetHandle handle);

View File

@@ -17,7 +17,7 @@ MeshAsset
ev_meshloader_loadasset( ev_meshloader_loadasset(
AssetHandle handle) AssetHandle handle)
{ {
const Asset *asset = ev_asset_getfromhandle(handle); const AssetStruct *asset = ev_asset_getfromhandle(handle);
uint32_t jsonLength = ((U32*)asset->data)[0]; uint32_t jsonLength = ((U32*)asset->data)[0];
uint32_t blobLength = ((U32*)asset->data)[1]; uint32_t blobLength = ((U32*)asset->data)[1];

View File

@@ -55,7 +55,7 @@ ev_shaderloader_loadasset(
CONST_STR entrypoint, CONST_STR entrypoint,
CompiledShaderType type) CompiledShaderType type)
{ {
const Asset *asset = ev_asset_getfromhandle(handle); const AssetStruct *asset = ev_asset_getfromhandle(handle);
ShaderCompilationFn compilation_fn = ShaderCompilationFn compilation_fn =
(type == EV_SHADER_BIN) (type == EV_SHADER_BIN)
?(ShaderCompilationFn)shaderc_compile_into_spv: ?(ShaderCompilationFn)shaderc_compile_into_spv:

View File

@@ -9,7 +9,7 @@ TextAsset
ev_textloader_loadasset( ev_textloader_loadasset(
AssetHandle handle) AssetHandle handle)
{ {
const Asset *asset = ev_asset_getfromhandle(handle); const AssetStruct *asset = ev_asset_getfromhandle(handle);
TextAsset inter = (TextAsset) { TextAsset inter = (TextAsset) {
.text = evstring_new(asset->data), .text = evstring_new(asset->data),
}; };

View File

@@ -38,7 +38,7 @@ void
onRemoveAssetComponent( onRemoveAssetComponent(
ECSQuery query) ECSQuery query)
{ {
Asset *assets = ECS->getQueryColumn(query, sizeof(Asset), 1); AssetStruct *assets = ECS->getQueryColumn(query, sizeof(AssetStruct), 1);
for(U32 i = 0; i < ECS->getQueryMatchCount(query); i++) { for(U32 i = 0; i < ECS->getQueryMatchCount(query); i++) {
aligned_free(assets[i].data); aligned_free(assets[i].data);
} }
@@ -108,7 +108,7 @@ EV_CONSTRUCTOR
if(AssetECS) { if(AssetECS) {
AssetManagerData.world = AssetECS->newWorld(); AssetManagerData.world = AssetECS->newWorld();
AssetManagerData.assetcomponent_id = AssetECS->registerComponent("Asset", sizeof(Asset), EV_ALIGNOF(Asset)); AssetManagerData.assetcomponent_id = AssetECS->registerComponent("Asset", sizeof(AssetStruct), EV_ALIGNOF(AssetStruct));
AssetECS->setOnRemoveTrigger("AssetComponentOnRemove", "Asset", onRemoveAssetComponent); AssetECS->setOnRemoveTrigger("AssetComponentOnRemove", "Asset", onRemoveAssetComponent);
ev_textloader_setassettype(AssetECS->registerComponent("TextAsset", sizeof(TextAsset), EV_ALIGNOF(TextAsset))); ev_textloader_setassettype(AssetECS->registerComponent("TextAsset", sizeof(TextAsset), EV_ALIGNOF(TextAsset)));
@@ -155,7 +155,7 @@ ev_asset_load(
{ {
assetsys_file_t file; assetsys_file_t file;
AssetSysCheck("Failed to find file %s. ", (path), assetsys_file(AssetManagerData.sys, path, &file)); AssetSysCheck("Failed to find file %s. ", (path), assetsys_file(AssetManagerData.sys, path, &file));
Asset a; AssetStruct a;
a.size = (I64)assetsys_file_size(AssetManagerData.sys, file); a.size = (I64)assetsys_file_size(AssetManagerData.sys, file);
a.data = aligned_malloc(a.size + 1, 16); a.data = aligned_malloc(a.size + 1, 16);
int loaded_size = 0; int loaded_size = 0;
@@ -175,7 +175,7 @@ AssetHandle
ev_asset_clonehandle( ev_asset_clonehandle(
AssetHandle handle) AssetHandle handle)
{ {
Asset *asset = AssetECS->getComponent(AssetManagerData.world, handle, AssetManagerData.assetcomponent_id); AssetStruct *asset = AssetECS->getComponent(AssetManagerData.world, handle, AssetManagerData.assetcomponent_id);
asset->ref_count++; asset->ref_count++;
return handle; return handle;
@@ -185,7 +185,7 @@ void
ev_asset_free( ev_asset_free(
AssetHandle handle) AssetHandle handle)
{ {
Asset *asset = AssetECS->getComponent(AssetManagerData.world, handle, AssetManagerData.assetcomponent_id); AssetStruct *asset = AssetECS->getComponent(AssetManagerData.world, handle, AssetManagerData.assetcomponent_id);
asset->ref_count--; asset->ref_count--;
if(asset->ref_count == 0) { if(asset->ref_count == 0) {
AssetECS->destroyEntity(AssetManagerData.world, handle); AssetECS->destroyEntity(AssetManagerData.world, handle);
@@ -225,7 +225,7 @@ ev_assetmanager_stopwatching(
filewatch_stop_watching(AssetManagerData.fwatch, path); filewatch_stop_watching(AssetManagerData.fwatch, path);
} }
const Asset * const AssetStruct *
ev_asset_getfromhandle( ev_asset_getfromhandle(
AssetHandle handle) AssetHandle handle)
{ {