diff options
author | x2048 <codeforsmile@gmail.com> | 2022-03-31 22:40:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-31 22:40:59 +0200 |
commit | 3dd7d7867b14058d3329f1ce2bd2e85713ff50b1 (patch) | |
tree | 9062518178ea3c250e717af0705b8ad382c1bed6 | |
parent | 31578303a4eab6b6b083e57b6bf8d12ff3b3d991 (diff) | |
download | minetest-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.cpp | 2 |
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 |