mirror of
https://github.com/minetest/minetest.git
synced 2024-11-09 17:23:45 +01:00
Restore buggy texture overlay modifier (#14852)
Required because of backwards compatibility.
This commit is contained in:
parent
682b789dd5
commit
768fd4adee
@ -456,6 +456,10 @@ i.e. without gamma-correction.
|
|||||||
|
|
||||||
Textures can be overlaid by putting a `^` between them.
|
Textures can be overlaid by putting a `^` between them.
|
||||||
|
|
||||||
|
Warning: If the lower and upper pixels are both semi-transparent, this operation
|
||||||
|
does *not* do alpha blending, and it is *not* associative. Otherwise it does
|
||||||
|
alpha blending in srgb color space.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
default_dirt.png^default_grass_side.png
|
default_dirt.png^default_grass_side.png
|
||||||
|
@ -420,12 +420,11 @@ void blit_pixel(video::SColor src_col, video::SColor &dst_col)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// A semi-transparent pixel is on top of a
|
// A semi-transparent pixel is on top of a
|
||||||
// semi-transparent pixel -> general alpha compositing
|
// semi-transparent pixel -> weird overlaying
|
||||||
u16 a_new_255 = src_a * 255 + (255 - src_a) * dst_a;
|
dst.r = (dst.r * (255 - src_a) + src.r * src_a) / 255;
|
||||||
dst.r = (dst.r * (255 - src_a) * dst_a + src.r * src_a * 255) / a_new_255;
|
dst.g = (dst.g * (255 - src_a) + src.g * src_a) / 255;
|
||||||
dst.g = (dst.g * (255 - src_a) * dst_a + src.g * src_a * 255) / a_new_255;
|
dst.b = (dst.b * (255 - src_a) + src.b * src_a) / 255;
|
||||||
dst.b = (dst.b * (255 - src_a) * dst_a + src.b * src_a * 255) / a_new_255;
|
dst_a = dst_a + (255 - dst_a) * src_a * src_a / (255 * 255);
|
||||||
dst_a = (a_new_255 + 127) / 255;
|
|
||||||
dst_col.set(dst_a, dst.r, dst.g, dst.b);
|
dst_col.set(dst_a, dst.r, dst.g, dst.b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user