mirror of
https://github.com/open-goal/jak-project
synced 2026-08-22 07:04:29 -04:00
[shrub] Fix bug with gs-prim settings (#2899)
Fix the bug described in https://github.com/open-goal/jak-project/issues/2882 where some shrubs are transparent when they shouldn't be. The problem was that we never carefully looked at the settings in `gs-prim`, which has a bit to enable/disable alpha blending entirely. Now it should be correct for both jak 1 and jak 2. To see this change, you'll need to re-extract. Also adds a setting to disable saving texture .pngs, to speed up decompilation. I left it on for jak 1 (to avoid confusion for texture swapping(, but off for jak 2 for now.
This commit is contained in:
+26
-13
@@ -433,7 +433,8 @@ TexturePage read_texture_page(ObjectFileData& data,
|
||||
TPageResultStats process_tpage(ObjectFileData& data,
|
||||
TextureDB& texture_db,
|
||||
const fs::path& output_path,
|
||||
const std::unordered_set<std::string>& animated_textures) {
|
||||
const std::unordered_set<std::string>& animated_textures,
|
||||
bool save_pngs) {
|
||||
TPageResultStats stats;
|
||||
auto& words = data.linked_data.words_by_seg.at(0);
|
||||
const auto& level_names = data.dgo_names;
|
||||
@@ -596,8 +597,10 @@ TPageResultStats process_tpage(ObjectFileData& data,
|
||||
}
|
||||
|
||||
// write texture to a PNG.
|
||||
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
|
||||
tex.w, tex.h);
|
||||
if (save_pngs) {
|
||||
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
|
||||
tex.w, tex.h);
|
||||
}
|
||||
texture_db.add_texture(texture_page.id, tex_id, out, tex.w, tex.h, tex.name,
|
||||
texture_page.name, level_names, tex.num_mips, tex.dest[0]);
|
||||
stats.successful_textures++;
|
||||
@@ -639,8 +642,10 @@ TPageResultStats process_tpage(ObjectFileData& data,
|
||||
}
|
||||
|
||||
// write texture to a PNG.
|
||||
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
|
||||
tex.w, tex.h);
|
||||
if (save_pngs) {
|
||||
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
|
||||
tex.w, tex.h);
|
||||
}
|
||||
texture_db.add_texture(texture_page.id, tex_id, out, tex.w, tex.h, tex.name,
|
||||
texture_page.name, level_names, tex.num_mips, tex.dest[0]);
|
||||
stats.successful_textures++;
|
||||
@@ -664,8 +669,10 @@ TPageResultStats process_tpage(ObjectFileData& data,
|
||||
}
|
||||
|
||||
// write texture to a PNG.
|
||||
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
|
||||
tex.w, tex.h);
|
||||
if (save_pngs) {
|
||||
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
|
||||
tex.w, tex.h);
|
||||
}
|
||||
texture_db.add_texture(texture_page.id, tex_id, out, tex.w, tex.h, tex.name,
|
||||
texture_page.name, level_names, tex.num_mips, tex.dest[0]);
|
||||
stats.successful_textures++;
|
||||
@@ -705,8 +712,10 @@ TPageResultStats process_tpage(ObjectFileData& data,
|
||||
}
|
||||
|
||||
// write texture to a PNG.
|
||||
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
|
||||
tex.w, tex.h);
|
||||
if (save_pngs) {
|
||||
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
|
||||
tex.w, tex.h);
|
||||
}
|
||||
texture_db.add_texture(texture_page.id, tex_id, out, tex.w, tex.h, tex.name,
|
||||
texture_page.name, level_names, tex.num_mips, tex.dest[0]);
|
||||
stats.successful_textures++;
|
||||
@@ -746,8 +755,10 @@ TPageResultStats process_tpage(ObjectFileData& data,
|
||||
}
|
||||
|
||||
// write texture to a PNG.
|
||||
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
|
||||
tex.w, tex.h);
|
||||
if (save_pngs) {
|
||||
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
|
||||
tex.w, tex.h);
|
||||
}
|
||||
texture_db.add_texture(texture_page.id, tex_id, out, tex.w, tex.h, tex.name,
|
||||
texture_page.name, level_names, tex.num_mips, tex.dest[0]);
|
||||
stats.successful_textures++;
|
||||
@@ -771,8 +782,10 @@ TPageResultStats process_tpage(ObjectFileData& data,
|
||||
}
|
||||
|
||||
// write texture to a PNG.
|
||||
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
|
||||
tex.w, tex.h);
|
||||
if (save_pngs) {
|
||||
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
|
||||
tex.w, tex.h);
|
||||
}
|
||||
texture_db.add_texture(texture_page.id, tex_id, out, tex.w, tex.h, tex.name,
|
||||
texture_page.name, level_names, tex.num_mips, tex.dest[0]);
|
||||
stats.successful_textures++;
|
||||
|
||||
Reference in New Issue
Block a user