mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
Fix: flux calculation from area-propotional value instead of normal value. (#654)
* bioms shouldn't be masked or the style selection box is useless * fix: misleading comment * Fix: calculating absolute flux from precipitation normal-value. * Fix: River automatic rerender on regeneration. Co-authored-by: Mészáros Gergely <monk@geotronic.hu>
This commit is contained in:
parent
6e522ec1f1
commit
288036c113
4 changed files with 12 additions and 4 deletions
|
|
@ -190,6 +190,12 @@ a {
|
||||||
#cults {
|
#cults {
|
||||||
stroke-linejoin: round;
|
stroke-linejoin: round;
|
||||||
fill-rule: evenodd;
|
fill-rule: evenodd;
|
||||||
|
}
|
||||||
|
|
||||||
|
#statesBody,
|
||||||
|
#provincesBody,
|
||||||
|
#relig,
|
||||||
|
#cults {
|
||||||
mask: url(#land);
|
mask: url(#land);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,12 @@ window.Rivers = (function () {
|
||||||
function drainWater() {
|
function drainWater() {
|
||||||
const MIN_FLUX_TO_FORM_RIVER = 30;
|
const MIN_FLUX_TO_FORM_RIVER = 30;
|
||||||
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);
|
||||||
|
|
||||||
land.forEach(function (i) {
|
land.forEach(function (i) {
|
||||||
cells.fl[i] += prec[cells.g[i]]; // add flux from precipitation
|
cells.fl[i] += prec[cells.g[i]] * area[i] / 100; // add flux from precipitation
|
||||||
|
|
||||||
// create lake outlet if lake is not in deep depression and flux > evaporation
|
// create lake outlet if lake is not in deep depression and flux > evaporation
|
||||||
const lakes = lakeOutCells[i] ? features.filter(feature => i === feature.outCell && feature.flux > feature.evaporation) : [];
|
const lakes = lakeOutCells[i] ? features.filter(feature => i === feature.outCell && feature.flux > feature.evaporation) : [];
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,7 @@ function regenerateRivers() {
|
||||||
Lakes.defineGroup();
|
Lakes.defineGroup();
|
||||||
Rivers.specify();
|
Rivers.specify();
|
||||||
if (!layerIsOn("toggleRivers")) toggleRivers();
|
if (!layerIsOn("toggleRivers")) toggleRivers();
|
||||||
|
else drawRivers();
|
||||||
}
|
}
|
||||||
|
|
||||||
function recalculatePopulation() {
|
function recalculatePopulation() {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class Voronoi {
|
||||||
|
|
||||||
// Half-edges are the indices into the delaunator outputs:
|
// Half-edges are the indices into the delaunator outputs:
|
||||||
// delaunay.triangles[e] gives the point ID where the half-edge starts
|
// delaunay.triangles[e] gives the point ID where the half-edge starts
|
||||||
// delaunay.triangles[e] returns either the opposite half-edge in the adjacent triangle, or -1 if there's not an adjacent triangle.
|
// delaunay.halfedges[e] returns either the opposite half-edge in the adjacent triangle, or -1 if there's not an adjacent triangle.
|
||||||
for (let e = 0; e < this.delaunay.triangles.length; e++) {
|
for (let e = 0; e < this.delaunay.triangles.length; e++) {
|
||||||
|
|
||||||
const p = this.delaunay.triangles[this.nextHalfedge(e)];
|
const p = this.delaunay.triangles[this.nextHalfedge(e)];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue