@adatechnology/game-destruction-three 0.29.3 → 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 CHANGED
@@ -1,6 +1,6 @@
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
6
  import { Quat, WorkBudgetOptions, PhysicsLoop, SeamWorld, PhysicsEngine, WorldDesc, BlastQuery, BodyId } from '@adatechnology/game-physics';
@@ -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`), or `'own'` (the kit's own solver, until it goes).
278
+ * and steps it in its `update`).
279
279
  */
280
- type PiecePhysics = PhysicsLoop | SeamWorld | 'own';
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, the kit's own solver), and the numbers of the throwaway world. */
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 (and once for the kit's own solver): a second call is a
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;
@@ -437,7 +437,7 @@ interface RendererOptions {
437
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,
438
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
439
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)
440
- * to heat the engine's own paths too; without it the kit's own solver and the code the engines share are what runs.
440
+ * to heat the engine's own paths too; without it there is no warm-up.
441
441
  */
442
442
  jitWarmUp?: boolean | JitWarmUpOptions;
443
443
  /** Upper bound of live particles (default 2500). */
@@ -450,13 +450,13 @@ interface RendererOptions {
450
450
  /** Ground height at (x, z) for fragments, pieces and drips (default 0). */
451
451
  groundAt?: (x: number, z: number) => number;
452
452
  /**
453
- * The terrain alone at (x, z): soil, lot, street, crater; never the top of a table or the floor of a house. With an engine (`physics` other than `'own'`) the ground it 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`; the kit's own solver ignores it.
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`.
455
455
  */
456
456
  terrainAt?: (x: number, z: number) => number;
457
457
  /**
458
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
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, the same in both solvers; only where a round
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
460
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.
461
461
  */
462
462
  terrainRollingAt?: (x: number, z: number) => number | undefined;
@@ -686,6 +686,11 @@ interface DestructionRenderer {
686
686
  * taller and kick what is light.
687
687
  */
688
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;
689
694
  /** Push a piece (throws, blasts). */
690
695
  impulse(objectId: string, impulse: Vec3, point?: Vec3): void;
691
696
  /** Integrate fragments, pieces and particles; apply pending visual changes. Call once per frame after `world.update`. */