2 slab_y = function(height, shift)
3 return {-0.5, -0.5 + (shift or 0), -0.5, 0.5, -0.5 + height +
6 slab_z = function(depth)
7 return {-0.5, -0.5, -0.5 + depth, 0.5, 0.5, 0.5}
9 bar_y = function(radius)
10 return {-radius, -0.5, -radius, radius, 0.5, radius}
12 cuboid = function(radius_x, radius_y, radius_z)
13 return {-radius_x, -radius_y, -radius_z, radius_x, radius_y, radius_z}
18 regular = {type="regular"},
19 null = {type="fixed", fixed={0,0,0,0,0,0}}
22 xdecor.pixelbox = function(size, boxes)
24 for _, box in pairs(boxes) do
25 -- `unpack` has been changed to `table.unpack` in newest Lua versions.
26 local x, y, z, w, h, l = unpack(box)
31 ((x + w) / size) - 0.5,
32 ((y + h) / size) - 0.5,
33 ((z + l) / size) - 0.5
36 return {type="fixed", fixed=fixed}
40 mt.__index = function(table, key)
41 local ref = xdecor.box[key]
42 local ref_type = type(ref)
44 if ref_type == "function" then
46 return {type="fixed", fixed=ref(...)}
48 elseif ref_type == "table" then
49 return {type="fixed", fixed=ref}
50 elseif ref_type == "nil" then
51 error(key.."could not be found among nodebox presets and functions")
54 error("unexpected datatype "..tostring(type(ref)).." while looking for "..key)
57 setmetatable(xdecor.nodebox, mt)