Allow allfaces drawtypes to have 6 textures (#15175)

This commit is contained in:
DragonWrangler1 2024-09-26 08:34:16 -07:00 committed by GitHub
parent d08d34d803
commit 65ec371b78
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 30 additions and 8 deletions

@ -1470,7 +1470,8 @@ Look for examples in `games/devtest` or `games/minetest_game`.
'Connected Glass'.
* `allfaces`
* Often used for partially-transparent nodes.
* External and internal sides of textures are visible.
* External sides of textures, and unlike other drawtypes, the external sides
of other blocks, are visible from the inside.
* `allfaces_optional`
* Often used for leaves nodes.
* This switches between `normal`, `glasslike` and `allfaces` according to

@ -98,6 +98,23 @@ minetest.register_node("testnodes:allfaces", {
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:allfaces_6", {
description = S("\"allfaces 6 Textures\" Drawtype Test Node").."\n"..
S("Transparent node with visible internal backfaces"),
drawtype = "allfaces",
paramtype = "light",
tiles = {
"testnodes_allfaces.png^[colorize:red",
"testnodes_allfaces.png^[colorize:orange",
"testnodes_allfaces.png^[colorize:yellow",
"testnodes_allfaces.png^[colorize:green",
"testnodes_allfaces.png^[colorize:blue",
"testnodes_allfaces.png^[colorize:purple"
},
groups = { dig_immediate = 3 },
})
local allfaces_optional_tooltip = ""..
S("Rendering depends on 'leaves_style' setting:").."\n"..
S("* 'fancy': transparent with visible internal backfaces").."\n"..

@ -1016,13 +1016,6 @@ void MapblockMeshGenerator::drawGlasslikeFramedNode()
}
}
void MapblockMeshGenerator::drawAllfacesNode()
{
static const aabb3f box(-BS / 2, -BS / 2, -BS / 2, BS / 2, BS / 2, BS / 2);
useTile(0, 0, 0);
drawAutoLightedCuboid(box);
}
void MapblockMeshGenerator::drawTorchlikeNode()
{
u8 wall = cur_node.n.getWallMounted(nodedef);
@ -1545,6 +1538,17 @@ namespace {
};
}
void MapblockMeshGenerator::drawAllfacesNode()
{
static const aabb3f box(-BS / 2, -BS / 2, -BS / 2, BS / 2, BS / 2, BS / 2);
TileSpec tiles[6];
for (int face = 0; face < 6; face++)
getTile(nodebox_tile_dirs[face], &tiles[face]);
if (data->m_smooth_lighting)
getSmoothLightFrame();
drawAutoLightedCuboid(box, nullptr, tiles, 6);
}
void MapblockMeshGenerator::drawNodeboxNode()
{
TileSpec tiles[6];