aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorx2048 <codeforsmile@gmail.com>2022-03-31 22:40:59 +0200
committerGitHub <noreply@github.com>2022-03-31 22:40:59 +0200
commit3dd7d7867b14058d3329f1ce2bd2e85713ff50b1 (patch)
tree9062518178ea3c250e717af0705b8ad382c1bed6
parent31578303a4eab6b6b083e57b6bf8d12ff3b3d991 (diff)
downloadminetest-3dd7d7867b14058d3329f1ce2bd2e85713ff50b1.tar.gz
minetest-3dd7d7867b14058d3329f1ce2bd2e85713ff50b1.tar.bz2
minetest-3dd7d7867b14058d3329f1ce2bd2e85713ff50b1.zip
Limit shadow map to the viewing range (#12158)
-rw-r--r--src/client/shadows/dynamicshadows.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/client/shadows/dynamicshadows.cpp b/src/client/shadows/dynamicshadows.cpp
index a45bf64fe..2995ec205 100644
--- a/src/client/shadows/dynamicshadows.cpp
+++ b/src/client/shadows/dynamicshadows.cpp
@@ -93,6 +93,8 @@ void DirectionalLight::update_frustum(const Camera *cam, Client *client, bool fo
float zNear = cam->getCameraNode()->getNearValue();
float zFar = getMaxFarValue();
+ if (!client->getEnv().getClientMap().getControl().range_all)
+ zFar = MYMIN(zFar, client->getEnv().getClientMap().getControl().wanted_range * BS);
///////////////////////////////////
// update splits near and fars