roamwright 0.4.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +3 -1
- package/README.md +11 -34
- package/geometry/bedding.js +141 -0
- package/geometry/builder-cells.js +42 -0
- package/geometry/builder-frame.js +47 -0
- package/geometry/builder.js +189 -177
- package/geometry/cell-mask.js +25 -0
- package/geometry/creased-sheet.js +34 -34
- package/geometry/ear.js +36 -36
- package/geometry/erosion.js +65 -42
- package/geometry/face-grid.js +65 -65
- package/geometry/foliage.js +10 -10
- package/geometry/hair-gathers.js +41 -41
- package/geometry/hair-locks.js +41 -41
- package/geometry/hair-patch.js +18 -18
- package/geometry/hair-shell.js +31 -31
- package/geometry/head-profile.js +15 -15
- package/geometry/head-shape.js +77 -77
- package/geometry/heightfield.js +27 -18
- package/geometry/index-parts.js +2 -2
- package/geometry/instance-visibility.js +12 -12
- package/geometry/instances.js +15 -15
- package/geometry/outline-grid.js +7 -7
- package/geometry/part-ranges.js +3 -3
- package/geometry/path-field.js +63 -33
- package/geometry/placement.js +52 -52
- package/geometry/point-buckets.js +50 -0
- package/geometry/primitives.js +63 -47
- package/geometry/sagging-tube.js +27 -27
- package/geometry/sampled-surface.js +109 -77
- package/geometry/scatter-grid.js +46 -6
- package/geometry/sculpt.js +93 -93
- package/geometry/shore-grid.js +77 -34
- package/geometry/strata-field.js +92 -92
- package/geometry/strata-tiles.js +91 -91
- package/geometry/stream.js +70 -48
- package/geometry/terrain-chunks.js +87 -82
- package/geometry/terrain-extension.js +6 -6
- package/index.js +5 -0
- package/math/cell-edge.js +16 -16
- package/math/cell-key.js +6 -0
- package/math/circle-clearances.js +19 -0
- package/math/cloth-textures.js +6 -6
- package/math/cloud-textures.js +20 -20
- package/math/color.js +14 -14
- package/math/curve.js +22 -22
- package/math/mountain-ranges.js +216 -165
- package/math/noise.js +101 -49
- package/math/particle-noise.js +28 -28
- package/math/periodic.js +5 -5
- package/math/random.js +24 -15
- package/math/rectangles.js +52 -0
- package/math/rock-texture.js +7 -7
- package/math/scalar.js +5 -5
- package/math/surface-textures.js +54 -54
- package/motion/arm-reach.js +24 -24
- package/motion/ballistic-arc.js +11 -0
- package/motion/biped-cycle.js +44 -0
- package/motion/biped-leg.js +37 -0
- package/motion/biped-stride.js +98 -122
- package/motion/contact-transition.js +33 -0
- package/motion/crowd-alarms.js +39 -39
- package/motion/crowd-routine.js +94 -65
- package/motion/daily-clock.js +9 -9
- package/motion/deck-surface.js +38 -0
- package/motion/ground-lookahead.js +5 -5
- package/motion/instance-sight.js +8 -8
- package/motion/player.js +36 -28
- package/motion/quadruped.js +155 -155
- package/motion/spaces.js +32 -32
- package/motion/weather.js +73 -24
- package/motion/wind.js +32 -13
- package/package.json +7 -3
- package/rendering/caster-motion.js +5 -5
- package/rendering/cell-lod.js +138 -82
- package/rendering/cloud-dome.js +28 -28
- package/rendering/cloud-field.js +2 -2
- package/rendering/compilation-schedule.js +68 -11
- package/rendering/contact-shadows.js +2 -2
- package/rendering/context.js +12 -0
- package/rendering/crowd-skinning.js +13 -13
- package/rendering/crust.js +18 -12
- package/rendering/daylight.js +3 -3
- package/rendering/detail-range.js +28 -0
- package/rendering/dispose-meshes.js +18 -0
- package/rendering/dof.js +9 -9
- package/rendering/eye-adapt.js +14 -14
- package/rendering/far-shadow.js +8 -8
- package/rendering/flocks.js +78 -78
- package/rendering/garment-material.js +17 -17
- package/rendering/glow-lines.js +13 -13
- package/rendering/hair-strands.js +20 -20
- package/rendering/height-probe.js +149 -19
- package/rendering/label-layout.js +46 -0
- package/rendering/label-range.js +38 -0
- package/rendering/light-budget.js +52 -52
- package/rendering/light-shafts.js +23 -23
- package/rendering/local-lights.js +15 -4
- package/rendering/material-lod.js +49 -49
- package/rendering/particle-emitters.js +90 -90
- package/rendering/particles.js +78 -67
- package/rendering/piece-batch.js +17 -6
- package/rendering/planar-reflection.js +38 -38
- package/rendering/post-shaders.js +17 -13
- package/rendering/post.js +71 -71
- package/rendering/rain-streaks.js +67 -0
- package/rendering/road-surface.js +11 -11
- package/rendering/sea-shaders.js +11 -11
- package/rendering/shader-warmup.js +29 -16
- package/rendering/shadow-alignment.js +4 -4
- package/rendering/shadow-depth.js +7 -7
- package/rendering/sky-occlusion.js +16 -16
- package/rendering/sky.js +16 -6
- package/rendering/stage-lights.js +6 -6
- package/rendering/static-point-shadow.js +3 -3
- package/rendering/still-casters.js +1 -1
- package/rendering/strata-material.js +10 -10
- package/rendering/stream-flow.js +10 -10
- package/rendering/taa.js +26 -26
- package/rendering/talus.js +15 -15
- package/rendering/terrain-rock.js +7 -7
- package/rendering/texture-fills.js +8 -8
- package/rendering/textures.js +28 -28
- package/rendering/wakes.js +24 -24
- package/rendering/water-material.js +36 -23
- package/rendering/world-matrices.js +38 -38
- package/runtime/diagnostic-log.js +2 -2
- package/runtime/first-use.js +33 -28
- package/runtime/frame-pacing.js +33 -0
- package/runtime/gpu-timing.js +7 -7
- package/runtime/grid-cache.js +1 -1
- package/runtime/grid-rows.js +44 -5
- package/runtime/hand-over.js +41 -23
- package/runtime/pool.js +58 -16
- package/runtime/quality-fit.js +1 -1
- package/runtime/search.js +22 -22
- package/runtime/spatial-audio.js +13 -13
- package/runtime/withdrawable-task.js +35 -0
- package/runtime/worker.js +7 -0
package/math/mountain-ranges.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Add seeded hills, ridges and escarpments to a terrain height function.
|
|
3
|
+
* {@link createMountainRanges} samples relief and loose rock for the same location.
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
2
6
|
import { clamp, lerp, sstep } from './scalar.js';
|
|
3
7
|
import { createNoise } from './noise.js';
|
|
4
8
|
import { createHash } from './random.js';
|
|
@@ -43,18 +47,61 @@ const RANGE_FROM = [0.3, 0.75], // how broken an upland must be to begin to be a
|
|
|
43
47
|
SWELL_WARP = 0.22, // and how far that radius is pulled about
|
|
44
48
|
SEG = 9; // numbers to a spur: its ends (u, v), the metres along it at each, its flanks' width at each, its ribs' phase
|
|
45
49
|
|
|
50
|
+
/**
|
|
51
|
+
* @typedef {object} EllipticalUpland
|
|
52
|
+
* @property {number} x - Centre X in metres.
|
|
53
|
+
* @property {number} z - Centre Z in metres.
|
|
54
|
+
* @property {number} rx - X radius in metres, or half-length along the supplied axis.
|
|
55
|
+
* @property {number} rz - Z radius in metres, or half-width across the supplied axis.
|
|
56
|
+
* @property {number} h - Height scale in metres.
|
|
57
|
+
* @property {number} rough - Relief roughness from 0 for a smooth swell to 1 for a broken ridge.
|
|
58
|
+
* @property {number} [axis] - Long-axis bearing in radians from +X toward +Z.
|
|
59
|
+
* @property {number} [face] - Bearing toward the steep side of an escarpment, in radians.
|
|
60
|
+
* @property {number} [hills] - Number of hills to scatter inside the ellipse.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @typedef {object} Ridge
|
|
65
|
+
* @property {[number, number, number][]} crest - At least two distinct consecutive points, each [x, z, height multiplier].
|
|
66
|
+
* @property {number} wide - Flank half-width in metres.
|
|
67
|
+
* @property {number} h - Height in metres before applying each crest point’s multiplier.
|
|
68
|
+
* @property {number} rough - Relief roughness from 0 to 1.
|
|
69
|
+
* @property {number} [face] - Bearing toward the steep side of an escarpment, in radians from +X toward +Z.
|
|
70
|
+
*/
|
|
71
|
+
|
|
46
72
|
// The long axis of an upland given as an ellipse ({ x, z, rx, rz }), as [bearing, half-length, half-width]: the longer of its
|
|
47
73
|
// radii, or along `axis` (a bearing: 0 east, clockwise seen from above), with rx then its half-length and rz its half-width.
|
|
48
|
-
const ellipseAxis =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
74
|
+
const ellipseAxis = landform => (landform.axis !== undefined ? [landform.axis, landform.rx, landform.rz] : landform.rx >= landform.rz ? [0, landform.rx, landform.rz] : [Math.PI / 2, landform.rz, landform.rx]);
|
|
75
|
+
/**
|
|
76
|
+
* Get the crest line and flank half-width for drawing a map. An explicit ridge
|
|
77
|
+
* keeps its original point array, including the third height component. An
|
|
78
|
+
* ellipse yields two X/Z endpoints along its long axis.
|
|
79
|
+
* @param {EllipticalUpland | Ridge} landform - Landform supplied to the range layout.
|
|
80
|
+
*/
|
|
81
|
+
export function crestOf(landform) {
|
|
82
|
+
if (landform.crest) return { line: landform.crest, wide: landform.wide };
|
|
83
|
+
const [bearing, halfLength, halfWidth] = ellipseAxis(landform),
|
|
84
|
+
reach = 0.8 * halfLength;
|
|
85
|
+
return { line: [-reach, reach].map(u => [landform.x + u * Math.cos(bearing), landform.z + u * Math.sin(bearing)]), wide: halfWidth };
|
|
55
86
|
}
|
|
56
87
|
|
|
57
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Build a reusable field of mountain relief. Call `layout` with ellipses or ridgelines,
|
|
90
|
+
* then add `heightAt(x, z)` to the base terrain elevation in metres. Each call also
|
|
91
|
+
* overwrites `surface.scree`, the loose-rock amount for that sample.
|
|
92
|
+
* Calling `layout` again replaces the previous landforms. Keep their order stable
|
|
93
|
+
* when reproducing a landscape because each landform’s seed depends on its index.
|
|
94
|
+
* @param {number} [seed] - World seed for the ridges, spurs and surface detail.
|
|
95
|
+
* @example
|
|
96
|
+
* ```js
|
|
97
|
+
* import { createMountainRanges } from 'roamwright/math/mountain-ranges.js';
|
|
98
|
+
*
|
|
99
|
+
* const mountains = createMountainRanges(42);
|
|
100
|
+
* mountains.layout([{ crest: [[0, 0, 0.6], [120, 40, 1]], wide: 50, h: 90, rough: 0.8 }]);
|
|
101
|
+
* const elevation = 12 + mountains.heightAt(80, 25);
|
|
102
|
+
* const looseRock = mountains.surface.scree;
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
58
105
|
export function createMountainRanges(seed = 0) {
|
|
59
106
|
const { fbm, ridged, vnoise } = createNoise(seed);
|
|
60
107
|
const hash2 = createHash(seed);
|
|
@@ -67,8 +114,8 @@ export function createMountainRanges(seed = 0) {
|
|
|
67
114
|
|
|
68
115
|
// The swell of an ellipse ({ x, z, rx, rz, h, rough }) at (x, z), in metres: a rise that falls away smoothly all round, broken
|
|
69
116
|
// by noise the more it is rough.
|
|
70
|
-
function swellAt(
|
|
71
|
-
const r0 = ((x -
|
|
117
|
+
function swellAt(landform, x, z) {
|
|
118
|
+
const r0 = ((x - landform.x) / landform.rx) ** 2 + ((z - landform.z) / landform.rz) ** 2;
|
|
72
119
|
if (r0 >= SWELL_REACH + SWELL_WARP / 2) return 0;
|
|
73
120
|
if (crag < 0) {
|
|
74
121
|
// the noise is worked out only where a swell is near
|
|
@@ -76,72 +123,72 @@ export function createMountainRanges(seed = 0) {
|
|
|
76
123
|
pull = SWELL_WARP * (fbm(x * 0.0021, z * 0.0021, 2, 337) - 0.5);
|
|
77
124
|
}
|
|
78
125
|
const r = r0 + pull;
|
|
79
|
-
return r < SWELL_REACH ?
|
|
126
|
+
return r < SWELL_REACH ? landform.h * Math.exp(-1.5 * Math.max(r, 0)) * lerp(1, 0.35 + 1.25 * crag, landform.rough) : 0;
|
|
80
127
|
}
|
|
81
128
|
|
|
82
129
|
// The height of a limb's crest at u, as a share of its own: 1 along its length, falling away past each end.
|
|
83
|
-
function crestShare(
|
|
84
|
-
const over = u < 0 ? -u /
|
|
85
|
-
return (over > 0 ? Math.exp(-1.5 * over **
|
|
130
|
+
function crestShare(limbData, u) {
|
|
131
|
+
const over = u < 0 ? -u / limbData.tail0 : u > limbData.len ? (u - limbData.len) / limbData.tail1 : 0;
|
|
132
|
+
return (over > 0 ? Math.exp(-1.5 * over ** limbData.fall) : 1) * lerp(limbData.k0, limbData.k1, clamp(u / (limbData.len || 1), 0, 1));
|
|
86
133
|
}
|
|
87
134
|
// How far a limb's crest stands off its straight line at u: it wanders, and an escarpment's rim stands toward its face.
|
|
88
|
-
function crestOffset(
|
|
89
|
-
const stray = 2 * (vnoise(u /
|
|
90
|
-
return
|
|
135
|
+
function crestOffset(limbData, u) {
|
|
136
|
+
const stray = 2 * (vnoise(u / limbData.wave + 7.3, 0, limbData.seed) - limbData.strayAt);
|
|
137
|
+
return limbData.rim + limbData.wander * stray * (limbData.line ? sstep(0, limbData.step, u) * sstep(limbData.len, limbData.len - limbData.step, u) : 1); // the stretches of a line meet end to end
|
|
91
138
|
}
|
|
92
139
|
// How far a range leans to one side at u, -1..1: no range's two flanks are alike, and which is the steeper changes along it.
|
|
93
|
-
const leanAt = (
|
|
94
|
-
// The width of a limb's flank on `side` of its crest at u, where the crest stands at
|
|
140
|
+
const leanAt = (limbData, u, seed) => 2 * vnoise(u / (4 * limbData.step) + 3.1, 0, limbData.seed + seed) - 1;
|
|
141
|
+
// The width of a limb's flank on `side` of its crest at u, where the crest stands at fraction crestFraction of its height: a range narrows as
|
|
95
142
|
// its crest falls, so its flanks keep their slope, and the flank it leans toward is the narrower and steeper.
|
|
96
|
-
const flankWidth = (
|
|
97
|
-
|
|
143
|
+
const flankWidth = (limbData, crestFraction, side, u) =>
|
|
144
|
+
limbData.b * (NARROW + (1 - NARROW) * crestFraction) * (limbData.face ? (limbData.face === side ? SCARP.face : SCARP.back) : 1 - side * LOP * limbData.rough * leanAt(limbData, u, 9));
|
|
98
145
|
// How far a range's shape is pulled off its place at (x, z), along x (`turn` 0) or z (1), as a share of the most: at two scales.
|
|
99
|
-
const warpAt = (
|
|
146
|
+
const warpAt = (limbData, x, z, turn) => 2 * fbm(x * limbData.warpOver + 31.7 * turn, z * limbData.warpOver + 11.3 * turn, 2, limbData.seed + 3 + turn) - 1;
|
|
100
147
|
// How far a crest is notched at u, as a share of the most.
|
|
101
|
-
const notchAt = (
|
|
148
|
+
const notchAt = (limbData, u) => 2 * fbm(u / (0.7 * limbData.step), 0, 3, limbData.seed + 6) - 1;
|
|
102
149
|
|
|
103
150
|
// The peaks and saddles of a limb's crest, as [u, share of the height] in turn from a peak to a peak: a peak stands where the
|
|
104
151
|
// data puts the upland (the middle of an ellipse, the points of a line), the rest a spacing apart.
|
|
105
|
-
function crestKnots(
|
|
106
|
-
const first =
|
|
107
|
-
step =
|
|
108
|
-
last =
|
|
109
|
-
from = -Math.ceil((first + 1.3 *
|
|
110
|
-
to = Math.ceil((
|
|
111
|
-
level =
|
|
152
|
+
function crestKnots(limbData, spacing) {
|
|
153
|
+
const first = limbData.line ? 0 : limbData.len / 2,
|
|
154
|
+
step = limbData.line ? limbData.len / Math.max(1, Math.round(limbData.len / spacing)) : spacing,
|
|
155
|
+
last = limbData.line ? Math.round(limbData.len / step) : 0, // the peak at a line's far point
|
|
156
|
+
from = -Math.ceil((first + 1.3 * limbData.tail0) / step),
|
|
157
|
+
to = Math.ceil((limbData.len + 1.3 * limbData.tail1 - first) / step),
|
|
158
|
+
level = limbData.rough * (limbData.face ? SCARP.level : 1),
|
|
112
159
|
knots = [];
|
|
113
160
|
let before = 0;
|
|
114
161
|
for (let k = from; k <= to; k++) {
|
|
115
|
-
const given = k === 0 || (
|
|
116
|
-
u = first + (k + (given ? 0 : 0.6 * (hash2(k, 1,
|
|
117
|
-
peak = given ? 1 : 1 - level * PEAK_DROP * Math.sqrt(hash2(k, 2,
|
|
162
|
+
const given = k === 0 || (limbData.line && k === last),
|
|
163
|
+
u = first + (k + (given ? 0 : 0.6 * (hash2(k, 1, limbData.seed) - 0.5))) * step,
|
|
164
|
+
peak = given ? 1 : 1 - level * PEAK_DROP * Math.sqrt(hash2(k, 2, limbData.seed)); // a few stand near the highest, most well under it
|
|
118
165
|
if (k > from) {
|
|
119
|
-
const drop = lerp(SADDLE_DROP[0], SADDLE_DROP[1], hash2(k, 4,
|
|
120
|
-
knots.push(lerp(knots[knots.length - 2], u, 0.35 + 0.3 * hash2(k, 3,
|
|
166
|
+
const drop = lerp(SADDLE_DROP[0], SADDLE_DROP[1], hash2(k, 4, limbData.seed)) + (hash2(k, 5, limbData.seed) < PASS[0] ? PASS[1] : 0);
|
|
167
|
+
knots.push(lerp(knots[knots.length - 2], u, 0.35 + 0.3 * hash2(k, 3, limbData.seed)), Math.min(before, peak) - level * drop);
|
|
121
168
|
}
|
|
122
169
|
knots.push(u, peak);
|
|
123
170
|
before = peak;
|
|
124
171
|
}
|
|
125
|
-
|
|
172
|
+
limbData.step = step;
|
|
126
173
|
return Float64Array.from(knots);
|
|
127
174
|
}
|
|
128
175
|
// How high a limb's crest stands at u between its peaks and saddles, as a share: pointed at a peak, level across a saddle.
|
|
129
|
-
function knotShare(
|
|
130
|
-
const
|
|
131
|
-
n =
|
|
132
|
-
if (u <=
|
|
133
|
-
if (u >=
|
|
134
|
-
let i = clamp(Math.floor(((u -
|
|
135
|
-
while (
|
|
136
|
-
while (
|
|
137
|
-
const t = (u -
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return
|
|
176
|
+
function knotShare(limbData, u) {
|
|
177
|
+
const knots = limbData.knots,
|
|
178
|
+
n = knots.length / 2;
|
|
179
|
+
if (u <= knots[0]) return knots[1];
|
|
180
|
+
if (u >= knots[2 * n - 2]) return knots[2 * n - 1];
|
|
181
|
+
let i = clamp(Math.floor(((u - knots[0]) / limbData.step) * 2), 0, n - 2);
|
|
182
|
+
while (knots[2 * i] > u) i--;
|
|
183
|
+
while (knots[2 * i + 2] < u) i++;
|
|
184
|
+
const t = (u - knots[2 * i]) / (knots[2 * i + 2] - knots[2 * i]),
|
|
185
|
+
startHeight = knots[2 * i + 1],
|
|
186
|
+
endHeight = knots[2 * i + 3];
|
|
187
|
+
return startHeight >= endHeight ? endHeight + (startHeight - endHeight) * (1 - t) ** PEAK_POINT : startHeight + (endHeight - startHeight) * t ** PEAK_POINT;
|
|
141
188
|
}
|
|
142
189
|
// The spurs that run down one side of a limb: one from each peak, with a branch or two that leave it lower down, and a short
|
|
143
190
|
// one from the shoulder of most saddles. A spur is a straight line: the range's warp bends it.
|
|
144
|
-
function limbSpurs(
|
|
191
|
+
function limbSpurs(limbData, side) {
|
|
145
192
|
const out = [],
|
|
146
193
|
spur = (u0, v0, angle, long, tau, wide0, wide1, seed) =>
|
|
147
194
|
out.push(
|
|
@@ -153,26 +200,26 @@ export function createMountainRanges(seed = 0) {
|
|
|
153
200
|
tau + long,
|
|
154
201
|
wide0,
|
|
155
202
|
wide1,
|
|
156
|
-
hash2(seed, 9,
|
|
203
|
+
hash2(seed, 9, limbData.seed),
|
|
157
204
|
);
|
|
158
|
-
for (let k = 0; k <
|
|
159
|
-
const u =
|
|
160
|
-
|
|
205
|
+
for (let k = 0; k < limbData.knots.length; k += 2) {
|
|
206
|
+
const u = limbData.knots[k],
|
|
207
|
+
crestFraction = crestShare(limbData, u),
|
|
161
208
|
id = k + (side > 0 ? 1 : 0),
|
|
162
|
-
r = n => hash2(id, n,
|
|
209
|
+
r = n => hash2(id, n, limbData.seed + 1),
|
|
163
210
|
peak = k % 4 === 0;
|
|
164
|
-
if (
|
|
165
|
-
const buttress =
|
|
166
|
-
long = flankWidth(
|
|
167
|
-
splay = u < 0 ? -sstep(0, 1, -u /
|
|
211
|
+
if (crestFraction < SPUR_LEAST || (!peak && r(0) > SHOULDER)) continue;
|
|
212
|
+
const buttress = limbData.face === side, // an escarpment's face is buttressed, not spurred
|
|
213
|
+
long = flankWidth(limbData, crestFraction, side, u) * FOOT * (buttress ? 0.75 : peak ? 0.45 + 0.7 * r(1) : 0.3 + 0.35 * r(1)),
|
|
214
|
+
splay = u < 0 ? -sstep(0, 1, -u / limbData.tail0) : u > limbData.len ? sstep(0, 1, (u - limbData.len) / limbData.tail1) : 0, // round a crest's end they fan out
|
|
168
215
|
lean = (r(2) - 0.5) * 1.1 + 0.9 * splay,
|
|
169
|
-
v = crestOffset(
|
|
170
|
-
girth =
|
|
216
|
+
v = crestOffset(limbData, u),
|
|
217
|
+
girth = limbData.step * (0.8 + 0.4 * r(7));
|
|
171
218
|
spur(u, v, lean, long, 0, 0.42 * girth, 0.64 * girth, id);
|
|
172
219
|
if (buttress || !peak) continue;
|
|
173
|
-
for (let
|
|
174
|
-
const at = (
|
|
175
|
-
turn = lean + (
|
|
220
|
+
for (let branchIndex = 0; branchIndex < 2; branchIndex++) {
|
|
221
|
+
const at = (branchIndex ? 0.6 : 0.38) + 0.14 * r(3 + branchIndex),
|
|
222
|
+
turn = lean + (branchIndex ? -1 : 1) * (r(5) < 0.5 ? -1 : 1) * (0.6 + 0.4 * r(6 + branchIndex));
|
|
176
223
|
spur(
|
|
177
224
|
u + at * long * Math.sin(lean),
|
|
178
225
|
v + side * at * long * Math.cos(lean),
|
|
@@ -181,32 +228,32 @@ export function createMountainRanges(seed = 0) {
|
|
|
181
228
|
at * long,
|
|
182
229
|
0.3 * girth,
|
|
183
230
|
0.42 * girth,
|
|
184
|
-
id + 1000 * (
|
|
231
|
+
id + 1000 * (branchIndex + 1),
|
|
185
232
|
);
|
|
186
233
|
}
|
|
187
234
|
}
|
|
188
235
|
// where a crest ends, a long spur runs out and away on either side of its fall, so that the end of a range is no cone
|
|
189
236
|
for (const [u, away, free] of [
|
|
190
|
-
[0, -1,
|
|
191
|
-
[
|
|
237
|
+
[0, -1, limbData.free0],
|
|
238
|
+
[limbData.len, 1, limbData.free1],
|
|
192
239
|
]) {
|
|
193
240
|
if (!free) continue;
|
|
194
241
|
const id = 5000 + (away > 0 ? 2 : 0) + (side > 0 ? 1 : 0),
|
|
195
|
-
long = flankWidth(
|
|
196
|
-
girth =
|
|
197
|
-
spur(u, crestOffset(
|
|
242
|
+
long = flankWidth(limbData, crestShare(limbData, u), side, u) * FOOT * (0.7 + 0.6 * hash2(id, 1, limbData.seed + 1)),
|
|
243
|
+
girth = limbData.step * (1 + 0.4 * hash2(id, 2, limbData.seed + 1));
|
|
244
|
+
spur(u, crestOffset(limbData, u), away * (0.6 + 0.7 * hash2(id, 3, limbData.seed + 1)), long, 0, 0.42 * girth, 0.64 * girth, id);
|
|
198
245
|
}
|
|
199
|
-
return binned(
|
|
246
|
+
return binned(limbData, out);
|
|
200
247
|
}
|
|
201
248
|
// The spurs of `list` sorted into bins along a limb's crest, a peak spacing long each: every bin holds the spurs that reach into
|
|
202
249
|
// its stretch, so a place asks only the few that could lie near it.
|
|
203
|
-
function binned(
|
|
204
|
-
const bins = Array.from({ length: Math.ceil((
|
|
250
|
+
function binned(limbData, list) {
|
|
251
|
+
const bins = Array.from({ length: Math.ceil((limbData.to - limbData.from) / limbData.step) }, () => []);
|
|
205
252
|
for (let i = 0; i < list.length; i += SEG) {
|
|
206
253
|
const reach = Math.max(list[i + 6], list[i + 7]),
|
|
207
|
-
first = Math.floor((Math.min(list[i], list[i + 2]) - reach -
|
|
208
|
-
last = Math.floor((Math.max(list[i], list[i + 2]) + reach -
|
|
209
|
-
for (let
|
|
254
|
+
first = Math.floor((Math.min(list[i], list[i + 2]) - reach - limbData.from) / limbData.step),
|
|
255
|
+
last = Math.floor((Math.max(list[i], list[i + 2]) + reach - limbData.from) / limbData.step);
|
|
256
|
+
for (let binIndex = Math.max(first, 0); binIndex <= Math.min(last, bins.length - 1); binIndex++) bins[binIndex].push(...list.slice(i, i + SEG));
|
|
210
257
|
}
|
|
211
258
|
return bins.map(bin => Float64Array.from(bin));
|
|
212
259
|
}
|
|
@@ -217,7 +264,7 @@ export function createMountainRanges(seed = 0) {
|
|
|
217
264
|
// swell it is where it is not broken enough to be one (none: a swell about its own crest).
|
|
218
265
|
function limb(spec, seed) {
|
|
219
266
|
const sharp = sstep(RANGE_FROM[0], RANGE_FROM[1], spec.rough),
|
|
220
|
-
|
|
267
|
+
limbData = {
|
|
221
268
|
...spec,
|
|
222
269
|
seed,
|
|
223
270
|
sharp,
|
|
@@ -226,23 +273,23 @@ export function createMountainRanges(seed = 0) {
|
|
|
226
273
|
wander: WANDER * spec.b * spec.rough * (spec.face ? SCARP.wander : 1),
|
|
227
274
|
strayAt: 0.5,
|
|
228
275
|
};
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
276
|
+
limbData.knots = crestKnots(limbData, clamp(PEAK_SPACING * limbData.b, PEAK_SPAN[0], PEAK_SPAN[1]));
|
|
277
|
+
limbData.wave = 3 * limbData.step;
|
|
278
|
+
limbData.warp = WARP[0] * limbData.b * limbData.rough * sharp;
|
|
279
|
+
limbData.warpOver = 1 / (WARP[1] * limbData.step);
|
|
280
|
+
limbData.rib = clamp(0.3 * limbData.step, RIB_SPAN[0], RIB_SPAN[1]);
|
|
234
281
|
// the stretch of its frame outside which the range raises nothing, however it is pulled about (by twice its warp at the most)
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
282
|
+
limbData.from = -TAIL_REACH * limbData.tail0 - 2 * limbData.warp;
|
|
283
|
+
limbData.to = limbData.len + TAIL_REACH * limbData.tail1 + 2 * limbData.warp;
|
|
284
|
+
limbData.far = REACH * limbData.b * Math.max(1 + LOP, SCARP.back) + Math.abs(limbData.rim) + 2 * limbData.wander + 2 * limbData.warp;
|
|
238
285
|
// a summit stands where the data puts it, the middle of an ellipse or the points of a line: there the crest has not strayed
|
|
239
286
|
// (crestOffset), nor been pulled about or notched, which `pin` holds for each end of the limb [warp along x, along z, notch]
|
|
240
|
-
const mid =
|
|
241
|
-
pinAt = u => [warpAt(
|
|
242
|
-
|
|
243
|
-
if (!
|
|
244
|
-
|
|
245
|
-
return
|
|
287
|
+
const mid = limbData.len / 2,
|
|
288
|
+
pinAt = u => [warpAt(limbData, limbData.x + u * limbData.ax, limbData.z + u * limbData.az, 0), warpAt(limbData, limbData.x + u * limbData.ax, limbData.z + u * limbData.az, 1), notchAt(limbData, u)];
|
|
289
|
+
limbData.pin = limbData.line ? [pinAt(0), pinAt(limbData.len)] : [pinAt(mid), pinAt(mid)];
|
|
290
|
+
if (!limbData.line) limbData.strayAt = vnoise(mid / limbData.wave + 7.3, 0, seed);
|
|
291
|
+
limbData.spurs = { 1: limbSpurs(limbData, 1), [-1]: limbSpurs(limbData, -1) };
|
|
292
|
+
return limbData;
|
|
246
293
|
}
|
|
247
294
|
|
|
248
295
|
const spurAt = { best: 0, next: 0, tau: 0, phase: 0, side: 0 }; // what spurNear found: the nearest spur's share and the next one's, how far along the nearest, its phase and which side of it
|
|
@@ -292,71 +339,75 @@ export function createMountainRanges(seed = 0) {
|
|
|
292
339
|
}
|
|
293
340
|
// Metres a limb's range raises the ground at (x, z), and the swell about its crest where it has no ellipse's (`smooth`: how
|
|
294
341
|
// far it is that swell).
|
|
295
|
-
function rangeHeight(
|
|
296
|
-
const px = x -
|
|
297
|
-
pz = z -
|
|
298
|
-
along = px *
|
|
299
|
-
if (along <
|
|
300
|
-
// a range's shape is pulled about, so that no crest, spur or foot is a ruled line; not at its summits (
|
|
301
|
-
const [from, to] =
|
|
302
|
-
held = clamp(along / (
|
|
303
|
-
dx = px +
|
|
304
|
-
dz = pz +
|
|
305
|
-
u = dx *
|
|
306
|
-
if (u < -TAIL_REACH *
|
|
307
|
-
const off = dz *
|
|
342
|
+
function rangeHeight(limbData, x, z, smooth) {
|
|
343
|
+
const px = x - limbData.x,
|
|
344
|
+
pz = z - limbData.z,
|
|
345
|
+
along = px * limbData.ax + pz * limbData.az;
|
|
346
|
+
if (along < limbData.from || along > limbData.to || Math.abs(pz * limbData.ax - px * limbData.az) > limbData.far) return 0; // before any noise is worked out
|
|
347
|
+
// a range's shape is pulled about, so that no crest, spur or foot is a ruled line; not at its summits (limbData.pin)
|
|
348
|
+
const [from, to] = limbData.pin,
|
|
349
|
+
held = clamp(along / (limbData.len || 1), 0, 1),
|
|
350
|
+
dx = px + limbData.warp * (warpAt(limbData, x, z, 0) - lerp(from[0], to[0], held)),
|
|
351
|
+
dz = pz + limbData.warp * (warpAt(limbData, x, z, 1) - lerp(from[1], to[1], held)),
|
|
352
|
+
u = dx * limbData.ax + dz * limbData.az;
|
|
353
|
+
if (u < -TAIL_REACH * limbData.tail0 || u > limbData.len + TAIL_REACH * limbData.tail1) return 0;
|
|
354
|
+
const off = dz * limbData.ax - dx * limbData.az - crestOffset(limbData, u),
|
|
308
355
|
side = off < 0 ? -1 : 1,
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
crest =
|
|
312
|
-
swell = smooth > 0 ? crest * Math.exp(-1.5 * (
|
|
313
|
-
wide = flankWidth(
|
|
314
|
-
s =
|
|
356
|
+
flankDistance = side * off,
|
|
357
|
+
crestFraction = crestShare(limbData, u),
|
|
358
|
+
crest = limbData.h * crestFraction * knotShare(limbData, u) * (1 + limbData.sharp * limbData.rough * NOTCH * (notchAt(limbData, u) - lerp(from[2], to[2], held))),
|
|
359
|
+
swell = smooth > 0 ? crest * Math.exp(-1.5 * (flankDistance / limbData.b) ** 2) : 0,
|
|
360
|
+
wide = flankWidth(limbData, crestFraction, side, u),
|
|
361
|
+
s = flankDistance / wide;
|
|
315
362
|
if (smooth >= 1 || s >= REACH) return swell * smooth;
|
|
316
|
-
spurNear(
|
|
317
|
-
const
|
|
318
|
-
scarp =
|
|
319
|
-
own = sstep(0, 0.25,
|
|
320
|
-
knobs = 1 - KNOB * own * vnoise(spurAt.tau /
|
|
321
|
-
floor = 1 - ((
|
|
363
|
+
spurNear(limbData.spurs[side][clamp(Math.floor((u - limbData.from) / limbData.step), 0, limbData.spurs[side].length - 1)], u, off);
|
|
364
|
+
const spurStrength = spurAt.best,
|
|
365
|
+
scarp = limbData.face ? (limbData.face === side ? 1 : -1) : 0,
|
|
366
|
+
own = sstep(0, 0.25, spurStrength - spurAt.next), // how far the place is one spur's alone: what is its own (its knobs, its gullies) fades out toward the next spur
|
|
367
|
+
knobs = 1 - KNOB * own * vnoise(spurAt.tau / limbData.step + 40 * spurAt.phase, 0, limbData.seed + 8),
|
|
368
|
+
floor = 1 - ((spurStrength * spurStrength) / (spurStrength + 0.15)) * 1.15 * knobs, // how far the place is a valley's floor: a spur's crest is a sharp line, the floor rounded
|
|
322
369
|
round = CREST_ROUND / wide,
|
|
323
|
-
bow = 1 + side * BOW *
|
|
370
|
+
bow = 1 + side * BOW * limbData.rough * leanAt(limbData, u, 10),
|
|
324
371
|
body = flankBody((Math.sqrt(s * s + round * round) - round) / (1 - EMBAYED * floor * sstep(0.1, 0.5, s)), scarp, bow),
|
|
325
|
-
deep =
|
|
326
|
-
sides =
|
|
327
|
-
gully = spurAt.tau /
|
|
372
|
+
deep = limbData.rough * CUT * sstep(0.02, 0.3, s) * (scarp < 0 ? 0.5 : 1),
|
|
373
|
+
sides = limbData.rough * RIB_CUT * own * (1 - spurStrength) * sstep(0.1, 0.35, s),
|
|
374
|
+
gully = spurAt.tau / limbData.rib + spurAt.phase + spurAt.side,
|
|
328
375
|
cut = (1 - deep * floor) * (1 - sides * Math.abs(2 * (gully - Math.floor(gully)) - 1)), // what the valleys and gullies leave of the flank
|
|
329
|
-
broken = body > 0 ? 1 +
|
|
330
|
-
stone = bedded(crest * (1 - APRON) * body * cut * broken, x, z, BEDS.hold *
|
|
376
|
+
broken = body > 0 ? 1 + limbData.rough * CRAG * sstep(0, 0.12, s) * (ridged(x * 0.009, z * 0.009, 4, 331) - 0.45) : 1,
|
|
377
|
+
stone = bedded(crest * (1 - APRON) * body * cut * broken, x, z, BEDS.hold * limbData.rough),
|
|
331
378
|
// the apron is banked highest where a valley comes out onto it, in a fan
|
|
332
|
-
apron = crest * APRON * Math.exp(-1.2 * s * s) * (1 + 0.5 *
|
|
379
|
+
apron = crest * APRON * Math.exp(-1.2 * s * s) * (1 + 0.5 * limbData.rough * (floor - 0.5) * sstep(0.6, 1, s)),
|
|
333
380
|
lies = sstep(2, 1.3, s) * Math.max(sstep(0.75, 1.05, s), 0.7 * floor * floor * sstep(0.3, 0.8, s)),
|
|
334
|
-
loose =
|
|
381
|
+
loose = limbData.sharp * sstep(8, 30, limbData.h * crestFraction) * lies;
|
|
335
382
|
if (loose > range.scree) range.scree = loose;
|
|
336
383
|
return lerp(stone + apron, swell, smooth);
|
|
337
384
|
}
|
|
338
385
|
// Metres a limb raises the ground at (x, z): its range, and where it is not broken enough to be one wholly, its swell.
|
|
339
|
-
function limbHeight(
|
|
340
|
-
if (!
|
|
341
|
-
return (
|
|
386
|
+
function limbHeight(limbData, x, z) {
|
|
387
|
+
if (!limbData.swell) return rangeHeight(limbData, x, z, 1 - limbData.sharp);
|
|
388
|
+
return (limbData.sharp < 1 ? (1 - limbData.sharp) * swellAt(limbData.swell, x, z) : 0) + (limbData.sharp > 0 ? limbData.sharp * rangeHeight(limbData, x, z, 0) : 0);
|
|
342
389
|
}
|
|
343
390
|
// The higher of two limbs of one upland, rounded where they meet.
|
|
344
|
-
function joined(
|
|
345
|
-
const most = Math.max(
|
|
391
|
+
function joined(firstHeight, secondHeight) {
|
|
392
|
+
const most = Math.max(firstHeight, secondHeight),
|
|
346
393
|
k = 0.25 * most,
|
|
347
|
-
near = k > 0 ? Math.max(k - Math.abs(
|
|
394
|
+
near = k > 0 ? Math.max(k - Math.abs(firstHeight - secondHeight), 0) / k : 0;
|
|
348
395
|
return most + (near * near * k) / 4;
|
|
349
396
|
}
|
|
350
|
-
|
|
397
|
+
/**
|
|
398
|
+
* @param {number} x - World X in metres.
|
|
399
|
+
* @param {number} z - World Z in metres.
|
|
400
|
+
* @returns {number} Added elevation in metres. An empty layout contributes zero.
|
|
401
|
+
*/
|
|
351
402
|
function rangesAt(x, z) {
|
|
352
403
|
let h = 0;
|
|
353
404
|
range.scree = 0;
|
|
354
405
|
crag = -1;
|
|
355
406
|
for (let i = 0; i < uplands.length; i++) {
|
|
356
|
-
const
|
|
357
|
-
if (x <
|
|
407
|
+
const upland = uplands[i];
|
|
408
|
+
if (x < upland.x0 || x > upland.x1 || z < upland.z0 || z > upland.z1) continue;
|
|
358
409
|
let top = 0;
|
|
359
|
-
for (let j = 0; j <
|
|
410
|
+
for (let j = 0; j < upland.limbs.length; j++) top = joined(top, limbHeight(upland.limbs[j], x, z));
|
|
360
411
|
h += top;
|
|
361
412
|
}
|
|
362
413
|
return h;
|
|
@@ -371,12 +422,12 @@ export function createMountainRanges(seed = 0) {
|
|
|
371
422
|
box.z0 = Math.min(box.z0, z);
|
|
372
423
|
box.z1 = Math.max(box.z1, z);
|
|
373
424
|
};
|
|
374
|
-
for (const
|
|
375
|
-
for (const u of [
|
|
376
|
-
if (
|
|
425
|
+
for (const limbData of limbs) {
|
|
426
|
+
for (const u of [limbData.from, limbData.to]) for (const v of [-limbData.far, limbData.far]) hold(limbData.x + u * limbData.ax - v * limbData.az, limbData.z + u * limbData.az + v * limbData.ax);
|
|
427
|
+
if (limbData.swell) {
|
|
377
428
|
const reach = Math.sqrt(SWELL_REACH + SWELL_WARP / 2);
|
|
378
|
-
hold(
|
|
379
|
-
hold(
|
|
429
|
+
hold(limbData.swell.x - reach * limbData.swell.rx, limbData.swell.z - reach * limbData.swell.rz);
|
|
430
|
+
hold(limbData.swell.x + reach * limbData.swell.rx, limbData.swell.z + reach * limbData.swell.rz);
|
|
380
431
|
}
|
|
381
432
|
}
|
|
382
433
|
return box;
|
|
@@ -385,15 +436,15 @@ export function createMountainRanges(seed = 0) {
|
|
|
385
436
|
const faceSide = (face, ax, az) => (face === undefined ? 0 : Math.cos(face) * -az + Math.sin(face) * ax < 0 ? -1 : 1);
|
|
386
437
|
// An upland given as an ellipse ({ x, z, rx, rz, h, rough }): one limb along its long axis. The more broken it is, the longer
|
|
387
438
|
// its crest holds its height before it falls away.
|
|
388
|
-
function ellipseLimb(
|
|
389
|
-
const [bearing,
|
|
390
|
-
held = HELD * sstep(RANGE_FROM[0], RANGE_FROM[1],
|
|
391
|
-
tail =
|
|
439
|
+
function ellipseLimb(landform, seed) {
|
|
440
|
+
const [bearing, halfLength, halfWidth] = ellipseAxis(landform),
|
|
441
|
+
held = HELD * sstep(RANGE_FROM[0], RANGE_FROM[1], landform.rough) * Math.max(halfLength - 0.5 * halfWidth, 0.2 * halfLength), // the half-length its crest holds its height over: little of a round one's
|
|
442
|
+
tail = halfLength - 0.95 * held,
|
|
392
443
|
ax = Math.cos(bearing),
|
|
393
444
|
az = Math.sin(bearing),
|
|
394
445
|
crest = {
|
|
395
|
-
x:
|
|
396
|
-
z:
|
|
446
|
+
x: landform.x - held * ax,
|
|
447
|
+
z: landform.z - held * az,
|
|
397
448
|
ax,
|
|
398
449
|
az,
|
|
399
450
|
len: 2 * held,
|
|
@@ -405,58 +456,58 @@ export function createMountainRanges(seed = 0) {
|
|
|
405
456
|
free1: true,
|
|
406
457
|
};
|
|
407
458
|
return limb(
|
|
408
|
-
{ ...crest, b, h:
|
|
459
|
+
{ ...crest, b: halfWidth, h: landform.h, rough: landform.rough, face: faceSide(landform.face, ax, az), line: false, swell: landform.axis === undefined ? landform : null },
|
|
409
460
|
seed,
|
|
410
461
|
);
|
|
411
462
|
}
|
|
412
463
|
// An upland given as a line ({ crest: [[x, z, share of h], ...], wide, h, rough }): a limb to each stretch, each running on a
|
|
413
464
|
// little past the point where the next begins.
|
|
414
|
-
function lineLimbs(
|
|
465
|
+
function lineLimbs(landform, seed) {
|
|
415
466
|
const limbs = [],
|
|
416
|
-
tail = end =>
|
|
417
|
-
for (let i = 0; i + 1 <
|
|
418
|
-
const [x, z, k0] =
|
|
419
|
-
[x1, z1, k1] =
|
|
467
|
+
tail = end => landform.wide * (end ? 0.65 : 0.7);
|
|
468
|
+
for (let i = 0; i + 1 < landform.crest.length; i++) {
|
|
469
|
+
const [x, z, k0] = landform.crest[i],
|
|
470
|
+
[x1, z1, k1] = landform.crest[i + 1],
|
|
420
471
|
len = Math.hypot(x1 - x, z1 - z),
|
|
421
472
|
ax = (x1 - x) / len,
|
|
422
473
|
az = (z1 - z) / len,
|
|
423
474
|
first = i === 0,
|
|
424
|
-
last = i + 2 ===
|
|
475
|
+
last = i + 2 === landform.crest.length,
|
|
425
476
|
crest = { x, z, ax, az, len, tail0: tail(first), tail1: tail(last), k0, k1, free0: first, free1: last };
|
|
426
477
|
limbs.push(
|
|
427
|
-
limb({ ...crest, b:
|
|
478
|
+
limb({ ...crest, b: landform.wide, h: landform.h, rough: landform.rough, face: faceSide(landform.face, ax, az), line: true, swell: null }, seed + i * 3),
|
|
428
479
|
);
|
|
429
480
|
}
|
|
430
481
|
return limbs;
|
|
431
482
|
}
|
|
432
483
|
// A field of hills ({ x, z, rx, rz, h, rough, hills: how many }): small ranges scattered over its ellipse, their crests near one
|
|
433
484
|
// strike (`axis`, or the ellipse's long axis), on a low swell.
|
|
434
|
-
function hillField(
|
|
435
|
-
const [strike, , lesser] = ellipseAxis(
|
|
485
|
+
function hillField(landform, seed) {
|
|
486
|
+
const [strike, , lesser] = ellipseAxis(landform),
|
|
436
487
|
r = (i, n) => hash2(i, n, seed + 2),
|
|
437
|
-
out = [boxed([ellipseLimb({ ...
|
|
438
|
-
for (let i = 0; i <
|
|
439
|
-
const far = 0.85 * Math.sqrt((i + 0.5) /
|
|
488
|
+
out = [boxed([ellipseLimb({ ...landform, h: landform.h * HILL.base, rough: 0, axis: undefined }, seed)])];
|
|
489
|
+
for (let i = 0; i < landform.hills; i++) {
|
|
490
|
+
const far = 0.85 * Math.sqrt((i + 0.5) / landform.hills),
|
|
440
491
|
round = i * 2.39996 + r(i, 1), // the golden angle from one to the next, so they fill the ellipse evenly
|
|
441
492
|
long = lesser * lerp(HILL.long[0], HILL.long[1], r(i, 2)),
|
|
442
493
|
hill = {
|
|
443
|
-
x:
|
|
444
|
-
z:
|
|
494
|
+
x: landform.x + landform.rx * far * Math.cos(round),
|
|
495
|
+
z: landform.z + landform.rz * far * Math.sin(round),
|
|
445
496
|
rx: long,
|
|
446
497
|
rz: long * lerp(HILL.wide[0], HILL.wide[1], r(i, 3)),
|
|
447
|
-
h:
|
|
448
|
-
rough:
|
|
498
|
+
h: landform.h * lerp(HILL.high[0], HILL.high[1], r(i, 4)) * (1 - 0.4 * far * far),
|
|
499
|
+
rough: landform.rough,
|
|
449
500
|
axis: strike + (r(i, 5) - 0.5) * HILL.turn,
|
|
450
501
|
};
|
|
451
502
|
out.push(boxed([ellipseLimb(hill, seed + 10 + i * 3)]));
|
|
452
503
|
}
|
|
453
504
|
return out;
|
|
454
505
|
}
|
|
455
|
-
|
|
506
|
+
/** @param {(EllipticalUpland | Ridge)[]} list - Landforms in stable seed order. */
|
|
456
507
|
function layOutRanges(list) {
|
|
457
|
-
uplands = list.flatMap((
|
|
508
|
+
uplands = list.flatMap((landform, i) => {
|
|
458
509
|
const seed = 400 + i * 41;
|
|
459
|
-
return
|
|
510
|
+
return landform.hills ? hillField(landform, seed) : [boxed(landform.crest ? lineLimbs(landform, seed) : [ellipseLimb(landform, seed)])];
|
|
460
511
|
});
|
|
461
512
|
}
|
|
462
513
|
return { layout: layOutRanges, heightAt: rangesAt, surface: range };
|