aboutsummaryrefslogtreecommitdiff
path: root/games/devtest/mods/testnodes/textures.lua
blob: a508b6a4d07305aeab38d469dd89f3d166b231e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
-- Node texture tests

local S = minetest.get_translator("testnodes")

minetest.register_node("testnodes:6sides", {
	description = S("Six Textures Test Node"),
	tiles = {
		"testnodes_normal1.png",
		"testnodes_normal2.png",
		"testnodes_normal3.png",
		"testnodes_normal4.png",
		"testnodes_normal5.png",
		"testnodes_normal6.png",
	},

	groups = { dig_immediate = 2 },
})

minetest.register_node("testnodes:anim", {
	description = S("Animated Test Node"),
	tiles = {
		{ name = "testnodes_anim.png",
		animation = {
			type = "vertical_frames",
			aspect_w = 16,
			aspect_h = 16,
			length = 4.0,
		}, },
	},

	groups = { dig_immediate = 2 },
})

-- Node texture transparency test

local alphas = { 64, 128, 191 }

for a=1,#alphas do
	local alpha = alphas[a]

	-- Transparency taken from texture
	minetest.register_node("testnodes:alpha_texture_"..alpha, {
		description = S("Texture Alpha Test Node (@1)", alpha),
		drawtype = "glasslike",
		paramtype = "light",
		tiles = {
			"testnodes_alpha"..alpha..".png",
		},
		use_texture_alpha = "blend",

		groups = { dig_immediate = 3 },
	})

	-- Transparency set via texture modifier
	minetest.register_node("testnodes:alpha_"..alpha, {
		description = S("Alpha Test Node (@1)", alpha),
		drawtype = "glasslike",
		paramtype = "light",
		tiles = {
			"testnodes_alpha.png^[opacity:" .. alpha,
		},
		use_texture_alpha = "blend",

		groups = { dig_immediate = 3 },
	})
end


-- Bumpmapping and Parallax Occlusion

-- This node has a normal map which corresponds to a pyramid with sides tilted
-- by an angle of 45°, i.e. the normal map contains four vectors which point
-- diagonally away from the surface (e.g. (0.7, 0.7, 0)),
-- and the heights in the height map linearly increase towards the centre,
-- so that the surface corresponds to a simple pyramid.
-- The node can help to determine if e.g. tangent space transformations work
-- correctly.
-- If, for example, the light comes from above, then the (tilted) pyramids
-- should look like they're lit from this light direction on all node faces.
-- The white albedo texture has small black indicators which can be used to see
-- how it is transformed ingame (and thus see if there's rotation around the
-- normal vector).
minetest.register_node("testnodes:height_pyramid", {
	description = "Bumpmapping and Parallax Occlusion Tester (height pyramid)",
	tiles = {"testnodes_height_pyramid.png"},
	groups = {dig_immediate = 3},
})

-- The stairs nodes should help to validate if shading works correctly for
-- rotated nodes (which have rotated textures).
stairs.register_stair_and_slab("height_pyramid", "experimantal:height_pyramid",
	{dig_immediate = 3},
	{"testnodes_height_pyramid.png"},
	"Bumpmapping and Parallax Occlusion Tester Stair (height pyramid)",
	"Bumpmapping and Parallax Occlusion Tester Slab (height pyramid)")

-- This node has a simple heightmap for parallax occlusion testing and flat
-- normalmap.
-- When parallax occlusion is enabled, the yellow scrawl should stick out of
-- the texture when viewed at an angle.
minetest.register_node("testnodes:parallax_extruded", {
	description = "Parallax Occlusion Tester",
	tiles = {"testnodes_parallax_extruded.png"},
	groups = {dig_immediate = 3},
})

-- Analogously to the height pyramid stairs nodes,
-- these nodes should help to validate if parallax occlusion works correctly for
-- rotated nodes (which have rotated textures).
stairs.register_stair_and_slab("parallax_extruded",
	"experimantal:parallax_extruded",
	{dig_immediate = 3},
	{"testnodes_parallax_extruded.png"},
	"Parallax Occlusion Tester Stair",
	"Parallax Occlusion Tester Slab")