Added texture data format support
This commit is contained in:
@@ -71,7 +71,7 @@ int32_t TextureTool::start() {
|
||||
|
||||
// Write info
|
||||
char headerBuffer[256];
|
||||
size_t headerBufferLength = sprintf((char *)headerBuffer, "DT_1.00|%i|%i|%i|%i|%i|%i|%i|",
|
||||
size_t headerBufferLength = sprintf((char *)headerBuffer, "DT_2.00|%i|%i|%i|%i|%i|%i|%i|",
|
||||
w,
|
||||
h,
|
||||
4, // RGBA,
|
||||
|
@@ -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:
|
||||
|
@@ -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;
|
||||
}
|
@@ -16,6 +16,7 @@ namespace Dawn {
|
||||
SceneAssetType type;
|
||||
std::string fileName;
|
||||
std::string usageName;
|
||||
std::string ref;
|
||||
};
|
||||
|
||||
class SceneAssetParser : public XmlParser<SceneAsset> {
|
||||
|
Reference in New Issue
Block a user