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 =>
|
||||
r.cells.forEach(oldc => {
|
||||
const targetCells = forwardGridMap[oldc];
|
||||
if (!targetCells) {
|
||||
console.error('Targetcells is empty');
|
||||
console.log("oldc,gridmap", oldc, forwardGridMap);
|
||||
return;
|
||||
}
|
||||
targetCells.forEach(c => {
|
||||
if (grid.cells.t[c]<1) return;
|
||||
rbeds[c] = 1;
|
||||
});
|
||||
})
|
||||
);
|
||||
// raise every land cell a bit
|
||||
// raise every land cell a bit except riverbeds
|
||||
grid.cells.h.forEach((h, i) => {
|
||||
if (!rbeds[i] || grid.cells.t[i]<1) return;
|
||||
grid.cells.h[i] = Math.min(grid.cells.h[i] * 1.1, 255);
|
||||
|
|
@ -78,6 +83,7 @@ window.Submap = (function () {
|
|||
}
|
||||
|
||||
markupGridOcean();
|
||||
if (options.addLakesInDepressions)
|
||||
addLakesInDeepDepressions();
|
||||
// openNearSeaLakes();
|
||||
OceanLayers();
|
||||
|
|
@ -150,9 +156,19 @@ window.Submap = (function () {
|
|||
|
||||
// transfer basemap 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.expand();
|
||||
// TODO: update culture centers
|
||||
|
||||
// transfer states, mark states without land as removed.
|
||||
const validStates = new Set(pack.cells.state);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ const generateSubmap = debounce(async function () {
|
|||
const settings = {
|
||||
promoteTown: Boolean(document.getElementById("submapPromoteTown").checked),
|
||||
depressRivers: Boolean(document.getElementById("submapDepressRivers").checked),
|
||||
addLakesInDepressions: Boolean(document.getElementById("submapAddLakeInDepression").checked),
|
||||
}
|
||||
|
||||
// Create projection func from current zoom extents
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue