summaryrefslogtreecommitdiff
path: root/src/client/shadows/dynamicshadowsrender.cpp
diff options
context:
space:
mode:
authorx2048 <codeforsmile@gmail.com>2021-08-12 20:07:09 +0200
committerGitHub <noreply@github.com>2021-08-12 20:07:09 +0200
commit442e48b84fea511badf108cedc2a6b43d79fd852 (patch)
treed4ba62bd7398f4e1f820dd19425344588a1fe9db /src/client/shadows/dynamicshadowsrender.cpp
parent0709946c75ae6f2257d368714185bed7bee538ba (diff)
downloadminetest-442e48b84fea511badf108cedc2a6b43d79fd852.tar.gz
minetest-442e48b84fea511badf108cedc2a6b43d79fd852.tar.bz2
minetest-442e48b84fea511badf108cedc2a6b43d79fd852.zip
Move updating shadows outside of RenderingCore::drawAll. (#11491)
Fixes indirect rendering modes such as some 3D modes mentioned in #11437 and undersampled rendering. Does not fully fix anaglyph 3d mode.
Diffstat (limited to 'src/client/shadows/dynamicshadowsrender.cpp')
-rw-r--r--src/client/shadows/dynamicshadowsrender.cpp61
1 files changed, 27 insertions, 34 deletions
diff --git a/src/client/shadows/dynamicshadowsrender.cpp b/src/client/shadows/dynamicshadowsrender.cpp
index 350586225..a913a9290 100644
--- a/src/client/shadows/dynamicshadowsrender.cpp
+++ b/src/client/shadows/dynamicshadowsrender.cpp
@@ -146,11 +146,6 @@ void ShadowRenderer::removeNodeFromShadowList(scene::ISceneNode *node)
}
}
-void ShadowRenderer::setClearColor(video::SColor ClearColor)
-{
- m_clear_color = ClearColor;
-}
-
void ShadowRenderer::updateSMTextures()
{
if (!m_shadows_enabled || m_smgr->getActiveCamera() == nullptr) {
@@ -242,6 +237,7 @@ void ShadowRenderer::updateSMTextures()
// This is also handled in ClientMap.
if (m_current_frame == m_map_shadow_update_frames - 1) {
if (m_shadow_map_colored) {
+ m_driver->setRenderTarget(0, false, false);
m_driver->setRenderTarget(shadowMapTextureColors,
true, false, video::SColor(255, 255, 255, 255));
}
@@ -273,7 +269,6 @@ void ShadowRenderer::updateSMTextures()
void ShadowRenderer::update(video::ITexture *outputTarget)
{
if (!m_shadows_enabled || m_smgr->getActiveCamera() == nullptr) {
- m_smgr->drawAll();
return;
}
@@ -308,36 +303,34 @@ void ShadowRenderer::update(video::ITexture *outputTarget)
m_driver->setRenderTarget(0, false, false);
} // end for lights
+ }
+}
- // now render the actual MT render pass
- m_driver->setRenderTarget(outputTarget, true, true, m_clear_color);
- m_smgr->drawAll();
-
- /* this code just shows shadows textures in screen and in ONLY for debugging*/
- #if 0
- // this is debug, ignore for now.
- m_driver->draw2DImage(shadowMapTextureFinal,
- core::rect<s32>(0, 50, 128, 128 + 50),
- core::rect<s32>({0, 0}, shadowMapTextureFinal->getSize()));
-
- m_driver->draw2DImage(shadowMapClientMap,
- core::rect<s32>(0, 50 + 128, 128, 128 + 50 + 128),
- core::rect<s32>({0, 0}, shadowMapTextureFinal->getSize()));
- m_driver->draw2DImage(shadowMapTextureDynamicObjects,
- core::rect<s32>(0, 128 + 50 + 128, 128,
- 128 + 50 + 128 + 128),
- core::rect<s32>({0, 0}, shadowMapTextureDynamicObjects->getSize()));
-
- if (m_shadow_map_colored) {
-
- m_driver->draw2DImage(shadowMapTextureColors,
- core::rect<s32>(128,128 + 50 + 128 + 128,
- 128 + 128, 128 + 50 + 128 + 128 + 128),
- core::rect<s32>({0, 0}, shadowMapTextureColors->getSize()));
- }
- #endif
- m_driver->setRenderTarget(0, false, false);
+void ShadowRenderer::drawDebug()
+{
+ /* this code just shows shadows textures in screen and in ONLY for debugging*/
+ #if 0
+ // this is debug, ignore for now.
+ m_driver->draw2DImage(shadowMapTextureFinal,
+ core::rect<s32>(0, 50, 128, 128 + 50),
+ core::rect<s32>({0, 0}, shadowMapTextureFinal->getSize()));
+
+ m_driver->draw2DImage(shadowMapClientMap,
+ core::rect<s32>(0, 50 + 128, 128, 128 + 50 + 128),
+ core::rect<s32>({0, 0}, shadowMapTextureFinal->getSize()));
+ m_driver->draw2DImage(shadowMapTextureDynamicObjects,
+ core::rect<s32>(0, 128 + 50 + 128, 128,
+ 128 + 50 + 128 + 128),
+ core::rect<s32>({0, 0}, shadowMapTextureDynamicObjects->getSize()));
+
+ if (m_shadow_map_colored) {
+
+ m_driver->draw2DImage(shadowMapTextureColors,
+ core::rect<s32>(128,128 + 50 + 128 + 128,
+ 128 + 128, 128 + 50 + 128 + 128 + 128),
+ core::rect<s32>({0, 0}, shadowMapTextureColors->getSize()));
}
+ #endif
}