mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 20:11:24 +01:00
updated resampler
This commit is contained in:
parent
01cc1eec30
commit
a3c81b24d1
2 changed files with 20 additions and 3 deletions
|
|
@ -64,13 +64,18 @@ window.Submap = (function () {
|
||||||
baseState.pack.rivers.forEach(r =>
|
baseState.pack.rivers.forEach(r =>
|
||||||
r.cells.forEach(oldc => {
|
r.cells.forEach(oldc => {
|
||||||
const targetCells = forwardGridMap[oldc];
|
const targetCells = forwardGridMap[oldc];
|
||||||
|
if (!targetCells) {
|
||||||
|
console.error('Targetcells is empty');
|
||||||
|
console.log("oldc,gridmap", oldc, forwardGridMap);
|
||||||
|
return;
|
||||||
|
}
|
||||||
targetCells.forEach(c => {
|
targetCells.forEach(c => {
|
||||||
if (grid.cells.t[c]<1) return;
|
if (grid.cells.t[c]<1) return;
|
||||||
rbeds[c] = 1;
|
rbeds[c] = 1;
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
// raise every land cell a bit
|
// raise every land cell a bit except riverbeds
|
||||||
grid.cells.h.forEach((h, i) => {
|
grid.cells.h.forEach((h, i) => {
|
||||||
if (!rbeds[i] || grid.cells.t[i]<1) return;
|
if (!rbeds[i] || grid.cells.t[i]<1) return;
|
||||||
grid.cells.h[i] = Math.min(grid.cells.h[i] * 1.1, 255);
|
grid.cells.h[i] = Math.min(grid.cells.h[i] * 1.1, 255);
|
||||||
|
|
@ -78,7 +83,8 @@ window.Submap = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
markupGridOcean();
|
markupGridOcean();
|
||||||
addLakesInDeepDepressions();
|
if (options.addLakesInDepressions)
|
||||||
|
addLakesInDeepDepressions();
|
||||||
// openNearSeaLakes();
|
// openNearSeaLakes();
|
||||||
OceanLayers();
|
OceanLayers();
|
||||||
// defineMapSize(); // not needed (not random)
|
// defineMapSize(); // not needed (not random)
|
||||||
|
|
@ -150,9 +156,19 @@ window.Submap = (function () {
|
||||||
|
|
||||||
// transfer basemap cultures
|
// transfer basemap cultures
|
||||||
pack.cultures = baseState.pack.cultures
|
pack.cultures = baseState.pack.cultures
|
||||||
|
// fix culture centers
|
||||||
|
const validCultures = new Set(pack.cells.culture);
|
||||||
|
pack.cultures.forEach((c, i) => {
|
||||||
|
if (!validCultures.has(c)) {
|
||||||
|
c.removed = true;
|
||||||
|
c.center = undefined;
|
||||||
|
} else {
|
||||||
|
c.center = pack.cells.culture.findIndex(x => x===c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Cultures.generate();
|
// Cultures.generate();
|
||||||
// Cultures.expand();
|
// Cultures.expand();
|
||||||
// TODO: update culture centers
|
|
||||||
|
|
||||||
// transfer states, mark states without land as removed.
|
// transfer states, mark states without land as removed.
|
||||||
const validStates = new Set(pack.cells.state);
|
const validStates = new Set(pack.cells.state);
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ const generateSubmap = debounce(async function () {
|
||||||
const settings = {
|
const settings = {
|
||||||
promoteTown: Boolean(document.getElementById("submapPromoteTown").checked),
|
promoteTown: Boolean(document.getElementById("submapPromoteTown").checked),
|
||||||
depressRivers: Boolean(document.getElementById("submapDepressRivers").checked),
|
depressRivers: Boolean(document.getElementById("submapDepressRivers").checked),
|
||||||
|
addLakesInDepressions: Boolean(document.getElementById("submapAddLakeInDepression").checked),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create projection func from current zoom extents
|
// Create projection func from current zoom extents
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue