diff --git a/assets/index.html b/assets/index.html
index cc8d579..1da997d 100644
--- a/assets/index.html
+++ b/assets/index.html
@@ -193,19 +193,19 @@
}
if (h > 0) {
- var hFrontNeighbor2 = heightMap[(wx + TILE) + ',' + wy] || 0;
- var hBackNeighbor2 = heightMap[wx + ',' + (wy - TILE)] || 0;
+ var hRightNeighbor = heightMap[(wx + TILE) + ',' + wy] || 0;
+ var hLeftNeighbor = heightMap[wx + ',' + (wy - TILE)] || 0;
- var shadowFront = hFrontNeighbor2 - h;
- var shadowBack = hBackNeighbor2 - h;
+ var shadowFromRight = hRightNeighbor - h;
+ var shadowFromLeft = hLeftNeighbor - h;
- if (shadowFront > 0) {
- var shadowW = Math.min(shadowFront * 2, TILE);
+ if (shadowFromRight > 0) {
+ var shadowW = Math.min(shadowFromRight * 2, TILE);
var tt = shadowW / TILE;
var top2 = project(wx + TILE - GAP/2, wy + TILE - GAP/2, h * HEIGHT_UNIT);
var top3 = project(wx + TILE - GAP/2, wy + GAP/2, h * HEIGHT_UNIT);
- var topA = project(wx + TILE - GAP/2, wy + TILE - GAP/2 - (TILE - GAP) * tt, h * HEIGHT_UNIT);
- var topB = project(wx + TILE - GAP/2, wy + GAP/2 + (TILE - GAP) * tt, h * HEIGHT_UNIT);
+ var topA = project(wx + TILE - GAP/2 - (TILE - GAP) * tt, wy + TILE - GAP/2, h * HEIGHT_UNIT);
+ var topB = project(wx + TILE - GAP/2 - (TILE - GAP) * tt, wy + GAP/2, h * HEIGHT_UNIT);
shadows.push({
points: [
@@ -218,20 +218,20 @@
});
}
- if (shadowBack > 0) {
- var shadowW = Math.min(shadowBack * 2, TILE);
+ if (shadowFromLeft > 0) {
+ var shadowW = Math.min(shadowFromLeft * 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 topA = project(wx + GAP/2 + (TILE - GAP) * tt, wy + TILE - GAP/2, h * HEIGHT_UNIT);
- var topB = project(wx + GAP/2 + (TILE - GAP) * tt, wy + 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);
shadows.push({
points: [
- { x: top4[0], y: top4[1] },
+ { x: top1[0], y: top1[1] },
{ x: topA[0], y: topA[1] },
{ x: topB[0], y: topB[1] },
- { x: top1[0], y: top1[1] }
+ { x: top4[0], y: top4[1] }
],
depth: (wx + wy) + 1
});