aboutsummaryrefslogtreecommitdiff
path: root/games/devtest/mods/testnodes
diff options
context:
space:
mode:
authorhecks <42101236+hecktest@users.noreply.github.com>2021-10-13 17:51:37 +0200
committerGitHub <noreply@github.com>2021-10-13 17:51:37 +0200
commit02292e03e42e5c3be0aa09a329dabd9c8dad5571 (patch)
tree85b9607cdaf5778c9de8b1c5bcca28da612d7b1e /games/devtest/mods/testnodes
parentfe5cb2cdfb137764d20ca56f17f607ec361e0dcf (diff)
downloadminetest-02292e03e42e5c3be0aa09a329dabd9c8dad5571.tar.gz
minetest-02292e03e42e5c3be0aa09a329dabd9c8dad5571.tar.bz2
minetest-02292e03e42e5c3be0aa09a329dabd9c8dad5571.zip
Add embedded PNG texture modifier (#11498)
Diffstat (limited to 'games/devtest/mods/testnodes')
-rw-r--r--games/devtest/mods/testnodes/textures.lua31
1 files changed, 31 insertions, 0 deletions
diff --git a/games/devtest/mods/testnodes/textures.lua b/games/devtest/mods/testnodes/textures.lua
index 4652007d9..dc581b0c7 100644
--- a/games/devtest/mods/testnodes/textures.lua
+++ b/games/devtest/mods/testnodes/textures.lua
@@ -102,12 +102,22 @@ local function gen_checkers(w, h, tile)
end
local fractal = mandelbrot(512, 512, 128)
+local frac_emb = mandelbrot(64, 64, 64)
local checker = gen_checkers(512, 512, 32)
local floor = math.floor
local abs = math.abs
+local data_emb = {}
local data_mb = {}
local data_ck = {}
+for i=1, #frac_emb do
+ data_emb[i] = {
+ r = floor(abs(frac_emb[i] * 2 - 1) * 255),
+ g = floor(abs(1 - frac_emb[i]) * 255),
+ b = floor(frac_emb[i] * 255),
+ a = frac_emb[i] < 0.95 and 255 or 0,
+ }
+end
for i=1, #fractal do
data_mb[i] = {
r = floor(fractal[i] * 255),
@@ -140,3 +150,24 @@ minetest.register_node("testnodes:generated_png_ck", {
groups = { dig_immediate = 2 },
})
+
+local png_emb = "[png:" .. minetest.encode_base64(minetest.encode_png(64,64,data_emb))
+
+minetest.register_node("testnodes:generated_png_emb", {
+ description = S("Generated In-Band Mandelbrot PNG Test Node"),
+ tiles = { png_emb },
+
+ groups = { dig_immediate = 2 },
+})
+minetest.register_node("testnodes:generated_png_src_emb", {
+ description = S("Generated In-Band Source Blit Mandelbrot PNG Test Node"),
+ tiles = { png_emb .. "^testnodes_damage_neg.png" },
+
+ groups = { dig_immediate = 2 },
+})
+minetest.register_node("testnodes:generated_png_dst_emb", {
+ description = S("Generated In-Band Dest Blit Mandelbrot PNG Test Node"),
+ tiles = { "testnodes_generated_ck.png^" .. png_emb },
+
+ groups = { dig_immediate = 2 },
+})