mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Refactor createShadowRenderer
This commit is contained in:
parent
41d43e8d95
commit
4bc366b984
1 changed files with 12 additions and 14 deletions
|
@ -686,21 +686,19 @@ std::string ShadowRenderer::readShaderFile(const std::string &path)
|
|||
|
||||
ShadowRenderer *createShadowRenderer(IrrlichtDevice *device, Client *client)
|
||||
{
|
||||
if (!g_settings->getBool("enable_dynamic_shadows"))
|
||||
return nullptr;
|
||||
|
||||
// disable if unsupported
|
||||
if (g_settings->getBool("enable_dynamic_shadows")) {
|
||||
// See also checks in builtin/mainmenu/settings/dlg_settings.lua
|
||||
const video::E_DRIVER_TYPE type = device->getVideoDriver()->getDriverType();
|
||||
if (type != video::EDT_OPENGL && type != video::EDT_OPENGL3) {
|
||||
warningstream << "Shadows: disabled dynamic shadows due to being unsupported" << std::endl;
|
||||
g_settings->setBool("enable_dynamic_shadows", false);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (g_settings->getBool("enable_dynamic_shadows")) {
|
||||
ShadowRenderer *shadow_renderer = new ShadowRenderer(device, client);
|
||||
shadow_renderer->initialize();
|
||||
return shadow_renderer;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue