Return back to table.insert() on xwall

This commit is contained in:
kilbith 2015-08-24 20:42:45 +02:00
parent be05c7ef77
commit b4da14d64f

View File

@ -102,56 +102,35 @@ end
function xwall.construct_node_box_data(node_box_list, center_node_box_list, node_box_line) function xwall.construct_node_box_data(node_box_list, center_node_box_list, node_box_line)
local res = {} local res = {}
res.c0, res.c1, res.c2, res.c3, res.c4 = {}, {}, {}, {}, {} res.c0, res.c1, res.c2, res.c3, res.c4 = {}, {}, {}, {}, {}
local pos0, pos1, pos2, pos3, pos4 = #res.c0, #res.c1, #res.c2, #res.c3, #res.c4
for i = 1, #node_box_list do for _, v in pairs(node_box_list) do
local v = node_box_list[i] table.insert(res.c1, v)
pos1 = pos1 + 1 table.insert(res.c2, v)
pos2 = pos2 + 1 table.insert(res.c3, v)
pos3 = pos3 + 1 table.insert(res.c4, v)
pos4 = pos4 + 1
res.c1[pos1] = v
res.c2[pos2] = v
res.c3[pos3] = v
res.c4[pos4] = v
end end
for i = 1, #node_box_list do for _, v in pairs(node_box_list) do
local v = node_box_list[i] table.insert(res.c2, {v[3], v[2], v[1], v[6], v[5], v[4]})
pos2 = pos2 + 1 table.insert(res.c3, {v[3], v[2], v[1], v[6], v[5], v[4]})
pos3 = pos3 + 1 table.insert(res.c4, {v[3], v[2], v[1], v[6], v[5], v[4]})
pos4 = pos4 + 1
res.c2[pos2] = {v[3], v[2], v[1], v[6], v[5], v[4]}
res.c3[pos3] = {v[3], v[2], v[1], v[6], v[5], v[4]}
res.c4[pos4] = {v[3], v[2], v[1], v[6], v[5], v[4]}
end end
for i = 1, #node_box_list do for _, v in pairs(node_box_list) do
local v = node_box_list[i] table.insert(res.c3, {v[4], v[2], v[3]-0.5, v[1], v[5], v[6]-0.5})
pos3 = pos3 + 1 table.insert(res.c4, {v[4], v[2], v[3]-0.5, v[1], v[5], v[6]-0.5})
pos4 = pos4 + 1
res.c3[pos3] = {v[4], v[2], v[3]-.5, v[1], v[5], v[6]-.5}
res.c4[pos4] = {v[4], v[2], v[3]-.5, v[1], v[5], v[6]-.5}
end end
for i = 1, #node_box_list do for _, v in pairs(node_box_list) do
local v = node_box_list[i] table.insert(res.c4, {v[3]-0.5, v[2], v[4], v[6]-0.5, v[5], v[1]})
pos4 = pos4 + 1
res.c4[pos4] = {v[3]-.5, v[2], v[4], v[6]-.5, v[5], v[1]}
end end
for i = 1, #center_node_box_list do for _, v in pairs(center_node_box_list) do
local v = center_node_box_list[i] table.insert(res.c0, v)
pos0 = pos0 + 1 table.insert(res.c1, v)
pos1 = pos1 + 1 table.insert(res.c2, v)
pos2 = pos2 + 1 table.insert(res.c3, v)
pos3 = pos3 + 1 table.insert(res.c4, v)
pos4 = pos4 + 1
res.c0[pos0] = v
res.c1[pos1] = v
res.c2[pos2] = v
res.c3[pos3] = v
res.c4[pos4] = v
end end
if #res.c0 < 1 then res.c0 = nil end if #res.c0 < 1 then res.c0 = nil end