@zylem/game-lib 0.8.9 → 0.9.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/README.md +7 -1
- package/dist/api/game-lib.api.json +37952 -19547
- package/dist/api/game-lib.api.md +1302 -7
- package/dist/api/game-lib.d.ts +1696 -3
- package/dist/api/game-lib.typedoc.json +174596 -76562
- package/dist/audio.d.ts +193 -1
- package/dist/audio.js +1 -1
- package/dist/bridge.d.ts +17 -2
- package/dist/bridge.js +1 -1
- package/dist/catalog.js +1 -1
- package/dist/chunk-2PFNNGTV.js +1 -0
- package/dist/chunk-2XMG3NJS.js +1 -0
- package/dist/chunk-4CZZZCFB.js +9 -0
- package/dist/chunk-7CBJKE42.js +1 -0
- package/dist/{chunk-CBUQBP2U.js → chunk-BQRMYLYD.js} +1 -1
- package/dist/chunk-FZNEWOC5.js +1 -0
- package/dist/chunk-GPCSX3M6.js +1 -0
- package/dist/chunk-K3NNXZIJ.js +1 -0
- package/dist/{chunk-JNFFTNMH.js → chunk-KSEP7AUF.js} +1 -1
- package/dist/{chunk-7JSZEEAE.js → chunk-LI43BZQN.js} +1 -1
- package/dist/chunk-NVVLLWIM.js +1 -0
- package/dist/chunk-QGIYILYI.js +1 -0
- package/dist/chunk-SHDHPDOV.js +24 -0
- package/dist/chunk-STVEILJJ.js +1 -0
- package/dist/chunk-SWDNK4GG.js +1 -0
- package/dist/chunk-UUOPT2N4.js +1 -0
- package/dist/chunk-VMXSE3EC.js +0 -0
- package/dist/{chunk-EYDC2PMO.js → chunk-VSFULLND.js} +1 -1
- package/dist/chunk-YNX3Q3CL.js +1 -0
- package/dist/chunk-ZZO4CKRU.js +1 -0
- package/dist/cinematics.d.ts +279 -0
- package/dist/cinematics.js +1 -0
- package/dist/core.d.ts +124 -10
- package/dist/core.js +1 -1
- package/dist/cutscene-definition-C479fkei.d.ts +509 -0
- package/dist/debug.d.ts +1 -0
- package/dist/debug.js +1 -1
- package/dist/{entity-type-map-D6BeAdvg.d.ts → entity-type-map-CrsrKT8c.d.ts} +12 -3
- package/dist/entity.d.ts +2 -1
- package/dist/entity.js +1 -1
- package/dist/game-D8KTP3fD.d.ts +652 -0
- package/dist/game-default-JV3Q6JAL.js +1 -0
- package/dist/graphics.d.ts +1 -1
- package/dist/graphics.js +1 -1
- package/dist/public.d.ts +12 -6
- package/dist/public.js +1 -1
- package/dist/schema/cutscene.schema.json +782 -0
- package/dist/schema/song.schema.json +430 -0
- package/dist/schema.d.ts +2 -0
- package/dist/schema.js +1 -1
- package/dist/selection-bounds-BKmSo9aG.d.ts +50 -0
- package/dist/song-definition-rEKksP0B.d.ts +263 -0
- package/dist/song-player-7QPLFLAS.js +1 -0
- package/dist/{game-DyKbOeck.d.ts → stage-CAPlk_cN.d.ts} +146 -647
- package/dist/web-components.d.ts +5 -3
- package/dist/web-components.js +1 -1
- package/dist/{zylem-camera-DZTpPOiD.d.ts → zylem-camera-CYDtrVgi.d.ts} +134 -102
- package/package.json +11 -4
- package/dist/chunk-34MYRTRP.js +0 -9
- package/dist/chunk-AXJTUVGC.js +0 -24
- package/dist/chunk-BWOZF5YK.js +0 -1
- package/dist/chunk-EVMLNMGU.js +0 -1
- package/dist/chunk-G3TBBZUI.js +0 -1
- package/dist/chunk-J6KD2G6F.js +0 -1
- package/dist/chunk-X7T7QRYP.js +0 -1
- package/dist/chunk-YVWDCZNT.js +0 -1
- package/dist/chunk-ZRT3ZQVH.js +0 -1
- package/dist/game-default-6YXFFZ2Q.js +0 -1
- /package/dist/{chunk-MSCVL5OK.js → chunk-ELQN62PQ.js} +0 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { k as CutsceneEasing, V as Vec3Def, h as CutsceneScene, n as CameraShot, g as CutsceneDefinition, s as DollyPath, i as CutsceneCamera, o as CameraTrack, x as SceneTransition, y as SceneTransitionType, v as EventItem, w as AudioItem } from './cutscene-definition-C479fkei.js';
|
|
2
|
+
export { A as AudioItemSchema, q as AudioTrack, l as CameraKeyframe, c as CameraKeyframeSchema, m as CameraPoseDef, d as CameraShotSchema, j as CutsceneCameraKind, b as CutsceneCameraSchema, C as CutsceneDefinitionSchema, u as CutsceneEvent, e as CutsceneEventSchema, a as CutsceneSceneSchema, r as CutsceneTrack, f as CutsceneTrackSchema, D as DollyPathSchema, E as EventItemSchema, p as EventTrack, S as SceneTransitionSchema, t as ShotBlend } from './cutscene-definition-C479fkei.js';
|
|
3
|
+
import { f as CameraBehavior, d as CameraContext, C as CameraPose, l as ZylemCamera } from './zylem-camera-CYDtrVgi.js';
|
|
4
|
+
import { Z as ZylemTransitionShader } from './stage-transition-CmGpV4tc.js';
|
|
5
|
+
import { Z as ZylemStage, q as Stage } from './stage-CAPlk_cN.js';
|
|
6
|
+
import { g as SongDefinition } from './song-definition-rEKksP0B.js';
|
|
7
|
+
import { CutsceneStatusPayload, CutsceneViewPayload, CutsceneLoadPayload, CameraPosePayload } from '@zylem/bridge';
|
|
8
|
+
import '@sinclair/typebox';
|
|
9
|
+
import 'three';
|
|
10
|
+
import './entity-BIf_a4dl.js';
|
|
11
|
+
import './simulation-body-zQw-emOr.js';
|
|
12
|
+
import '@zylem/behaviors/core';
|
|
13
|
+
import 'three/webgpu';
|
|
14
|
+
import './base-node-idopiSw5.js';
|
|
15
|
+
import './base-node-life-cycle-BK9xebT9.js';
|
|
16
|
+
import './entity-type-map-CrsrKT8c.js';
|
|
17
|
+
import './entity-XqvuWgPm.js';
|
|
18
|
+
import './vector-D3eDzvcA.js';
|
|
19
|
+
import './material-CxxAyJYp.js';
|
|
20
|
+
import './collision-builder-BckxkdmA.js';
|
|
21
|
+
import './events.js';
|
|
22
|
+
import 'mitt';
|
|
23
|
+
import './selection-bounds-BKmSo9aG.js';
|
|
24
|
+
import '@zylem/behaviors/particle-emitter';
|
|
25
|
+
import 'three/addons/lines/webgpu/Line2.js';
|
|
26
|
+
import './game-interfaces-vF5sRi1n.js';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Pure evaluation of a cutscene at a point in time: which scene and shot are
|
|
30
|
+
* active, where each camera is, and the blended pose the picture should
|
|
31
|
+
* show. Nothing here touches Three.js cameras or the stage, so the same code
|
|
32
|
+
* drives the runtime player, the editor's scrubbing, and the unit specs.
|
|
33
|
+
*/
|
|
34
|
+
declare function easeValue(easing: CutsceneEasing, t: number): number;
|
|
35
|
+
interface EvaluatedPose {
|
|
36
|
+
position: Vec3Def;
|
|
37
|
+
lookAt: Vec3Def;
|
|
38
|
+
fov: number;
|
|
39
|
+
}
|
|
40
|
+
declare function lerpVec3(a: Vec3Def, b: Vec3Def, t: number): Vec3Def;
|
|
41
|
+
declare function lerpPose(a: EvaluatedPose, b: EvaluatedPose, t: number): EvaluatedPose;
|
|
42
|
+
/** The scene containing `time` (last one wins on shared boundaries; the final scene past the end). */
|
|
43
|
+
declare function sceneAt(scenes: readonly CutsceneScene[], time: number): CutsceneScene | undefined;
|
|
44
|
+
/** The shot covering `time` on one track, if any (last one wins on overlaps). */
|
|
45
|
+
declare function shotAt(shots: readonly CameraShot[], time: number): CameraShot | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* The active shot across every camera track. Tracks are prioritised in
|
|
48
|
+
* order, so a shot on the first camera track overrides one on the second.
|
|
49
|
+
*/
|
|
50
|
+
declare function activeShot(definition: CutsceneDefinition, time: number): CameraShot | undefined;
|
|
51
|
+
/** The shot that ended most recently before `shot` began, on any camera track. */
|
|
52
|
+
declare function previousShot(definition: CutsceneDefinition, shot: CameraShot): CameraShot | undefined;
|
|
53
|
+
/** Point along a dolly path at `u` in 0…1 (arc-length parameterised). */
|
|
54
|
+
declare function dollyPointAt(path: DollyPath, u: number): Vec3Def;
|
|
55
|
+
/** Evenly spaced samples of a dolly path, for drawing it. */
|
|
56
|
+
declare function sampleDollyPath(path: DollyPath, segments?: number): Vec3Def[];
|
|
57
|
+
/** Positions of named entities the cameras may reference, by name. */
|
|
58
|
+
type TargetLookup = (name: string) => Vec3Def | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Where a camera is at `time` while `shot` is active: base pose, then dolly
|
|
61
|
+
* progress or follow target, then keyframes on top.
|
|
62
|
+
*/
|
|
63
|
+
declare function evaluateCameraPose(camera: CutsceneCamera, definition: Pick<CutsceneDefinition, 'dollies'>, shot: Pick<CameraShot, 'start' | 'end'>, time: number, lookup?: TargetLookup): EvaluatedPose;
|
|
64
|
+
interface CutsceneFrame {
|
|
65
|
+
scene: CutsceneScene | undefined;
|
|
66
|
+
shot: CameraShot | undefined;
|
|
67
|
+
camera: CutsceneCamera | undefined;
|
|
68
|
+
pose: EvaluatedPose | undefined;
|
|
69
|
+
/** 0…1 while blending in from the previous shot, else 1. */
|
|
70
|
+
blend: number;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Everything the picture needs at `time`: the active scene and shot, and the
|
|
74
|
+
* camera pose after blending from the previous shot when the shot asks for
|
|
75
|
+
* it. Without an active shot the pose is `undefined` and the gameplay camera
|
|
76
|
+
* keeps control.
|
|
77
|
+
*/
|
|
78
|
+
declare function evaluateCutscene(definition: CutsceneDefinition, time: number, lookup?: TargetLookup): CutsceneFrame;
|
|
79
|
+
/** Items on every event/audio track with `time` in `(from, to]`, in time order. */
|
|
80
|
+
declare function itemsBetween<T extends {
|
|
81
|
+
time: number;
|
|
82
|
+
}>(items: readonly T[], from: number, to: number): T[];
|
|
83
|
+
/** Camera tracks in priority order. */
|
|
84
|
+
declare function cameraTracks(definition: CutsceneDefinition): CameraTrack[];
|
|
85
|
+
/** Total length: the declared duration, or the furthest scene end if longer. */
|
|
86
|
+
declare function cutsceneLength(definition: Pick<CutsceneDefinition, 'duration' | 'scenes'>): number;
|
|
87
|
+
|
|
88
|
+
/** Pipeline key the cutscene player registers its behavior under. */
|
|
89
|
+
declare const CUTSCENE_BEHAVIOR_KEY = "cutscene";
|
|
90
|
+
/**
|
|
91
|
+
* Camera behavior that hands the pipeline a fixed pose each frame while a
|
|
92
|
+
* cutscene is playing. It runs after the game's own behaviors (high
|
|
93
|
+
* priority) so shots override follow/look-at logic, and it disables itself
|
|
94
|
+
* when the player has no pose (no active shot) so gameplay framing resumes.
|
|
95
|
+
*
|
|
96
|
+
* `damping` applies optional per-frame smoothing for follow cameras; the
|
|
97
|
+
* player passes 0 for authored moves so keyframes land exactly.
|
|
98
|
+
*/
|
|
99
|
+
declare class CutsceneCameraBehavior implements CameraBehavior {
|
|
100
|
+
priority: number;
|
|
101
|
+
enabled: boolean;
|
|
102
|
+
private target;
|
|
103
|
+
private smoothed;
|
|
104
|
+
private damping;
|
|
105
|
+
/** Sets the pose to show; `null` releases the camera back to gameplay. */
|
|
106
|
+
setPose(pose: EvaluatedPose | null, damping?: number): void;
|
|
107
|
+
/** Snap smoothing state so the next frame lands exactly on the pose (seeks, cuts). */
|
|
108
|
+
snap(): void;
|
|
109
|
+
onDetach(): void;
|
|
110
|
+
update(ctx: CameraContext, pose: CameraPose): CameraPose;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
type CutscenePlayerState = 'idle' | 'playing' | 'paused' | 'finished';
|
|
114
|
+
/**
|
|
115
|
+
* What the player needs from the running game. `createStageCutsceneHost`
|
|
116
|
+
* builds one from a live stage; tests and the editor can hand in stubs.
|
|
117
|
+
*/
|
|
118
|
+
interface CutsceneHost {
|
|
119
|
+
/** The camera the cutscene drives; resolved each frame so stage swaps are safe. */
|
|
120
|
+
camera: () => ZylemCamera | null;
|
|
121
|
+
/** World position of a named entity, for follow cameras and dolly look-ats. */
|
|
122
|
+
entityPosition?: (name: string) => Vec3Def | undefined;
|
|
123
|
+
playAnimation?: (entity: string, key: string) => void;
|
|
124
|
+
/** Stage event dispatch (`emit` events). */
|
|
125
|
+
dispatch?: (name: string, payload: Record<string, unknown>) => void;
|
|
126
|
+
setVariable?: (name: string, value: unknown) => void;
|
|
127
|
+
playSong?: (ref: string, options: {
|
|
128
|
+
loop: boolean;
|
|
129
|
+
volume: number;
|
|
130
|
+
}) => void;
|
|
131
|
+
stopSong?: (ref?: string) => void;
|
|
132
|
+
playSfx?: (url: string, options: {
|
|
133
|
+
volume: number;
|
|
134
|
+
loop: boolean;
|
|
135
|
+
}) => void;
|
|
136
|
+
/**
|
|
137
|
+
* Runs a picture transition into the new scene: snapshot the current frame
|
|
138
|
+
* and blend it into the frames that follow. Omit to hard-cut everywhere.
|
|
139
|
+
*/
|
|
140
|
+
beginTransition?: (transition: SceneTransition, shader: ZylemTransitionShader | undefined) => void;
|
|
141
|
+
}
|
|
142
|
+
interface CutscenePlayerOptions {
|
|
143
|
+
host: CutsceneHost;
|
|
144
|
+
/**
|
|
145
|
+
* `auto` (default) advances on `requestAnimationFrame`; `manual` leaves it
|
|
146
|
+
* to the caller's `update(dt)` — e.g. a stage `update` hook, so the
|
|
147
|
+
* cutscene pauses with the game.
|
|
148
|
+
*/
|
|
149
|
+
tick?: 'auto' | 'manual';
|
|
150
|
+
/** Maps a transition type to a blend shader (e.g. `createStageTransition({ pattern }).shader`). */
|
|
151
|
+
transitionShader?: (type: SceneTransitionType) => ZylemTransitionShader | undefined;
|
|
152
|
+
/** Fire events/audio crossed by a `seek`. Off by default: scrubbing should not trigger gameplay. */
|
|
153
|
+
fireEventsOnSeek?: boolean;
|
|
154
|
+
timeScale?: number;
|
|
155
|
+
}
|
|
156
|
+
interface CutscenePlayerEvents {
|
|
157
|
+
time: (time: number) => void;
|
|
158
|
+
state: (state: CutscenePlayerState) => void;
|
|
159
|
+
scene: (scene: CutsceneScene | undefined) => void;
|
|
160
|
+
shot: (shot: CameraShot | undefined) => void;
|
|
161
|
+
event: (item: EventItem) => void;
|
|
162
|
+
audio: (item: AudioItem) => void;
|
|
163
|
+
complete: () => void;
|
|
164
|
+
skip: () => void;
|
|
165
|
+
}
|
|
166
|
+
interface CutscenePlayer {
|
|
167
|
+
readonly definition: CutsceneDefinition;
|
|
168
|
+
readonly state: CutscenePlayerState;
|
|
169
|
+
/** Seconds. */
|
|
170
|
+
readonly time: number;
|
|
171
|
+
readonly length: number;
|
|
172
|
+
/** The pose the picture shows right now, if a shot is active. */
|
|
173
|
+
readonly pose: EvaluatedPose | undefined;
|
|
174
|
+
play(from?: number): void;
|
|
175
|
+
pause(): void;
|
|
176
|
+
/** Stops, rewinds, and returns the camera to gameplay. */
|
|
177
|
+
stop(): void;
|
|
178
|
+
seek(time: number): void;
|
|
179
|
+
/** Jumps to the end (when `skippable`) and completes. */
|
|
180
|
+
skip(): boolean;
|
|
181
|
+
/** Advances by `dt` seconds; only needed with `tick: 'manual'`. */
|
|
182
|
+
update(dt: number): void;
|
|
183
|
+
/** Swaps the definition in place, keeping time and state (live editing). */
|
|
184
|
+
setDefinition(definition: CutsceneDefinition): void;
|
|
185
|
+
on<K extends keyof CutscenePlayerEvents>(event: K, handler: CutscenePlayerEvents[K]): () => void;
|
|
186
|
+
dispose(): void;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Plays a cutscene against a live stage: drives the camera through a
|
|
190
|
+
* pipeline behavior, fires event/audio items as the playhead crosses them,
|
|
191
|
+
* and runs scene transitions through the renderer.
|
|
192
|
+
*
|
|
193
|
+
* ```ts
|
|
194
|
+
* const player = createCutscenePlayer(INTRO_CUTSCENE, { host: createStageCutsceneHost(stage) });
|
|
195
|
+
* player.on('complete', () => player.dispose());
|
|
196
|
+
* player.play();
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
declare function createCutscenePlayer(initial: CutsceneDefinition, options: CutscenePlayerOptions): CutscenePlayer;
|
|
200
|
+
|
|
201
|
+
interface StageCutsceneHostOptions {
|
|
202
|
+
/**
|
|
203
|
+
* Looks a song reference (slug or URL from a `playSong` event / audio
|
|
204
|
+
* item) up to a definition the audio module can play. Without it song
|
|
205
|
+
* items are ignored.
|
|
206
|
+
*/
|
|
207
|
+
resolveSong?: (ref: string) => SongDefinition | Promise<SongDefinition | undefined> | undefined;
|
|
208
|
+
/** Maps a transition type to a blend shader; defaults to a crossfade for every type. */
|
|
209
|
+
transitionShader?: (type: SceneTransitionType) => ZylemTransitionShader | undefined;
|
|
210
|
+
/** Called for `emit` events in addition to the stage dispatch. */
|
|
211
|
+
onEvent?: (name: string, payload: Record<string, unknown>) => void;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Registers the blend shaders every stage-bound cutscene uses for its scene
|
|
215
|
+
* transitions, typically once at startup:
|
|
216
|
+
*
|
|
217
|
+
* ```ts
|
|
218
|
+
* import { createStageTransition } from '@zylem/shaders';
|
|
219
|
+
* setCutsceneTransitionShaders((type) => createStageTransition({ pattern: type }).shader);
|
|
220
|
+
* ```
|
|
221
|
+
*
|
|
222
|
+
* Without this, every non-`cut` transition is a plain crossfade.
|
|
223
|
+
*/
|
|
224
|
+
declare function setCutsceneTransitionShaders(resolver: ((type: SceneTransitionType) => ZylemTransitionShader | undefined) | null): void;
|
|
225
|
+
/**
|
|
226
|
+
* A `CutsceneHost` bound to a live stage: drives the stage camera, resolves
|
|
227
|
+
* entities by name, dispatches stage events, writes stage variables, plays
|
|
228
|
+
* songs through `@zylem/game-lib/audio` (loaded on demand) and one-shots
|
|
229
|
+
* through Howler, and runs scene transitions on the stage renderer.
|
|
230
|
+
*/
|
|
231
|
+
/** What a stage-bound cutscene plays on: the public `Stage` wrapper or the internal stage. */
|
|
232
|
+
type CutsceneStageLike = ZylemStage | Stage;
|
|
233
|
+
declare function createStageCutsceneHost(stageLike: CutsceneStageLike, options?: StageCutsceneHostOptions): CutsceneHost;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Editor preview of a cutscene inside the running game: answers the bridge's
|
|
237
|
+
* `cutscene:*` commands with a player bound to the current stage and reports
|
|
238
|
+
* progress back. Owned by `ZylemGame`; Director mode drives it.
|
|
239
|
+
*/
|
|
240
|
+
declare class CutscenePreviewController {
|
|
241
|
+
private readonly getStage;
|
|
242
|
+
private readonly publish;
|
|
243
|
+
private readonly hostOptions;
|
|
244
|
+
private readonly publishView?;
|
|
245
|
+
private player;
|
|
246
|
+
private lastStatus;
|
|
247
|
+
/** A load that arrived before the stage existed; replayed by `stageReady()`. */
|
|
248
|
+
private pending;
|
|
249
|
+
private readonly viewInverse;
|
|
250
|
+
private readonly viewProjection;
|
|
251
|
+
private lastView;
|
|
252
|
+
constructor(getStage: () => ZylemStage | null, publish: (status: CutsceneStatusPayload) => void, hostOptions?: StageCutsceneHostOptions, publishView?: ((view: CutsceneViewPayload) => void) | undefined);
|
|
253
|
+
get active(): boolean;
|
|
254
|
+
/**
|
|
255
|
+
* The game reports itself running before its first stage finishes loading,
|
|
256
|
+
* so an editor that loads a cutscene straight away would find no stage.
|
|
257
|
+
* The game calls this once a stage is up; a held load runs then.
|
|
258
|
+
*/
|
|
259
|
+
stageReady(): void;
|
|
260
|
+
load(payload: CutsceneLoadPayload): void;
|
|
261
|
+
play(from?: number): void;
|
|
262
|
+
pause(): void;
|
|
263
|
+
stop(): void;
|
|
264
|
+
seek(time: number): void;
|
|
265
|
+
/** Drops the player because its stage is going away; a held load survives for the next stage. */
|
|
266
|
+
releaseStage(): void;
|
|
267
|
+
/**
|
|
268
|
+
* Once per rendered frame while a cutscene is loaded: publishes the
|
|
269
|
+
* camera's projection and the canvas box when either changed, so the
|
|
270
|
+
* editor's overlays track the view without polling.
|
|
271
|
+
*/
|
|
272
|
+
frame(): void;
|
|
273
|
+
unload(): void;
|
|
274
|
+
/** The live camera as position + look-at, for "capture from viewport". */
|
|
275
|
+
cameraPose(): Omit<CameraPosePayload, 'requestId'> | null;
|
|
276
|
+
private report;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export { AudioItem, CUTSCENE_BEHAVIOR_KEY, CameraShot, CameraTrack, CutsceneCamera, CutsceneCameraBehavior, CutsceneDefinition, CutsceneEasing, type CutsceneFrame, type CutsceneHost, type CutscenePlayer, type CutscenePlayerEvents, type CutscenePlayerOptions, type CutscenePlayerState, CutscenePreviewController, CutsceneScene, type CutsceneStageLike, DollyPath, type EvaluatedPose, EventItem, SceneTransition, SceneTransitionType, type StageCutsceneHostOptions, type TargetLookup, Vec3Def, activeShot, cameraTracks, createCutscenePlayer, createStageCutsceneHost, cutsceneLength, dollyPointAt, easeValue, evaluateCameraPose, evaluateCutscene, itemsBetween, lerpPose, lerpVec3, previousShot, sampleDollyPath, sceneAt, setCutsceneTransitionShaders, shotAt };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-VMXSE3EC.js";import{a as u,b as v,c as w,d as x,e as y,f as z,g as A,h as B,i as C,j as D,k as E}from"./chunk-YNX3Q3CL.js";import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t}from"./chunk-2XMG3NJS.js";import"./chunk-7GYFZKK7.js";import"./chunk-QGIYILYI.js";import"./chunk-WOT6VMZA.js";export{C as AudioItemSchema,a as CUTSCENE_BEHAVIOR_KEY,w as CameraKeyframeSchema,z as CameraShotSchema,b as CutsceneCameraBehavior,x as CutsceneCameraSchema,E as CutsceneDefinitionSchema,A as CutsceneEventSchema,t as CutscenePreviewController,v as CutsceneSceneSchema,D as CutsceneTrackSchema,y as DollyPathSchema,B as EventItemSchema,u as SceneTransitionSchema,h as activeShot,o as cameraTracks,q as createCutscenePlayer,s as createStageCutsceneHost,p as cutsceneLength,j as dollyPointAt,c as easeValue,l as evaluateCameraPose,m as evaluateCutscene,n as itemsBetween,e as lerpPose,d as lerpVec3,i as previousShot,k as sampleDollyPath,f as sceneAt,r as setCutsceneTransitionShaders,g as shotAt};
|
package/dist/core.d.ts
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as AspectRatio,
|
|
1
|
+
import { S as StageStateInterface } from './game-D8KTP3fD.js';
|
|
2
|
+
export { A as AspectRatio, f as AspectRatioValue, D as DeviceProfile, G as Game, b as GameConfigLike, d as GameDeviceConfig, a as GameLoadingEvent, R as ResolutionInput, e as ResolveGameConfigRuntime, j as RetroPreset, k as RetroPresetKey, l as RetroResolution, c as createGame, g as gameConfig, h as getDisplayAspect, i as getPresetResolution, p as parseResolution } from './game-D8KTP3fD.js';
|
|
3
3
|
export { G as GameInputConfig, a as GameInputPlayerConfig, K as KeyboardMapping, M as MouseConfig, b as MouseMapping, V as VirtualTouchButtonConfig, d as VirtualTouchButtonSlot, c as VirtualTouchButtonsConfig, e as VirtualTouchConfig, f as VirtualTouchJoystickConfig, g as VirtualTouchJoysticksConfig, h as VirtualTouchPosition, i as VirtualTouchStyle, Z as ZylemGameConfig } from './game-interfaces-vF5sRi1n.js';
|
|
4
|
+
import { q as Stage, C as CameraWrapper } from './stage-CAPlk_cN.js';
|
|
5
|
+
export { e as CameraManager, d as CameraOptions, l as FirstPersonOptions, f as FirstPersonPerspective, k as Fixed2DOptions, F as Fixed2DPerspective, n as IsometricOptions, I as IsometricPerspective, P as PerspectiveOptions, R as RenderBundleManager, p as RenderStrategyManager, m as SecondPersonOptions, g as SecondPersonPerspective, S as StageConfigLike, a as StageOptions, j as ThirdPersonOptions, T as ThirdPersonPerspective, o as TopDownOptions, h as TopDownPerspective, b as createCamera, i as createPerspective, c as createStage, s as stageConfig } from './stage-CAPlk_cN.js';
|
|
4
6
|
import { Vector2 } from 'three';
|
|
5
7
|
import { G as GameEntity, a as GameEntityOptions } from './entity-XqvuWgPm.js';
|
|
6
8
|
import { S as StageBlueprint } from './blueprints-TbGY-h53.js';
|
|
7
9
|
import { a as SetupContext, k as LoadedContext, U as UpdateContext, D as DestroyContext, l as CleanupContext } from './base-node-life-cycle-BK9xebT9.js';
|
|
8
10
|
export { L as LoadingEvent, S as StageNavigationOptions } from './base-node-life-cycle-BK9xebT9.js';
|
|
9
11
|
export { S as StageTransitionConfig, a as StageTransitionEasing, Z as ZylemTransitionShader, c as crossfadeTransitionShader } from './stage-transition-CmGpV4tc.js';
|
|
10
|
-
import { f as CameraBehavior } from './zylem-camera-
|
|
11
|
-
export { g as CameraAction, d as CameraContext, e as CameraPerspective,
|
|
12
|
+
import { f as CameraBehavior } from './zylem-camera-CYDtrVgi.js';
|
|
13
|
+
export { g as CameraAction, d as CameraContext, e as CameraPerspective, k as CameraPipeline, h as CameraPipelineState, C as CameraPose, j as CameraProjection, P as PerspectiveType, a as Perspectives, c as PoseDelta, T as TransformLike, V as Viewport, b as ZylemRenderer, i as isWebGPUSupported } from './zylem-camera-CYDtrVgi.js';
|
|
12
14
|
import { e as Vec3Input, c as Vec3 } from './vector-D3eDzvcA.js';
|
|
13
15
|
export { f as VEC2_ONE, g as VEC2_ZERO, h as VEC3_ONE, i as VEC3_ZERO, V as Vec2, a as Vec2Components, b as Vec2Input, d as Vec3Components, n as normalizeVec2, j as normalizeVec3, t as toThreeVector2, k as toThreeVector3 } from './vector-D3eDzvcA.js';
|
|
14
16
|
import { S as StageEntity } from './entity-BIf_a4dl.js';
|
|
15
17
|
import { B as BaseNode, N as NodeInterface } from './base-node-idopiSw5.js';
|
|
16
|
-
import './
|
|
18
|
+
import './default-controls-CAKJ5zlo.js';
|
|
19
|
+
import './events.js';
|
|
20
|
+
import 'mitt';
|
|
21
|
+
import '@zylem/behaviors/core';
|
|
22
|
+
import './entity-type-map-CrsrKT8c.js';
|
|
17
23
|
import './material-CxxAyJYp.js';
|
|
18
24
|
import 'three/webgpu';
|
|
19
|
-
import '
|
|
25
|
+
import './selection-bounds-BKmSo9aG.js';
|
|
20
26
|
import '@zylem/behaviors/particle-emitter';
|
|
21
27
|
import 'three/addons/lines/webgpu/Line2.js';
|
|
22
28
|
import './simulation-body-zQw-emOr.js';
|
|
23
29
|
import '@zylem/bridge';
|
|
24
|
-
import './events.js';
|
|
25
|
-
import 'mitt';
|
|
26
|
-
import './default-controls-CAKJ5zlo.js';
|
|
27
30
|
import './collision-builder-BckxkdmA.js';
|
|
28
31
|
import '@sinclair/typebox';
|
|
29
32
|
|
|
@@ -135,6 +138,117 @@ interface FollowTargetOptions {
|
|
|
135
138
|
*/
|
|
136
139
|
declare function createFollowTarget(options?: FollowTargetOptions): CameraBehavior;
|
|
137
140
|
|
|
141
|
+
/** How one axis of the follow focus tracks the target. */
|
|
142
|
+
type PlatformAxisMode = 'delay' | 'settle' | 'off';
|
|
143
|
+
interface PlatformAxisModes {
|
|
144
|
+
x?: PlatformAxisMode;
|
|
145
|
+
y?: PlatformAxisMode;
|
|
146
|
+
z?: PlatformAxisMode;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Options for the Super Mario World style follow.
|
|
150
|
+
*
|
|
151
|
+
* `delay` lerps toward the target and can wait inside a deadzone.
|
|
152
|
+
* `settle` holds still while the axis is moving (a jump, a lane change) and
|
|
153
|
+
* eases to the new rest once the axis goes quiet — landing on a platform.
|
|
154
|
+
* `off` leaves that axis of the incoming pose alone.
|
|
155
|
+
*/
|
|
156
|
+
interface PlatformFollowOptions {
|
|
157
|
+
/** Key in CameraContext.targets to follow. Default 'primary'. */
|
|
158
|
+
targetKey?: string;
|
|
159
|
+
/**
|
|
160
|
+
* Per-axis mode. Default: x and z delay, y settles. Vertical jumps do not
|
|
161
|
+
* drag the camera; landing does. The same settle mode works on a horizontal axis.
|
|
162
|
+
*/
|
|
163
|
+
axes?: PlatformAxisModes;
|
|
164
|
+
/**
|
|
165
|
+
* Interpolation factor for `delay` axes, in 0..1 per 60Hz frame.
|
|
166
|
+
* 1 = instant. Scaled by dt. Default 0.1.
|
|
167
|
+
*/
|
|
168
|
+
lerpFactor?: number;
|
|
169
|
+
/**
|
|
170
|
+
* Deadzone in world units for `delay` axes. The focus holds until the
|
|
171
|
+
* target (plus lookahead) leaves this window. Default 0.
|
|
172
|
+
*/
|
|
173
|
+
window?: number;
|
|
174
|
+
/** Speed, in units/second, at or below which a `settle` axis counts as resting. Default 0.75. */
|
|
175
|
+
settleSpeed?: number;
|
|
176
|
+
/** Seconds a `settle` axis must stay slow before the focus accepts the new rest. Default 0.15. */
|
|
177
|
+
settleTime?: number;
|
|
178
|
+
/** Interpolation factor used once a `settle` axis has a new rest. Default 0.08. */
|
|
179
|
+
settleLerp?: number;
|
|
180
|
+
/**
|
|
181
|
+
* World units of lookahead along the last travel direction.
|
|
182
|
+
* Applied on `delay` axes only. Default 0.
|
|
183
|
+
*/
|
|
184
|
+
lookahead?: number;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Follow a target with per-axis delay or platform settling.
|
|
188
|
+
*
|
|
189
|
+
* Shifts `position` and `lookAt` by the same delta, so the perspective's
|
|
190
|
+
* offset stays intact and the framed point becomes the filtered focus.
|
|
191
|
+
*
|
|
192
|
+
* "On a platform" is inferred from the axis going quiet. Games do not have
|
|
193
|
+
* to supply a grounded flag.
|
|
194
|
+
*/
|
|
195
|
+
declare function createPlatformFollow(options?: PlatformFollowOptions): CameraBehavior;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Pointer for edge scrolling.
|
|
199
|
+
* `x`/`y` are 0..1 from the top-left, unless `centered` is set, in which case
|
|
200
|
+
* they are −1..1 with −1 at the left and top (the shape of `inputs.p1.pointer.centerX/Y`).
|
|
201
|
+
*/
|
|
202
|
+
interface StrategyPointer {
|
|
203
|
+
x: number;
|
|
204
|
+
y: number;
|
|
205
|
+
centered?: boolean;
|
|
206
|
+
}
|
|
207
|
+
/** What {@link StrategyPanOptions.sampleInput} returns each frame. */
|
|
208
|
+
interface StrategyPanInput {
|
|
209
|
+
pointer?: StrategyPointer;
|
|
210
|
+
/** Stick or arrow intent, −1..1. +x is screen right, +y is screen up. */
|
|
211
|
+
pan?: {
|
|
212
|
+
x: number;
|
|
213
|
+
y: number;
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
interface StrategyPanOptions {
|
|
217
|
+
/**
|
|
218
|
+
* Read pointer and pan intent. Kept as a closure so the behavior does not
|
|
219
|
+
* import InputManager. Typical source: `inputs.p1.pointer` and directions.
|
|
220
|
+
*/
|
|
221
|
+
sampleInput?: () => StrategyPanInput;
|
|
222
|
+
/** Fraction of the viewport that counts as an edge. Default 0.08. */
|
|
223
|
+
edgeMargin?: number;
|
|
224
|
+
/** World units per second at a flush edge. Default 12. */
|
|
225
|
+
edgeSpeed?: number;
|
|
226
|
+
/** World units per second at full stick deflection. Default 16. */
|
|
227
|
+
panSpeed?: number;
|
|
228
|
+
/** Target key to ease toward. Null follows nothing. */
|
|
229
|
+
followKey?: string | null;
|
|
230
|
+
/** Interpolation factor while following, per 60Hz frame. Default 0.12. */
|
|
231
|
+
followLerp?: number;
|
|
232
|
+
/**
|
|
233
|
+
* A manual pan or edge scroll drops follow until {@link StrategyPanBehavior.setFollowKey}.
|
|
234
|
+
* Default true.
|
|
235
|
+
*/
|
|
236
|
+
breakFollowOnPan?: boolean;
|
|
237
|
+
}
|
|
238
|
+
interface StrategyPanBehavior extends CameraBehavior {
|
|
239
|
+
/** Follow `key`, or pass null to pan freely. Clears a manual-pan suspension. */
|
|
240
|
+
setFollowKey(key: string | null): void;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* StarCraft-style pan on the XZ plane.
|
|
244
|
+
*
|
|
245
|
+
* The perspective (top-down or isometric) owns the angle. This behavior only
|
|
246
|
+
* slides the framed point: edge scroll, arrow or stick pan, and an optional
|
|
247
|
+
* follow target. Screen up maps to world −Z, which matches a top-down camera
|
|
248
|
+
* whose up vector is −Z.
|
|
249
|
+
*/
|
|
250
|
+
declare function createStrategyPan(options?: StrategyPanOptions): StrategyPanBehavior;
|
|
251
|
+
|
|
138
252
|
/**
|
|
139
253
|
* Options for setCameraFeed.
|
|
140
254
|
*/
|
|
@@ -224,4 +338,4 @@ declare function isManagedRenderEntity(entity: {
|
|
|
224
338
|
*/
|
|
225
339
|
type Vect3 = Vec3;
|
|
226
340
|
|
|
227
|
-
export { CameraBehavior, type CameraFeedOptions, CameraWrapper, type FollowTargetOptions, type RenderCategory, STAGE_STATE_CHANGE, SetupContext, StageBlueprint, StageEntity, StageManager, type StageStateChangeEvent, UpdateContext, Vec3, Vec3Input, type Vect3, createFollowTarget, dispatchStageState, entitySpawner, initStageStateDispatcher, isManagedRenderEntity, resolveRenderCategory, setCameraFeed, setStageFrameProfilerEnabled, stageState, usesManagedRenderPath, vessel };
|
|
341
|
+
export { CameraBehavior, type CameraFeedOptions, CameraWrapper, type FollowTargetOptions, type PlatformAxisMode, type PlatformAxisModes, type PlatformFollowOptions, type RenderCategory, STAGE_STATE_CHANGE, SetupContext, StageBlueprint, StageEntity, StageManager, type StageStateChangeEvent, type StrategyPanBehavior, type StrategyPanInput, type StrategyPanOptions, type StrategyPointer, UpdateContext, Vec3, Vec3Input, type Vect3, createFollowTarget, createPlatformFollow, createStrategyPan, dispatchStageState, entitySpawner, initStageStateDispatcher, isManagedRenderEntity, resolveRenderCategory, setCameraFeed, setStageFrameProfilerEnabled, stageState, usesManagedRenderPath, vessel };
|
package/dist/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b,b as c,c as d,d as e,e as f,f as
|
|
1
|
+
import{a as b,b as c,c as d,d as e,e as f,f as K,g as L,h as M,i as N,j as O,k as P,l as Q,m as R,n as S,o as T,p as U,q as V}from"./chunk-SHDHPDOV.js";import{a,c as p,d as q,e as r,f as s,g as t,h as u,i as v,k as w,l as x,m as y,n as z,o as A,p as B,q as C,r as D,s as E,t as F,u as G,v as H,w as I,y as J}from"./chunk-SWDNK4GG.js";import"./chunk-PCFF4LLO.js";import"./chunk-Q2YDBMVY.js";import"./chunk-BCFFS3FP.js";import"./chunk-VSFULLND.js";import"./chunk-2HSR5XDQ.js";import"./chunk-7CBJKE42.js";import"./chunk-BQRMYLYD.js";import"./chunk-GPCSX3M6.js";import"./chunk-WBQ5TNRZ.js";import"./chunk-LI43BZQN.js";import"./chunk-YQS7CGXE.js";import"./chunk-STVEILJJ.js";import"./chunk-KP6DLLJO.js";import"./chunk-6FGXC4T6.js";import"./chunk-AIQ6IVT5.js";import"./chunk-QXVH6POE.js";import"./chunk-UUOPT2N4.js";import"./chunk-EVYHPR3J.js";import"./chunk-VUJXR5K5.js";import"./chunk-2XMG3NJS.js";import{a as o}from"./chunk-7GYFZKK7.js";import"./chunk-QGIYILYI.js";import"./chunk-D2PATZCC.js";import"./chunk-4QLJUQSJ.js";import{a as g,b as h,c as i,d as j,g as k,h as l,i as m,j as n}from"./chunk-7WRQ2UAN.js";import"./chunk-BH53MBAZ.js";import"./chunk-XRP4JJXL.js";import"./chunk-UG22Z42P.js";import"./chunk-WOT6VMZA.js";export{b as AspectRatio,E as CameraManager,w as CameraPipeline,F as CameraWrapper,z as FirstPersonPerspective,y as Fixed2DPerspective,M as Game,A as IsometricPerspective,v as Perspectives,s as RenderBundleManager,t as RenderStrategyManager,P as STAGE_STATE_CHANGE,C as SecondPersonPerspective,L as StageManager,x as ThirdPersonPerspective,B as TopDownPerspective,h as VEC2_ONE,g as VEC2_ZERO,j as VEC3_ONE,i as VEC3_ZERO,G as createCamera,S as createFollowTarget,N as createGame,D as createPerspective,T as createPlatformFollow,J as createStage,U as createStrategyPan,o as crossfadeTransitionShader,R as dispatchStageState,O as entitySpawner,f as gameConfig,c as getDisplayAspect,d as getPresetResolution,Q as initStageStateDispatcher,r as isManagedRenderEntity,a as isWebGPUSupported,k as normalizeVec2,l as normalizeVec3,e as parseResolution,p as resolveRenderCategory,V as setCameraFeed,u as setStageFrameProfilerEnabled,H as stageConfig,K as stageState,m as toThreeVector2,n as toThreeVector3,q as usesManagedRenderPath,I as vessel};
|