1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Ensure deterministic client occlusion culling and minor improvements (#14212)

* Ensure deterministic client occlusion culling
* Increase culling optimize distance slightly
* More accurate culling when sampling
This commit is contained in:
lhofhansl 2024-01-06 18:43:46 -08:00 committed by GitHub
parent 8db4ba9e58
commit bd42cc2c77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 11 deletions

View file

@ -1193,13 +1193,14 @@ bool Map::isBlockOccluded(v3s16 pos_relative, v3s16 cam_pos_nodes, bool simple_c
// 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;
// This should be only used in server occlusion cullung.
// The client recalculates the complete drawlist periodically,
// and random sampling could lead to visible flicker.
if (simple_check) {
v3s16 random_point(myrand_range(-bs2, bs2), myrand_range(-bs2, bs2), myrand_range(-bs2, bs2));
return isOccluded(cam_pos_nodes, pos_blockcenter + random_point, step, stepfac,
start_offset, end_offset, 1);
}
// Additional occlusion check, see comments in that function
v3s16 check;