@adatechnology/game-vehicles-three 0.6.4 → 0.7.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/{chunk-MRUPKE7J.js → chunk-L63R2JQA.js} +542 -29
- package/dist/chunk-L63R2JQA.js.map +1 -0
- package/dist/index.d.ts +148 -5
- package/dist/index.global.js +1334 -255
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +11 -1
- package/dist/{testing-C-BgV7gj.d.ts → testing-DI0_R8dH.d.ts} +4 -5
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +8 -8
- package/dist/chunk-MRUPKE7J.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { E as EngineProfile, V as VehicleSoundKeys, B as BuiltVehicle } from './testing-
|
|
2
|
-
export { a as BIKE_ENGINE, b as BuildVehicleOptions, C as CAR_ENGINE, c as CRASH_SPEEDS, D as DEFAULT_TEST_VEHICLES, d as DEFAULT_TEST_WRECKS, e as DEFAULT_VEHICLE_SOUND_KEYS, f as DocumentLike, g as ENGINE_PROFILES, h as EffectsLike, i as EngineLayer, j as EngineLoadLayer, F as FleetDims, M as ModuleRoomLike, P as PAGE_ITEM_ALIASES, k as PAGE_SCENARIO_ALIASES, l as PROVING_AREA_ID, m as PROVING_TEXT, n as ProvingModuleOptions, o as ProvingRoomLike, p as ProvingText, T as TRUCK_ENGINE, q as VEHICLES_AREA_ID, r as VEHICLE_SCENARIO_IDS, s as VehicleEffectIds, t as VehicleFleetContent, u as VehicleQuality, v as VehicleSoundIds, w as VehicleWreck, x as VehiclesContext, y as VehiclesRoom, z as VehiclesTestFleet, A as VehiclesTestOptions, G as VehiclesThree, H as VehiclesThreeOptions, I as createProvingModule, J as createVehiclesTestModule, K as createVehiclesThree, L as defaultEffectIds, N as defaultSoundIds, O as loadProvingModule, Q as loadVehiclesTestModule } from './testing-
|
|
3
|
-
import { EffectSink, Vec3, AudioSink } from '@adatechnology/game-contracts';
|
|
1
|
+
import { E as EngineProfile, V as VehicleSoundKeys, B as BuiltVehicle } from './testing-DI0_R8dH.js';
|
|
2
|
+
export { a as BIKE_ENGINE, b as BuildVehicleOptions, C as CAR_ENGINE, c as CRASH_SPEEDS, D as DEFAULT_TEST_VEHICLES, d as DEFAULT_TEST_WRECKS, e as DEFAULT_VEHICLE_SOUND_KEYS, f as DocumentLike, g as ENGINE_PROFILES, h as EffectsLike, i as EngineLayer, j as EngineLoadLayer, F as FleetDims, M as ModuleRoomLike, P as PAGE_ITEM_ALIASES, k as PAGE_SCENARIO_ALIASES, l as PROVING_AREA_ID, m as PROVING_TEXT, n as ProvingModuleOptions, o as ProvingRoomLike, p as ProvingText, T as TRUCK_ENGINE, q as VEHICLES_AREA_ID, r as VEHICLE_SCENARIO_IDS, s as VehicleEffectIds, t as VehicleFleetContent, u as VehicleQuality, v as VehicleSoundIds, w as VehicleWreck, x as VehiclesContext, y as VehiclesRoom, z as VehiclesTestFleet, A as VehiclesTestOptions, G as VehiclesThree, H as VehiclesThreeOptions, I as createProvingModule, J as createVehiclesTestModule, K as createVehiclesThree, L as defaultEffectIds, N as defaultSoundIds, O as loadProvingModule, Q as loadVehiclesTestModule } from './testing-DI0_R8dH.js';
|
|
3
|
+
import { EffectSink, Vec3, AudioSink, AnimationClipSpec } from '@adatechnology/game-contracts';
|
|
4
4
|
import { CabinSource } from '@adatechnology/game-vehicles';
|
|
5
|
-
import { LoopRecipe, Falloff, SoundRecipe, SoundBank } from '@adatechnology/game-audio';
|
|
5
|
+
import { LoopRecipe, Falloff, SampleAlias, SoundRecipe, SoundBank } from '@adatechnology/game-audio';
|
|
6
6
|
import { Object3D, CanvasTexture, CircleGeometry, MeshBasicMaterial, Mesh, Vector3 } from 'three';
|
|
7
7
|
import '@adatechnology/game-vehicles-proving';
|
|
8
8
|
|
|
@@ -33,6 +33,34 @@ declare const VEHICLE_LOOP_FALLOFF: Falloff;
|
|
|
33
33
|
declare const VEHICLE_LOOPS: readonly LoopRecipe[];
|
|
34
34
|
/** The one-shots: the starter, the engine stopping, crashes by speed, and the doors, trunk and hood of a car. */
|
|
35
35
|
declare const VEHICLE_SOUNDS: readonly SoundRecipe[];
|
|
36
|
+
/**
|
|
37
|
+
* The RPM each car recording runs at, measured on the files (the crank turning at 16.7 and 42 Hz, the firing at four times that: a V8). A layer
|
|
38
|
+
* plays its file at `rpm / recorded rpm`.
|
|
39
|
+
*/
|
|
40
|
+
declare const CAR_RECORDED_RPM: {
|
|
41
|
+
readonly idle: 1000;
|
|
42
|
+
readonly high: 2520;
|
|
43
|
+
};
|
|
44
|
+
/** Where the start and the stop sit in the recording of a car starting, running and stopping (`engine_start_run_stop`), in seconds. */
|
|
45
|
+
declare const CAR_START_RUN_STOP: {
|
|
46
|
+
/** The starter and the engine catching (at 0.58 s) and flaring; the loops take over at the crank time of the vehicle. */
|
|
47
|
+
readonly start: {
|
|
48
|
+
readonly offset: 0;
|
|
49
|
+
readonly duration: 1.3;
|
|
50
|
+
};
|
|
51
|
+
/** The ignition off: the engine running down to the end of the file. */
|
|
52
|
+
readonly stop: {
|
|
53
|
+
readonly offset: 9.96;
|
|
54
|
+
readonly duration: 0.64;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* The vehicle ids answered by the recordings of the kit's manifest (files kept by the game, never in the SDK): the car engine layers by RPM, the
|
|
59
|
+
* start and the stop cut out of one recording, the door and the trunk. Each recipe above stays as the fallback while the files load or where the
|
|
60
|
+
* game has none. `car_door_open` is a file id of its own and needs no alias; the hood, the truck, the bike, the tyres, crashes and horns have no
|
|
61
|
+
* recording yet.
|
|
62
|
+
*/
|
|
63
|
+
declare const VEHICLE_SAMPLE_ALIASES: readonly SampleAlias[];
|
|
36
64
|
declare const VEHICLE_SOUND_BANK: SoundBank;
|
|
37
65
|
|
|
38
66
|
/** What one engine loop is set to this frame. `frequency` is absent for the load layer (noise has no pitch). */
|
|
@@ -259,6 +287,112 @@ declare function createVehicleLamps(THREE: {
|
|
|
259
287
|
owner?: string;
|
|
260
288
|
}): VehicleLamps;
|
|
261
289
|
|
|
290
|
+
/**
|
|
291
|
+
* The openings of a built vehicle worked by hand: each door, the hood and the trunk lid swing on the hinges the vehicle destructible draws (their open
|
|
292
|
+
* pose is the one of its `open_*` clips, so the door takes its skin, glass and trim with it), each side window slides down into its door, a sunroof
|
|
293
|
+
* slides back when the model has one, the wiper blades sweep, and the central locking keeps the doors and the lid shut. It moves only what the kit
|
|
294
|
+
* drew and puts every part back on `dispose`.
|
|
295
|
+
*/
|
|
296
|
+
|
|
297
|
+
type Vec$1 = {
|
|
298
|
+
x: number;
|
|
299
|
+
y: number;
|
|
300
|
+
z: number;
|
|
301
|
+
copy(v: Vec$1): Vec$1;
|
|
302
|
+
clone(): Vec$1;
|
|
303
|
+
sub(v: Vec$1): Vec$1;
|
|
304
|
+
add(v: Vec$1): Vec$1;
|
|
305
|
+
applyQuaternion(q: Quat$1): Vec$1;
|
|
306
|
+
};
|
|
307
|
+
type Quat$1 = {
|
|
308
|
+
copy(q: Quat$1): Quat$1;
|
|
309
|
+
clone(): Quat$1;
|
|
310
|
+
setFromAxisAngle(axis: Vec$1, angle: number): Quat$1;
|
|
311
|
+
multiply(q: Quat$1): Quat$1;
|
|
312
|
+
};
|
|
313
|
+
/** What the body needs of three.js: vectors and quaternions to turn a wiper about its spindle. */
|
|
314
|
+
type BodyThree = {
|
|
315
|
+
Vector3: new (x?: number, y?: number, z?: number) => Vec$1;
|
|
316
|
+
Quaternion: new () => Quat$1;
|
|
317
|
+
};
|
|
318
|
+
/** A side window by where it sits: `front_left`, `rear_right`... */
|
|
319
|
+
type WindowId = `${'front' | 'rear'}_${'left' | 'right'}`;
|
|
320
|
+
type BodyEvent = {
|
|
321
|
+
type: 'sound';
|
|
322
|
+
key: string;
|
|
323
|
+
part: string;
|
|
324
|
+
} | {
|
|
325
|
+
type: 'refused';
|
|
326
|
+
part: string;
|
|
327
|
+
reason: 'locked' | 'missing';
|
|
328
|
+
};
|
|
329
|
+
interface VehicleBodyOptions {
|
|
330
|
+
THREE: BodyThree;
|
|
331
|
+
/** The open and close clips of the vehicle destructible (`animations()`): the open pose of each door, the hood and the lid. */
|
|
332
|
+
clips: readonly AnimationClipSpec[];
|
|
333
|
+
/** Seconds a door, the hood or the lid takes to open. Default 1.2 (the clips'). */
|
|
334
|
+
swingSeconds?: number;
|
|
335
|
+
/** Seconds a window takes from shut to open. Default 3.5. */
|
|
336
|
+
windowSeconds?: number;
|
|
337
|
+
/** Share of the pane's height that goes into the door. Default 0.92 (the top edge stays in the seal). */
|
|
338
|
+
windowTravel?: number;
|
|
339
|
+
}
|
|
340
|
+
interface VehicleBody {
|
|
341
|
+
/** Part ids the body can open: `door_front_left`..., `hood`, `lid`. */
|
|
342
|
+
readonly parts: readonly string[];
|
|
343
|
+
readonly windows: readonly WindowId[];
|
|
344
|
+
readonly hasSunroof: boolean;
|
|
345
|
+
readonly wipers: number;
|
|
346
|
+
readonly locked: boolean;
|
|
347
|
+
/** 0 shut to 1 open. */
|
|
348
|
+
openness(part: string): number;
|
|
349
|
+
/** Opens a shut part or shuts an open one. Locked doors and lid refuse. */
|
|
350
|
+
toggle(part: string): BodyEvent[];
|
|
351
|
+
/** Window opening, 0 shut to 1 down. */
|
|
352
|
+
window(id: WindowId): number;
|
|
353
|
+
toggleWindow(id: WindowId): void;
|
|
354
|
+
setWindow(id: WindowId, open: number): void;
|
|
355
|
+
toggleSunroof(): void;
|
|
356
|
+
/** Locks or unlocks the doors and the lid (the key or the remote). */
|
|
357
|
+
lock(locked: boolean): BodyEvent[];
|
|
358
|
+
/** Advances the moving parts; `wipe` is the wipers' sweeps per second (0 parked). */
|
|
359
|
+
update(dt: number, wipe?: number): BodyEvent[];
|
|
360
|
+
dispose(): void;
|
|
361
|
+
}
|
|
362
|
+
declare function createVehicleBody(built: BuiltVehicle, options: VehicleBodyOptions): VehicleBody;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* The wheels of a built vehicle turning as it moves: each wheel the kit drew (`context.wheels`) rolls about its axle by the distance travelled over
|
|
366
|
+
* its radius, and the front ones turn with the steering. The turn is applied over the wheel's own rest pose, so a mirrored or tilted wheel rolls the
|
|
367
|
+
* right way, and `dispose` puts every wheel back exactly as it was drawn.
|
|
368
|
+
*/
|
|
369
|
+
|
|
370
|
+
type Vec = {
|
|
371
|
+
x: number;
|
|
372
|
+
y: number;
|
|
373
|
+
z: number;
|
|
374
|
+
};
|
|
375
|
+
type Quat = {
|
|
376
|
+
copy(q: Quat): Quat;
|
|
377
|
+
clone(): Quat;
|
|
378
|
+
setFromAxisAngle(axis: Vec, angle: number): Quat;
|
|
379
|
+
multiply(q: Quat): Quat;
|
|
380
|
+
premultiply(q: Quat): Quat;
|
|
381
|
+
};
|
|
382
|
+
/** What the wheels need of three.js. */
|
|
383
|
+
type WheelRollThree = {
|
|
384
|
+
Vector3: new (x?: number, y?: number, z?: number) => Vec;
|
|
385
|
+
Quaternion: new () => Quat;
|
|
386
|
+
};
|
|
387
|
+
interface WheelRoll {
|
|
388
|
+
/** Wheels found on the vehicle. */
|
|
389
|
+
readonly count: number;
|
|
390
|
+
/** The vehicle went `distance` metres forward (negative backwards) with the front wheels steered `steer` radians (positive to the left). */
|
|
391
|
+
roll(distance: number, steer: number): void;
|
|
392
|
+
dispose(): void;
|
|
393
|
+
}
|
|
394
|
+
declare function createWheelRoll(THREE: WheelRollThree, built: BuiltVehicle): WheelRoll;
|
|
395
|
+
|
|
262
396
|
/** What the cluster shows this instant. */
|
|
263
397
|
type DashboardReading = {
|
|
264
398
|
kmh: number;
|
|
@@ -279,6 +413,15 @@ type DashboardReading = {
|
|
|
279
413
|
temperature?: number;
|
|
280
414
|
/** Fuel, 0 (empty) to 1 (full); leave out while the vehicle has no fuel model. */
|
|
281
415
|
fuel?: number;
|
|
416
|
+
/** Cruise control holding a speed. */
|
|
417
|
+
cruise?: boolean;
|
|
418
|
+
/** Drive profile shown by its letter (E economy, S sport; nothing for normal). */
|
|
419
|
+
profile?: 'eco' | 'normal' | 'sport';
|
|
420
|
+
/** The aids switched off light their amber lamps. */
|
|
421
|
+
tractionOff?: boolean;
|
|
422
|
+
absOff?: boolean;
|
|
423
|
+
/** The alternator does not keep up (the battery drains with the engine running). */
|
|
424
|
+
charging?: boolean;
|
|
282
425
|
};
|
|
283
426
|
/** The scale of the dials and how often the faces are redrawn. */
|
|
284
427
|
type DashboardOptions = {
|
|
@@ -331,4 +474,4 @@ declare const DASHBOARD_LOOK: {
|
|
|
331
474
|
};
|
|
332
475
|
declare function createVehicleDashboard(THREE: ThreeLib, built: BuiltVehicle, options: DashboardOptions): VehicleDashboard;
|
|
333
476
|
|
|
334
|
-
export { BuiltVehicle, type CabinSmoke, DASHBOARD_LOOK, type DashboardOptions, type DashboardReading, type EngineLayerSetting, type EngineMixInput, EngineProfile, LAMP_RULES, LITE_CLASSES, type LampSwitch, type LiteClass, type LiteFusion, PRUNE_BELOW, VEHICLE_LOD_DISTANCE, VEHICLE_LOOPS, VEHICLE_LOOP_FALLOFF, VEHICLE_SOUNDS, VEHICLE_SOUND_BANK, type VehicleDashboard, type VehicleLamps, type VehicleLod, type VehicleSound, type VehicleSoundFrame, VehicleSoundKeys, type VehicleSoundOptions, type VehicleSoundReading, classColor, classify, createCabinSmoke, createGearGuess, createVehicleDashboard, createVehicleLamps, createVehicleLod, createVehicleSound, engineMix, firingHz, fuse, layerWeight, liteMaterials, liteMeshes, rpmShare };
|
|
477
|
+
export { type BodyEvent, type BodyThree, BuiltVehicle, CAR_RECORDED_RPM, CAR_START_RUN_STOP, type CabinSmoke, DASHBOARD_LOOK, type DashboardOptions, type DashboardReading, type EngineLayerSetting, type EngineMixInput, EngineProfile, LAMP_RULES, LITE_CLASSES, type LampSwitch, type LiteClass, type LiteFusion, PRUNE_BELOW, VEHICLE_LOD_DISTANCE, VEHICLE_LOOPS, VEHICLE_LOOP_FALLOFF, VEHICLE_SAMPLE_ALIASES, VEHICLE_SOUNDS, VEHICLE_SOUND_BANK, type VehicleBody, type VehicleBodyOptions, type VehicleDashboard, type VehicleLamps, type VehicleLod, type VehicleSound, type VehicleSoundFrame, VehicleSoundKeys, type VehicleSoundOptions, type VehicleSoundReading, type WheelRoll, type WheelRollThree, type WindowId, classColor, classify, createCabinSmoke, createGearGuess, createVehicleBody, createVehicleDashboard, createVehicleLamps, createVehicleLod, createVehicleSound, createWheelRoll, engineMix, firingHz, fuse, layerWeight, liteMaterials, liteMeshes, rpmShare };
|