forked from Mirrorlandia_minetest/minetest
Restore visual_scale support for nodeboxes (and allfaces) (#9906)
This commit is contained in:
parent
36099ba947
commit
e746607d0f
@ -6941,7 +6941,7 @@ Used by `minetest.register_node`.
|
|||||||
|
|
||||||
visual_scale = 1.0,
|
visual_scale = 1.0,
|
||||||
-- Supported for drawtypes "plantlike", "signlike", "torchlike",
|
-- Supported for drawtypes "plantlike", "signlike", "torchlike",
|
||||||
-- "firelike", "mesh".
|
-- "firelike", "mesh", "nodebox", "allfaces".
|
||||||
-- For plantlike and firelike, the image will start at the bottom of the
|
-- For plantlike and firelike, the image will start at the bottom of the
|
||||||
-- node. For torchlike, the image will start at the surface to which the
|
-- node. For torchlike, the image will start at the surface to which the
|
||||||
-- node "attaches". For the other drawtypes the image will be centered
|
-- node "attaches". For the other drawtypes the image will be centered
|
||||||
|
@ -366,6 +366,7 @@ void MapblockMeshGenerator::generateCuboidTextureCoords(const aabb3f &box, f32 *
|
|||||||
void MapblockMeshGenerator::drawAutoLightedCuboid(aabb3f box, const f32 *txc,
|
void MapblockMeshGenerator::drawAutoLightedCuboid(aabb3f box, const f32 *txc,
|
||||||
TileSpec *tiles, int tile_count)
|
TileSpec *tiles, int tile_count)
|
||||||
{
|
{
|
||||||
|
bool scale = std::fabs(f->visual_scale - 1.0f) > 1e-3f;
|
||||||
f32 texture_coord_buf[24];
|
f32 texture_coord_buf[24];
|
||||||
f32 dx1 = box.MinEdge.X;
|
f32 dx1 = box.MinEdge.X;
|
||||||
f32 dy1 = box.MinEdge.Y;
|
f32 dy1 = box.MinEdge.Y;
|
||||||
@ -373,6 +374,14 @@ void MapblockMeshGenerator::drawAutoLightedCuboid(aabb3f box, const f32 *txc,
|
|||||||
f32 dx2 = box.MaxEdge.X;
|
f32 dx2 = box.MaxEdge.X;
|
||||||
f32 dy2 = box.MaxEdge.Y;
|
f32 dy2 = box.MaxEdge.Y;
|
||||||
f32 dz2 = box.MaxEdge.Z;
|
f32 dz2 = box.MaxEdge.Z;
|
||||||
|
if (scale) {
|
||||||
|
if (!txc) { // generate texture coords before scaling
|
||||||
|
generateCuboidTextureCoords(box, texture_coord_buf);
|
||||||
|
txc = texture_coord_buf;
|
||||||
|
}
|
||||||
|
box.MinEdge *= f->visual_scale;
|
||||||
|
box.MaxEdge *= f->visual_scale;
|
||||||
|
}
|
||||||
box.MinEdge += origin;
|
box.MinEdge += origin;
|
||||||
box.MaxEdge += origin;
|
box.MaxEdge += origin;
|
||||||
if (!txc) {
|
if (!txc) {
|
||||||
@ -1323,7 +1332,7 @@ void MapblockMeshGenerator::drawNodeboxNode()
|
|||||||
|
|
||||||
std::vector<aabb3f> boxes;
|
std::vector<aabb3f> boxes;
|
||||||
n.getNodeBoxes(nodedef, &boxes, neighbors_set);
|
n.getNodeBoxes(nodedef, &boxes, neighbors_set);
|
||||||
for (const auto &box : boxes)
|
for (auto &box : boxes)
|
||||||
drawAutoLightedCuboid(box, nullptr, tiles, 6);
|
drawAutoLightedCuboid(box, nullptr, tiles, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user