diff --git a/doc/lua_api.md b/doc/lua_api.md index aeb903ae2..57c99ef9d 100644 --- a/doc/lua_api.md +++ b/doc/lua_api.md @@ -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:x:,` 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:` 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:` 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 ----------------- diff --git a/games/devtest/mods/testnodes/textures.lua b/games/devtest/mods/testnodes/textures.lua index 96f291d6a..b95fbd62e 100644 --- a/games/devtest/mods/testnodes/textures.lua +++ b/games/devtest/mods/testnodes/textures.lua @@ -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 } diff --git a/games/devtest/mods/testnodes/textures/testnodes_128x128_rgb.png b/games/devtest/mods/testnodes/textures/testnodes_128x128_rgb.png new file mode 100644 index 000000000..060d8e67a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_128x128_rgb.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_mask_WRGBKW.png b/games/devtest/mods/testnodes/textures/testnodes_mask_WRGBKW.png new file mode 100644 index 000000000..03ab71e3f Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_mask_WRGBKW.png differ diff --git a/src/client/imagesource.cpp b/src/client/imagesource.cpp index bb6668264..195d57a41 100644 --- a/src/client/imagesource.cpp +++ b/src/client/imagesource.cpp @@ -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();