mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
heightmap select - style fixes
This commit is contained in:
parent
6766de46ef
commit
f56bd0f586
7 changed files with 123 additions and 91 deletions
|
|
@ -1369,10 +1369,12 @@ function editHeightmap() {
|
|||
grid.cells.h.forEach((height, i) => {
|
||||
const h = height < 20 ? Math.max(height / 1.5, 0) : height;
|
||||
const v = (h / 100) * 255;
|
||||
imageData.data[i * 4] = v;
|
||||
imageData.data[i * 4 + 1] = v;
|
||||
imageData.data[i * 4 + 2] = v;
|
||||
imageData.data[i * 4 + 3] = 255;
|
||||
|
||||
const n = i * 4;
|
||||
imageData.data[n] = v;
|
||||
imageData.data[n + 1] = v;
|
||||
imageData.data[n + 2] = v;
|
||||
imageData.data[n + 3] = 255;
|
||||
});
|
||||
|
||||
ctx.putImageData(imageData, 0, 0);
|
||||
|
|
|
|||
|
|
@ -151,9 +151,9 @@ function toggleHeight(event) {
|
|||
function drawHeightmap() {
|
||||
TIME && console.time("drawHeightmap");
|
||||
terrs.selectAll("*").remove();
|
||||
const cells = pack.cells,
|
||||
vertices = pack.vertices,
|
||||
n = cells.i.length;
|
||||
|
||||
const {cells, vertices} = pack;
|
||||
const n = cells.i.length;
|
||||
const used = new Uint8Array(cells.i.length);
|
||||
const paths = new Array(101).fill("");
|
||||
|
||||
|
|
@ -161,6 +161,7 @@ function drawHeightmap() {
|
|||
const terracing = terrs.attr("terracing") / 10; // add additional shifted darker layer for pseudo-3d effect
|
||||
const skip = +terrs.attr("skip") + 1;
|
||||
const simplification = +terrs.attr("relax");
|
||||
|
||||
switch (+terrs.attr("curve")) {
|
||||
case 0:
|
||||
lineGen.curve(d3.curveBasisClosed);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue