Don't discriminate textures only by FBX logical name.

We don't want to use the logical texture name from the FBX to distinguish separate textures. It seems entirely valid for distinct textures to have the same name. It's not completely clear what's best to use instead, but adding fileLocation seems reasonable. It can be blank, for textures that don't exist on the filesystem –– but that's a pretty weird edge case, and even then we have both 'usage' and 'name' to distinguish.
This commit is contained in:
Par Winzell 2019-01-24 16:56:04 -08:00
parent d451aa73f3
commit 12025de179
1 changed files with 3 additions and 1 deletions

View File

@ -100,7 +100,9 @@ int RawModel::AddTexture(
return -1;
}
for (size_t i = 0; i < textures.size(); i++) {
if (StringUtils::CompareNoCase(textures[i].name, name) == 0 && textures[i].usage == usage) {
// we allocate the struct even if the implementing image file is missing
if (StringUtils::CompareNoCase(textures[i].fileLocation, fileLocation) == 0 &&
StringUtils::CompareNoCase(textures[i].name, name) == 0 && textures[i].usage == usage) {
return (int)i;
}
}