mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-19 10:31:24 +01:00
refactor: submap - simplify options
This commit is contained in:
parent
72be5f8220
commit
1d9ba6f17c
4 changed files with 21 additions and 53 deletions
|
|
@ -38,15 +38,12 @@ function openSubmapTool() {
|
|||
populationRate = populationRateInput.value = rn(populationRate / scale, 2);
|
||||
|
||||
const parentMap = {grid: deepCopy(grid), pack: deepCopy(pack), notes: deepCopy(notes)};
|
||||
const smoothHeightmap = byId("submapSmoothHeightmap").checked;
|
||||
const depressRivers = byId("submapDepressRivers").checked;
|
||||
const projection = (x, y) => [(x - x0) * scale, (y - y0) * scale];
|
||||
const inverse = (x, y) => [x / scale + x0, y / scale + y0];
|
||||
const options = {smoothHeightmap, depressRivers, projection, inverse, scale};
|
||||
|
||||
resetZoom(0);
|
||||
undraw();
|
||||
Resample.process(parentMap, options);
|
||||
Resample.process({parentMap, projection, inverse, scale});
|
||||
rescaleBurgStyles(scale);
|
||||
drawLayers();
|
||||
|
||||
|
|
|
|||
|
|
@ -128,11 +128,10 @@ async function openTransformTool() {
|
|||
|
||||
const parentMap = {grid: deepCopy(grid), pack: deepCopy(pack), notes: deepCopy(notes)};
|
||||
const [projection, inverse] = getProjection();
|
||||
const options = {depressRivers: false, smoothHeightmap: false, scale: 1, inverse, projection};
|
||||
|
||||
resetZoom(0);
|
||||
undraw();
|
||||
Resample.process(parentMap, options);
|
||||
Resample.process({parentMap, projection, inverse, scale: 1});
|
||||
drawLayers();
|
||||
|
||||
INFO && console.groupEnd("transformMap");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue