Resized torchlike sprite now attaches to surface (#9303)
authorWuzzy <wuzzy2@mail.ru>
Mon, 20 Jan 2020 19:17:54 +0000 (19:17 +0000)
committerParamat <paramat@users.noreply.github.com>
Mon, 20 Jan 2020 19:17:54 +0000 (19:17 +0000)
doc/lua_api.txt
src/client/content_mapblock.cpp

index 0b12913d5192e5afcd3a00d4e26884109a74b6c1..b06e08548a8e7cbff7664db32682b327e9498206 100644 (file)
@@ -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
index 4a0df617142c5c36d02cf541ce5eb5d19a2aa0dd..5be0caf19cee14967d07653d752fc0934c6ce581 100644 (file)
@@ -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);