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,28 +227,25 @@ RenderMaterial MDLPart::createMaterial(const physis_Material &material)
}
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 texture = physis_texture_parse(cache.lookupFile(QLatin1String(material.textures[i])));
auto tex = renderer->addTexture(texture.width, texture.height, texture.rgba, texture.rgba_size);
newMaterial.multiTexture = new RenderTexture(tex);
} break;
case 'd': {
auto texture = physis_texture_parse(cache.lookupFile(QLatin1String(material.textures[i])));
auto tex = renderer->addTexture(texture.width, texture.height, texture.rgba, texture.rgba_size);
newMaterial.diffuseTexture = new RenderTexture(tex);
} break;
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);
newMaterial.normalTexture = new RenderTexture(tex);
} break;
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);
newMaterial.specularTexture = new RenderTexture(tex);
@ -257,6 +254,9 @@ RenderMaterial MDLPart::createMaterial(const physis_Material &material)
qDebug() << "unhandled type" << type;
break;
}
} else {
qInfo() << "Failed to load" << t;
}
}
return newMaterial;