From 603eb579431bf366f8186ea5d11eb6f2f35f746f Mon Sep 17 00:00:00 2001 From: DS Date: Fri, 16 Aug 2024 22:01:16 +0200 Subject: [PATCH] Fix comment and alpha test node oopsies from #14852 --- games/devtest/mods/testnodes/textures.lua | 8 +++++--- .../testnodes_alpha_compositing_bottom.png | Bin 251 -> 265 bytes src/client/imagesource.cpp | 12 +++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/games/devtest/mods/testnodes/textures.lua b/games/devtest/mods/testnodes/textures.lua index 86bc3e343..96f291d6a 100644 --- a/games/devtest/mods/testnodes/textures.lua +++ b/games/devtest/mods/testnodes/textures.lua @@ -89,10 +89,12 @@ for a=1,#alphas do end minetest.register_node("testnodes:alpha_compositing", { - description = S("Alpha Compositing Test Node") .. "\n" .. + description = S("Texture Overlay Test Node") .. "\n" .. S("A regular grid should be visible where each cell contains two " .. - "texels with the same colour.") .. "\n" .. - S("Alpha compositing is gamma-incorrect for backwards compatibility."), + "texels with the same color.") .. "\n" .. + S("Texture overlay is gamma-incorrect, " .. + "and in general it does not do alpha compositing, " .. + "both for backwards compatibility."), drawtype = "glasslike", paramtype = "light", tiles = {"testnodes_alpha_compositing_bottom.png^" .. diff --git a/games/devtest/mods/testnodes/textures/testnodes_alpha_compositing_bottom.png b/games/devtest/mods/testnodes/textures/testnodes_alpha_compositing_bottom.png index 83447e42309a9c7433a74662b39fb40175bb74a9..40d9f53dea9a98a249ba624c9a39f778ddc2bdd2 100644 GIT binary patch delta 248 zcmey(*vT|OvYwfNfk8u;KNv{)1^9%x0%_6WY_Y=3d|8KGi%>gRp zEeY}qW?*LK;&KTD8nI%*?y}vd$@?2>?*OT`~Xw delta 234 zcmV>+AnNo19bT z;^M#tl6Q7>6oJbF36P&K6(9`2FAoDi0l1TqC1Gq_@)R3DFdYDyWTpdz0Yg0<0BOq7 k0g$FF9l*qJ$y00q0DfS@_D8%Q_y7O^07*qoM6N<$f(SBZ9{>OV diff --git a/src/client/imagesource.cpp b/src/client/imagesource.cpp index 696159408..adc39f130 100644 --- a/src/client/imagesource.cpp +++ b/src/client/imagesource.cpp @@ -371,14 +371,12 @@ void blitBaseImage(video::IImage* &src, video::IImage* &dst) namespace { -/** Calculate the color of a single pixel drawn on top of another pixel without - * gamma correction +/** Calculate the result of the overlay texture modifier (`^`) for a single + * pixel * - * The color mixing is a little more complicated than just - * video::SColor::getInterpolated because getInterpolated does not handle alpha - * correctly. - * For example, a pixel with alpha=64 drawn atop a pixel with alpha=128 should - * yield a pixel with alpha=160, while getInterpolated would yield alpha=96. + * This is not alpha blending if both src and dst are semi-transparent. The + * reason this is that an old implementation did it wrong, and fixing it would + * break backwards compatibility (see #14847). * * \tparam overlay If enabled, only modify dst_col if it is fully opaque * \param src_col Color of the top pixel