aboutsummaryrefslogtreecommitdiff
path: root/src/client/render/core.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/render/core.cpp')
-rw-r--r--src/client/render/core.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/client/render/core.cpp b/src/client/render/core.cpp
index 3c4583623..4a820f583 100644
--- a/src/client/render/core.cpp
+++ b/src/client/render/core.cpp
@@ -24,25 +24,35 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/clientmap.h"
#include "client/hud.h"
#include "client/minimap.h"
+#include "client/shadows/dynamicshadowsrender.h"
RenderingCore::RenderingCore(IrrlichtDevice *_device, Client *_client, Hud *_hud)
: device(_device), driver(device->getVideoDriver()), smgr(device->getSceneManager()),
guienv(device->getGUIEnvironment()), client(_client), camera(client->getCamera()),
- mapper(client->getMinimap()), hud(_hud)
+ mapper(client->getMinimap()), hud(_hud),
+ shadow_renderer(nullptr)
{
screensize = driver->getScreenSize();
virtual_size = screensize;
+
+ if (g_settings->getBool("enable_shaders") &&
+ g_settings->getBool("enable_dynamic_shadows")) {
+ shadow_renderer = new ShadowRenderer(device, client);
+ }
}
RenderingCore::~RenderingCore()
{
clearTextures();
+ delete shadow_renderer;
}
void RenderingCore::initialize()
{
// have to be called late as the VMT is not ready in the constructor:
initTextures();
+ if (shadow_renderer)
+ shadow_renderer->initialize();
}
void RenderingCore::updateScreenSize()
@@ -72,7 +82,14 @@ void RenderingCore::draw(video::SColor _skycolor, bool _show_hud, bool _show_min
void RenderingCore::draw3D()
{
- smgr->drawAll();
+ if (shadow_renderer) {
+ // Shadow renderer will handle the draw stage
+ shadow_renderer->setClearColor(skycolor);
+ shadow_renderer->update();
+ } else {
+ smgr->drawAll();
+ }
+
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
if (!show_hud)
return;