mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
Added 1k, 2k, and 5k option for number of points
This commit is contained in:
parent
667006db86
commit
b2b46c4d39
4 changed files with 41 additions and 25 deletions
|
|
@ -942,7 +942,7 @@
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>Points number</td>
|
<td>Points number</td>
|
||||||
<td>
|
<td>
|
||||||
<input id="densityInput" type="range" min=1 max=10 value=1>
|
<input id="densityInput" type="range" min=1 max=13 value=4>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<output id="densityOutput">10K</output>
|
<output id="densityOutput">10K</output>
|
||||||
|
|
|
||||||
7
main.js
7
main.js
|
|
@ -615,7 +615,12 @@ function generateSeed() {
|
||||||
// Place points to calculate Voronoi diagram
|
// Place points to calculate Voronoi diagram
|
||||||
function placePoints() {
|
function placePoints() {
|
||||||
TIME && console.time("placePoints");
|
TIME && console.time("placePoints");
|
||||||
const cellsDesired = 10000 * densityInput.value; // generate 10k points for each densityInput point
|
let cellsDesired = 10000 * (+densityInput.value - 3); // generate 10k points for each densityInput point
|
||||||
|
switch (+densityInput.value) {
|
||||||
|
case 1: cellsDesired = 1000; break;
|
||||||
|
case 2: cellsDesired = 2000; break;
|
||||||
|
case 3: cellsDesired = 5000; break;
|
||||||
|
}
|
||||||
const spacing = grid.spacing = rn(Math.sqrt(graphWidth * graphHeight / cellsDesired), 2); // spacing between points before jirrering
|
const spacing = grid.spacing = rn(Math.sqrt(graphWidth * graphHeight / cellsDesired), 2); // spacing between points before jirrering
|
||||||
grid.boundary = getBoundaryPoints(graphWidth, graphHeight, spacing);
|
grid.boundary = getBoundaryPoints(graphWidth, graphHeight, spacing);
|
||||||
grid.points = getJitteredGrid(graphWidth, graphHeight, spacing); // jittered square grid
|
grid.points = getJitteredGrid(graphWidth, graphHeight, spacing); // jittered square grid
|
||||||
|
|
|
||||||
|
|
@ -187,31 +187,37 @@
|
||||||
|
|
||||||
function getBlobPower() {
|
function getBlobPower() {
|
||||||
switch (+densityInput.value) {
|
switch (+densityInput.value) {
|
||||||
case 1: return .98;
|
case 1: return .93;
|
||||||
case 2: return .985;
|
case 2: return .95;
|
||||||
case 3: return .987;
|
case 3: return .96;
|
||||||
case 4: return .9892;
|
case 4: return .98;
|
||||||
case 5: return .9911;
|
case 5: return .985;
|
||||||
case 6: return .9921;
|
case 6: return .987;
|
||||||
case 7: return .9934;
|
case 7: return .9892;
|
||||||
case 8: return .9942;
|
case 8: return .9911;
|
||||||
case 9: return .9946;
|
case 9: return .9921;
|
||||||
case 10: return .995;
|
case 10: return .9934;
|
||||||
|
case 11: return .9942;
|
||||||
|
case 12: return .9946;
|
||||||
|
case 13: return .995;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLinePower() {
|
function getLinePower() {
|
||||||
switch (+densityInput.value) {
|
switch (+densityInput.value) {
|
||||||
case 1: return .81;
|
case 1: return .74;
|
||||||
case 2: return .82;
|
case 2: return .75;
|
||||||
case 3: return .83;
|
case 3: return .78;
|
||||||
case 4: return .84;
|
case 4: return .81;
|
||||||
case 5: return .855;
|
case 5: return .82;
|
||||||
case 6: return .87;
|
case 6: return .83;
|
||||||
case 7: return .885;
|
case 7: return .84;
|
||||||
case 8: return .91;
|
case 8: return .855;
|
||||||
case 9: return .92;
|
case 9: return .87;
|
||||||
case 10: return .93;
|
case 10: return .885;
|
||||||
|
case 11: return .91;
|
||||||
|
case 12: return .92;
|
||||||
|
case 13: return .93;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -276,9 +276,14 @@ function copyMapURL() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeCellsDensity(value) {
|
function changeCellsDensity(value) {
|
||||||
densityOutput.value = value * 10 + "K";
|
switch (value) {
|
||||||
if (value > 5) densityOutput.style.color = "#b12117";
|
case 1 : densityOutput.value = "1K"; break;
|
||||||
else if (value > 1) densityOutput.style.color = "#dfdf12";
|
case 2 : densityOutput.value = "2K"; break;
|
||||||
|
case 3 : densityOutput.value = "5K"; break;
|
||||||
|
default: densityOutput.value = (value-3) * 10 + "K";
|
||||||
|
}
|
||||||
|
if (value > 9) densityOutput.style.color = "#b12117";
|
||||||
|
else if (value > 4) densityOutput.style.color = "#dfdf12";
|
||||||
else densityOutput.style.color = "#038603";
|
else densityOutput.style.color = "#038603";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue