diff --git a/assets/index.html b/assets/index.html index fc5e3af..61aa0a8 100644 --- a/assets/index.html +++ b/assets/index.html @@ -196,10 +196,10 @@ if (h > 0) { var hRightNeighbor = heightMap[(wx + TILE) + ',' + wy] || 0; - var hLeftNeighbor = heightMap[wx + ',' + (wy - TILE)] || 0; + var hBackNeighbor = heightMap[wx + ',' + (wy - TILE)] || 0; var shadowFromRight = hRightNeighbor - h; - var shadowFromLeft = hLeftNeighbor - h; + var shadowFromBack = hBackNeighbor - h; if (shadowFromRight > 0) { var shadowW = Math.min(shadowFromRight * 2, TILE); @@ -221,13 +221,13 @@ }); } - if (shadowFromLeft > 0) { - var shadowW = Math.min(shadowFromLeft * 2, TILE); + if (shadowFromBack > 0) { + var shadowW = Math.min(shadowFromBack * 2, TILE); var tt = shadowW / TILE; var top1 = project(wx + GAP/2, wy + TILE - GAP/2, h * HEIGHT_UNIT); - var top4 = project(wx + GAP/2, wy + GAP/2, h * HEIGHT_UNIT); + var top2 = project(wx + TILE - GAP/2, wy + TILE - GAP/2, h * HEIGHT_UNIT); var topA = project(wx + GAP/2, wy + TILE - GAP/2 - (TILE - GAP) * tt, h * HEIGHT_UNIT); - var topB = project(wx + GAP/2, wy + GAP/2 - (TILE - GAP) * tt, h * HEIGHT_UNIT); + var topB = project(wx + TILE - GAP/2, wy + TILE - GAP/2 - (TILE - GAP) * tt, h * HEIGHT_UNIT); renderList.push({ type: 'shadow', @@ -235,7 +235,7 @@ { x: top1[0], y: top1[1] }, { x: topA[0], y: topA[1] }, { x: topB[0], y: topB[1] }, - { x: top4[0], y: top4[1] } + { x: top2[0], y: top2[1] } ], depth: wx + wy + 0.0005 });