mirror of
https://github.com/minetest/minetest.git
synced 2024-12-21 13:45:42 +01:00
Client: upscale [mask or base image (#15205)
This improves texture pack compatibility. Masks are expected to be of the same size as the base texture. This change upscales the smaller texture if needed. The behaviour is now the same as a.png^b.png and a.png^[overlay:b.png (to mention a few).
This commit is contained in:
parent
a19d0033bc
commit
95d7348a08
@ -490,6 +490,11 @@ to let the client generate textures on-the-fly.
|
||||
The modifiers are applied directly in sRGB colorspace,
|
||||
i.e. without gamma-correction.
|
||||
|
||||
### Notes
|
||||
|
||||
* `TEXMOD_UPSCALE`: The texture with the lower resolution will be automatically
|
||||
upscaled to the higher resolution texture.
|
||||
|
||||
### Texture overlaying
|
||||
|
||||
Textures can be overlaid by putting a `^` between them.
|
||||
@ -503,8 +508,9 @@ Example:
|
||||
default_dirt.png^default_grass_side.png
|
||||
|
||||
`default_grass_side.png` is overlaid over `default_dirt.png`.
|
||||
The texture with the lower resolution will be automatically upscaled to
|
||||
the higher resolution texture.
|
||||
|
||||
*See notes: `TEXMOD_UPSCALE`*
|
||||
|
||||
|
||||
### Texture grouping
|
||||
|
||||
@ -701,6 +707,8 @@ Apply a mask to the base image.
|
||||
|
||||
The mask is applied using binary AND.
|
||||
|
||||
*See notes: `TEXMOD_UPSCALE`*
|
||||
|
||||
#### `[sheet:<w>x<h>:<x>,<y>`
|
||||
|
||||
Retrieves a tile at position x, y (in tiles, 0-indexed)
|
||||
@ -798,6 +806,8 @@ in GIMP. Overlay is the same as Hard light but with the role of the two
|
||||
textures swapped, see the `[hardlight` modifier description for more detail
|
||||
about these blend modes.
|
||||
|
||||
*See notes: `TEXMOD_UPSCALE`*
|
||||
|
||||
#### `[hardlight:<file>`
|
||||
|
||||
Applies a Hard light blend with the two textures, like the Hard light layer
|
||||
@ -813,6 +823,8 @@ increase contrast without clipping.
|
||||
Hard light is the same as Overlay but with the roles of the two textures
|
||||
swapped, i.e. `A.png^[hardlight:B.png` is the same as `B.png^[overlay:A.png`
|
||||
|
||||
*See notes: `TEXMOD_UPSCALE`*
|
||||
|
||||
#### `[png:<base64>`
|
||||
|
||||
Embed a base64 encoded PNG image in the texture string.
|
||||
@ -831,6 +843,8 @@ In particular consider `minetest.dynamic_add_media` and test whether
|
||||
using other texture modifiers could result in a shorter string than
|
||||
embedding a whole image, this may vary by use case.
|
||||
|
||||
*See notes: `TEXMOD_UPSCALE`*
|
||||
|
||||
Hardware coloring
|
||||
-----------------
|
||||
|
||||
|
@ -52,6 +52,12 @@ minetest.register_node("testnodes:fill_positioning_reference", {
|
||||
groups = {dig_immediate = 3},
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:modifier_mask", {
|
||||
description = S("[mask Modifier Test Node"),
|
||||
tiles = {"testnodes_128x128_rgb.png^[mask:testnodes_mask_WRGBKW.png"},
|
||||
groups = {dig_immediate = 3},
|
||||
})
|
||||
|
||||
-- Node texture transparency test
|
||||
|
||||
local alphas = { 64, 128, 191 }
|
||||
|
BIN
games/devtest/mods/testnodes/textures/testnodes_128x128_rgb.png
Normal file
BIN
games/devtest/mods/testnodes/textures/testnodes_128x128_rgb.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
games/devtest/mods/testnodes/textures/testnodes_mask_WRGBKW.png
Normal file
BIN
games/devtest/mods/testnodes/textures/testnodes_mask_WRGBKW.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 148 B |
@ -1447,6 +1447,8 @@ bool ImageSource::generateImagePart(std::string_view part_of_name,
|
||||
|
||||
video::IImage *img = generateImage(filename, source_image_names);
|
||||
if (img) {
|
||||
upscaleImagesToMatchLargest(baseimg, img);
|
||||
|
||||
apply_mask(img, baseimg, v2s32(0, 0), v2s32(0, 0),
|
||||
img->getDimension());
|
||||
img->drop();
|
||||
|
Loading…
Reference in New Issue
Block a user