Tried multiple attempts since then, here’s updated version.
mesh quads.zip (1.8 MB)
There function that control position vertices . Ortographic version works without tearing, but with isometric i tried multiple formulae to transfrom orto to iso coordinates, none works. I guess maybe problem is because tiled y coordinate starts at top to bottom, meanwhile defold from bottom to top.
local function set_pos_vertices(stream, offset, x, y, z, w, h, is_rotated)
z = M.y_sort(x, y, z) -- sort must be before x, y
if M.mode == M.MODES.ORTHOGRAPHIC then
x = x * M.tile_width
y = y * M.tile_height
else -- isometric
x, y = (x - y) * 16 - 16, (x + y) * 8
end
if is_rotated then
-- v 3---2 indices
-- | > |B/A| > 1-2-3
-- 0---u 0---1 1-3-0
stream[offset + 01], stream[offset + 02], stream[offset + 03] = x + w, y, z
stream[offset + 04], stream[offset + 05], stream[offset + 06] = x + w, y + h, z
stream[offset + 07], stream[offset + 08], stream[offset + 09] = x, y + h, z
---
stream[offset + 10], stream[offset + 11], stream[offset + 12] = x + w, y, z
stream[offset + 13], stream[offset + 14], stream[offset + 15] = x, y + h, z
stream[offset + 16], stream[offset + 17], stream[offset + 18] = x, y, z
else
-- v 3---2 indices
-- | > |B/A| > 0-1-2
-- 0---u 0---1 0-2-3
stream[offset + 01], stream[offset + 02], stream[offset + 03] = x, y, z
stream[offset + 04], stream[offset + 05], stream[offset + 06] = x + w, y, z
stream[offset + 07], stream[offset + 08], stream[offset + 09] = x + w, y + h, z
--
stream[offset + 10], stream[offset + 11], stream[offset + 12] = x, y, z
stream[offset + 13], stream[offset + 14], stream[offset + 15] = x + w, y + h, z
stream[offset + 16], stream[offset + 17], stream[offset + 18] = x, y + h, z
end
end
p.s. project contains 2 git branches (ortograhic and isometric)