Added texture data format support

This commit is contained in:
2023-06-20 08:35:28 -07:00
parent 9aa6a0f529
commit 0b26b5a06a
20 changed files with 156 additions and 43 deletions

View File

@@ -16,17 +16,24 @@ void SceneAssetGenerator::generate(
std::string tabs
) {
std::string assetType = "";
asset->usageName = "asset" + std::to_string(assetNumber++);
if(asset->ref.empty()) {
asset->usageName = "asset" + std::to_string(assetNumber++);
} else {
asset->usageName = asset->ref;
}
switch(asset->type) {
case SCENE_ASSET_TYPE_TEXTURE:
assetType = "TextureAsset";
assetMap[asset->fileName] = "&" + asset->usageName + "->texture";
assetMap[asset->usageName] = "&" + asset->usageName + "->texture";
break;
case SCENE_ASSET_TYPE_TRUETYPE_FONT:
assetType = "TrueTypeAsset";
assetMap[asset->fileName] = "&" + asset->usageName + "->font";
assetMap[asset->usageName] = "&" + asset->usageName + "->font";
break;
default:

View File

@@ -12,7 +12,9 @@ std::vector<std::string> SceneAssetParser::getRequiredAttributes() {
}
std::map<std::string, std::string> SceneAssetParser::getOptionalAttributes() {
return { };
return {
{ "ref", "" }
};
}
int32_t SceneAssetParser::onParse(
@@ -31,6 +33,8 @@ int32_t SceneAssetParser::onParse(
*error = "Unknown asset type '" + values["type"] + "'";
return 1;
}
out->ref = values["ref"];
return 0;
}

View File

@@ -16,6 +16,7 @@ namespace Dawn {
SceneAssetType type;
std::string fileName;
std::string usageName;
std::string ref;
};
class SceneAssetParser : public XmlParser<SceneAsset> {