mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 20:11:24 +01:00
normalize prec, flux and river width
This commit is contained in:
parent
c2a9e4ad5d
commit
2b481caa84
3 changed files with 2 additions and 3 deletions
|
|
@ -835,6 +835,7 @@ function parseLoadedData(data) {
|
||||||
// v 1.65 changed rivers data
|
// v 1.65 changed rivers data
|
||||||
d3.select("#rivers").attr("style", null); // remove style to unhide layer
|
d3.select("#rivers").attr("style", null); // remove style to unhide layer
|
||||||
const {cells, rivers} = pack;
|
const {cells, rivers} = pack;
|
||||||
|
const defaultWidthFactor = rn(1 / (pointsInput.dataset.cells / 10000) ** 0.25, 2);
|
||||||
|
|
||||||
for (const river of rivers) {
|
for (const river of rivers) {
|
||||||
const node = document.getElementById("river" + river.i);
|
const node = document.getElementById("river" + river.i);
|
||||||
|
|
@ -863,7 +864,7 @@ function parseLoadedData(data) {
|
||||||
river.points = riverPoints;
|
river.points = riverPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
river.widthFactor = 1;
|
river.widthFactor = defaultWidthFactor;
|
||||||
|
|
||||||
cells.i.forEach(i => {
|
cells.i.forEach(i => {
|
||||||
const riverInWater = cells.r[i] && cells.h[i] < 20;
|
const riverInWater = cells.r[i] && cells.h[i] < 20;
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@ window.Rivers = (function () {
|
||||||
const cellsNumberModifier = (pointsInput.dataset.cells / 10000) ** 0.25;
|
const cellsNumberModifier = (pointsInput.dataset.cells / 10000) ** 0.25;
|
||||||
|
|
||||||
const prec = grid.cells.prec;
|
const prec = grid.cells.prec;
|
||||||
const area = pack.cells.area;
|
|
||||||
const land = cells.i.filter(i => h[i] >= 20).sort((a, b) => h[b] - h[a]);
|
const land = cells.i.filter(i => h[i] >= 20).sort((a, b) => h[b] - h[a]);
|
||||||
const lakeOutCells = Lakes.setClimateData(h);
|
const lakeOutCells = Lakes.setClimateData(h);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -545,7 +545,6 @@ function togglePrec(event) {
|
||||||
function drawPrec() {
|
function drawPrec() {
|
||||||
prec.selectAll("circle").remove();
|
prec.selectAll("circle").remove();
|
||||||
const {cells, points} = grid;
|
const {cells, points} = grid;
|
||||||
|
|
||||||
prec.style("display", "block");
|
prec.style("display", "block");
|
||||||
const show = d3.transition().duration(800).ease(d3.easeSinIn);
|
const show = d3.transition().duration(800).ease(d3.easeSinIn);
|
||||||
prec.selectAll('text').attr('opacity', 0).transition(show).attr('opacity', 1);
|
prec.selectAll('text').attr('opacity', 0).transition(show).attr('opacity', 1);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue