Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing item images clipping in formspecs #8652

Merged
merged 3 commits into from
Jul 26, 2019

Conversation

pyrollo
Copy link
Contributor

@pyrollo pyrollo commented Jul 2, 2019

When using item_image_button in formspec with a node, item image is not clipped at all.

This PR makes drawItemStack clip drawn image against clip rectangle even with 3D rendered items.

How to test

You can easily test result of this PR with this Lua code :

minetest.register_chatcommand("t", {
	params = "",
	description = "Test",
	func = function(name, param)
		minetest.show_formspec(name, "test", [[size[5,5]
		item_image_button[0,-0.75;1,1;default:stone;test;]
		item_image_button[1,-0.5;1,1;default:stone;test;]
		item_image_button[2,-0.25;1,1;default:stone;test;]
		item_image_button[3,0;1,1;default:stone;test;]
		item_image_button[1,5;1,1;default:stone;test;]
		item_image_button[-0.75,1;1,1;default:stone;test;]
		item_image_button[-0.5,2;1,1;default:stone;test;]
		item_image_button[-0.25,3;1,1;default:stone;test;]
		item_image_button[4.5,1;1,1;default:stone;test;]
		item_image_button[4.75,2;1,1;default:stone;test;]
		item_image_button[5,3;1,1;default:stone;test;]
		]])
	end,
})

Result before the modification:
screenshot_20190702_234303

Result after it:
screenshot_20190702_234055

src/client/hud.cpp Outdated Show resolved Hide resolved
src/client/hud.cpp Outdated Show resolved Hide resolved
src/client/hud.cpp Outdated Show resolved Hide resolved
src/client/hud.cpp Outdated Show resolved Hide resolved
@SmallJoker SmallJoker added Bugfix 🐛 PRs that fix a bug Formspec labels Jul 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants