From cd4f69ef0822393e425ba47ba6728ed055a0c67a Mon Sep 17 00:00:00 2001 From: Evolvedexperiment Date: Tue, 2 Mar 2021 19:11:17 +0000 Subject: [PATCH] Change to 1k granularity for points --- index.html | 2 +- main.js | 2 +- modules/heightmap-generator.js | 36 ++++++++++++++++++++++++++++++++-- modules/ui/options.js | 6 +++--- 4 files changed, 39 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 13815826..94a4614f 100644 --- a/index.html +++ b/index.html @@ -942,7 +942,7 @@ Points number - + 10K diff --git a/main.js b/main.js index adac14e0..8bdca6b9 100644 --- a/main.js +++ b/main.js @@ -615,7 +615,7 @@ function generateSeed() { // Place points to calculate Voronoi diagram function placePoints() { TIME && console.time("placePoints"); - const cellsDesired = 10000 * densityInput.value; // generate 10k points for each densityInput point + const cellsDesired = 1000 * densityInput.value; // generate 1k points for each densityInput point const spacing = grid.spacing = rn(Math.sqrt(graphWidth * graphHeight / cellsDesired), 2); // spacing between points before jirrering grid.boundary = getBoundaryPoints(graphWidth, graphHeight, spacing); grid.points = getJitteredGrid(graphWidth, graphHeight, spacing); // jittered square grid diff --git a/modules/heightmap-generator.js b/modules/heightmap-generator.js index e469b4dc..f636b9fb 100644 --- a/modules/heightmap-generator.js +++ b/modules/heightmap-generator.js @@ -186,7 +186,23 @@ } function getBlobPower() { - switch (+densityInput.value) { + if (+densityInput.value < 10) { + switch (+densityInput.value) { + case 1: return .93; + case 2: return .95; + case 3: return .96; + case 4: return .96; + case 5: return .96; + case 6: return .96; + case 7: return .97; + case 8: return .97; + case 9: return .975; + case 10: return .98; + } + } + + let x = Math.max(1, rn(+densityInput.value / 10)); + switch (x) { case 1: return .98; case 2: return .985; case 3: return .987; @@ -201,7 +217,23 @@ } function getLinePower() { - switch (+densityInput.value) { + if (+densityInput.value < 10) { + switch (+densityInput.value) { + case 1: return .74; + case 2: return .75; + case 3: return .76; + case 4: return .77; + case 5: return .78; + case 6: return .79; + case 7: return .795; + case 8: return .80; + case 9: return .805; + case 10: return .81; + } + } + + let x = Math.max(1, rn(+densityInput.value / 10)); + switch (x) { case 1: return .81; case 2: return .82; case 3: return .83; diff --git a/modules/ui/options.js b/modules/ui/options.js index 26e3329e..b968043c 100644 --- a/modules/ui/options.js +++ b/modules/ui/options.js @@ -276,9 +276,9 @@ function copyMapURL() { } function changeCellsDensity(value) { - densityOutput.value = value * 10 + "K"; - if (value > 5) densityOutput.style.color = "#b12117"; - else if (value > 1) densityOutput.style.color = "#dfdf12"; + densityOutput.value = value * 1 + "K"; + if (value > 50) densityOutput.style.color = "#b12117"; + else if (value > 10) densityOutput.style.color = "#dfdf12"; else densityOutput.style.color = "#038603"; }