@adatechnology/game-destruction-three 0.22.0 → 0.23.0
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/dist/index.d.ts +3 -1
- package/dist/index.global.js +352 -29
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +338 -29
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -254,13 +254,35 @@ function buildBrokenBoardGeometry(THREE, seed) {
|
|
|
254
254
|
}
|
|
255
255
|
return faceted(THREE, positions);
|
|
256
256
|
}
|
|
257
|
+
function buildRubbleGeometry(THREE, seed) {
|
|
258
|
+
const rnd = createRng(9e3 + seed);
|
|
259
|
+
const base = new THREE.BoxGeometry(1, 1, 1, 2, 2, 2).toNonIndexed();
|
|
260
|
+
const source = base.getAttribute("position");
|
|
261
|
+
const moved = /* @__PURE__ */ new Map();
|
|
262
|
+
const positions = [];
|
|
263
|
+
for (let i = 0; i < source.count; i++) {
|
|
264
|
+
const p = [source.getX(i), source.getY(i), source.getZ(i)];
|
|
265
|
+
const key = p.map((x) => x.toFixed(3)).join(",");
|
|
266
|
+
let out = moved.get(key);
|
|
267
|
+
if (!out) {
|
|
268
|
+
const outer = p.filter((x) => Math.abs(x) > 0.49).length;
|
|
269
|
+
const bite = outer === 3 ? 0.08 + 0.3 * rnd() : outer === 2 ? 0.1 * rnd() : 0;
|
|
270
|
+
out = p.map((x) => Math.abs(x) > 0.49 ? x - Math.sign(x) * bite * (0.4 + 0.6 * rnd()) : x);
|
|
271
|
+
moved.set(key, out);
|
|
272
|
+
}
|
|
273
|
+
positions.push(out[0], out[1], out[2]);
|
|
274
|
+
}
|
|
275
|
+
base.dispose();
|
|
276
|
+
return faceted(THREE, positions);
|
|
277
|
+
}
|
|
257
278
|
|
|
258
279
|
// src/fragments.ts
|
|
259
280
|
var BUILDERS = {
|
|
260
281
|
sliver: buildSliverGeometry,
|
|
261
282
|
lump: buildLumpGeometry,
|
|
262
283
|
veneer: buildVeneerGeometry,
|
|
263
|
-
board: buildBrokenBoardGeometry
|
|
284
|
+
board: buildBrokenBoardGeometry,
|
|
285
|
+
rubble: buildRubbleGeometry
|
|
264
286
|
};
|
|
265
287
|
var SHEET_MAX = 4e-3;
|
|
266
288
|
var SHEET_AIR = 2.5;
|
|
@@ -369,6 +391,7 @@ var FragmentSystem = class {
|
|
|
369
391
|
if (f.shape === "chunk" && form === "granules") return this.sharedGeometry("lump", seed);
|
|
370
392
|
if (f.shape === "scrap" && form === "plies") return this.sharedGeometry("veneer", seed);
|
|
371
393
|
if (f.shape === "slab" && (form === "slivers" || form === "plies")) return this.sharedGeometry("board", seed);
|
|
394
|
+
if (f.shape === "chunk" && this.o.crumbles?.(f.material)) return this.sharedGeometry("rubble", seed);
|
|
372
395
|
return this.box;
|
|
373
396
|
}
|
|
374
397
|
markParts() {
|
|
@@ -377,18 +400,18 @@ var FragmentSystem = class {
|
|
|
377
400
|
return { geometry: this.markGeometry, material: this.markMaterial };
|
|
378
401
|
}
|
|
379
402
|
/**
|
|
380
|
-
* Meshes, never put in a scene by this class, that draw every shared piece of a fragment once: the box, the six shards, the wood splinters, MDF lumps
|
|
403
|
+
* Meshes, never put in a scene by this class, that draw every shared piece of a fragment once: the box, the six shards, the wood splinters, MDF lumps, plywood veneer, broken masonry, the bullet-hole disc, and the opaque and
|
|
381
404
|
* glass materials. A host draws them at load so the first blast does not upload these buffers in the middle of a frame.
|
|
382
405
|
*/
|
|
383
406
|
warmMeshes() {
|
|
384
407
|
const opaque = this.materialFor("warm", 8421504, false);
|
|
385
408
|
const glass2 = this.materialFor("warm", 8421504, true);
|
|
386
409
|
const geometries = [this.box, ...Array.from({ length: SHARD_SHAPES }, (_, index) => this.shardGeometry(index))];
|
|
387
|
-
const
|
|
410
|
+
const shaped = ["sliver", "lump", "veneer", "board", "rubble"].flatMap((shape) => Array.from({ length: FRAGMENT_SHAPE_VARIANTS }, (_, index) => this.sharedGeometry(shape, index)));
|
|
388
411
|
const { geometry, material } = this.markParts();
|
|
389
412
|
return [
|
|
390
413
|
...geometries.flatMap((shared) => [new this.THREE.Mesh(shared, opaque), new this.THREE.Mesh(shared, glass2)]),
|
|
391
|
-
...
|
|
414
|
+
...shaped.map((shared) => new this.THREE.Mesh(shared, opaque)),
|
|
392
415
|
new this.THREE.Mesh(geometry, material)
|
|
393
416
|
];
|
|
394
417
|
}
|
|
@@ -1150,16 +1173,29 @@ var PieceSystem = class {
|
|
|
1150
1173
|
}
|
|
1151
1174
|
}
|
|
1152
1175
|
update(dt) {
|
|
1153
|
-
const steps = this.collisionSteps(dt);
|
|
1154
|
-
|
|
1176
|
+
const { steps, near } = this.collisionSteps(dt);
|
|
1177
|
+
if (steps === 1) {
|
|
1178
|
+
this.time += dt;
|
|
1179
|
+
this.step(dt);
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
const start = this.time;
|
|
1183
|
+
this.time = start + dt;
|
|
1184
|
+
const far = (b) => !near.has(b);
|
|
1185
|
+
this.step(dt, { moves: far, meets: (a, b) => far(a) && far(b) });
|
|
1186
|
+
for (let i = 0; i < steps; i++) {
|
|
1187
|
+
this.time = start + dt * (i + 1) / steps;
|
|
1188
|
+
this.step(dt / steps, { moves: (b) => near.has(b), meets: (a, b) => near.has(a) || near.has(b) });
|
|
1189
|
+
}
|
|
1155
1190
|
}
|
|
1156
1191
|
/**
|
|
1157
1192
|
* Steps of an update: one, or more while a round piece and a piece it could meet within the update close in fast enough to pass through each other between two (closing at
|
|
1158
1193
|
* their two speeds they cover at most the round one's radius per step: two cans at 3.6 m/s close 12 cm in a frame, a can is 7 cm across; a plank thrown at a can still counts).
|
|
1159
|
-
* A round piece with nothing in reach takes one step, so its sweep against the world (the costly part) runs once.
|
|
1194
|
+
* A round piece with nothing in reach takes one step, so its sweep against the world (the costly part) runs once; `near` holds the pieces of the pairs that need more.
|
|
1160
1195
|
*/
|
|
1161
1196
|
collisionSteps(dt) {
|
|
1162
1197
|
let need = 1;
|
|
1198
|
+
const near = /* @__PURE__ */ new Set();
|
|
1163
1199
|
const p = this.p;
|
|
1164
1200
|
const speedOf = (b) => b.held ? 0 : Math.hypot(b.velocity[0], b.velocity[1], b.velocity[2]);
|
|
1165
1201
|
for (const b of this.list) {
|
|
@@ -1176,13 +1212,17 @@ var PieceSystem = class {
|
|
|
1176
1212
|
const reach = closing * dt + rb + Math.hypot(o.halfExtents[0], o.halfExtents[1], o.halfExtents[2]);
|
|
1177
1213
|
const oc = this.centerOf(o, p);
|
|
1178
1214
|
if (Math.abs(oc.x - cx) > reach || Math.abs(oc.y - cy) > reach || Math.abs(oc.z - cz) > reach) continue;
|
|
1179
|
-
|
|
1215
|
+
const pair = Math.ceil(closing * dt / radius);
|
|
1216
|
+
if (pair < 2) continue;
|
|
1217
|
+
need = Math.max(need, pair);
|
|
1218
|
+
near.add(b);
|
|
1219
|
+
near.add(o);
|
|
1180
1220
|
}
|
|
1181
1221
|
}
|
|
1182
|
-
return Math.max(1, Math.min(MAX_COLLISION_STEPS, need));
|
|
1222
|
+
return { steps: Math.max(1, Math.min(MAX_COLLISION_STEPS, need)), near };
|
|
1183
1223
|
}
|
|
1184
|
-
step(
|
|
1185
|
-
|
|
1224
|
+
/** A step of `dt`: the pieces `only.moves` takes move (all when absent) and the pairs `only.meets` takes meet, so each pair meets in one of the steps of an update. */
|
|
1225
|
+
step(dt, only) {
|
|
1186
1226
|
this.solids = this.list.map((body) => {
|
|
1187
1227
|
const c = this.centerOf(body, new this.THREE.Vector3());
|
|
1188
1228
|
const h = body.halfExtents;
|
|
@@ -1243,14 +1283,14 @@ var PieceSystem = class {
|
|
|
1243
1283
|
b.calmAt = null;
|
|
1244
1284
|
continue;
|
|
1245
1285
|
}
|
|
1246
|
-
if (b.sleeping) continue;
|
|
1286
|
+
if (b.sleeping || only && !only.moves(b)) continue;
|
|
1247
1287
|
this.integrate(b, dt);
|
|
1248
1288
|
if (b.sleeping) continue;
|
|
1249
1289
|
const v = b.velocity;
|
|
1250
1290
|
const w = b.angularVelocity;
|
|
1251
1291
|
if (Math.hypot(v[0], v[1], v[2]) > WAKE_ABOVE_SPEED || Math.hypot(w[0], w[1], w[2]) > WAKE_ABOVE_SPIN) this.wakeAbove(b);
|
|
1252
1292
|
}
|
|
1253
|
-
this.collide(dt);
|
|
1293
|
+
this.collide(dt, only?.meets);
|
|
1254
1294
|
}
|
|
1255
1295
|
/** A few sleeping pieces each update (`SUPPORT_CHECKS`, in turn) look under them again: one whose table broke, or whose shelf fell over, falls. */
|
|
1256
1296
|
wakeUnsupported() {
|
|
@@ -1752,7 +1792,7 @@ var PieceSystem = class {
|
|
|
1752
1792
|
* Pieces against each other. Candidates by sweep and prune along x on their bounding spheres (sorted once per step: fifty cans cost a sort and a handful of pairs, not
|
|
1753
1793
|
* 1225); a pair with a round piece in it meets by its shapes (`shapeContact`) and exchanges an impulse, two boxes are only pushed apart (`separatePair`).
|
|
1754
1794
|
*/
|
|
1755
|
-
collide(dt) {
|
|
1795
|
+
collide(dt, meets) {
|
|
1756
1796
|
const n = this.list.length;
|
|
1757
1797
|
if (n < 2) return;
|
|
1758
1798
|
const centers = this.list.map((b) => {
|
|
@@ -1770,6 +1810,7 @@ var PieceSystem = class {
|
|
|
1770
1810
|
const a = this.list[i];
|
|
1771
1811
|
const b = this.list[j];
|
|
1772
1812
|
if ((a.held || a.sleeping) && (b.held || b.sleeping)) continue;
|
|
1813
|
+
if (meets && !meets(a, b)) continue;
|
|
1773
1814
|
const r = radii[i] + radii[j];
|
|
1774
1815
|
const ca = centers[i];
|
|
1775
1816
|
const cb = centers[j];
|
|
@@ -2311,6 +2352,47 @@ function shellDisplacementAt(THREE, worldPoint, shells, out) {
|
|
|
2311
2352
|
return Math.sqrt(nearest) * nearestScale;
|
|
2312
2353
|
}
|
|
2313
2354
|
|
|
2355
|
+
// src/stair-crack.ts
|
|
2356
|
+
function stairCrackPath(spec) {
|
|
2357
|
+
const rnd = createRng(spec.seed);
|
|
2358
|
+
const run = Math.max(0.02, spec.step[0] / 2);
|
|
2359
|
+
const rise = Math.max(0.02, spec.step[1]);
|
|
2360
|
+
const points = [[0, 0]];
|
|
2361
|
+
let h = 0;
|
|
2362
|
+
let u = 0;
|
|
2363
|
+
let walked = 0;
|
|
2364
|
+
while (walked < spec.length) {
|
|
2365
|
+
const along2 = run * (rnd() < 0.2 ? 2 : 1);
|
|
2366
|
+
h += along2;
|
|
2367
|
+
points.push([h, u]);
|
|
2368
|
+
u += rise;
|
|
2369
|
+
points.push([h, u]);
|
|
2370
|
+
walked += along2 + rise;
|
|
2371
|
+
}
|
|
2372
|
+
return points;
|
|
2373
|
+
}
|
|
2374
|
+
function stairCrackStrip(points, width, taper) {
|
|
2375
|
+
const out = [];
|
|
2376
|
+
const n = points.length - 1;
|
|
2377
|
+
for (let k = 0; k < n; k++) {
|
|
2378
|
+
const [h0, u0] = points[k];
|
|
2379
|
+
const [h1, u1] = points[k + 1];
|
|
2380
|
+
const length = Math.hypot(h1 - h0, u1 - u0) || 1;
|
|
2381
|
+
const half0 = width * (1 - (1 - taper) * k / n) / 2;
|
|
2382
|
+
const half1 = width * (1 - (1 - taper) * (k + 1) / n) / 2;
|
|
2383
|
+
const sh = -(u1 - u0) / length;
|
|
2384
|
+
const su = (h1 - h0) / length;
|
|
2385
|
+
const eh = (h1 - h0) / length * half0;
|
|
2386
|
+
const eu = (u1 - u0) / length * half0;
|
|
2387
|
+
const a = [h0 - eh - sh * half0, u0 - eu - su * half0];
|
|
2388
|
+
const b = [h1 + eh - sh * half1, u1 + eu - su * half1];
|
|
2389
|
+
const c = [h1 + eh + sh * half1, u1 + eu + su * half1];
|
|
2390
|
+
const d = [h0 - eh + sh * half0, u0 - eu + su * half0];
|
|
2391
|
+
out.push(...a, ...b, ...c, ...a, ...c, ...d);
|
|
2392
|
+
}
|
|
2393
|
+
return out;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2314
2396
|
// src/visual.ts
|
|
2315
2397
|
var POS_ATTR = "position";
|
|
2316
2398
|
function positionAttr(geo) {
|
|
@@ -2415,6 +2497,8 @@ var collapseForeign = (mesh, arr) => {
|
|
|
2415
2497
|
}
|
|
2416
2498
|
};
|
|
2417
2499
|
var DECAL_SNAP = 0.03;
|
|
2500
|
+
var STAIR_CRACK_LIFT = 2e-3;
|
|
2501
|
+
var STAIR_CRACK_TAPER = 0.35;
|
|
2418
2502
|
var Visuals = class {
|
|
2419
2503
|
constructor(THREE, lowQuality, decalCap) {
|
|
2420
2504
|
__publicField(this, "THREE", THREE);
|
|
@@ -2908,6 +2992,71 @@ var Visuals = class {
|
|
|
2908
2992
|
lines.renderOrder = 2;
|
|
2909
2993
|
this.addDecal(mv, { obj: lines, geometry: geo });
|
|
2910
2994
|
}
|
|
2995
|
+
/**
|
|
2996
|
+
* A stair-step crack through the joints of a wall (settlement): from `worldPoint` on the face whose outward normal is `worldNormal`, climbing toward
|
|
2997
|
+
* `worldToward` (the side that went down) one unit at a time, `width` metres wide at its start. A strip of triangles in the mesh's space, owned by the
|
|
2998
|
+
* part's marks: it goes with them (cleared, restored, disposed).
|
|
2999
|
+
*/
|
|
3000
|
+
addStairCrack(mv, worldPoint, worldNormal, worldToward, spec) {
|
|
3001
|
+
const mesh = mv.mesh;
|
|
3002
|
+
mesh.updateWorldMatrix(true, false);
|
|
3003
|
+
const n = worldNormal.clone().normalize();
|
|
3004
|
+
const up = new this.THREE.Vector3(0, 1, 0).addScaledVector(n, -n.y).normalize();
|
|
3005
|
+
const side = worldToward.clone().addScaledVector(n, -worldToward.dot(n)).addScaledVector(up, -worldToward.dot(up));
|
|
3006
|
+
if (side.lengthSq() < 1e-8) side.crossVectors(up, n);
|
|
3007
|
+
side.normalize();
|
|
3008
|
+
const start = this.onFace(mesh, worldPoint, n).clone().addScaledVector(n, STAIR_CRACK_LIFT);
|
|
3009
|
+
const flat = stairCrackStrip(stairCrackPath({ length: spec.length, step: spec.step, seed: spec.seed }), spec.width, STAIR_CRACK_TAPER);
|
|
3010
|
+
const flip = new this.THREE.Vector3().crossVectors(side, up).dot(n) < 0;
|
|
3011
|
+
const verts = [];
|
|
3012
|
+
const point = this.a;
|
|
3013
|
+
for (let i = 0; i < flat.length; i += 6) {
|
|
3014
|
+
const order = flip ? [0, 2, 1] : [0, 1, 2];
|
|
3015
|
+
for (const k of order) {
|
|
3016
|
+
point.copy(start).addScaledVector(side, flat[i + k * 2]).addScaledVector(up, flat[i + k * 2 + 1]);
|
|
3017
|
+
mesh.worldToLocal(point);
|
|
3018
|
+
verts.push(point.x, point.y, point.z);
|
|
3019
|
+
}
|
|
3020
|
+
}
|
|
3021
|
+
const geo = new this.THREE.BufferGeometry();
|
|
3022
|
+
geo.setAttribute("position", new this.THREE.Float32BufferAttribute(verts, 3));
|
|
3023
|
+
const strip = new this.THREE.Mesh(geo, this.kit.patchMaterial(spec.color));
|
|
3024
|
+
strip.renderOrder = 2;
|
|
3025
|
+
this.addDecal(mv, { obj: strip, geometry: geo });
|
|
3026
|
+
}
|
|
3027
|
+
// ------------------------------------------------------------------------------------------------------------------------------------
|
|
3028
|
+
// Settlement
|
|
3029
|
+
// ------------------------------------------------------------------------------------------------------------------------------------
|
|
3030
|
+
/**
|
|
3031
|
+
* Moves the part's vertices and its marks down by `dropAt(world point)` metres (negative: up), where each of them is: a part that settled more at
|
|
3032
|
+
* one end tilts. Writes the geometry unless `write` is false (several parts of one merged mesh are then written once by `commit`).
|
|
3033
|
+
*/
|
|
3034
|
+
sink(mv, dropAt, write = true) {
|
|
3035
|
+
if (!this.ownGeometry(mv)) return false;
|
|
3036
|
+
const mesh = mv.mesh;
|
|
3037
|
+
mesh.updateWorldMatrix(true, false);
|
|
3038
|
+
const scale = mesh.matrixWorld.getMaxScaleOnAxis() || 1;
|
|
3039
|
+
const down = this.b.set(0, -1, 0).transformDirection(this.m4.copy(mesh.matrixWorld).invert());
|
|
3040
|
+
const work = mv.host ? mv.host.work : mv.work;
|
|
3041
|
+
const from = mv.range ? mv.range[0] * 3 : 0;
|
|
3042
|
+
const to = mv.range ? mv.range[1] * 3 : work.length;
|
|
3043
|
+
const point = this.a;
|
|
3044
|
+
for (let i = from; i < to; i += 3) {
|
|
3045
|
+
const d = dropAt(point.set(work[i], work[i + 1], work[i + 2]).applyMatrix4(mesh.matrixWorld)) / scale;
|
|
3046
|
+
work[i] += down.x * d;
|
|
3047
|
+
work[i + 1] += down.y * d;
|
|
3048
|
+
work[i + 2] += down.z * d;
|
|
3049
|
+
}
|
|
3050
|
+
for (const decal of mv.decals) decal.obj.position.addScaledVector(down, dropAt(decal.obj.getWorldPosition(point)) / scale);
|
|
3051
|
+
mv.touched = true;
|
|
3052
|
+
if (write) this.commit(mv);
|
|
3053
|
+
return true;
|
|
3054
|
+
}
|
|
3055
|
+
/** Writes what `sink` moved into the geometry. */
|
|
3056
|
+
commit(mv) {
|
|
3057
|
+
const pos = positionAttr(mv.mesh.geometry);
|
|
3058
|
+
if (pos) this.writePositions(mv, pos);
|
|
3059
|
+
}
|
|
2911
3060
|
// ------------------------------------------------------------------------------------------------------------------------------------
|
|
2912
3061
|
// Char and heat glow
|
|
2913
3062
|
// ------------------------------------------------------------------------------------------------------------------------------------
|
|
@@ -3303,6 +3452,7 @@ var Visuals = class {
|
|
|
3303
3452
|
}
|
|
3304
3453
|
restorePart(pv) {
|
|
3305
3454
|
for (const mv of pv.meshes) this.restoreMesh(mv);
|
|
3455
|
+
delete pv.settled;
|
|
3306
3456
|
pv.charApplied = 0;
|
|
3307
3457
|
pv.glowApplied = 0;
|
|
3308
3458
|
pv.meltApplied = 0;
|
|
@@ -3313,6 +3463,78 @@ var Visuals = class {
|
|
|
3313
3463
|
}
|
|
3314
3464
|
};
|
|
3315
3465
|
|
|
3466
|
+
// src/settlement.ts
|
|
3467
|
+
import { settlementAt } from "@adatechnology/game-destruction";
|
|
3468
|
+
var SETTLE_SECONDS = 1.2;
|
|
3469
|
+
var SETTLE_REDRAW = 0.1;
|
|
3470
|
+
var dropOf = (line, point) => line ? settlementAt(line, point) : 0;
|
|
3471
|
+
var sameLine = (a, b) => !!a && a.drop.length === b.drop.length && a.drop.every((v, k) => v === b.drop[k]) && a.from.every((v, k) => v === b.from[k]) && a.to.every((v, k) => v === b.to[k]);
|
|
3472
|
+
var SettlementView = class {
|
|
3473
|
+
constructor(THREE, visuals) {
|
|
3474
|
+
__publicField(this, "visuals", visuals);
|
|
3475
|
+
__publicField(this, "moving", /* @__PURE__ */ new Map());
|
|
3476
|
+
__publicField(this, "local");
|
|
3477
|
+
__publicField(this, "inverse");
|
|
3478
|
+
this.local = new THREE.Vector3();
|
|
3479
|
+
this.inverse = new THREE.Matrix4();
|
|
3480
|
+
}
|
|
3481
|
+
/** The parts of an object (`root` draws it in object space) and their settlement now: those that changed start going to it. */
|
|
3482
|
+
follow(root, parts) {
|
|
3483
|
+
for (const [pv, target] of parts) {
|
|
3484
|
+
if (!target || pv.gone !== "none" || sameLine(this.moving.get(pv)?.target ?? pv.settled, target)) continue;
|
|
3485
|
+
this.finish(pv);
|
|
3486
|
+
this.moving.set(pv, { pv, root, start: pv.settled, target, shown: 0, elapsed: 0, lastDrawn: -SETTLE_REDRAW });
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3489
|
+
get count() {
|
|
3490
|
+
return this.moving.size;
|
|
3491
|
+
}
|
|
3492
|
+
update(dt) {
|
|
3493
|
+
for (const s of this.moving.values()) {
|
|
3494
|
+
s.elapsed += dt;
|
|
3495
|
+
const done = s.elapsed >= SETTLE_SECONDS;
|
|
3496
|
+
if (!done && s.elapsed - s.lastDrawn < SETTLE_REDRAW) continue;
|
|
3497
|
+
s.lastDrawn = s.elapsed;
|
|
3498
|
+
const t = Math.min(1, s.elapsed / SETTLE_SECONDS);
|
|
3499
|
+
this.draw(s, t * t * (3 - 2 * t));
|
|
3500
|
+
if (done) {
|
|
3501
|
+
s.pv.settled = s.target;
|
|
3502
|
+
this.moving.delete(s.pv);
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
/** Draws the rest of a part's settlement at once (it is about to be split off or put back). */
|
|
3507
|
+
finish(pv) {
|
|
3508
|
+
const s = this.moving.get(pv);
|
|
3509
|
+
if (!s) return;
|
|
3510
|
+
this.draw(s, 1);
|
|
3511
|
+
pv.settled = s.target;
|
|
3512
|
+
this.moving.delete(pv);
|
|
3513
|
+
}
|
|
3514
|
+
/** Forget a part without drawing (it was put back as it was). */
|
|
3515
|
+
forget(pv) {
|
|
3516
|
+
this.moving.delete(pv);
|
|
3517
|
+
}
|
|
3518
|
+
clear() {
|
|
3519
|
+
this.moving.clear();
|
|
3520
|
+
}
|
|
3521
|
+
draw(s, shown) {
|
|
3522
|
+
const share = shown - s.shown;
|
|
3523
|
+
if (share <= 0) return;
|
|
3524
|
+
s.shown = shown;
|
|
3525
|
+
s.root.updateWorldMatrix(true, false);
|
|
3526
|
+
this.inverse.copy(s.root.matrixWorld).invert();
|
|
3527
|
+
const dropAt = (world) => {
|
|
3528
|
+
const p = this.local.copy(world).applyMatrix4(this.inverse);
|
|
3529
|
+
const at = [p.x, p.y, p.z];
|
|
3530
|
+
return (dropOf(s.target, at) - dropOf(s.start, at)) * share;
|
|
3531
|
+
};
|
|
3532
|
+
const writes = /* @__PURE__ */ new Map();
|
|
3533
|
+
for (const mv of s.pv.meshes) if (this.visuals.sink(mv, dropAt, false)) writes.set(mv.host ?? mv, mv);
|
|
3534
|
+
for (const mv of writes.values()) this.visuals.commit(mv);
|
|
3535
|
+
}
|
|
3536
|
+
};
|
|
3537
|
+
|
|
3316
3538
|
// src/renderer.ts
|
|
3317
3539
|
var rendererCount = 0;
|
|
3318
3540
|
var COLLAPSE_CLOUD_KG = 1e3;
|
|
@@ -3322,6 +3544,8 @@ var CHIP_DECAL_EDGE = 0.05;
|
|
|
3322
3544
|
var WOOD_RIM = 1.5;
|
|
3323
3545
|
var IMPACT_TAGS = ["metal", "glass", "wood"];
|
|
3324
3546
|
var GLOW_FROM_C = 430;
|
|
3547
|
+
var MIN_DRAWN_CRACK_WIDTH = 4e-3;
|
|
3548
|
+
var SETTLEMENT_CRACK_COLOR = 2827296;
|
|
3325
3549
|
var QUEUE_CAP = 4e3;
|
|
3326
3550
|
var TRICKLE_SECONDS = [2, 5];
|
|
3327
3551
|
var TRICKLE_EVERY = 0.25;
|
|
@@ -3541,6 +3765,8 @@ var Renderer = class {
|
|
|
3541
3765
|
});
|
|
3542
3766
|
__publicField(this, "unsubscribe");
|
|
3543
3767
|
__publicField(this, "visuals");
|
|
3768
|
+
/** The parts the ground went down under, drawn going down (`subside`). */
|
|
3769
|
+
__publicField(this, "settlement");
|
|
3544
3770
|
__publicField(this, "fragments");
|
|
3545
3771
|
__publicField(this, "ground");
|
|
3546
3772
|
__publicField(this, "pieceSys");
|
|
@@ -3549,6 +3775,8 @@ var Renderer = class {
|
|
|
3549
3775
|
__publicField(this, "fires", /* @__PURE__ */ new Map());
|
|
3550
3776
|
/** Primed parts burning in the effects world until they go off: their burn loop ends when they are put out. */
|
|
3551
3777
|
__publicField(this, "primedBurning", /* @__PURE__ */ new Set());
|
|
3778
|
+
/** The burn loops asked of the host and not yet ended, by part: whatever stops a part's fire ends its loop, once, with what it started with. */
|
|
3779
|
+
__publicField(this, "burnSounds", /* @__PURE__ */ new Map());
|
|
3552
3780
|
__publicField(this, "leaks", []);
|
|
3553
3781
|
__publicField(this, "homeTags", []);
|
|
3554
3782
|
__publicField(this, "throttles", /* @__PURE__ */ new Map());
|
|
@@ -3583,6 +3811,7 @@ var Renderer = class {
|
|
|
3583
3811
|
this.v2 = new THREE.Vector3();
|
|
3584
3812
|
const maxParticles = Math.max(8, Math.floor((o.maxParticles ?? 2500) * (this.low ? 0.5 : 1)));
|
|
3585
3813
|
this.visuals = new Visuals(THREE, this.low, 600);
|
|
3814
|
+
this.settlement = new SettlementView(THREE, this.visuals);
|
|
3586
3815
|
this.ground = new GroundSpots(THREE, o.scene, this.groundAt, 48);
|
|
3587
3816
|
if (!o.vfx) warnOnce("game-destruction-three.own-effects-world", "game-destruction-three made an effects world of its own because the host lent none (options.vfx); pass the host effects so the effects share one budget");
|
|
3588
3817
|
this.vfx = o.vfx ?? createVfx({ profile: this.quality, gravity: this.gravity, groundAt: this.groundAt, sprites: { capacity: maxParticles, density: this.low ? 0.6 : 1 } });
|
|
@@ -3597,7 +3826,8 @@ var Renderer = class {
|
|
|
3597
3826
|
gravity: this.gravity,
|
|
3598
3827
|
max: this.maxFragments,
|
|
3599
3828
|
life: o.fragmentLife ?? 12,
|
|
3600
|
-
formOf: (id) => this.world.materials.get(id)?.splitForm
|
|
3829
|
+
formOf: (id) => this.world.materials.get(id)?.splitForm,
|
|
3830
|
+
crumbles: (id) => this.world.materials.get(id)?.fracture === "crumble"
|
|
3601
3831
|
});
|
|
3602
3832
|
this.cages = new RebarCages(THREE, o.scene);
|
|
3603
3833
|
this.pieceSys = new PieceSystem(THREE, {
|
|
@@ -3992,6 +4222,7 @@ var Renderer = class {
|
|
|
3992
4222
|
this.checkBroken();
|
|
3993
4223
|
for (const b of this.bounds.values()) b.onFrame?.(dt);
|
|
3994
4224
|
for (const b of this.bounds.values()) if (b.soilNode && this.world.state(b.id)?.soil?.status === "yielding") this.onSettle(b.id);
|
|
4225
|
+
this.settlement.update(dt);
|
|
3995
4226
|
this.updateActive(dt);
|
|
3996
4227
|
this.updateLeaks(dt);
|
|
3997
4228
|
this.updateTrickles(dt);
|
|
@@ -4067,6 +4298,18 @@ var Renderer = class {
|
|
|
4067
4298
|
node.quaternion.set(q[0], q[1], q[2], q[3]);
|
|
4068
4299
|
node.updateMatrixWorld(true);
|
|
4069
4300
|
}
|
|
4301
|
+
/** The ground went down under some parts of an object: each part with a settlement (`PartState.settlement`) starts going down to it. */
|
|
4302
|
+
onSubside(objectId) {
|
|
4303
|
+
const b = this.bounds.get(objectId);
|
|
4304
|
+
const state = this.world.state(objectId);
|
|
4305
|
+
if (!b || !state) return;
|
|
4306
|
+
const parts = [];
|
|
4307
|
+
for (const ps of state.parts) {
|
|
4308
|
+
const pv = b.parts.get(ps.id);
|
|
4309
|
+
if (pv && ps.settlement) parts.push([pv, ps.settlement]);
|
|
4310
|
+
}
|
|
4311
|
+
this.settlement.follow(b.soilNode ?? b.root, parts);
|
|
4312
|
+
}
|
|
4070
4313
|
syncTransforms() {
|
|
4071
4314
|
for (const b of this.bounds.values()) this.syncOne(b);
|
|
4072
4315
|
}
|
|
@@ -4217,9 +4460,15 @@ var Renderer = class {
|
|
|
4217
4460
|
case "debris":
|
|
4218
4461
|
this.vfx.burst(ev.kind, ev.point, ev.normal, ev.count, ev.speed > 0 ? ev.speed : DEFAULT_SPEED[ev.kind] ?? 1, this.debrisOptions(ev.kind, ev.object, ev.part, ev.material));
|
|
4219
4462
|
break;
|
|
4220
|
-
case "fracture":
|
|
4463
|
+
case "fracture": {
|
|
4464
|
+
const pv = this.partVis(ev.object, ev.part);
|
|
4465
|
+
if (pv) this.settlement.forget(pv);
|
|
4221
4466
|
this.onFracture(ev);
|
|
4222
4467
|
break;
|
|
4468
|
+
}
|
|
4469
|
+
case "subside":
|
|
4470
|
+
this.onSubside(ev.object);
|
|
4471
|
+
break;
|
|
4223
4472
|
case "detach":
|
|
4224
4473
|
this.onDetach(ev);
|
|
4225
4474
|
break;
|
|
@@ -4229,6 +4478,10 @@ var Renderer = class {
|
|
|
4229
4478
|
case "collapse": {
|
|
4230
4479
|
const root = this.bounds.get(ev.object)?.root;
|
|
4231
4480
|
const furniture = !!root && kitOriginOf(root)?.kind === "furniture";
|
|
4481
|
+
for (const part of ev.parts) {
|
|
4482
|
+
const pv = this.partVis(ev.object, part);
|
|
4483
|
+
if (pv) this.settlement.finish(pv);
|
|
4484
|
+
}
|
|
4232
4485
|
this.splitLoose(ev.object);
|
|
4233
4486
|
if (!furniture || ev.mass >= COLLAPSE_CLOUD_KG) this.playEvent({ kind: "collapse" }, this.rootPoint(ev.object));
|
|
4234
4487
|
else this.vfx.burst("dust", this.rootPoint(ev.object), [0, 1, 0], clamp(Math.round(ev.mass / 4), 4, 24), 0.8);
|
|
@@ -4246,7 +4499,7 @@ var Renderer = class {
|
|
|
4246
4499
|
this.startFire(ev);
|
|
4247
4500
|
this.activate(ev.object, ev.part);
|
|
4248
4501
|
this.sound("ignite", ev.point, 0.7);
|
|
4249
|
-
this.
|
|
4502
|
+
this.startBurnSound(ev.object, ev.part, ev.point, this.burning(ev.object, ev.part));
|
|
4250
4503
|
break;
|
|
4251
4504
|
case "primed":
|
|
4252
4505
|
if (ev.trigger !== "explosion") {
|
|
@@ -4254,7 +4507,7 @@ var Renderer = class {
|
|
|
4254
4507
|
this.primedBurning.add(`${ev.object}|${ev.part}`);
|
|
4255
4508
|
this.activate(ev.object, ev.part);
|
|
4256
4509
|
this.sound("primed", ev.point, 0.7, { seconds: ev.delay });
|
|
4257
|
-
this.
|
|
4510
|
+
if (!this.burnSounds.has(`${ev.object}|${ev.part}`)) this.startBurnSound(ev.object, ev.part, ev.point, { fuel: "gas" });
|
|
4258
4511
|
}
|
|
4259
4512
|
break;
|
|
4260
4513
|
case "spall":
|
|
@@ -4276,20 +4529,20 @@ var Renderer = class {
|
|
|
4276
4529
|
break;
|
|
4277
4530
|
case "extinguish": {
|
|
4278
4531
|
const f = this.fires.get(`${ev.object}|${ev.part}`);
|
|
4279
|
-
|
|
4532
|
+
this.primedBurning.delete(`${ev.object}|${ev.part}`);
|
|
4280
4533
|
if (f) {
|
|
4281
4534
|
this.stopFire(`${ev.object}|${ev.part}`);
|
|
4282
4535
|
this.vfx.burst("steam", f.point, [0, 1, 0], 14, 1.2);
|
|
4283
4536
|
}
|
|
4284
|
-
|
|
4537
|
+
this.endBurnSound(`${ev.object}|${ev.part}`);
|
|
4285
4538
|
this.activate(ev.object, ev.part);
|
|
4286
4539
|
this.sound("extinguish", f?.point ?? this.rootPoint(ev.object), 0.6);
|
|
4287
4540
|
break;
|
|
4288
4541
|
}
|
|
4289
4542
|
case "burnout": {
|
|
4290
4543
|
this.stopFire(`${ev.object}|${ev.part}`);
|
|
4291
|
-
|
|
4292
|
-
this.
|
|
4544
|
+
this.primedBurning.delete(`${ev.object}|${ev.part}`);
|
|
4545
|
+
this.endBurnSound(`${ev.object}|${ev.part}`);
|
|
4293
4546
|
this.vfx.burst("ash", ev.point, [0, 1, 0], 16, 1);
|
|
4294
4547
|
this.vfx.burst("smoke", ev.point, [0, 1, 0], 6, 0.8, { color: SMOKE_TONES.grey });
|
|
4295
4548
|
const pv = this.partVis(ev.object, ev.part);
|
|
@@ -4357,7 +4610,8 @@ var Renderer = class {
|
|
|
4357
4610
|
break;
|
|
4358
4611
|
}
|
|
4359
4612
|
case "explode":
|
|
4360
|
-
|
|
4613
|
+
this.primedBurning.delete(`${ev.object}|${ev.part}`);
|
|
4614
|
+
this.endBurnSound(`${ev.object}|${ev.part}`);
|
|
4361
4615
|
this.onExplode(ev);
|
|
4362
4616
|
break;
|
|
4363
4617
|
case "destroyed":
|
|
@@ -4476,7 +4730,20 @@ var Renderer = class {
|
|
|
4476
4730
|
const pv = b?.parts.get(ev.part);
|
|
4477
4731
|
if (!b || !pv) return;
|
|
4478
4732
|
const def = this.world.materials.get(pv.material);
|
|
4479
|
-
|
|
4733
|
+
const stair = ev.crack.stair;
|
|
4734
|
+
if (stair && !def?.visual?.transparent) {
|
|
4735
|
+
const wp = new this.THREE.Vector3(ev.worldPoint[0], ev.worldPoint[1], ev.worldPoint[2]);
|
|
4736
|
+
const seed = hashNumbers(ev.time, ev.worldPoint[0], ev.worldPoint[1], ev.worldPoint[2]);
|
|
4737
|
+
const width = Math.max(stair.width, MIN_DRAWN_CRACK_WIDTH);
|
|
4738
|
+
const normal = this.worldDir(b, ev.crack.normal);
|
|
4739
|
+
const toward = this.worldDir(b, stair.along);
|
|
4740
|
+
const look = { length: ev.crack.length, step: stair.step, width, color: SETTLEMENT_CRACK_COLOR, seed };
|
|
4741
|
+
for (const face of [wp, wp.clone().addScaledVector(normal, -stair.through)]) {
|
|
4742
|
+
const out = face === wp ? normal : normal.clone().negate();
|
|
4743
|
+
const mv = this.nearestMesh(pv, face);
|
|
4744
|
+
if (mv) this.visuals.addStairCrack(mv, face, out, toward, look);
|
|
4745
|
+
}
|
|
4746
|
+
} else if (def?.visual?.transparent) {
|
|
4480
4747
|
const wp = new this.THREE.Vector3(ev.worldPoint[0], ev.worldPoint[1], ev.worldPoint[2]);
|
|
4481
4748
|
const mv = this.nearestMesh(pv, wp);
|
|
4482
4749
|
const seed = hashNumbers(ev.time, ev.worldPoint[0], ev.worldPoint[1], ev.worldPoint[2]);
|
|
@@ -5046,9 +5313,25 @@ var Renderer = class {
|
|
|
5046
5313
|
}
|
|
5047
5314
|
stopFire(key) {
|
|
5048
5315
|
const fire2 = this.fires.get(key);
|
|
5049
|
-
if (
|
|
5050
|
-
|
|
5051
|
-
|
|
5316
|
+
if (fire2) {
|
|
5317
|
+
if (fire2.handle !== void 0) this.vfx.stop(fire2.handle);
|
|
5318
|
+
this.fires.delete(key);
|
|
5319
|
+
}
|
|
5320
|
+
this.endBurnSound(key);
|
|
5321
|
+
}
|
|
5322
|
+
/** A part's fire loop starts; one already running for the part (it caught again) is ended first, so the host never counts a fire twice. */
|
|
5323
|
+
startBurnSound(object, part, point, detail) {
|
|
5324
|
+
const key = `${object}|${part}`;
|
|
5325
|
+
this.endBurnSound(key);
|
|
5326
|
+
this.burnSounds.set(key, { object, point, detail });
|
|
5327
|
+
this.sound("burn_loop", point, 0.5, detail);
|
|
5328
|
+
}
|
|
5329
|
+
/** The part's fire loop ends, with the point and the fuel it started with; nothing when it has none running. */
|
|
5330
|
+
endBurnSound(key) {
|
|
5331
|
+
const started = this.burnSounds.get(key);
|
|
5332
|
+
if (!started) return;
|
|
5333
|
+
this.burnSounds.delete(key);
|
|
5334
|
+
this.sound("burn_end", started.point, 0.5, started.detail);
|
|
5052
5335
|
}
|
|
5053
5336
|
// ----------------------------------------------------------------------------------------------------------------------------------
|
|
5054
5337
|
// Fire, heat, char, melt, leaks
|
|
@@ -5074,6 +5357,7 @@ var Renderer = class {
|
|
|
5074
5357
|
const ps = pv ? this.world.part(a.object, a.part) : null;
|
|
5075
5358
|
if (!pv || !ps) {
|
|
5076
5359
|
this.active.delete(key);
|
|
5360
|
+
this.stopFire(key);
|
|
5077
5361
|
continue;
|
|
5078
5362
|
}
|
|
5079
5363
|
const def = this.world.materials.get(pv.material);
|
|
@@ -5193,6 +5477,7 @@ var Renderer = class {
|
|
|
5193
5477
|
for (const home of homes) this.restoreHome(home);
|
|
5194
5478
|
for (const [key, a] of [...this.active]) if (homes.has(a.object)) this.active.delete(key);
|
|
5195
5479
|
for (const [key, f] of [...this.fires]) if (homes.has(f.object)) this.stopFire(key);
|
|
5480
|
+
for (const [key, started] of [...this.burnSounds]) if (homes.has(started.object)) this.endBurnSound(key);
|
|
5196
5481
|
for (let i = this.leaks.length - 1; i >= 0; i--) if (homes.has(this.leaks[i].object)) this.leaks.splice(i, 1);
|
|
5197
5482
|
for (const home of homes) {
|
|
5198
5483
|
this.fragments.removeHome(home);
|
|
@@ -5205,6 +5490,7 @@ var Renderer = class {
|
|
|
5205
5490
|
for (const b of [...this.bounds.values()]) {
|
|
5206
5491
|
for (const [pid, pv] of [...b.parts]) {
|
|
5207
5492
|
if (pv.home !== home) continue;
|
|
5493
|
+
this.settlement.forget(pv);
|
|
5208
5494
|
this.visuals.restorePart(pv);
|
|
5209
5495
|
this.tagPart(pv, home);
|
|
5210
5496
|
if (b !== homeBound && homeBound) {
|
|
@@ -5226,8 +5512,10 @@ var Renderer = class {
|
|
|
5226
5512
|
this.slices.length = 0;
|
|
5227
5513
|
this.active.clear();
|
|
5228
5514
|
for (const key of [...this.fires.keys()]) this.stopFire(key);
|
|
5515
|
+
for (const key of [...this.burnSounds.keys()]) this.endBurnSound(key);
|
|
5229
5516
|
this.leaks.length = 0;
|
|
5230
5517
|
this.trickles.length = 0;
|
|
5518
|
+
this.settlement.clear();
|
|
5231
5519
|
for (const id of [...this.bounds.keys()]) if (this.bounds.has(id)) this.restore(id);
|
|
5232
5520
|
for (const b of [...this.bounds.values()]) {
|
|
5233
5521
|
if (b.isSplit) {
|
|
@@ -5865,6 +6153,7 @@ var DESTRUCTION_SOUND_KEYS = {
|
|
|
5865
6153
|
}
|
|
5866
6154
|
};
|
|
5867
6155
|
var DEFAULT_FIRE = { perFire: 0.08, max: 0.45 };
|
|
6156
|
+
var FIRE_FADE_SECONDS = 0.4;
|
|
5868
6157
|
var DEFAULT_CRACKLES = { base: 2, perSqrtFire: 3, max: 14, volume: 0.5 };
|
|
5869
6158
|
var DEFAULT_INDOOR_CONFINEMENT = 1.3;
|
|
5870
6159
|
function createDestructionSound(engine, options = {}) {
|
|
@@ -5886,6 +6175,11 @@ function createDestructionSound(engine, options = {}) {
|
|
|
5886
6175
|
const loops = /* @__PURE__ */ new Map();
|
|
5887
6176
|
const fires = [];
|
|
5888
6177
|
let nextCrackle = 0;
|
|
6178
|
+
const fading = [];
|
|
6179
|
+
const fadeOut = (handle) => {
|
|
6180
|
+
handle.set({ volume: 0 });
|
|
6181
|
+
fading.push({ handle, left: FIRE_FADE_SECONDS });
|
|
6182
|
+
};
|
|
5889
6183
|
const fuelFor = (detail) => detail?.fuel ?? (detail?.material !== void 0 ? fuelOf[detail.material] : void 0) ?? defaultFuel;
|
|
5890
6184
|
const setFire = () => {
|
|
5891
6185
|
if (options.burnLoop === false) return;
|
|
@@ -5896,7 +6190,7 @@ function createDestructionSound(engine, options = {}) {
|
|
|
5896
6190
|
}
|
|
5897
6191
|
for (const [id, handle] of loops) {
|
|
5898
6192
|
if (count.has(id)) continue;
|
|
5899
|
-
handle
|
|
6193
|
+
fadeOut(handle);
|
|
5900
6194
|
loops.delete(id);
|
|
5901
6195
|
}
|
|
5902
6196
|
for (const [id, n] of count) {
|
|
@@ -5923,8 +6217,15 @@ function createDestructionSound(engine, options = {}) {
|
|
|
5923
6217
|
else if (best >= 0) fires.splice(best, 1);
|
|
5924
6218
|
};
|
|
5925
6219
|
const reset = () => {
|
|
6220
|
+
for (const handle of loops.values()) fadeOut(handle);
|
|
6221
|
+
loops.clear();
|
|
6222
|
+
fires.length = 0;
|
|
6223
|
+
};
|
|
6224
|
+
const dispose = () => {
|
|
5926
6225
|
for (const handle of loops.values()) handle.stop();
|
|
5927
6226
|
loops.clear();
|
|
6227
|
+
for (const { handle } of fading) handle.stop();
|
|
6228
|
+
fading.length = 0;
|
|
5928
6229
|
fires.length = 0;
|
|
5929
6230
|
};
|
|
5930
6231
|
const blastSound = (point, volume, detail) => {
|
|
@@ -5971,6 +6272,13 @@ function createDestructionSound(engine, options = {}) {
|
|
|
5971
6272
|
engine.play(sound, { position: point, volume: volume * (rule.volumeScale ?? 1), intensity: Math.min(1, Math.max(0, volume)), ...params ? { params } : {} });
|
|
5972
6273
|
},
|
|
5973
6274
|
update(dt) {
|
|
6275
|
+
for (let i = fading.length - 1; i >= 0; i--) {
|
|
6276
|
+
const entry = fading[i];
|
|
6277
|
+
entry.left -= dt;
|
|
6278
|
+
if (entry.left > 0) continue;
|
|
6279
|
+
entry.handle.stop();
|
|
6280
|
+
fading.splice(i, 1);
|
|
6281
|
+
}
|
|
5974
6282
|
if (!crackles || fires.length === 0 || options.burnLoop === false) return;
|
|
5975
6283
|
const weight = fires.reduce((sum, f) => sum + FIRE_CRACKLE_OF[f.fuel], 0);
|
|
5976
6284
|
if (weight <= 0) return;
|
|
@@ -5996,7 +6304,7 @@ function createDestructionSound(engine, options = {}) {
|
|
|
5996
6304
|
return by;
|
|
5997
6305
|
},
|
|
5998
6306
|
reset,
|
|
5999
|
-
dispose
|
|
6307
|
+
dispose
|
|
6000
6308
|
};
|
|
6001
6309
|
}
|
|
6002
6310
|
|
|
@@ -6058,6 +6366,7 @@ export {
|
|
|
6058
6366
|
DESTRUCTION_SOUND_KEYS,
|
|
6059
6367
|
DRAG_SOUNDS,
|
|
6060
6368
|
EXPLOSION_BOOM,
|
|
6369
|
+
FIRE_FADE_SECONDS,
|
|
6061
6370
|
FIRE_FALLOFF,
|
|
6062
6371
|
FIRE_LOOP,
|
|
6063
6372
|
FIRE_SOUNDS,
|