From ebbc51222a350476d97cd41ffbf6cf3d567e8e29 Mon Sep 17 00:00:00 2001 From: liteng <930372551@qq.com> Date: Tue, 23 Oct 2018 21:57:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=BD=A2=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShadowEditor.Web/src/object/terrain/Terrain.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ShadowEditor.Web/src/object/terrain/Terrain.js b/ShadowEditor.Web/src/object/terrain/Terrain.js index 35dd229d..a3420521 100644 --- a/ShadowEditor.Web/src/object/terrain/Terrain.js +++ b/ShadowEditor.Web/src/object/terrain/Terrain.js @@ -41,15 +41,14 @@ Terrain.prototype.generateHeight = function (width, height) { var size = width * height, data = new Uint8Array(size), perlin = new ImprovedNoise(), - quality = 1, - z = Math.random(); + quality = 1; for (var j = 0; j < 4; j++) { for (var i = 0; i < size; i++) { - var x = i % width, y = ~~(i / width); + var x = i % width, y = parseInt(i / width); data[i] += Math.abs(perlin.noise(x / quality, y / quality, 0) * quality); } - quality *= 5; + quality *= 2; } return data;