height generation - ability to pass cells number

This commit is contained in:
Azgaar 2022-05-29 14:33:07 +03:00
parent ab160e609c
commit 4f372c7a46
3 changed files with 66 additions and 42 deletions

View file

@ -940,7 +940,11 @@ function editHeightmap(options) {
const seed = byId("templateSeed").value;
if (seed) Math.random = aleaPRNG(seed);
HeightmapGenerator.resetHeights();
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);
restartHistory();
for (const step of steps) {