aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/game.cpp2
-rw-r--r--src/client/shadows/dynamicshadowsrender.cpp14
2 files changed, 7 insertions, 9 deletions
diff --git a/src/client/game.cpp b/src/client/game.cpp
index 4a8ef9969..e0f13307f 100644
--- a/src/client/game.cpp
+++ b/src/client/game.cpp
@@ -4212,8 +4212,6 @@ void Game::updateShadows()
v3f sun_pos = light * offset_constant;
- if (shadow->getDirectionalLightCount() == 0)
- shadow->addDirectionalLight();
shadow->getDirectionalLight().setDirection(sun_pos);
shadow->setTimeOfDay(in_timeofday);
diff --git a/src/client/shadows/dynamicshadowsrender.cpp b/src/client/shadows/dynamicshadowsrender.cpp
index 740edfe21..320a046cd 100644
--- a/src/client/shadows/dynamicshadowsrender.cpp
+++ b/src/client/shadows/dynamicshadowsrender.cpp
@@ -53,6 +53,9 @@ ShadowRenderer::ShadowRenderer(IrrlichtDevice *device, Client *client) :
m_shadow_map_colored = g_settings->getBool("shadow_map_color");
m_shadow_samples = g_settings->getS32("shadow_filters");
m_map_shadow_update_frames = g_settings->getS16("shadow_update_frames");
+
+ // add at least one light
+ addDirectionalLight();
}
ShadowRenderer::~ShadowRenderer()
@@ -157,11 +160,8 @@ size_t ShadowRenderer::getDirectionalLightCount() const
f32 ShadowRenderer::getMaxShadowFar() const
{
- if (!m_light_list.empty()) {
- float zMax = m_light_list[0].getFarValue();
- return zMax;
- }
- return 0.0f;
+ float zMax = m_light_list[0].getFarValue();
+ return zMax;
}
void ShadowRenderer::setShadowIntensity(float shadow_intensity)
@@ -258,7 +258,7 @@ void ShadowRenderer::updateSMTextures()
node.node->setMaterialTexture(TEXTURE_LAYER_SHADOW, shadowMapTextureFinal);
}
- if (!m_shadow_node_array.empty() && !m_light_list.empty()) {
+ if (!m_shadow_node_array.empty()) {
bool reset_sm_texture = false;
// detect if SM should be regenerated
@@ -344,7 +344,7 @@ void ShadowRenderer::update(video::ITexture *outputTarget)
}
- if (!m_shadow_node_array.empty() && !m_light_list.empty()) {
+ if (!m_shadow_node_array.empty()) {
for (DirectionalLight &light : m_light_list) {
// Static shader values for entities are set in updateSMTextures