mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
height generation - ability to pass cells number
This commit is contained in:
parent
ab160e609c
commit
4f372c7a46
3 changed files with 66 additions and 42 deletions
|
|
@ -282,10 +282,14 @@ function drawHeights(heights) {
|
|||
}
|
||||
|
||||
function generateHeightmap(id) {
|
||||
HeightmapGenerator.resetHeights();
|
||||
const heights = HeightmapGenerator.fromTemplate(id);
|
||||
const heights = new Uint8Array(grid.points.length);
|
||||
// use cells number of the current graph, no matter what UI input value is
|
||||
const cellsDesired = rn((graphWidth * graphHeight) / grid.spacing ** 2, -3);
|
||||
|
||||
HeightmapGenerator.setHeights(heights, cellsDesired);
|
||||
const newHeights = HeightmapGenerator.fromTemplate(id);
|
||||
HeightmapGenerator.cleanup();
|
||||
return heights;
|
||||
return newHeights;
|
||||
}
|
||||
|
||||
function drawTemplatePreview(id) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue