@adatechnology/game-destruction-three 0.10.0 → 0.11.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/dist/index.d.ts +34 -3
- package/dist/index.global.js +613 -37
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +405 -27
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Vec3, DebrisKind, HitResult, DestructionWorld, MaterialId, DestructibleSpec } from '@adatechnology/game-destruction';
|
|
1
|
+
import { Vec3, DebrisKind, HitResult, DestructionWorld, MaterialId, DestructibleSpec, MaterialDef } from '@adatechnology/game-destruction';
|
|
3
2
|
export { Quat, Vec3 } from '@adatechnology/game-destruction';
|
|
3
|
+
import * as THREE_NS from 'three';
|
|
4
4
|
import { WarmUpProbes, BlastShoveOptions, Vec3 as Vec3$1 } from '@adatechnology/game-contracts';
|
|
5
5
|
import { VfxWorld, SpriteKind } from '@adatechnology/game-vfx';
|
|
6
6
|
import { LoopRecipe, SoundBank, SoundRecipe, AudioEngine } from '@adatechnology/game-audio';
|
|
@@ -121,6 +121,22 @@ interface ExplodeOptions {
|
|
|
121
121
|
*/
|
|
122
122
|
readonly report?: readonly HitResult[];
|
|
123
123
|
}
|
|
124
|
+
/** One box of `DestructionRenderer.solidsNear`. */
|
|
125
|
+
interface SolidBox {
|
|
126
|
+
readonly objectId: string;
|
|
127
|
+
readonly min: Vec3;
|
|
128
|
+
readonly max: Vec3;
|
|
129
|
+
/** The piece the box belongs to; null for a fixed object and a loose body. */
|
|
130
|
+
readonly piece: Piece | null;
|
|
131
|
+
/** A big fragment (a broken board): not a piece, but it lies there and is kicked along. */
|
|
132
|
+
readonly loose?: LooseBody;
|
|
133
|
+
}
|
|
134
|
+
/** A fragment big enough to be walked on (`DestructionRenderer.solidsNear`). */
|
|
135
|
+
interface LooseBody {
|
|
136
|
+
readonly mass: number;
|
|
137
|
+
/** Gives it this speed on the floor (m/s). */
|
|
138
|
+
push(velocityX: number, velocityZ: number): void;
|
|
139
|
+
}
|
|
124
140
|
interface DestructionRenderer {
|
|
125
141
|
/** Attach a world object to its three.js root. */
|
|
126
142
|
bind(objectId: string, root: Object3D, options?: BindOptions): void;
|
|
@@ -131,7 +147,16 @@ interface DestructionRenderer {
|
|
|
131
147
|
velocity?: Vec3;
|
|
132
148
|
}): Piece;
|
|
133
149
|
pieces(): Piece[];
|
|
150
|
+
/** What lies in the disc looks at the ground again (`groundAt` changed under it: a crater, a heap). */
|
|
151
|
+
wakeRegion(x: number, z: number, radius: number): void;
|
|
134
152
|
piece(objectId: string): Piece | null;
|
|
153
|
+
/**
|
|
154
|
+
* World boxes of what is drawn around (x, z) within `radius`: each drawn mesh of a fixed object (meshes wider than 3 m and parts inside a merged
|
|
155
|
+
* mesh are left out: walls, floors, roofs), of every piece and of the big fragments, with the object's id and its piece, if it is one. A turned mesh
|
|
156
|
+
* gives several boxes along its length, so that they follow it instead of its axis box. A walking body uses it to step onto low debris, stop at what is
|
|
157
|
+
* taller and kick what is light.
|
|
158
|
+
*/
|
|
159
|
+
solidsNear(x: number, z: number, radius: number): SolidBox[];
|
|
135
160
|
/** Push a piece (throws, blasts). */
|
|
136
161
|
impulse(objectId: string, impulse: Vec3, point?: Vec3): void;
|
|
137
162
|
/** Integrate fragments, pieces and particles; apply pending visual changes. Call once per frame after `world.update`. */
|
|
@@ -182,6 +207,10 @@ interface SpecFromObjectResult {
|
|
|
182
207
|
parts: Record<string, Object3D[]>;
|
|
183
208
|
}
|
|
184
209
|
|
|
210
|
+
/** Sound key for an impact on a material. */
|
|
211
|
+
declare function impactKey(def: MaterialDef | undefined): string;
|
|
212
|
+
/** Sound key (`drag_*`) of a base of this material dragged on a floor. */
|
|
213
|
+
declare const dragSoundKey: (def: MaterialDef | undefined) => string;
|
|
185
214
|
/** Create the renderer. See `DestructionRenderer`. */
|
|
186
215
|
declare function createDestructionRenderer(THREE: ThreeNamespace, options: RendererOptions): DestructionRenderer;
|
|
187
216
|
|
|
@@ -219,6 +248,8 @@ declare const EXPLOSION_BOOM: SoundRecipe;
|
|
|
219
248
|
* silent there; here `createDestructionSound` raises it while something burns (the level is the kit's, in `fire`).
|
|
220
249
|
*/
|
|
221
250
|
declare const BURN_LOOP: LoopRecipe;
|
|
251
|
+
/** Something heavy dragged on a floor, by what its base is made of. */
|
|
252
|
+
declare const DRAG_SOUNDS: readonly SoundRecipe[];
|
|
222
253
|
declare const DESTRUCTION_SOUND_BANK: SoundBank;
|
|
223
254
|
|
|
224
255
|
/**
|
|
@@ -276,4 +307,4 @@ declare function createDestructionSound(engine: AudioEngine, options?: Destructi
|
|
|
276
307
|
/** Every particle kind the renderer can emit (the game's sprite kinds, see `@adatechnology/game-vfx`). */
|
|
277
308
|
type ParticleKind = SpriteKind;
|
|
278
309
|
|
|
279
|
-
export { BURN_LOOP, type BindOptions, DEFAULT_FIRE, DESTRUCTION_SOUND_BANK, DESTRUCTION_SOUND_KEYS, type DestructionRenderer, type DestructionSound, type DestructionSoundOptions, type DestructionSoundStyle, EXPLOSION_BOOM, type ExplodeOptions, type Mesh, type MeshRange, type Object3D, type PartHint, type ParticleKind, type Piece, type Quality, type RendererOptions, SCENE_SOUNDS, type SoundKeyRule, type SpecFromObjectOptions, type SpecFromObjectResult, type ThreeNamespace, createDestructionRenderer, createDestructionSound, heatColor, specFromObject3D };
|
|
310
|
+
export { BURN_LOOP, type BindOptions, DEFAULT_FIRE, DESTRUCTION_SOUND_BANK, DESTRUCTION_SOUND_KEYS, DRAG_SOUNDS, type DestructionRenderer, type DestructionSound, type DestructionSoundOptions, type DestructionSoundStyle, EXPLOSION_BOOM, type ExplodeOptions, type LooseBody, type Mesh, type MeshRange, type Object3D, type PartHint, type ParticleKind, type Piece, type Quality, type RendererOptions, SCENE_SOUNDS, type SolidBox, type SoundKeyRule, type SpecFromObjectOptions, type SpecFromObjectResult, type ThreeNamespace, createDestructionRenderer, createDestructionSound, dragSoundKey, heatColor, impactKey, specFromObject3D };
|