@adatechnology/game-destruction-three 0.29.2 → 1.0.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 +18 -11
- package/dist/index.global.js +139 -938
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +139 -938
- package/dist/index.js.map +1 -1
- package/package.json +5 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Vec3, Fragment, DebrisKind, HitResult, DestructionWorld, MaterialId, DestructibleSpec, MaterialDef, DestructionEvent, BlastOptions, DamageType } from '@adatechnology/game-destruction';
|
|
2
2
|
export { Quat, Vec3 } from '@adatechnology/game-destruction';
|
|
3
|
-
import { WorkerCoordinator, KitOrigin, DeferredQueue, DeferredQueueOptions, WarmUpProbes, BlastShoveOptions, TaskKind, Vec3 as Vec3$1 } from '@adatechnology/game-contracts';
|
|
3
|
+
import { WorkerCoordinator, KitOrigin, HostSolid, DeferredQueue, DeferredQueueOptions, WarmUpProbes, BlastShoveOptions, TaskKind, Vec3 as Vec3$1 } from '@adatechnology/game-contracts';
|
|
4
4
|
import { HeightPatch } from '@adatechnology/game-terrain';
|
|
5
5
|
import { WorkerLike, WorkerScopeLike } from '@adatechnology/game-shapes';
|
|
6
|
-
import
|
|
7
|
-
import { Quat, WorkBudgetOptions, PhysicsLoop, SeamWorld, PhysicsEngine, WorldDesc, BlastQuery } from '@adatechnology/game-physics';
|
|
6
|
+
import { Quat, WorkBudgetOptions, PhysicsLoop, SeamWorld, PhysicsEngine, WorldDesc, BlastQuery, BodyId } from '@adatechnology/game-physics';
|
|
8
7
|
export { DEFAULT_WORK_BUDGET_MS, isPhysicsLoop, physicsPieceCount } from '@adatechnology/game-physics';
|
|
8
|
+
import * as THREE_NS from 'three';
|
|
9
9
|
import { VfxWorld, SpriteKind } from '@adatechnology/game-vfx';
|
|
10
10
|
import { LoopRecipe, SoundBank, SoundRecipe, Falloff, AudioEngine, VoiceGroup, SampleDefaults, SfxManifest } from '@adatechnology/game-audio';
|
|
11
11
|
|
|
@@ -275,9 +275,9 @@ declare const splitWorkUnits: (costs: Required<WorkUnitCosts>, size: {
|
|
|
275
275
|
|
|
276
276
|
/**
|
|
277
277
|
* The physics a seam is handed, always by its host and always spelled out: a `PhysicsLoop` (the host steps it; the seam registers phases), a world (the seam makes its own loop
|
|
278
|
-
* and steps it in its `update`)
|
|
278
|
+
* and steps it in its `update`).
|
|
279
279
|
*/
|
|
280
|
-
type PiecePhysics = PhysicsLoop | SeamWorld
|
|
280
|
+
type PiecePhysics = PhysicsLoop | SeamWorld;
|
|
281
281
|
declare class PhysicsOptionError extends Error {
|
|
282
282
|
readonly code = "PHYSICS_OPTION";
|
|
283
283
|
constructor(message: string);
|
|
@@ -310,7 +310,7 @@ declare const SETTLED_BATCH_DEFAULTS: Required<SettledBatchOptions>;
|
|
|
310
310
|
/** Where the batches come from when their meshes do not all come from one piece of the kit. */
|
|
311
311
|
declare const SETTLED_BATCH_ORIGIN: KitOrigin;
|
|
312
312
|
|
|
313
|
-
/** What the warm-up runs on: the engine whose body creation, compounds and ground it heats (without one
|
|
313
|
+
/** What the warm-up runs on: the engine whose body creation, compounds and ground it heats (without one there is nothing to warm), and the numbers of the throwaway world. */
|
|
314
314
|
interface JitWarmUpOptions {
|
|
315
315
|
readonly engine?: PhysicsEngine;
|
|
316
316
|
/** The world the engine makes for the warm-up (default `KIT_WORLD`: the same code runs as in the game's world). */
|
|
@@ -322,7 +322,7 @@ interface JitWarmUpReport {
|
|
|
322
322
|
readonly fragments: number;
|
|
323
323
|
}
|
|
324
324
|
/**
|
|
325
|
-
* Runs the first explosion once, off screen, so the code it needs is warm when the real one comes. Once per engine
|
|
325
|
+
* Runs the first explosion once, off screen, so the code it needs is warm when the real one comes. Once per engine: a second call, or a call with no engine, is a
|
|
326
326
|
* no-op (`undefined`). `makeRenderer` is the renderer factory of the package, so the throwaway renderer is the real one.
|
|
327
327
|
*/
|
|
328
328
|
declare const warmUpDestructionJit: (THREE: ThreeNamespace, makeRenderer: (options: RendererOptions) => DestructionRenderer, options?: JitWarmUpOptions) => JitWarmUpReport | undefined;
|
|
@@ -408,6 +408,8 @@ interface RendererOptions {
|
|
|
408
408
|
* all of them, so a piece 23 m across and mostly air gets the tiles (and the solid under each) it touches, not 70. Default off: the same tiles as before (T3.8v).
|
|
409
409
|
*/
|
|
410
410
|
tilesUnderParts?: boolean;
|
|
411
|
+
/** With an engine: the body a piece in a hand passes through (the holder's own), so a carried thing wider than the arm's reach does not shove the holder. */
|
|
412
|
+
heldIgnores?: () => BodyId | undefined;
|
|
411
413
|
/**
|
|
412
414
|
* Fit the boxes a part drawn by a range of a merged mesh gets when it comes loose (`fitOrientedBoxes`) ahead of the blow, a part at a time with the time a frame has left, so the frame
|
|
413
415
|
* that splits a house reads them instead of fitting them. They are fitted in the space of the part's own vertices and carried to where the part is by its pose (a turn and a
|
|
@@ -435,7 +437,7 @@ interface RendererOptions {
|
|
|
435
437
|
* Run one explosion on a small throwaway wall once, when the first renderer is made, so the code the first real explosion needs (fracture, split, oriented boxes, engine bodies,
|
|
436
438
|
* the ground under the pieces) is not cold: the first one costs about twice the later ones without it. Off screen, in a world and a renderer of its own, all freed; the game's
|
|
437
439
|
* state and random streams are not touched. Default on, once per process and engine; `false` turns it off. Give `{ engine }` (the `PhysicsEngine` the host made its world from)
|
|
438
|
-
* to heat the engine's own paths too; without it
|
|
440
|
+
* to heat the engine's own paths too; without it there is no warm-up.
|
|
439
441
|
*/
|
|
440
442
|
jitWarmUp?: boolean | JitWarmUpOptions;
|
|
441
443
|
/** Upper bound of live particles (default 2500). */
|
|
@@ -448,13 +450,13 @@ interface RendererOptions {
|
|
|
448
450
|
/** Ground height at (x, z) for fragments, pieces and drips (default 0). */
|
|
449
451
|
groundAt?: (x: number, z: number) => number;
|
|
450
452
|
/**
|
|
451
|
-
* The terrain alone at (x, z): soil, lot, street, crater; never the top of a table or the floor of a house.
|
|
452
|
-
* on is this, because every drawn fixed thing is a body of its own there (`staticSolids`) and a top in both would be ground twice. Default `groundAt
|
|
453
|
+
* The terrain alone at (x, z): soil, lot, street, crater; never the top of a table or the floor of a house. The ground the engine stands the pieces
|
|
454
|
+
* on is this, because every drawn fixed thing is a body of its own there (`staticSolids`) and a top in both would be ground twice. Default `groundAt`.
|
|
453
455
|
*/
|
|
454
456
|
terrainAt?: (x: number, z: number) => number;
|
|
455
457
|
/**
|
|
456
458
|
* The rolling resistance (C_rr) of the terrain's surface at (x, z), from its material (`TerrainMaterial.rolling`: grass, soil and sand hold a rolling can or rod back far
|
|
457
|
-
* more than asphalt), or undefined for the default (0.015, a hard floor). Read at the middle of the 2 m tile the point is in
|
|
459
|
+
* more than asphalt), or undefined for the default (0.015, a hard floor). Read at the middle of the 2 m tile the point is in; only where a round
|
|
458
460
|
* piece stands on the terrain itself (not on a top, a fixed thing or another piece). A round piece rolls by the larger of its own and this one.
|
|
459
461
|
*/
|
|
460
462
|
terrainRollingAt?: (x: number, z: number) => number | undefined;
|
|
@@ -684,6 +686,11 @@ interface DestructionRenderer {
|
|
|
684
686
|
* taller and kick what is light.
|
|
685
687
|
*/
|
|
686
688
|
solidsNear(x: number, z: number, radius: number): SolidBox[];
|
|
689
|
+
/**
|
|
690
|
+
* Gives the physics engine fixed bodies of a module that has no bound object (a house's walls): the boxes as `source` says them, asked every update, under the name `id`. Null takes
|
|
691
|
+
* them away. A world with no engine ignores them.
|
|
692
|
+
*/
|
|
693
|
+
setHostSolids(id: string, source: (() => readonly HostSolid[]) | null): void;
|
|
687
694
|
/** Push a piece (throws, blasts). */
|
|
688
695
|
impulse(objectId: string, impulse: Vec3, point?: Vec3): void;
|
|
689
696
|
/** Integrate fragments, pieces and particles; apply pending visual changes. Call once per frame after `world.update`. */
|