diff --git a/vendor/clouds3d.js b/vendor/clouds3d.js index e70acf8..b755466 100644 --- a/vendor/clouds3d.js +++ b/vendor/clouds3d.js @@ -336,6 +336,29 @@ function drawTileAt(lng, perp, dx, dz, centerTileX, centerTileY) { return fetchTileImage(tileX, tileY).then(function(img) { groundCtx.drawImage(img, canvasX, canvasY); groundLoadedTiles[tileX + '_' + tileY] = true; + + // Debug labels: 'N' at the image's north edge (top of canvas + // tile area after UNPACK_FLIP_Y_WEBGL), 'S' at south edge. + // Tile coords X,Y at the centre so we can verify the canvas + // arrangement matches the world directions. + groundCtx.fillStyle = 'rgba(255,255,255,0.85)'; + groundCtx.strokeStyle = 'rgba(0,0,0,0.85)'; + groundCtx.lineWidth = 3; + groundCtx.font = 'bold 48px sans-serif'; + groundCtx.textAlign = 'center'; + // N at canvas top of tile area (= north in image) + groundCtx.strokeText('N', canvasX + 128, canvasY + 56); + groundCtx.fillText('N', canvasX + 128, canvasY + 56); + // S at canvas bottom of tile area + groundCtx.strokeText('S', canvasX + 128, canvasY + 240); + groundCtx.fillText('S', canvasX + 128, canvasY + 240); + // Tile coords + groundCtx.font = 'bold 20px monospace'; + groundCtx.strokeText('x=' + tileX + ' y=' + tileY, + canvasX + 128, canvasY + 140); + groundCtx.fillText('x=' + tileX + ' y=' + tileY, + canvasX + 128, canvasY + 140); + return true; }).catch(function() { // On failure draw a neutral gray so the gap is at least