mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-06 17:41:04 +00:00
Add depth sorting for node faces (#11696)
Use BSP tree to order transparent triangles https://en.wikipedia.org/wiki/Binary_space_partitioning
This commit is contained in:
parent
26c046a563
commit
b0b9732359
8 changed files with 628 additions and 92 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue