]> git.lizzy.rs Git - dragonfireclient.git/blob - games/devtest/mods/testnodes/textures.lua
devtest: Fix deprecated alpha usage
[dragonfireclient.git] / games / devtest / mods / testnodes / textures.lua
1 -- Node texture tests
2
3 local S = minetest.get_translator("testnodes")
4
5 minetest.register_node("testnodes:6sides", {
6         description = S("Six Textures Test Node"),
7         tiles = {
8                 "testnodes_normal1.png",
9                 "testnodes_normal2.png",
10                 "testnodes_normal3.png",
11                 "testnodes_normal4.png",
12                 "testnodes_normal5.png",
13                 "testnodes_normal6.png",
14         },
15
16         groups = { dig_immediate = 2 },
17 })
18
19 minetest.register_node("testnodes:anim", {
20         description = S("Animated Test Node"),
21         tiles = {
22                 { name = "testnodes_anim.png",
23                 animation = {
24                         type = "vertical_frames",
25                         aspect_w = 16,
26                         aspect_h = 16,
27                         length = 4.0,
28                 }, },
29         },
30
31         groups = { dig_immediate = 2 },
32 })
33
34 -- Node texture transparency test
35
36 local alphas = { 64, 128, 191 }
37
38 for a=1,#alphas do
39         local alpha = alphas[a]
40
41         -- Transparency taken from texture
42         minetest.register_node("testnodes:alpha_texture_"..alpha, {
43                 description = S("Texture Alpha Test Node (@1)", alpha),
44                 drawtype = "glasslike",
45                 paramtype = "light",
46                 tiles = {
47                         "testnodes_alpha"..alpha..".png",
48                 },
49                 use_texture_alpha = "blend",
50
51                 groups = { dig_immediate = 3 },
52         })
53
54         -- Transparency set via texture modifier
55         minetest.register_node("testnodes:alpha_"..alpha, {
56                 description = S("Alpha Test Node (@1)", alpha),
57                 drawtype = "glasslike",
58                 paramtype = "light",
59                 tiles = {
60                         "testnodes_alpha.png^[opacity:" .. alpha,
61                 },
62                 use_texture_alpha = "blend",
63
64                 groups = { dig_immediate = 3 },
65         })
66 end
67
68
69 -- Bumpmapping and Parallax Occlusion
70
71 -- This node has a normal map which corresponds to a pyramid with sides tilted
72 -- by an angle of 45°, i.e. the normal map contains four vectors which point
73 -- diagonally away from the surface (e.g. (0.7, 0.7, 0)),
74 -- and the heights in the height map linearly increase towards the centre,
75 -- so that the surface corresponds to a simple pyramid.
76 -- The node can help to determine if e.g. tangent space transformations work
77 -- correctly.
78 -- If, for example, the light comes from above, then the (tilted) pyramids
79 -- should look like they're lit from this light direction on all node faces.
80 -- The white albedo texture has small black indicators which can be used to see
81 -- how it is transformed ingame (and thus see if there's rotation around the
82 -- normal vector).
83 minetest.register_node("testnodes:height_pyramid", {
84         description = "Bumpmapping and Parallax Occlusion Tester (height pyramid)",
85         tiles = {"testnodes_height_pyramid.png"},
86         groups = {dig_immediate = 3},
87 })
88
89 -- The stairs nodes should help to validate if shading works correctly for
90 -- rotated nodes (which have rotated textures).
91 stairs.register_stair_and_slab("height_pyramid", "experimantal:height_pyramid",
92         {dig_immediate = 3},
93         {"testnodes_height_pyramid.png"},
94         "Bumpmapping and Parallax Occlusion Tester Stair (height pyramid)",
95         "Bumpmapping and Parallax Occlusion Tester Slab (height pyramid)")
96
97 -- This node has a simple heightmap for parallax occlusion testing and flat
98 -- normalmap.
99 -- When parallax occlusion is enabled, the yellow scrawl should stick out of
100 -- the texture when viewed at an angle.
101 minetest.register_node("testnodes:parallax_extruded", {
102         description = "Parallax Occlusion Tester",
103         tiles = {"testnodes_parallax_extruded.png"},
104         groups = {dig_immediate = 3},
105 })
106
107 -- Analogously to the height pyramid stairs nodes,
108 -- these nodes should help to validate if parallax occlusion works correctly for
109 -- rotated nodes (which have rotated textures).
110 stairs.register_stair_and_slab("parallax_extruded",
111         "experimantal:parallax_extruded",
112         {dig_immediate = 3},
113         {"testnodes_parallax_extruded.png"},
114         "Parallax Occlusion Tester Stair",
115         "Parallax Occlusion Tester Slab")