roamwright 0.61.12 → 0.61.14
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/README.md +2 -1
- package/examples/animals.js +3 -2
- package/examples/crowds.js +3 -2
- package/examples/figure-motion.js +3 -2
- package/examples/figure.js +23 -31
- package/examples/fliers.js +3 -2
- package/examples/fortification.js +3 -2
- package/examples/house-kit.js +3 -2
- package/examples/island.js +22 -30
- package/examples/pacing.js +3 -2
- package/examples/props-and-plants.js +3 -2
- package/examples/ruins.html +60 -0
- package/examples/ruins.js +326 -0
- package/examples/ships.js +3 -2
- package/examples/small-world-land.js +2 -2
- package/examples/soundscape.js +3 -2
- package/examples/stage.js +3 -19
- package/examples/towns.js +3 -2
- package/geometry/heightfield.js +31 -1
- package/geometry/paved-road.js +443 -0
- package/geometry/ruins-hill.js +392 -0
- package/geometry/ruins-mound.js +484 -0
- package/geometry/ruins-rubble.js +161 -0
- package/geometry/strata-rocks.js +270 -0
- package/index.js +29 -0
- package/package.json +1 -1
- package/rendering/paved-ground.js +218 -0
- package/rendering/paved-road.js +353 -0
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scene binding for paved stone highways and roadside cedar avenues: distance-dissolved near/far
|
|
3
|
+
* flagstone paving, stone milestones and arches, and stretched instanced tree avenues with per-tree
|
|
4
|
+
* LOD dissolve handover.
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as THREE from 'three';
|
|
9
|
+
import { GB, geometryView } from '../geometry/builder.js';
|
|
10
|
+
import {
|
|
11
|
+
AVENUE_CEDAR,
|
|
12
|
+
PAVED_ROAD,
|
|
13
|
+
buildAvenueCedar,
|
|
14
|
+
buildFarRoadPaving,
|
|
15
|
+
buildRoadArch,
|
|
16
|
+
buildRoadMilestones,
|
|
17
|
+
buildRoadPaving,
|
|
18
|
+
planRoadAvenue,
|
|
19
|
+
roadLine,
|
|
20
|
+
} from '../geometry/paved-road.js';
|
|
21
|
+
import { TRS } from '../geometry/primitives.js';
|
|
22
|
+
import { createHash, mulberry32 } from '../math/random.js';
|
|
23
|
+
import { TAU } from '../math/scalar.js';
|
|
24
|
+
import { detailLens } from './detail-range.js';
|
|
25
|
+
import { handOverOf, handOverShadow, reachOf, twinMaterial } from './material-lod.js';
|
|
26
|
+
import { createShotCuts } from './shot-cuts.js';
|
|
27
|
+
|
|
28
|
+
const _tone = new THREE.Color();
|
|
29
|
+
const _drift = [1, 1, 1];
|
|
30
|
+
const farPavingMaterials = new WeakMap();
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Return a cached far-road paving material derived from `baseMaterial` via `reachOf(..., beyond = true)`
|
|
34
|
+
* with negative polygon offset so the distant strip never z-fights the underlying terrain.
|
|
35
|
+
*
|
|
36
|
+
* @param {import('three').Material} baseMaterial - Base stone material.
|
|
37
|
+
* @param {{ value: number }} reach - Distance uniform in metres at which near paving yields to the far strip.
|
|
38
|
+
* @param {number} [band=30] - Dissolve band depth in metres around `reach`.
|
|
39
|
+
* @returns {import('three').Material}
|
|
40
|
+
*/
|
|
41
|
+
export function farRoadPavingMaterial(baseMaterial, reach, band = 30) {
|
|
42
|
+
let byReach = farPavingMaterials.get(baseMaterial);
|
|
43
|
+
if (!byReach) farPavingMaterials.set(baseMaterial, (byReach = new Map()));
|
|
44
|
+
let byBand = byReach.get(reach);
|
|
45
|
+
if (!byBand) byReach.set(reach, (byBand = new Map()));
|
|
46
|
+
let mat = byBand.get(band);
|
|
47
|
+
if (!mat) {
|
|
48
|
+
mat = reachOf(baseMaterial, reach, true, band);
|
|
49
|
+
mat.polygonOffset = true;
|
|
50
|
+
mat.polygonOffsetFactor = mat.polygonOffsetUnits = -2;
|
|
51
|
+
byBand.set(band, mat);
|
|
52
|
+
}
|
|
53
|
+
return mat;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Create a zero-allocation per-frame updater that dissolves each tree in a roadside avenue smoothly
|
|
58
|
+
* between its near-detail stretch mesh and its single far instanced mesh, snapping immediately on
|
|
59
|
+
* camera cuts and holding steady during scenes.
|
|
60
|
+
*
|
|
61
|
+
* @param {object} options
|
|
62
|
+
* @param {Array<{ x: number, y: number, z: number, jitter: number, closeShot?: boolean }>} options.trees - Avenue tree records.
|
|
63
|
+
* @param {Float32Array} options.shares - Shared per-tree near blend weights (`0` far to `1` near).
|
|
64
|
+
* @param {import('three').InstancedMesh} options.far - Single instanced mesh carrying every far tree.
|
|
65
|
+
* @param {import('three').InstancedMesh[]} options.nearMeshes - Stretches of near instanced meshes reading subarrays of `shares`.
|
|
66
|
+
* @param {import('three').PerspectiveCamera} options.camera - Active scene camera.
|
|
67
|
+
* @param {ReturnType<typeof createShotCuts>} [options.cuts] - Shot-cut detector (created automatically if omitted).
|
|
68
|
+
* @param {() => number} [options.getReach] - Returns the base near-tree distance in metres (default `() => 240`).
|
|
69
|
+
* @param {() => boolean} [options.isPreparing] - Returns true while preparing a view so LODs snap immediately.
|
|
70
|
+
* @param {number} [options.stretch] - Trees per near stretch (defaults to `AVENUE_CEDAR.stretch`).
|
|
71
|
+
* @param {number} [options.hold] - Hysteresis distance in metres (defaults to `AVENUE_CEDAR.hold`).
|
|
72
|
+
* @param {number} [options.handover] - Dissolve duration in seconds (defaults to `AVENUE_CEDAR.handover`).
|
|
73
|
+
* @param {number} [options.closeMinReach=12] - Minimum near reach in metres for trees marked `closeShot`.
|
|
74
|
+
* @param {number} [options.detailFov=68] - Reference vertical FOV in degrees for telephoto reach scaling.
|
|
75
|
+
* @returns {(dt: number) => void} Per-frame update callback.
|
|
76
|
+
*/
|
|
77
|
+
export function createAvenueHandover({
|
|
78
|
+
trees,
|
|
79
|
+
shares,
|
|
80
|
+
far,
|
|
81
|
+
nearMeshes,
|
|
82
|
+
camera,
|
|
83
|
+
cuts,
|
|
84
|
+
getReach = () => 240,
|
|
85
|
+
isPreparing = () => false,
|
|
86
|
+
stretch = AVENUE_CEDAR.stretch,
|
|
87
|
+
hold = AVENUE_CEDAR.hold,
|
|
88
|
+
handover = AVENUE_CEDAR.handover,
|
|
89
|
+
closeMinReach = 12,
|
|
90
|
+
detailFov = 68,
|
|
91
|
+
}) {
|
|
92
|
+
const wanted = new Uint8Array(trees.length);
|
|
93
|
+
const eye = camera.position;
|
|
94
|
+
const shotCuts =
|
|
95
|
+
cuts ??
|
|
96
|
+
createShotCuts({
|
|
97
|
+
camera,
|
|
98
|
+
jumpMetres: AVENUE_CEDAR.cut,
|
|
99
|
+
jumpMetresInScene: 4,
|
|
100
|
+
turnInSceneOnly: true,
|
|
101
|
+
lensInSceneOnly: true,
|
|
102
|
+
});
|
|
103
|
+
return dt => {
|
|
104
|
+
const lens = detailLens(camera, detailFov);
|
|
105
|
+
const reach = getReach() * lens;
|
|
106
|
+
const cut = shotCuts.poll() || isPreparing();
|
|
107
|
+
const frozen = shotCuts.inScene && !cut;
|
|
108
|
+
const step = dt / handover;
|
|
109
|
+
let any = false;
|
|
110
|
+
for (let k = 0; k < nearMeshes.length; k++) {
|
|
111
|
+
const first = k * stretch;
|
|
112
|
+
const end = Math.min(trees.length, first + stretch);
|
|
113
|
+
let moved = false;
|
|
114
|
+
let shown = false;
|
|
115
|
+
for (let i = first; i < end; i++) {
|
|
116
|
+
if (!frozen) {
|
|
117
|
+
const t = trees[i];
|
|
118
|
+
const d = Math.hypot(eye.x - t.x, eye.y - t.y, eye.z - t.z);
|
|
119
|
+
const treeReach = (t.closeShot ? Math.max(closeMinReach, reach) : reach) * t.jitter;
|
|
120
|
+
wanted[i] = d < treeReach + (wanted[i] ? hold : -hold) ? 1 : 0;
|
|
121
|
+
}
|
|
122
|
+
const was = shares[i];
|
|
123
|
+
const now = cut ? wanted[i] : wanted[i] ? Math.min(1, was + step) : Math.max(0, was - step);
|
|
124
|
+
if (now !== was) {
|
|
125
|
+
shares[i] = now;
|
|
126
|
+
moved = true;
|
|
127
|
+
}
|
|
128
|
+
if (now > 0) shown = true;
|
|
129
|
+
}
|
|
130
|
+
const mesh = nearMeshes[k];
|
|
131
|
+
mesh.visible = shown;
|
|
132
|
+
if (moved) {
|
|
133
|
+
mesh.geometry.attributes.aNear.needsUpdate = true;
|
|
134
|
+
any = true;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (any) far.geometry.attributes.aNear.needsUpdate = true;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Lay a roadside avenue of instanced cedars along both sides of a paved road line: one far instanced
|
|
143
|
+
* mesh plus range-culled near stretches sharing per-tree `aNear` blend weights, wired to
|
|
144
|
+
* {@link createAvenueHandover}.
|
|
145
|
+
*
|
|
146
|
+
* @param {object} options
|
|
147
|
+
* @param {ReturnType<typeof roadLine>} options.line - Sampled road line.
|
|
148
|
+
* @param {(x: number, z: number) => number} options.ground - Terrain height sampler `(x, z) => y` in metres.
|
|
149
|
+
* @param {import('three').Object3D} options.parent - Group receiving the avenue meshes.
|
|
150
|
+
* @param {() => number} [options.random=Math.random] - Repeatable RNG for per-tree scale, yaw and tint.
|
|
151
|
+
* @param {number} options.offset - Lateral distance in metres from road centre to each tree row.
|
|
152
|
+
* @param {number} options.treeSpacing - Longitudinal spacing in metres between trees on one side.
|
|
153
|
+
* @param {import('three').Material} [options.foliageMaterial] - Base vertex-coloured foliage material.
|
|
154
|
+
* @param {number} [options.cedarSeed=319] - Seed for the shared near and far cedar geometry pair.
|
|
155
|
+
* @param {(x: number, z: number, salt: number) => number} [options.hash] - Deterministic 2D hash in `[0, 1)`.
|
|
156
|
+
* @param {(x: number, z: number, bright: number, out: number[]) => void} [options.standColourDrift] - Optional colour drift hook mutating `out`.
|
|
157
|
+
* @param {(x: number, z: number, hx: number, hz: number) => void} [options.addCollider] - Optional trunk collider callback.
|
|
158
|
+
* @param {import('three').PerspectiveCamera} [options.camera] - Active camera (when omitted, all trees stay on far LOD until updated).
|
|
159
|
+
* @param {ReturnType<typeof createShotCuts>} [options.cuts] - Optional shot-cut detector.
|
|
160
|
+
* @param {() => number} [options.getReach] - Base near-tree reach in metres.
|
|
161
|
+
* @param {() => boolean} [options.isPreparing] - Returns true while preparing a scene or view.
|
|
162
|
+
* @param {Partial<typeof PAVED_ROAD>} [options.shape] - Overrides to `PAVED_ROAD`.
|
|
163
|
+
* @param {Partial<typeof AVENUE_CEDAR>} [options.cedarShape] - Overrides to `AVENUE_CEDAR`.
|
|
164
|
+
* @returns {{ trees: Array<object>, hand: (dt: number) => void, far: import('three').InstancedMesh, nearMeshes: import('three').InstancedMesh[] }}
|
|
165
|
+
*/
|
|
166
|
+
export function layRoadAvenue({
|
|
167
|
+
line,
|
|
168
|
+
ground,
|
|
169
|
+
parent,
|
|
170
|
+
random = Math.random,
|
|
171
|
+
offset,
|
|
172
|
+
treeSpacing,
|
|
173
|
+
foliageMaterial,
|
|
174
|
+
cedarSeed = 319,
|
|
175
|
+
hash = createHash(cedarSeed),
|
|
176
|
+
standColourDrift,
|
|
177
|
+
addCollider = () => {},
|
|
178
|
+
camera,
|
|
179
|
+
cuts,
|
|
180
|
+
getReach,
|
|
181
|
+
isPreparing,
|
|
182
|
+
shape,
|
|
183
|
+
cedarShape,
|
|
184
|
+
}) {
|
|
185
|
+
const roadCfg = shape ? { ...PAVED_ROAD, ...shape } : PAVED_ROAD;
|
|
186
|
+
const cedarCfg = cedarShape ? { ...AVENUE_CEDAR, ...cedarShape } : AVENUE_CEDAR;
|
|
187
|
+
const trees = planRoadAvenue(line, ground, offset, treeSpacing, { endMargin: roadCfg.archBack + 12 });
|
|
188
|
+
const baseFoliage =
|
|
189
|
+
foliageMaterial ?? new THREE.MeshStandardMaterial({ vertexColors: true, roughness: 0.95, flatShading: true, side: THREE.DoubleSide });
|
|
190
|
+
const near = buildAvenueCedar(mulberry32(cedarSeed), false, { shape: cedarCfg });
|
|
191
|
+
const material = twinMaterial(baseFoliage, 'tinted');
|
|
192
|
+
const shares = new Float32Array(trees.length);
|
|
193
|
+
const farGeometry = geometryView(buildAvenueCedar(mulberry32(cedarSeed), true, { shape: cedarCfg }));
|
|
194
|
+
const far = new THREE.InstancedMesh(farGeometry, handOverOf(material, true), trees.length);
|
|
195
|
+
const nearMaterial = handOverOf(material);
|
|
196
|
+
const nearShadow = handOverShadow();
|
|
197
|
+
const nearMeshes = [];
|
|
198
|
+
farGeometry.setAttribute('aNear', new THREE.InstancedBufferAttribute(shares, 1).setUsage(THREE.DynamicDrawUsage));
|
|
199
|
+
trees.forEach((t, i) => {
|
|
200
|
+
const k = 0.92 + random() * 0.2;
|
|
201
|
+
const sx = k * (0.94 + random() * 0.12);
|
|
202
|
+
const sz = k * (0.94 + random() * 0.12);
|
|
203
|
+
const yaw = random() * TAU;
|
|
204
|
+
const coolNeedle = random() >= 0.5;
|
|
205
|
+
const brightDraw = random();
|
|
206
|
+
t.tall = k;
|
|
207
|
+
t.girth = (sx + sz) / 2;
|
|
208
|
+
t.jitter = 0.8 + 0.4 * hash(Math.round(t.x * 9), Math.round(t.z * 9), 457);
|
|
209
|
+
if (standColourDrift) standColourDrift(t.x, t.z, brightDraw, _drift);
|
|
210
|
+
else {
|
|
211
|
+
_drift[0] = _drift[1] = _drift[2] = 1;
|
|
212
|
+
}
|
|
213
|
+
_tone.setHex(coolNeedle ? 0xe0ecd8 : 0xffffff);
|
|
214
|
+
_tone.r *= _drift[0];
|
|
215
|
+
_tone.g *= _drift[1];
|
|
216
|
+
_tone.b *= _drift[2];
|
|
217
|
+
far.setMatrixAt(i, TRS(t.x, t.y - cedarCfg.sink, t.z, sx, k, sz, yaw));
|
|
218
|
+
far.setColorAt(i, _tone);
|
|
219
|
+
addCollider(t.x, t.z, 0.5, 0.5);
|
|
220
|
+
});
|
|
221
|
+
far.customDepthMaterial = handOverShadow(true);
|
|
222
|
+
far.castShadow = far.receiveShadow = true;
|
|
223
|
+
far.computeBoundingSphere();
|
|
224
|
+
parent.add(far);
|
|
225
|
+
for (let first = 0; first < trees.length; first += cedarCfg.stretch) {
|
|
226
|
+
const stretchTrees = trees.slice(first, first + cedarCfg.stretch);
|
|
227
|
+
const nearGeometry = geometryView(near);
|
|
228
|
+
const nearMesh = new THREE.InstancedMesh(nearGeometry, nearMaterial, stretchTrees.length);
|
|
229
|
+
nearGeometry.setAttribute(
|
|
230
|
+
'aNear',
|
|
231
|
+
new THREE.InstancedBufferAttribute(shares.subarray(first, first + stretchTrees.length), 1).setUsage(THREE.DynamicDrawUsage),
|
|
232
|
+
);
|
|
233
|
+
stretchTrees.forEach((_, i) => {
|
|
234
|
+
for (let e = 0; e < 16; e++) nearMesh.instanceMatrix.array[i * 16 + e] = far.instanceMatrix.array[(first + i) * 16 + e];
|
|
235
|
+
far.getColorAt(first + i, _tone);
|
|
236
|
+
nearMesh.setColorAt(i, _tone);
|
|
237
|
+
});
|
|
238
|
+
nearMesh.customDepthMaterial = nearShadow;
|
|
239
|
+
nearMesh.castShadow = nearMesh.receiveShadow = true;
|
|
240
|
+
nearMesh.computeBoundingSphere();
|
|
241
|
+
nearMesh.visible = false;
|
|
242
|
+
parent.add(nearMesh);
|
|
243
|
+
nearMeshes.push(nearMesh);
|
|
244
|
+
}
|
|
245
|
+
const hand = camera
|
|
246
|
+
? createAvenueHandover({
|
|
247
|
+
trees,
|
|
248
|
+
shares,
|
|
249
|
+
far,
|
|
250
|
+
nearMeshes,
|
|
251
|
+
camera,
|
|
252
|
+
cuts,
|
|
253
|
+
getReach,
|
|
254
|
+
isPreparing,
|
|
255
|
+
stretch: cedarCfg.stretch,
|
|
256
|
+
hold: cedarCfg.hold,
|
|
257
|
+
handover: cedarCfg.handover,
|
|
258
|
+
})
|
|
259
|
+
: () => {};
|
|
260
|
+
return { trees, hand, far, nearMeshes };
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Lay a complete paved stone road over a terrain: near flagstone courses and raised kerbs handing
|
|
265
|
+
* over by distance to a far paving strip, milestones, an optional spanning stone arch, and an
|
|
266
|
+
* optional roadside avenue of cedars.
|
|
267
|
+
*
|
|
268
|
+
* @param {object} options
|
|
269
|
+
* @param {{ pts: number[][], w: number, trees?: number }} options.road - Road spline points `[[x, z], ...]`, width `w` in metres and optional `trees` spacing in metres.
|
|
270
|
+
* @param {(x: number, z: number) => number} options.ground - Terrain height sampler `(x, z) => y` in metres.
|
|
271
|
+
* @param {import('three').Object3D} options.parent - Group receiving the road meshes.
|
|
272
|
+
* @param {() => number} [options.random=Math.random] - Repeatable RNG for stones, milestones, arch and avenue trees.
|
|
273
|
+
* @param {import('three').Material} [options.stoneMaterial] - Base stone material for paving, milestones and arch.
|
|
274
|
+
* @param {import('three').Material} [options.foliageMaterial] - Base foliage material for avenue cedars.
|
|
275
|
+
* @param {{ value: number }} [options.pavingReach] - Uniform `{ value: metres }` where near flags hand over to the far strip (default `{ value: 220 }`).
|
|
276
|
+
* @param {number} [options.pavingBand=30] - Dissolve band depth in metres around `pavingReach`.
|
|
277
|
+
* @param {boolean} [options.arch=false] - Whether to erect a monumental spanning arch near the road's end.
|
|
278
|
+
* @param {number} [options.avenueOffset] - Lateral offset in metres to each tree row (defaults to `road.w / 2 + kerb + treeOff`).
|
|
279
|
+
* @param {number} [options.cedarSeed=319] - Seed for the avenue cedar geometry pair.
|
|
280
|
+
* @param {(x: number, z: number, salt: number) => number} [options.hash] - Deterministic 2D hash for tree LOD jitter.
|
|
281
|
+
* @param {(x: number, z: number, bright: number, out: number[]) => void} [options.standColourDrift] - Optional colour drift hook for avenue trees.
|
|
282
|
+
* @param {(x: number, z: number, hx: number, hz: number, rot?: number) => void} [options.addCollider] - Optional collider callback for arch piers and tree trunks.
|
|
283
|
+
* @param {import('three').PerspectiveCamera} [options.camera] - Active camera for avenue LOD handover.
|
|
284
|
+
* @param {ReturnType<typeof createShotCuts>} [options.cuts] - Optional shot-cut detector for avenue handover.
|
|
285
|
+
* @param {() => number} [options.getReach] - Base near-tree reach in metres.
|
|
286
|
+
* @param {() => boolean} [options.isPreparing] - Returns true while preparing a scene or view.
|
|
287
|
+
* @param {typeof import('../geometry/builder.js').GB} [options.Builder] - Geometry builder class.
|
|
288
|
+
* @param {Partial<typeof PAVED_ROAD>} [options.shape] - Overrides to `PAVED_ROAD`.
|
|
289
|
+
* @param {Partial<typeof AVENUE_CEDAR>} [options.cedarShape] - Overrides to `AVENUE_CEDAR`.
|
|
290
|
+
* @returns {{ line: ReturnType<typeof roadLine>, avenueOffset: number, trees: Array<object> | null, hand: ((dt: number) => void) | null }}
|
|
291
|
+
*/
|
|
292
|
+
export function layPavedRoad({
|
|
293
|
+
road,
|
|
294
|
+
ground,
|
|
295
|
+
parent,
|
|
296
|
+
random = Math.random,
|
|
297
|
+
stoneMaterial,
|
|
298
|
+
foliageMaterial,
|
|
299
|
+
pavingReach = { value: 220 },
|
|
300
|
+
pavingBand = 30,
|
|
301
|
+
arch = false,
|
|
302
|
+
avenueOffset,
|
|
303
|
+
cedarSeed = 319,
|
|
304
|
+
hash,
|
|
305
|
+
standColourDrift,
|
|
306
|
+
addCollider = () => {},
|
|
307
|
+
camera,
|
|
308
|
+
cuts,
|
|
309
|
+
getReach,
|
|
310
|
+
isPreparing,
|
|
311
|
+
Builder,
|
|
312
|
+
shape,
|
|
313
|
+
cedarShape,
|
|
314
|
+
}) {
|
|
315
|
+
const cfg = shape ? { ...PAVED_ROAD, ...shape } : PAVED_ROAD;
|
|
316
|
+
const BuilderClass = Builder ?? GB;
|
|
317
|
+
const stone = stoneMaterial ?? new THREE.MeshStandardMaterial({ vertexColors: true, roughness: 0.92, metalness: 0 });
|
|
318
|
+
const line = roadLine(ground, road.pts, cfg.spacing);
|
|
319
|
+
const paving = new BuilderClass();
|
|
320
|
+
const works = new BuilderClass();
|
|
321
|
+
buildRoadPaving(paving, random, line, road.w, { shape: cfg });
|
|
322
|
+
buildRoadMilestones(works, random, line, road.w, { shape: cfg });
|
|
323
|
+
if (arch) buildRoadArch(works, random, line, road.w, { addCollider, shape: cfg });
|
|
324
|
+
paving.mesh(reachOf(stone, pavingReach, false, pavingBand), parent);
|
|
325
|
+
buildFarRoadPaving(line, road.w, { Builder: BuilderClass, shape: cfg }).mesh(
|
|
326
|
+
farRoadPavingMaterial(stone, pavingReach, pavingBand),
|
|
327
|
+
parent,
|
|
328
|
+
false,
|
|
329
|
+
);
|
|
330
|
+
works.mesh(stone, parent);
|
|
331
|
+
const offset = avenueOffset ?? road.w / 2 + cfg.kerb + cfg.treeOff;
|
|
332
|
+
if (!road.trees) return { line, avenueOffset: offset, trees: null, hand: null };
|
|
333
|
+
const { trees, hand } = layRoadAvenue({
|
|
334
|
+
line,
|
|
335
|
+
ground,
|
|
336
|
+
parent,
|
|
337
|
+
random,
|
|
338
|
+
offset,
|
|
339
|
+
treeSpacing: road.trees,
|
|
340
|
+
foliageMaterial,
|
|
341
|
+
cedarSeed,
|
|
342
|
+
hash,
|
|
343
|
+
standColourDrift,
|
|
344
|
+
addCollider,
|
|
345
|
+
camera,
|
|
346
|
+
cuts,
|
|
347
|
+
getReach,
|
|
348
|
+
isPreparing,
|
|
349
|
+
shape: cfg,
|
|
350
|
+
cedarShape,
|
|
351
|
+
});
|
|
352
|
+
return { line, avenueOffset: offset, trees, hand };
|
|
353
|
+
}
|