diff options
Diffstat (limited to 'tools/asset_packer.cc')
| -rw-r--r-- | tools/asset_packer.cc | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/tools/asset_packer.cc b/tools/asset_packer.cc index 7e186b6..0d48906 100644 --- a/tools/asset_packer.cc +++ b/tools/asset_packer.cc @@ -80,9 +80,8 @@ static bool ParseProceduralParams(const std::string& params_str, // Helper struct to hold all information about an asset during parsing struct AssetBuildInfo { std::string name; - std::string filename; // Original filename for static assets - bool is_procedural; - bool is_gpu_procedural; + std::string filename; // Original filename for static assets + std::string asset_type; // "STATIC", "PROC", "PROC_GPU", "MP3" std::string proc_func_name; // Function name string std::vector<float> proc_params; // Parameters for procedural function @@ -439,21 +438,23 @@ int main(int argc, char* argv[]) { info.data_array_name = "ASSET_DATA_" + info.name; info.params_array_name = "ASSET_PROC_PARAMS_" + info.name; info.func_name_str_name = "ASSET_PROC_FUNC_STR_" + info.name; - info.is_procedural = false; - info.is_gpu_procedural = false; + info.asset_type = "STATIC"; if (compression_type_str.rfind("PROC_GPU(", 0) == 0) { - info.is_procedural = true; - info.is_gpu_procedural = true; + info.asset_type = "PROC_GPU"; if (!ParseProceduralFunction(compression_type_str, &info, true)) { return 1; } } else if (compression_type_str.rfind("PROC(", 0) == 0) { - info.is_procedural = true; - info.is_gpu_procedural = false; + info.asset_type = "PROC"; if (!ParseProceduralFunction(compression_type_str, &info, false)) { return 1; } + } else if (compression_type_str == "MP3") { + info.asset_type = "MP3"; + } else if (compression_type_str != "NONE") { + fprintf(stderr, "Warning: Unknown compression type '%s' for asset: %s\n", + compression_type_str.c_str(), info.name.c_str()); } asset_build_infos.push_back(info); @@ -479,7 +480,7 @@ int main(int argc, char* argv[]) { std::fclose(assets_h_file); for (const auto& info : asset_build_infos) { - if (!info.is_procedural) { + if (info.asset_type != "PROC" && info.asset_type != "PROC_GPU") { std::string base_dir = assets_txt_path.substr(0, assets_txt_path.find_last_of("/\\") + 1); std::filesystem::path base_path = std::filesystem::absolute(base_dir); @@ -542,15 +543,16 @@ int main(int argc, char* argv[]) { fprintf(assets_data_cc_file, " static const AssetRecord assets[] = {\n"); for (const auto& info : asset_build_infos) { fprintf(assets_data_cc_file, " { "); - if (info.is_procedural) { - fprintf(assets_data_cc_file, "nullptr, 0, true, %s, %s, %s, %zu", - info.is_gpu_procedural ? "true" : "false", + if (info.asset_type == "PROC" || info.asset_type == "PROC_GPU") { + fprintf(assets_data_cc_file, "nullptr, 0, AssetType::%s, %s, %s, %zu", + info.asset_type.c_str(), info.func_name_str_name.c_str(), info.params_array_name.c_str(), info.proc_params.size()); } else { fprintf(assets_data_cc_file, - "%s, ASSET_SIZE_%s, false, false, nullptr, nullptr, 0", - info.data_array_name.c_str(), info.name.c_str()); + "%s, ASSET_SIZE_%s, AssetType::%s, nullptr, nullptr, 0", + info.data_array_name.c_str(), info.name.c_str(), + info.asset_type.c_str()); } fprintf(assets_data_cc_file, " },\n"); } |
