mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
refactor: river generation start
This commit is contained in:
parent
4833a8ab35
commit
4e65616dbc
11 changed files with 285 additions and 265 deletions
|
|
@ -13,18 +13,19 @@ export function drawCoastline(vertices: IGraphVertices, features: TPackFeatures)
|
|||
|
||||
for (const feature of features) {
|
||||
if (!feature) continue;
|
||||
if (feature.type === "ocean") continue;
|
||||
|
||||
const points = clipPoly(feature.vertices.map(vertex => vertices.p[vertex]));
|
||||
const simplifiedPoints = simplify(points, SIMPLIFICATION_TOLERANCE);
|
||||
const path = round(lineGen(simplifiedPoints)!);
|
||||
|
||||
landMask
|
||||
.append("path")
|
||||
.attr("d", path)
|
||||
.attr("fill", "black")
|
||||
.attr("id", "land_" + feature.i);
|
||||
|
||||
if (feature.type === "lake") {
|
||||
landMask
|
||||
.append("path")
|
||||
.attr("d", path)
|
||||
.attr("fill", "black")
|
||||
.attr("id", "land_" + feature.i);
|
||||
|
||||
lakes
|
||||
.select("#freshwater")
|
||||
.append("path")
|
||||
|
|
@ -32,6 +33,12 @@ export function drawCoastline(vertices: IGraphVertices, features: TPackFeatures)
|
|||
.attr("id", "lake_" + feature.i)
|
||||
.attr("data-f", feature.i);
|
||||
} else {
|
||||
landMask
|
||||
.append("path")
|
||||
.attr("d", path)
|
||||
.attr("fill", "white")
|
||||
.attr("id", "land_" + feature.i);
|
||||
|
||||
waterMask
|
||||
.append("path")
|
||||
.attr("d", path)
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ export function drawStates() {
|
|||
// define inner-state lakes to omit on border render
|
||||
const innerLakes = features.map(feature => {
|
||||
if (feature.type !== "lake") return false;
|
||||
if (!feature.shoreline) Lakes.getShoreline(feature);
|
||||
|
||||
const states = feature.shoreline.map(i => cells.state[i]);
|
||||
const shoreline = feature.shoreline || [];
|
||||
const states = shoreline.map(i => cells.state[i]);
|
||||
return new Set(states).size > 1 ? false : true;
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue