aboutsummaryrefslogtreecommitdiff
path: root/games/devtest/mods/testnodes/textures.lua
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2022-05-17 22:12:00 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2022-05-17 22:12:00 +0200
commit21df26984da91143c15587f5a03c98d68c3adc4e (patch)
treeaaa707a628ad331f67890023dffe1b4f60dd01d3 /games/devtest/mods/testnodes/textures.lua
parentb09fc5de5cdb021f43ad32b7e3f50dc75c0bc622 (diff)
parenteabf05758e3ba5f6f4bb1b8d1d1f02179b84e410 (diff)
downloaddragonfireclient-21df26984da91143c15587f5a03c98d68c3adc4e.tar.xz
Merge branch 'master' of https://github.com/minetest/minetest
Diffstat (limited to 'games/devtest/mods/testnodes/textures.lua')
-rw-r--r--games/devtest/mods/testnodes/textures.lua148
1 files changed, 148 insertions, 0 deletions
diff --git a/games/devtest/mods/testnodes/textures.lua b/games/devtest/mods/testnodes/textures.lua
index 4652007d9..2faacdd78 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,141 @@ 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 },
+})
+
+--[[
+
+The following nodes can be used to demonstrate the TGA format support.
+
+Minetest supports TGA types 1, 2, 3 & 10. While adding the support for
+TGA type 9 (RLE-compressed, color-mapped) is easy, it is not advisable
+to do so, as it is not backwards compatible with any Minetest pre-5.5;
+content creators should therefore either use TGA type 1 or 10, or PNG.
+
+TODO: Types 1, 2 & 10 should have two test nodes each (i.e. bottom-top
+and top-bottom) for 16bpp (A1R5G5B5), 24bpp (B8G8R8), 32bpp (B8G8R8A8)
+colors.
+
+Note: Minetest requires the optional TGA footer for a texture to load.
+If a TGA image does not load in Minetest, append eight (8) null bytes,
+then the string “TRUEVISION-XFILE.”, then another null byte.
+
+]]--
+
+minetest.register_node("testnodes:tga_type1_24bpp_bt", {
+ description = S("TGA Type 1 (color-mapped RGB) 24bpp bottom-top Test Node"),
+ drawtype = "glasslike",
+ paramtype = "light",
+ sunlight_propagates = true,
+ tiles = { "testnodes_tga_type1_24bpp_bt.tga" },
+ groups = { dig_immediate = 2 },
+})
+
+minetest.register_node("testnodes:tga_type1_24bpp_tb", {
+ description = S("TGA Type 1 (color-mapped RGB) 24bpp top-bottom Test Node"),
+ drawtype = "glasslike",
+ paramtype = "light",
+ sunlight_propagates = true,
+ tiles = { "testnodes_tga_type1_24bpp_tb.tga" },
+ groups = { dig_immediate = 2 },
+})
+
+minetest.register_node("testnodes:tga_type2_16bpp_bt", {
+ description = S("TGA Type 2 (uncompressed RGB) 16bpp bottom-top Test Node"),
+ drawtype = "glasslike",
+ paramtype = "light",
+ sunlight_propagates = true,
+ tiles = { "testnodes_tga_type2_16bpp_bt.tga" },
+ use_texture_alpha = "clip",
+ groups = { dig_immediate = 2 },
+})
+
+minetest.register_node("testnodes:tga_type2_16bpp_tb", {
+ description = S("TGA Type 2 (uncompressed RGB) 16bpp top-bottom Test Node"),
+ drawtype = "glasslike",
+ paramtype = "light",
+ sunlight_propagates = true,
+ tiles = { "testnodes_tga_type2_16bpp_tb.tga" },
+ use_texture_alpha = "clip",
+ groups = { dig_immediate = 2 },
+})
+
+minetest.register_node("testnodes:tga_type2_32bpp_bt", {
+ description = S("TGA Type 2 (uncompressed RGB) 32bpp bottom-top Test Node"),
+ drawtype = "glasslike",
+ paramtype = "light",
+ sunlight_propagates = true,
+ tiles = { "testnodes_tga_type2_32bpp_bt.tga" },
+ use_texture_alpha = "blend",
+ groups = { dig_immediate = 2 },
+})
+
+minetest.register_node("testnodes:tga_type2_32bpp_tb", {
+ description = S("TGA Type 2 (uncompressed RGB) 32bpp top-bottom Test Node"),
+ drawtype = "glasslike",
+ paramtype = "light",
+ sunlight_propagates = true,
+ tiles = { "testnodes_tga_type2_32bpp_tb.tga" },
+ use_texture_alpha = "blend",
+ groups = { dig_immediate = 2 },
+})
+
+minetest.register_node("testnodes:tga_type3_16bpp_bt", {
+ description = S("TGA Type 3 (uncompressed grayscale) 16bpp bottom-top Test Node"),
+ drawtype = "glasslike",
+ paramtype = "light",
+ sunlight_propagates = true,
+ tiles = { "testnodes_tga_type3_16bpp_bt.tga" },
+ use_texture_alpha = "blend",
+ groups = { dig_immediate = 2 },
+})
+
+minetest.register_node("testnodes:tga_type3_16bpp_tb", {
+ description = S("TGA Type 3 (uncompressed grayscale) 16bpp top-bottom Test Node"),
+ drawtype = "glasslike",
+ paramtype = "light",
+ sunlight_propagates = true,
+ tiles = { "testnodes_tga_type3_16bpp_tb.tga" },
+ use_texture_alpha = "blend",
+ groups = { dig_immediate = 2 },
+})
+
+minetest.register_node("testnodes:tga_type10_32bpp_bt", {
+ description = S("TGA Type 10 (RLE-compressed RGB) 32bpp bottom-top Test Node"),
+ tiles = { "testnodes_tga_type10_32bpp_bt.tga" },
+ drawtype = "glasslike",
+ paramtype = "light",
+ sunlight_propagates = true,
+ use_texture_alpha = "blend",
+ groups = { dig_immediate = 2 },
+})
+
+minetest.register_node("testnodes:tga_type10_32bpp_tb", {
+ description = S("TGA Type 10 (RLE-compressed RGB) 32bpp top-bottom Test Node"),
+ drawtype = "glasslike",
+ paramtype = "light",
+ sunlight_propagates = true,
+ tiles = { "testnodes_tga_type10_32bpp_tb.tga" },
+ use_texture_alpha = "blend",
+ groups = { dig_immediate = 2 },
+})