summaryrefslogtreecommitdiff
path: root/src/client/tile.h
diff options
context:
space:
mode:
authorx2048 <codeforsmile@gmail.com>2022-04-02 10:42:27 +0200
committerGitHub <noreply@github.com>2022-04-02 10:42:27 +0200
commitb0b9732359d43325c8bd820abeb8417353365a0c (patch)
tree3de2c5a55f67ee142a9f2a1b95c2b47b6d881c54 /src/client/tile.h
parent26c046a563f686f9309055f5d566a92d436eed7e (diff)
downloadminetest-b0b9732359d43325c8bd820abeb8417353365a0c.tar.gz
minetest-b0b9732359d43325c8bd820abeb8417353365a0c.tar.bz2
minetest-b0b9732359d43325c8bd820abeb8417353365a0c.zip
Add depth sorting for node faces (#11696)
Use BSP tree to order transparent triangles https://en.wikipedia.org/wiki/Binary_space_partitioning
Diffstat (limited to 'src/client/tile.h')
-rw-r--r--src/client/tile.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/client/tile.h b/src/client/tile.h
index fe96cef58..88ff91f8e 100644
--- a/src/client/tile.h
+++ b/src/client/tile.h
@@ -260,6 +260,18 @@ struct TileLayer
&& (material_flags & MATERIAL_FLAG_TILEABLE_VERTICAL);
}
+ bool isTransparent() const
+ {
+ switch (material_type) {
+ case TILE_MATERIAL_BASIC:
+ case TILE_MATERIAL_ALPHA:
+ case TILE_MATERIAL_LIQUID_TRANSPARENT:
+ case TILE_MATERIAL_WAVING_LIQUID_TRANSPARENT:
+ return true;
+ }
+ return false;
+ }
+
// Ordered for size, please do not reorder
video::ITexture *texture = nullptr;
@@ -308,7 +320,8 @@ struct TileSpec
for (int layer = 0; layer < MAX_TILE_LAYERS; layer++) {
if (layers[layer] != other.layers[layer])
return false;
- if (!layers[layer].isTileable())
+ // Only non-transparent tiles can be merged into fast faces
+ if (layers[layer].isTransparent() || !layers[layer].isTileable())
return false;
}
return rotation == 0