1
Fork 0
mirror of https://github.com/redstrate/Novus.git synced 2025-04-21 19:57:44 +00:00

Allow textures that failed to load

This commit is contained in:
Joshua Goins 2024-04-18 17:57:16 -04:00
parent 6f9cf59f94
commit 88dfb45c36

View file

@ -227,35 +227,35 @@ RenderMaterial MDLPart::createMaterial(const physis_Material &material)
} }
char type = t[t.length() - 5]; char type = t[t.length() - 5];
auto texture = physis_texture_parse(cache.lookupFile(QLatin1String(material.textures[i])));
if (texture.rgba != nullptr) {
switch (type) {
case 'm': {
auto tex = renderer->addTexture(texture.width, texture.height, texture.rgba, texture.rgba_size);
switch (type) { newMaterial.multiTexture = new RenderTexture(tex);
case 'm': { } break;
auto texture = physis_texture_parse(cache.lookupFile(QLatin1String(material.textures[i]))); case 'd': {
auto tex = renderer->addTexture(texture.width, texture.height, texture.rgba, texture.rgba_size); auto tex = renderer->addTexture(texture.width, texture.height, texture.rgba, texture.rgba_size);
newMaterial.multiTexture = new RenderTexture(tex); newMaterial.diffuseTexture = new RenderTexture(tex);
} break; } break;
case 'd': { case 'n': {
auto texture = physis_texture_parse(cache.lookupFile(QLatin1String(material.textures[i]))); auto tex = renderer->addTexture(texture.width, texture.height, texture.rgba, texture.rgba_size);
auto tex = renderer->addTexture(texture.width, texture.height, texture.rgba, texture.rgba_size);
newMaterial.diffuseTexture = new RenderTexture(tex); newMaterial.normalTexture = new RenderTexture(tex);
} break; } break;
case 'n': { case 's': {
auto texture = physis_texture_parse(cache.lookupFile(QLatin1String(material.textures[i]))); auto tex = renderer->addTexture(texture.width, texture.height, texture.rgba, texture.rgba_size);
auto tex = renderer->addTexture(texture.width, texture.height, texture.rgba, texture.rgba_size);
newMaterial.normalTexture = new RenderTexture(tex); newMaterial.specularTexture = new RenderTexture(tex);
} break; } break;
case 's': { default:
auto texture = physis_texture_parse(cache.lookupFile(QLatin1String(material.textures[i]))); qDebug() << "unhandled type" << type;
auto tex = renderer->addTexture(texture.width, texture.height, texture.rgba, texture.rgba_size); break;
}
newMaterial.specularTexture = new RenderTexture(tex); } else {
} break; qInfo() << "Failed to load" << t;
default:
qDebug() << "unhandled type" << type;
break;
} }
} }