mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
getSignedDistanceField
This commit is contained in:
parent
845f2e99f5
commit
00189f2185
4 changed files with 60 additions and 52 deletions
|
|
@ -15,7 +15,6 @@ const generate = function(changeHeights = true) {
|
|||
cells.conf = new Uint8Array(cells.i.length); // confluences array
|
||||
let riverNext = 1; // first river id is 1
|
||||
|
||||
markupLand();
|
||||
const h = alterHeights();
|
||||
removeStoredLakeData();
|
||||
resolveDepressions(h);
|
||||
|
|
@ -27,16 +26,6 @@ const generate = function(changeHeights = true) {
|
|||
|
||||
TIME && console.timeEnd('generateRivers');
|
||||
|
||||
// build distance field in cells from water (cells.t)
|
||||
function markupLand() {
|
||||
const q = t => cells.i.filter(i => cells.t[i] === t);
|
||||
for (let t = 2, queue = q(t); queue.length; t++, queue = q(t)) {
|
||||
queue.forEach(i => cells.c[i].forEach(c => {
|
||||
if (!cells.t[c]) cells.t[c] = t+1;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
// height with added t value to make map less depressed
|
||||
function alterHeights() {
|
||||
const h = Array.from(cells.h)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue