@bendyline/molen-client 0.0.9 → 0.0.11

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/README.md CHANGED
@@ -67,6 +67,7 @@ probe — a pinned backend is what makes a captured frame reproducible.
67
67
  | `./vite` | `molenScripts()` — a Vite plugin that type-strips `*.ts?raw` scene scripts so the browser never sees TypeScript |
68
68
  | `./vehicles` | `createVehicleVisual`, `createParkedVehicleBatch`, `vehicleCameraPose` — car visuals and cockpit/chase views, the render half of `@bendyline/molen-kernel/vehicles` |
69
69
  | `./aircraft` | `createAircraftVisual`, `aircraftCameraPose` — animated airframe and instrumented cockpit, the render half of `@bendyline/molen-kernel/aircraft` |
70
+ | `./instruments` | Named signal expressions and reusable wiring for calibrated dials, altimeters, attitude indicators, annunciators and seven-segment readouts; geometry stays in each model |
70
71
  | `./navigation` | `OrbitController`, `FlyController`, `WalkController` + `WalkCollision`, `FollowController`, `NavigationInputSource` (keys, gamepad, pointer gestures) and `createTouchJoystick` — camera navigation for `createViewer` hosts |
71
72
  | `./markers` | `createMarkerLayer`, `composeMarkerImage`, `projectWorldToScreen` — screen-sized, ground-snapped, pickable world markers such as photo pins |
72
73
  | `./audio` | `createAudioLayer`, `AudioDirector`, `WebAudioBackend`, `loadPackSoundbanks`, `attachAutoplayUnlock` — plays sound banks and a scene's `audioEnvironment`/`audioSource`/`audioZone` rules and `molen.audio.*` events; three-free at runtime, so the director also runs in Node |
@@ -1,15 +1,124 @@
1
- import { n as ModelSignals, t as ModelSignalVisual } from "./model-signals-DVlLyP-w.mjs";
2
- import { a as VehicleCameraPose, i as VehicleCameraOptions, n as VehicleInteriorVisual } from "./vehicle-interior-GWcXnvXS.mjs";
3
- import { AircraftInputData, AircraftSpec, AircraftStateData } from "@bendyline/molen-schema";
1
+ import { n as ModelSignals, t as ModelSignalVisual } from "./model-signals-BpeXhsim.mjs";
2
+ import { a as VehicleCameraPose, i as VehicleCameraOptions, n as VehicleInteriorVisual } from "./vehicle-interior-BgcC750p.mjs";
3
+ import { AircraftCollisionProbe, AircraftContact, AircraftInputData, AircraftSpec, AircraftStateData, LiveryData, VehicleSpec } from "@bendyline/molen-schema";
4
4
  import * as THREE from "three";
5
5
 
6
+ //#region src/aircraft-controls.d.ts
7
+ type AircraftControlAction = "power" | "mixture" | "propeller" | "stick" | "yaw" | "gear" | "flaps" | "engine" | "brake" | "thrustVector";
8
+ interface AircraftCockpitControl {
9
+ id: string;
10
+ label: string;
11
+ action: AircraftControlAction;
12
+ /** Omitted for the common throttle or engine master. */
13
+ engine?: string;
14
+ /** Named physical controls; an empty array indicates an unmodeled control. */
15
+ nodes: string[];
16
+ }
17
+ /** glTF node extras for authored cockpit controls. Motion is relative to the exported rest pose. */
18
+ interface AircraftControlNode {
19
+ action: AircraftControlAction;
20
+ engine?: string;
21
+ motion?: {
22
+ property: "position" | "rotation";
23
+ axis: "x" | "y" | "z";
24
+ scale: number;
25
+ offset?: number;
26
+ };
27
+ }
28
+ interface AircraftControlChange {
29
+ control: AircraftCockpitControl;
30
+ value: number;
31
+ /** Pitch for a two-axis stick; value is roll. */
32
+ pitch?: number;
33
+ }
34
+ interface AircraftCockpit {
35
+ controls: readonly AircraftCockpitControl[];
36
+ /** Adapted interior bindings give each physical throttle its own engine signal. */
37
+ interior: AircraftSpec["visual"]["interior"];
38
+ pick(ray: THREE.Ray): AircraftCockpitControl | undefined;
39
+ }
40
+ /** Discover moving controls from their authored input bindings, never from instrument needles. */
41
+ declare function createAircraftCockpit(model: THREE.Object3D, spec: AircraftSpec): AircraftCockpit;
42
+ declare function aircraftControlValue(input: AircraftInputData, control: AircraftCockpitControl): number;
43
+ /** Immutable pilot input update; hosts still submit it through flyAircraft's seat/authority checks. */
44
+ declare function applyAircraftControl(input: AircraftInputData, change: AircraftControlChange, spec: AircraftSpec, state?: AircraftStateData): AircraftInputData;
45
+ /** Transient pointer axes are mixed with keyboard/gamepad axes without latching after release. */
46
+ declare class AircraftPointerAxes {
47
+ pitch: number;
48
+ roll: number;
49
+ yaw: number;
50
+ set(change: AircraftControlChange): void;
51
+ clear(): void;
52
+ }
53
+ //#endregion
54
+ //#region src/aircraft-cockpit-pointer.d.ts
55
+ interface AircraftCockpitSession {
56
+ id: string;
57
+ cockpit: AircraftCockpit;
58
+ spec: AircraftSpec;
59
+ input: AircraftInputData;
60
+ state?: AircraftStateData;
61
+ change(change: AircraftControlChange): void;
62
+ /** Release spring-loaded stick/pedal input on blur, exit or pointer cancellation. */
63
+ release(): void;
64
+ }
65
+ interface AircraftCockpitPointer {
66
+ /** Call every frame; also hides the panel and cancels input when the pilot leaves. */
67
+ update(): void;
68
+ dispose(): void;
69
+ }
70
+ /** Capture only actual cockpit-control hits; ordinary canvas drags remain camera gestures. */
71
+ interface AircraftCockpitPointerOptions {
72
+ element: HTMLElement;
73
+ camera: THREE.Camera;
74
+ session(): AircraftCockpitSession | undefined;
75
+ /** Optional host for the accessible companion controls. Defaults to the canvas parent. */
76
+ container?: HTMLElement;
77
+ /** Show optional HTML controls for accessibility or models with incomplete cockpit geometry. */
78
+ companionPanel?: boolean;
79
+ }
80
+ declare function bindAircraftCockpitPointer(options: AircraftCockpitPointerOptions): AircraftCockpitPointer;
81
+ //#endregion
82
+ //#region src/aircraft-collision.d.ts
83
+ interface AircraftObstacleScene {
84
+ /** Collision tree origin and query, e.g. WalkCollision. */
85
+ origin: THREE.Vector3;
86
+ octree: {
87
+ sphereIntersect(sphere: THREE.Sphere): false | {
88
+ normal: THREE.Vector3;
89
+ depth: number;
90
+ };
91
+ getSphereTriangles?(sphere: THREE.Sphere, triangles: THREE.Triangle[]): unknown;
92
+ };
93
+ cars: ReadonlyArray<{
94
+ transform: {
95
+ pos: [number, number, number];
96
+ rot: [number, number, number, number];
97
+ };
98
+ spec: VehicleSpec;
99
+ }>;
100
+ /** Other aircraft body centers. The host excludes the queried aircraft. */
101
+ aircraft: ReadonlyArray<[number, number, number]>;
102
+ }
103
+ /** Contact normals from streamed geometry and nearby parked vehicles, in absolute coordinates. */
104
+ declare function aircraftObstacleContacts(probes: readonly AircraftCollisionProbe[], scene: AircraftObstacleScene): AircraftContact[];
105
+ //#endregion
6
106
  //#region src/aircraft.d.ts
7
107
  interface AircraftVisual {
108
+ setLivery(data: LiveryData | undefined): void;
8
109
  object: THREE.Object3D;
110
+ cockpit: AircraftCockpit;
9
111
  interior?: VehicleInteriorVisual;
10
112
  /** The spec's exterior `animation` bindings (gear legs and doors, control surfaces). */
11
113
  animation?: ModelSignalVisual;
12
- update(state: AircraftStateData, input: AircraftInputData, altitude: number, signals?: ModelSignals): void;
114
+ update(state: AircraftStateData, input: AircraftInputData, altitude: number, signals?: ModelSignals, timeSeconds?: number): void;
115
+ /**
116
+ * The camera, in the coordinates of `object.position`. Cabin nodes (the spec's interior) are
117
+ * drawn only near it: from farther away a cockpit is a few pixels behind the canopy, yet it held
118
+ * most of an aircraft's draw calls, and as many again in the shadow pass. Boarded and chase
119
+ * views are always near enough.
120
+ */
121
+ updateView(camera: readonly [number, number, number]): void;
13
122
  dispose(): void;
14
123
  }
15
124
  /**
@@ -18,7 +127,7 @@ interface AircraftVisual {
18
127
  * The gear and flaps follow `state.gearPosition` and `state.flapPosition` as they travel, or the
19
128
  * selection in `input` when the state has no positions (helicopters, hosts that animate only).
20
129
  */
21
- declare function createAircraftVisual(model: THREE.Object3D, spec: AircraftSpec): AircraftVisual;
130
+ declare function createAircraftVisual(model: THREE.Object3D, spec: AircraftSpec, livery?: LiveryData): AircraftVisual;
22
131
  interface AircraftCameraPose extends VehicleCameraPose {
23
132
  rotation: [number, number, number, number];
24
133
  }
@@ -27,4 +136,4 @@ declare function aircraftCameraPose(transform: {
27
136
  rot: [number, number, number, number];
28
137
  }, spec: AircraftSpec, options: VehicleCameraOptions): AircraftCameraPose;
29
138
  //#endregion
30
- export { AircraftCameraPose, AircraftVisual, aircraftCameraPose, createAircraftVisual };
139
+ export { AircraftCameraPose, AircraftCockpit, AircraftCockpitControl, AircraftCockpitPointer, AircraftCockpitPointerOptions, AircraftCockpitSession, AircraftControlAction, AircraftControlChange, AircraftControlNode, AircraftObstacleScene, AircraftPointerAxes, AircraftVisual, aircraftCameraPose, aircraftControlValue, aircraftObstacleContacts, applyAircraftControl, bindAircraftCockpitPointer, createAircraftCockpit, createAircraftVisual };