Upgrade roof slopes to use proper meshes

instead of hundreds of nodeboxes per.
This commit is contained in:
Vanessa Ezekowitz 2014-12-13 17:03:08 -05:00
parent 3c3aa9e0d0
commit d8252aee6b
37 changed files with 137 additions and 84 deletions

View File

@ -0,0 +1,35 @@
# Blender v2.69 (sub 0) OBJ File: 'slope_test_slope.blend'
# www.blender.org
mtllib slope_test_slope.mtl
o Cube_Cube.002
v 0.500000 0.500000 0.500000
v -0.500000 0.500000 0.500000
v -0.500000 -0.500000 0.500000
v 0.500000 -0.500000 0.500000
v -0.500000 -0.500000 -0.500000
v 0.500000 -0.500000 -0.500000
vt 0.546875 0.984375
vt 0.296875 0.984375
vt 0.296875 0.734375
vt 0.546875 0.734375
vt 0.578125 0.734375
vt 0.828125 0.734375
vt 0.828125 0.984375
vt 0.578125 0.984375
vt 0.546875 0.703125
vt 0.296875 0.453125
vt 0.546875 0.453125
vt 0.578125 0.703125
vt 0.578125 0.453125
vt 0.828125 0.453125
vt 0.265625 0.984375
vt 0.015625 0.984375
vt 0.015625 0.609375
vt 0.265625 0.609375
usemtl None
s off
f 1/1 2/2 3/3 4/4
f 4/5 3/6 5/7 6/8
f 2/9 5/10 3/11
f 1/12 4/13 6/14
f 2/15 1/16 6/17 5/18

View File

@ -0,0 +1,48 @@
# Blender v2.69 (sub 0) OBJ File: 'slope_test_icorner.blend'
# www.blender.org
mtllib slope_test_icorner.mtl
o Cube_Cube.000
v 0.500000 0.500000 0.500000
v -0.500000 0.500000 0.500000
v -0.500000 -0.500000 0.500000
v 0.500000 -0.500000 0.500000
v -0.500000 -0.500000 -0.500000
v 0.500000 0.500000 -0.500000
v 0.500000 -0.500000 0.500000
v 0.500000 -0.500000 -0.500000
v -0.500000 -0.500000 -0.500000
vt 0.546875 0.984375
vt 0.296875 0.984375
vt 0.296875 0.734375
vt 0.546875 0.734375
vt 0.828125 0.421875
vt 0.578125 0.171875
vt 0.828125 0.171875
vt 0.546875 0.703125
vt 0.296875 0.703125
vt 0.546875 0.328125
vt 0.578125 0.703125
vt 0.578125 0.453125
vt 0.828125 0.453125
vt 0.828125 0.984375
vt 0.578125 0.984375
vt 0.578125 0.734375
vt 0.828125 0.734375
vt 0.015625 0.734375
vt 0.265625 0.734375
vt 0.265625 0.984375
vt 0.015625 0.984375
vt 0.265625 0.703125
vt 0.015625 0.703125
vt 0.015625 0.328125
usemtl None
s off
f 6/1 1/2 7/3 8/4
f 2/5 5/6 3/7
f 2/8 1/9 5/10
f 6/11 8/12 9/13
f 9/14 8/15 7/16 3/17
f 3/18 7/19 1/20 2/21
f 1/22 6/23 9/24
l 1 4
l 3 4

View File

@ -0,0 +1,32 @@
# Blender v2.69 (sub 0) OBJ File: 'slope_test_ocorner.blend'
# www.blender.org
mtllib slope_test_ocorner.mtl
o Cube_Cube.002
v 0.500000 0.500000 0.500000
v -0.500000 -0.500000 0.500000
v 0.500000 -0.500000 0.500000
v -0.500000 -0.500000 -0.500000
v 0.500000 -0.500000 -0.500000
vt 0.578125 0.734375
vt 0.828125 0.734375
vt 0.828125 0.984375
vt 0.578125 0.984375
vt 0.296875 0.703125
vt 0.296875 0.453125
vt 0.546875 0.453125
vt 0.546875 0.984375
vt 0.296875 0.734375
vt 0.546875 0.734375
vt 0.265625 0.578125
vt 0.015625 0.203125
vt 0.265625 0.203125
vt 0.015625 0.984375
vt 0.015625 0.609375
vt 0.265625 0.609375
usemtl None
s off
f 3/1 2/2 4/3 5/4
f 1/5 3/6 5/7
f 1/8 2/9 3/10
f 1/11 4/12 2/13
f 1/14 5/15 4/16

View File

@ -4,16 +4,12 @@ local S = homedecor.gettext
-- Corner shingle nodes, courtesy Bas080
homedecor.register_outer_corner = function(modname, subname, groups, images, description)
local slopeboxedge = {}
local detail = homedecor.detail_level
for i = 0, detail-1 do
slopeboxedge[i+1]={-0.5, -0.5, (i/detail)-0.5, 0.5-(i/detail), (i/detail)-0.5+(1.25/detail), 0.5}
end
homedecor.register_outer_corner = function(modname, subname, groups, slope_image, description)
minetest.register_node(modname..":shingle_outer_corner_" .. subname, {
description = S(description.. " (outer corner)"),
drawtype = "nodebox",
tiles = images,
drawtype = "mesh",
mesh = "homedecor_slope_outer_corner.obj",
tiles = { "homedecor_slope_outer_corner_"..slope_image..".png" },
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
@ -34,17 +30,12 @@ homedecor.register_outer_corner = function(modname, subname, groups, images, des
})
end
homedecor.register_inner_corner = function(modname, subname, groups, images, description)
local slopeboxedge = {}
local detail = homedecor.detail_level
for i = 0, detail-1 do
slopeboxedge[i+1]={-0.5, -0.5, -0.5, 0.5-(i/detail), (i/detail)-0.5+(1.25/detail), 0.5}
slopeboxedge[i+detail+1]={-0.5, -0.5, (i/detail)-0.5, 0.5, (i/detail)-0.5+(1.25/detail), 0.5}
end
homedecor.register_inner_corner = function(modname, subname, groups, slope_image, description)
minetest.register_node(modname..":shingle_inner_corner_" .. subname, {
description = S(description.. " (inner corner)"),
drawtype = "nodebox",
tiles = images,
drawtype = "mesh",
mesh = "homedecor_slope_inner_corner.obj",
tiles = { "homedecor_slope_inner_corner_"..slope_image..".png" },
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
@ -52,24 +43,16 @@ homedecor.register_inner_corner = function(modname, subname, groups, images, des
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
},
node_box = {
type = "fixed",
fixed = slopeboxedge
},
groups = groups,
})
end
homedecor.register_slope = function(modname, subname, recipeitem, groups, images, description)
local slopeboxedge = {}
local detail = homedecor.detail_level
for i = 0, detail-1 do
slopeboxedge[i+1]={-0.5, -0.5, (i/detail)-0.5, 0.5, (i/detail)-0.5+(1.25/detail), 0.5}
end
homedecor.register_slope = function(modname, subname, recipeitem, groups, slope_image, description)
minetest.register_node(modname..":shingle_side_" .. subname, {
description = S(description),
drawtype = "nodebox",
tiles = images,
drawtype = "mesh",
mesh = "homedecor_slope.obj",
tiles = { "homedecor_slope_"..slope_image..".png" },
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
@ -201,49 +184,28 @@ minetest.register_craft({
burntime = 30,
})
homedecor.register_roof = function(modname, subname, groups, images , description)
homedecor.register_outer_corner(modname, subname, groups, images, description)
homedecor.register_inner_corner(modname, subname, groups, images, description)
homedecor.register_roof = function(modname, subname, groups, slope_image , description)
homedecor.register_outer_corner(modname, subname, groups, slope_image, description)
homedecor.register_inner_corner(modname, subname, groups, slope_image, description)
end
-- corners
homedecor.register_roof("homedecor", "wood",
{ snappy = 3 },
{
"homedecor_shingles_wood_c_t.png",
"homedecor_shingles_wood_c_x.png",
"homedecor_shingles_wood_c_x.png",
"homedecor_shingles_wood_c_x.png",
"homedecor_shingles_wood_c_z.png",
"homedecor_shingles_wood_c_z.png",
},
"wood",
"Wood Shingles"
)
homedecor.register_roof("homedecor", "asphalt",
{ snappy = 3 },
{
"homedecor_shingles_asphalt_c_t.png",
"homedecor_shingles_asphalt_c_x.png",
"homedecor_shingles_asphalt_c_x.png",
"homedecor_shingles_asphalt_c_x.png",
"homedecor_shingles_asphalt_c_z.png",
"homedecor_shingles_asphalt_c_z.png",
},
"asphalt",
"Asphalt Shingles"
)
homedecor.register_roof("homedecor", "terracotta",
{ snappy = 3 },
{
"homedecor_shingles_terracotta_c_t.png",
"homedecor_shingles_terracotta_c_x.png",
"homedecor_shingles_terracotta_c_x.png",
"homedecor_shingles_terracotta_c_x.png",
"homedecor_shingles_terracotta_c_z.png",
"homedecor_shingles_terracotta_c_z.png",
},
"terracotta",
"Terracotta Shingles"
)
@ -252,52 +214,28 @@ homedecor.register_roof("homedecor", "terracotta",
homedecor.register_slope("homedecor", "wood",
"homedecor:shingles_wood",
{ snappy = 3 },
{
"homedecor_shingles_wood_s_t.png",
"homedecor_shingles_wood_s_z.png",
"homedecor_shingles_wood_s_z.png",
"homedecor_shingles_wood_s_z.png",
"homedecor_shingles_wood_s_z.png",
"homedecor_shingles_wood_s_z.png",
},
"wood",
"Wood Shingles"
)
homedecor.register_slope("homedecor", "asphalt",
"homedecor:shingles_asphalt",
{ snappy = 3 },
{
"homedecor_shingles_asphalt_s_t.png",
"homedecor_shingles_asphalt_s_z.png",
"homedecor_shingles_asphalt_s_z.png",
"homedecor_shingles_asphalt_s_z.png",
"homedecor_shingles_asphalt_s_z.png",
"homedecor_shingles_asphalt_s_z.png",
},
"asphalt",
"Asphalt Shingles"
)
homedecor.register_slope("homedecor", "terracotta",
"homedecor:shingles_terracotta",
{ snappy = 3 },
{
"homedecor_shingles_terracotta_s_t.png",
"homedecor_shingles_terracotta_s_z.png",
"homedecor_shingles_terracotta_s_z.png",
"homedecor_shingles_terracotta_s_z.png",
"homedecor_shingles_terracotta_s_z.png",
"homedecor_shingles_terracotta_s_z.png",
},
"terracotta",
"Terracotta Shingles"
)
homedecor.register_slope("homedecor", "glass",
"homedecor:shingles_glass",
{ snappy = 3 },
{
"homedecor_shingles_glass_top.png",
"homedecor_shingles_glass.png"
},
"glass",
"Glass Shingles"
)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 B

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 454 B

After

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 896 B

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 896 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 896 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB