mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Tune polygon offset handling to avoid issues with mesh nodes (#16064)
This commit is contained in:
parent
c5abecbd3c
commit
d795c28af8
1 changed files with 12 additions and 0 deletions
|
@ -910,6 +910,7 @@ void ContentFeatures::updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc
|
||||||
u32 overlay_shader = shdsrc->getShader("nodes_shader", overlay_material, drawtype);
|
u32 overlay_shader = shdsrc->getShader("nodes_shader", overlay_material, drawtype);
|
||||||
|
|
||||||
// Tiles (fill in f->tiles[])
|
// Tiles (fill in f->tiles[])
|
||||||
|
bool any_polygon_offset = false;
|
||||||
for (u16 j = 0; j < 6; j++) {
|
for (u16 j = 0; j < 6; j++) {
|
||||||
tiles[j].world_aligned = isWorldAligned(tdef[j].align_style,
|
tiles[j].world_aligned = isWorldAligned(tdef[j].align_style,
|
||||||
tsettings.world_aligned_mode, drawtype);
|
tsettings.world_aligned_mode, drawtype);
|
||||||
|
@ -922,6 +923,17 @@ void ContentFeatures::updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc
|
||||||
tdef[j].backface_culling, tsettings);
|
tdef[j].backface_culling, tsettings);
|
||||||
|
|
||||||
tiles[j].layers[0].need_polygon_offset = !tiles[j].layers[1].empty();
|
tiles[j].layers[0].need_polygon_offset = !tiles[j].layers[1].empty();
|
||||||
|
any_polygon_offset |= tiles[j].layers[0].need_polygon_offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drawtype == NDT_MESH && any_polygon_offset) {
|
||||||
|
// Our per-tile polygon offset enablement workaround works fine for normal
|
||||||
|
// nodes and anything else, where we know that different tiles are different
|
||||||
|
// faces that couldn't possibly conflict with each other.
|
||||||
|
// We can't assume this for mesh nodes, so apply it to all tiles (= materials)
|
||||||
|
// then.
|
||||||
|
for (u16 j = 0; j < 6; j++)
|
||||||
|
tiles[j].layers[0].need_polygon_offset = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MaterialType special_material = material_type;
|
MaterialType special_material = material_type;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue