Graphics: Use default white texture if material has empty texture slot

This commit is contained in:
Jérôme Leclercq
2021-10-21 13:00:36 +02:00
parent a18415216b
commit 6bab824e4f
6 changed files with 27 additions and 17 deletions

View File

@@ -79,15 +79,19 @@ namespace Nz
}
//TODO: Use "missing" texture
if (textureSlot.texture)
Texture* texture = textureSlot.texture.get();
if (!texture)
{
bindings.push_back({
textureSetting.bindingIndex,
ShaderBinding::TextureBinding {
textureSlot.texture.get(), textureSlot.sampler.get()
}
});
const auto& defaultTextures = Graphics::Instance()->GetDefaultTextures();
texture = defaultTextures.whiteTextures[UnderlyingCast(textureSetting.type)].get();
}
bindings.push_back({
textureSetting.bindingIndex,
ShaderBinding::TextureBinding {
texture, textureSlot.sampler.get()
}
});
}
// Shared UBO (TODO)