aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorx2048 <codeforsmile@gmail.com>2022-06-07 21:26:31 +0200
committerGitHub <noreply@github.com>2022-06-07 21:26:31 +0200
commit3107c9859114336989855a2c9ee2cbde0e88e3d3 (patch)
tree1606bf8590395916f9ec4558aea8f4858ffaa372 /src/client
parentedc7df54801ab3bf30f96ac5aad6ce11a102f6b9 (diff)
downloadminetest-3107c9859114336989855a2c9ee2cbde0e88e3d3.tar.gz
minetest-3107c9859114336989855a2c9ee2cbde0e88e3d3.tar.bz2
minetest-3107c9859114336989855a2c9ee2cbde0e88e3d3.zip
Mapblock Mesh BspTree: Increase the depth of block-level splits
... before going node-level triangle search. Fixes transparent grass on transparent land
Diffstat (limited to 'src/client')
-rw-r--r--src/client/mapblock_mesh.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/client/mapblock_mesh.cpp b/src/client/mapblock_mesh.cpp
index 3be9e13b8..d8a8c25eb 100644
--- a/src/client/mapblock_mesh.cpp
+++ b/src/client/mapblock_mesh.cpp
@@ -1021,7 +1021,12 @@ void MapBlockBspTree::buildTree(const std::vector<MeshTriangle> *triangles)
for (u32 i = 0; i < triangles->size(); i++)
indexes.push_back(i);
- root = buildTree(v3f(1, 0, 0), v3f(85, 85, 85), 40, indexes, 0);
+ if (!indexes.empty()) {
+ // Start in the center of the block with increment of one quarter in each direction
+ root = buildTree(v3f(1, 0, 0), v3f((MAP_BLOCKSIZE + 1) * 0.5f * BS), MAP_BLOCKSIZE * 0.25f * BS, indexes, 0);
+ } else {
+ root = -1;
+ }
}
/**
@@ -1097,7 +1102,7 @@ s32 MapBlockBspTree::buildTree(v3f normal, v3f origin, float delta, const std::v
v3f next_normal = candidate_normal;
v3f next_origin = origin + delta * normal;
float next_delta = candidate_delta;
- if (next_delta < 10) {
+ if (next_delta < 5) {
const MeshTriangle *candidate = findSplitCandidate(front_list, *triangles);
next_normal = candidate->getNormal();
next_origin = candidate->centroid;
@@ -1113,7 +1118,7 @@ s32 MapBlockBspTree::buildTree(v3f normal, v3f origin, float delta, const std::v
v3f next_normal = candidate_normal;
v3f next_origin = origin - delta * normal;
float next_delta = candidate_delta;
- if (next_delta < 10) {
+ if (next_delta < 5) {
const MeshTriangle *candidate = findSplitCandidate(back_list, *triangles);
next_normal = candidate->getNormal();
next_origin = candidate->centroid;