Skip to content

Commit

Permalink
excavate x squared profile for rivers, puddles need new excavation too
Browse files Browse the repository at this point in the history
  • Loading branch information
IR0NSIGHT committed Oct 25, 2023
1 parent 9897254 commit 04efdca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pathing/postprocessing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type riverProfile = { width: number, depth: number, speed: number }
* @param dist
*/
const depthByDist = (maxWidth: number, maxDepth: number, dist: number): number => {
return (dist / maxWidth) * (dist / maxWidth) * maxDepth;
return maxDepth - ((dist / maxWidth) * (dist / maxWidth) * maxDepth);
}

export const applyRiverLayers = (river: point[], pondSurface: SeenSetReadOnly, riverExport: RiverExportTarget): void => {
Expand All @@ -44,7 +44,7 @@ export const applyRiverLayers = (river: point[], pondSurface: SeenSetReadOnly, r
y: point.point.y,
z: point.z,
width: Math.sqrt(params.growthRate * index),
depth: 2,
depth: Math.sqrt(params.growthRate * index),
speed: 1
})
)
Expand All @@ -64,7 +64,7 @@ export const applyRiverLayers = (river: point[], pondSurface: SeenSetReadOnly, r
const lip = dimension.getSlope(point.x, point.y) > 1 ? 1 : 0 //1 == 45°

const depth = depthByDist(profile.width, profile.depth, Math.sqrt(squaredDistToParent));
dimension.setHeightAt(point.x, point.y, point.parent.z - profile.depth - lip)
dimension.setHeightAt(point.x, point.y, point.parent.z - depth - lip)
dimension.setWaterLevelAt(point.x, point.y, point.parent.z - lip)
}

Expand Down

0 comments on commit 04efdca

Please sign in to comment.