Skip to content

Commit 2b21cac

Browse files
lhofhanslparamat
authored andcommittedNov 8, 2016
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.
1 parent 45eab34 commit 2b21cac

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎src/clientmap.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,14 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver)
293293
float step = BS * 1;
294294
float stepfac = 1.1;
295295
float startoff = BS * 1;
296-
float endoff = -BS*MAP_BLOCKSIZE * 1.42 * 1.42;
296+
// - Length of the diagonal of a mapblock.
297+
float endoff = -BS * MAP_BLOCKSIZE * 1.732050807569;
297298
v3s16 spn = cam_pos_nodes + v3s16(0, 0, 0);
298299
s16 bs2 = MAP_BLOCKSIZE / 2 + 1;
299300
u32 needed_count = 1;
300301
if (occlusion_culling_enabled &&
301302
isOccluded(this, spn, cpn + v3s16(0, 0, 0),
302-
step, stepfac, startoff, endoff, needed_count, nodemgr) &&
303+
step, stepfac, startoff, endoff / 2, needed_count, nodemgr) &&
303304
isOccluded(this, spn, cpn + v3s16(bs2,bs2,bs2),
304305
step, stepfac, startoff, endoff, needed_count, nodemgr) &&
305306
isOccluded(this, spn, cpn + v3s16(bs2,bs2,-bs2),

0 commit comments

Comments
 (0)
Please sign in to comment.