diff options
author | Lars Hofhansl <larsh@apache.org> | 2016-11-04 00:13:17 -0700 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2016-11-08 15:12:08 +0000 |
commit | 2b21cac1d80454bd23c5f60c4570b30edba62584 (patch) | |
tree | 9e7b6295b9731749f1c3f61b7715031d4737665f /src | |
parent | 45eab340b90e54134a6f1cde3314c10cce08820b (diff) | |
download | minetest-2b21cac1d80454bd23c5f60c4570b30edba62584.tar.gz minetest-2b21cac1d80454bd23c5f60c4570b30edba62584.tar.bz2 minetest-2b21cac1d80454bd23c5f60c4570b30edba62584.zip |
Occlusion culling: Fix 'end offset' distance, half this for centre point
'endoff', the maximum diagonal of a mapblock, was incorrectly calculated.
Half this value for the centre point of the mapblock.
Diffstat (limited to 'src')
-rw-r--r-- | src/clientmap.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/clientmap.cpp b/src/clientmap.cpp index 60170ab70..1d856520b 100644 --- a/src/clientmap.cpp +++ b/src/clientmap.cpp @@ -293,13 +293,14 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver) float step = BS * 1; float stepfac = 1.1; float startoff = BS * 1; - float endoff = -BS*MAP_BLOCKSIZE * 1.42 * 1.42; + // - Length of the diagonal of a mapblock. + float endoff = -BS * MAP_BLOCKSIZE * 1.732050807569; v3s16 spn = cam_pos_nodes + v3s16(0, 0, 0); s16 bs2 = MAP_BLOCKSIZE / 2 + 1; u32 needed_count = 1; if (occlusion_culling_enabled && isOccluded(this, spn, cpn + v3s16(0, 0, 0), - step, stepfac, startoff, endoff, needed_count, nodemgr) && + step, stepfac, startoff, endoff / 2, needed_count, nodemgr) && isOccluded(this, spn, cpn + v3s16(bs2,bs2,bs2), step, stepfac, startoff, endoff, needed_count, nodemgr) && isOccluded(this, spn, cpn + v3s16(bs2,bs2,-bs2), |