mirror of
https://github.com/minetest/minetest.git
synced 2024-12-23 14:42:24 +01:00
cda112493a
* Add test nodes for alpha compositing and the fill texture modifier Texture test nodes can be helpful to test if `blit_with_alpha` works correctly. The alpha compositing test node covers different cases where pixel colors are mixed with each other. The test currently fails because `blitPixel` does not work correctly if a semi-transparent color is drawn on top of another semi-transparent color. The test nodes for the fill texture modifier show if the size and position arguments of the modifier work correctly. They do not cover special cases such as very large or negative position or size values. * Faster blit_with_alpha() The `blit_with_alpha` function has a noticeable effect on the time it takes to join a game. To reduce the join times, I replace the `blit_with_alpha` function with a new one: * It does not uses floating-point numbers. * It directly operates on the raw pixel data instead of using the comparatively slow `setPixel` and `getPixel` functions from Irrlicht. Only ECF_A8R8G8B8 base images are supported now. If the top image does not have the ECF_A8R8G8B8 color format, it is converted; I assume that this happens rarely. * There are case distinctions for fully opaque, fully transparent and semi-transparent pixels. This empirically increases the performance since the mixing between two semi-transparent happens rarely. * The new function no longer has the `src_pos` argument since it was always the zero vector. * The function is only documented once where it is declared. For backwards compatibility, `blit_with_alpha` still mixes colors without gamma correction. `blit_with_alpha` nonetheless behaves slightly different than before: If a semi-transparent pixel is drawn on top of another semi-transparent pixel, the color is mixed in a way which we can consider to be more correct now. |
||
---|---|---|
.. | ||
devtest |