refactor: 移除贴图文件名探测——资产读取保持确定性

按用户决定:OBJ/FBX 按材质定义(MTL/assimp 槽位)写死读取,
不做文件名猜测补槽;贴图缺失走默认纹理 + INFO 日志可见。
补槽职责归将来手动材质编辑接口。
This commit is contained in:
2026-09-23 19:51:03 +08:00
parent 2b875c9284
commit 960bdf2662
+2 -22
View File
@@ -280,28 +280,8 @@ Scope<Mesh> Model::ProcessMesh(aiMesh* mesh, const aiScene* scene)
texPaths[slot] = (modelDir / path.C_Str()).string();
}
}
// OBJ 常见导出遗漏:PBR 贴图在目录里但 MTL 未引用
//(backpack 的 roughness.jpg/ao.jpg 正是如此)。
// 约定文件名探测补槽,命中留 INFO 锚点
if (!m_IsGltf) {
const std::pair<const char*, Material::Slot> probes[] = {
{"roughness", Material::MetallicRoughness},
{"ao", Material::Ao},
{"occlusion", Material::Ao},
};
for (const auto& [stem, slot] : probes) {
if (!texPaths[slot].empty()) continue;
for (const char* ext : {".jpg", ".png"}) {
std::filesystem::path p = modelDir / (std::string(stem) + ext);
if (std::filesystem::exists(p)) {
texPaths[slot] = p.string();
ENGINE_INFO("Probed {} texture: {}", stem, p.string());
break;
}
}
}
}
// 注:不做文件名探测/自动补槽——资产缺什么就是什么;
// 补槽是将来手动材质编辑的职责,加载期保持确定性
// 材质加载可见性:贴图槽缺失/路径解析错误会静默退化成默认
// 纹理(金属全没 → 塑料感),这里留下诊断锚点