+
+ /*
+ Occlusion culling
+ */
+
+ v3s16 cpn = block->getPos() * MAP_BLOCKSIZE;
+ cpn += v3s16(MAP_BLOCKSIZE/2, MAP_BLOCKSIZE/2, MAP_BLOCKSIZE/2);
+ float step = BS*1;
+ float stepfac = 1.1;
+ float startoff = BS*1;
+ float endoff = -BS*MAP_BLOCKSIZE*1.42*1.42;
+ v3s16 spn = cam_pos_nodes + v3s16(0,0,0);
+ s16 bs2 = MAP_BLOCKSIZE/2 + 1;
+ u32 needed_count = 1;
+ if(
+ isOccluded(this, spn, cpn + v3s16(0,0,0),
+ step, stepfac, startoff, endoff, 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),
+ step, stepfac, startoff, endoff, 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),
+ step, stepfac, startoff, endoff, 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),
+ step, stepfac, startoff, endoff, 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),
+ step, stepfac, startoff, endoff, needed_count, nodemgr)
+ )
+ {
+ blocks_occlusion_culled++;
+ continue;
+ }
+
+ // This block is in range. Reset usage timer.
+ block->resetUsageTimer();
+