mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Allow cheaper culling checks at a distance (#14073)
* Allow cheaper culling checks at a distance * Pick a random ray, so that far missing block will eventually be shown
This commit is contained in:
parent
16c22477c2
commit
ca1a723890
6 changed files with 25 additions and 5 deletions
10
src/map.cpp
10
src/map.cpp
|
@ -1155,7 +1155,7 @@ bool Map::isOccluded(const v3s16 &pos_camera, const v3s16 &pos_target,
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Map::isBlockOccluded(MapBlock *block, v3s16 cam_pos_nodes)
|
||||
bool Map::isBlockOccluded(MapBlock *block, v3s16 cam_pos_nodes, bool simple_check)
|
||||
{
|
||||
// Check occlusion for center and all 8 corners of the mapblock
|
||||
// Overshoot a little for less flickering
|
||||
|
@ -1193,6 +1193,14 @@ bool Map::isBlockOccluded(MapBlock *block, v3s16 cam_pos_nodes)
|
|||
// this is a HACK, we should think of a more precise algorithm
|
||||
u32 needed_count = 2;
|
||||
|
||||
v3s16 random_point(myrand_range(-bs2, bs2), myrand_range(-bs2, bs2), myrand_range(-bs2, bs2));
|
||||
if (!isOccluded(cam_pos_nodes, pos_blockcenter + random_point, step, stepfac,
|
||||
start_offset, end_offset, needed_count))
|
||||
return false;
|
||||
|
||||
if (simple_check)
|
||||
return true;
|
||||
|
||||
// Additional occlusion check, see comments in that function
|
||||
v3s16 check;
|
||||
if (determineAdditionalOcclusionCheck(cam_pos_nodes, block->getBox(), check)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue