custom models: envmap support (#3777)

Custom models and model replacements now support environment mapping.

Also fixed some cases in Jak 3 where tfrags had missing textures
(defaulting to texture 0 from tpage 0, which in Jak 3 is the default eye
texture) and replaced them with more suitable alternatives.

Fixes #3776 


https://github.com/user-attachments/assets/7c11b0de-b254-40cb-9719-11238dfb3d43


![image](https://github.com/user-attachments/assets/4cc60b55-4965-4cb8-b29d-096560e7b3aa)


![image](https://github.com/user-attachments/assets/cb46d0d1-57d7-482c-b235-15d0e633f62c)
This commit is contained in:
Hat Kid
2024-11-23 14:32:55 +01:00
committed by GitHub
parent 2ff49b9905
commit c263bc2114
11 changed files with 350 additions and 246 deletions
@@ -2032,6 +2032,20 @@ s32 find_or_add_texture_to_level(u32 combo_tex_id,
if (ok_to_miss) {
// we're missing a texture, just use the first one.
tex_it = tdb.textures.begin();
// some tfrags in jak 3 are missing textures, so we use some suitable
// replacements instead of the default eye texture
static std::map<std::string, std::string> per_level_tex_hacks = {
{"wasintro", "des-rock-01"},
{"intpfall", "common-black"},
{"powergd", "common-black"},
};
auto it = std::find_if(tdb.textures.begin(), tdb.textures.end(),
[&](const std::pair<u32, TextureDB::TextureData> val) {
return val.second.name == per_level_tex_hacks[level_name];
});
if (it != tdb.textures.end()) {
tex_it = it;
}
} else {
ASSERT_MSG(
false,