Skip to content

Commit

Permalink
Resized torchlike sprite now attaches to surface (#9303)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuzzy2 authored and paramat committed Jan 20, 2020
1 parent 468eb4b commit 0877587
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
5 changes: 3 additions & 2 deletions doc/lua_api.txt
Expand Up @@ -6569,8 +6569,9 @@ Used by `minetest.register_node`.
-- Supported for drawtypes "plantlike", "signlike", "torchlike",
-- "firelike", "mesh".
-- For plantlike and firelike, the image will start at the bottom of the
-- node, for the other drawtypes the image will be centered on the node.
-- Note that positioning for "torchlike" may still change.
-- node. For torchlike, the image will start at the surface to which the
-- node "attaches". For the other drawtypes the image will be centered
-- on the node.

tiles = {tile definition 1, def2, def3, def4, def5, def6},
-- Textures of node; +Y, -Y, +X, -X, +Z, -Z
Expand Down
22 changes: 16 additions & 6 deletions src/client/content_mapblock.cpp
Expand Up @@ -860,17 +860,27 @@ void MapblockMeshGenerator::drawTorchlikeNode()
for (v3f &vertex : vertices) {
switch (wall) {
case DWM_YP:
vertex.rotateXZBy(-45); break;
vertex.Y += -size + BS/2;
vertex.rotateXZBy(-45);
break;
case DWM_YN:
vertex.rotateXZBy( 45); break;
vertex.Y += size - BS/2;
vertex.rotateXZBy(45);
break;
case DWM_XP:
vertex.rotateXZBy( 0); break;
vertex.X += -size + BS/2;
break;
case DWM_XN:
vertex.rotateXZBy(180); break;
vertex.X += -size + BS/2;
vertex.rotateXZBy(180);
break;
case DWM_ZP:
vertex.rotateXZBy( 90); break;
vertex.X += -size + BS/2;
vertex.rotateXZBy(90);
break;
case DWM_ZN:
vertex.rotateXZBy(-90); break;
vertex.X += -size + BS/2;
vertex.rotateXZBy(-90);
}
}
drawQuad(vertices);
Expand Down

0 comments on commit 0877587

Please sign in to comment.