fix: support relative texture paths

This commit is contained in:
2025-10-18 18:53:27 +02:00
parent 5ddc0eb73a
commit 8b8ad35d01
2 changed files with 8 additions and 5 deletions

View File

@ -196,7 +196,10 @@ void Object::LoadMaterials(const std::filesystem::path& filename) {
while (len > 0 && (texPath[len - 1] == ' ' || texPath[len - 1] == '\t'))
texPath[--len] = '\0';
currentMaterial->SetDiffuseTexture(Texture::LoadFile(texPath));
std::filesystem::path fullPath = filename;
std::filesystem::path texturePath = fullPath.parent_path() / texPath;
currentMaterial->SetDiffuseTexture(Texture::LoadFile(texturePath));
}
break;
}