@@ -293,14 +293,19 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver)
293
293
float step = BS * 1 ;
294
294
float stepfac = 1.1 ;
295
295
float startoff = BS * 1 ;
296
- // - Length of the diagonal of a mapblock.
296
+ // The occlusion search of 'isOccluded()' must stop short of the target
297
+ // point by distance 'endoff' (end offset) to not enter the target mapblock.
298
+ // For the 8 mapblock corners 'endoff' must therefore be the maximum diagonal
299
+ // of a mapblock, because we must consider all view angles.
300
+ // sqrt(1^2 + 1^2 + 1^2) = 1.732
297
301
float endoff = -BS * MAP_BLOCKSIZE * 1.732050807569 ;
298
- v3s16 spn = cam_pos_nodes + v3s16 ( 0 , 0 , 0 ) ;
302
+ v3s16 spn = cam_pos_nodes;
299
303
s16 bs2 = MAP_BLOCKSIZE / 2 + 1 ;
300
304
u32 needed_count = 1 ;
301
305
if (occlusion_culling_enabled &&
302
- isOccluded (this , spn, cpn + v3s16 (0 , 0 , 0 ),
303
- step, stepfac, startoff, endoff / 2 , needed_count, nodemgr) &&
306
+ // For the central point of the mapblock 'endoff' can be halved
307
+ isOccluded (this , spn, cpn,
308
+ step, stepfac, startoff, endoff / 2 .0f , needed_count, nodemgr) &&
304
309
isOccluded (this , spn, cpn + v3s16 (bs2,bs2,bs2),
305
310
step, stepfac, startoff, endoff, needed_count, nodemgr) &&
306
311
isOccluded (this , spn, cpn + v3s16 (bs2,bs2,-bs2),
0 commit comments