Wield images not colored correctly
TurkeyMcMac opened this issue · comments
Minetest version
5.6.0-dev
OS / Hardware
Not relevant, I don't think.
Summary
Wield images should be colored just like inventory images according to the set palette_index
or color
. They are not.
Steps to reproduce
Place and pick up a testnodes:color
in devtest. The color of the wield image will not match that of the inventory image:
I am pretty sure this works for wield items but it may not for wield nodes.
Apparently the bug is still there even when using wield_image
:
I applied this patch to devtest to test the bug:
diff --git a/games/devtest/mods/testnodes/param2.lua b/games/devtest/mods/testnodes/param2.lua
index 5d64376fa..39d6e8b02 100644
--- a/games/devtest/mods/testnodes/param2.lua
+++ b/games/devtest/mods/testnodes/param2.lua
@@ -83,6 +83,8 @@ minetest.register_node("testnodes:color", {
tiles = {
"testnodes_node.png",
},
+ inventory_image = "testnodes_node.png",
+ wield_image = "testnodes_node.png",
groups = { dig_immediate = 3 },
})
Confirmed to be broken for both wield items and nodes, this worked in 5.5.
The bug does not manifest when I disable shaders. The problem is surely with this code:
minetest/src/client/wieldmesh.cpp
Lines 507 to 521 in a89afe1
Well not necessarily, the shader code probably just forgets to apply the color.
True.
Shaders apply the color correctly, but that's the ambient light color. Item color information should have been stored in the vertices, but it never happens with shaders, because I moved that setColor() call into an 'else' (line 519 in @TurkeyMcMac 's reference). I've now added calls to initialize the colors once when the mesh is created.
@x2048 Flat wield images are still not colored for me.
@TurkeyMcMac can you open a new issue with a reproduction scenario?
I, alongside with TurkeyMcMac can still reproduce this issue. Reopening.
#12304 does NOT track this issue, it is a PR that just accidentally uncovered the bug again. :D
@TurkeyMcMac The issue should be fixed in the master now, could you check? Thank you.
Thanks, it works now.