@zylem/game-lib 0.9.2 → 0.9.3
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/api/game-lib.api.json +229 -137
- package/dist/api/game-lib.api.md +11 -8
- package/dist/api/game-lib.d.ts +112 -44
- package/dist/api/game-lib.typedoc.json +45201 -44976
- package/dist/bridge.d.ts +25 -0
- package/dist/bridge.js +1 -1
- package/dist/chunk-3CLQWJ2I.js +1 -0
- package/dist/chunk-47HAZZWF.js +1 -0
- package/dist/chunk-4A274H3Y.js +1 -0
- package/dist/{chunk-Q2YDBMVY.js → chunk-OCQ7A5IK.js} +1 -1
- package/dist/{chunk-CGHGVX4T.js → chunk-U4JSAJAD.js} +2 -2
- package/dist/cinematics.d.ts +2 -2
- package/dist/core.d.ts +6 -6
- package/dist/core.js +1 -1
- package/dist/debug.d.ts +3 -2
- package/dist/debug.js +1 -1
- package/dist/{game-D8KTP3fD.d.ts → game-DBNxY6mb.d.ts} +2 -2
- package/dist/{game-default-UPRL345L.js → game-default-PEEHJUHT.js} +1 -1
- package/dist/graphics.d.ts +1 -1
- package/dist/public.d.ts +3 -3
- package/dist/public.js +1 -1
- package/dist/{stage-CAPlk_cN.d.ts → stage-bVLyYnOQ.d.ts} +74 -43
- package/dist/web-components.d.ts +3 -3
- package/dist/{zylem-camera-CYDtrVgi.d.ts → zylem-camera-CO713zFl.d.ts} +11 -0
- package/package.json +2 -2
- package/dist/chunk-BCFFS3FP.js +0 -1
- package/dist/chunk-EA52VY4B.js +0 -1
- package/dist/chunk-G5IJBJ4E.js +0 -1
package/dist/api/game-lib.api.md
CHANGED
|
@@ -681,22 +681,24 @@ export const CameraKeyframeSchema: _sinclair_typebox.TObject<{
|
|
|
681
681
|
easing: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"linear">, _sinclair_typebox.TLiteral<"easeIn">, _sinclair_typebox.TLiteral<"easeOut">, _sinclair_typebox.TLiteral<"easeInOut">]>;
|
|
682
682
|
}>;
|
|
683
683
|
|
|
684
|
+
// Warning: (ae-forgotten-export) The symbol "EditorCameraHost" needs to be exported by the entry point public.d.ts
|
|
685
|
+
//
|
|
684
686
|
// @public
|
|
685
|
-
export class CameraManager {
|
|
686
|
-
|
|
687
|
-
activateDebugCamera(): boolean;
|
|
687
|
+
export class CameraManager implements EditorCameraHost {
|
|
688
|
+
activateCameraById(id: string): boolean;
|
|
688
689
|
// Warning: (ae-forgotten-export) The symbol "ZylemCamera" needs to be exported by the entry point public.d.ts
|
|
689
690
|
get activeCameras(): ReadonlyArray<ZylemCamera>;
|
|
690
691
|
addActiveCamera(nameOrRef: string | ZylemCamera): boolean;
|
|
691
692
|
addCamera(camera: ZylemCamera, name?: string): string;
|
|
692
693
|
get allCameras(): ReadonlyArray<ZylemCamera>;
|
|
693
694
|
deactivateCamera(nameOrRef: string | ZylemCamera): boolean;
|
|
694
|
-
|
|
695
|
-
get debugCamera(): ZylemCamera | null;
|
|
695
|
+
destroyEditorCameras(): void;
|
|
696
696
|
dispose(): void;
|
|
697
697
|
ensureDefaultCamera(): ZylemCamera;
|
|
698
|
+
ensureEditorCameras(): Promise<void>;
|
|
698
699
|
getCamera(name: string): ZylemCamera | null;
|
|
699
|
-
|
|
700
|
+
hasEditorCameras(): boolean;
|
|
701
|
+
isEditorViewActive(): boolean;
|
|
700
702
|
get primaryCamera(): ZylemCamera | null;
|
|
701
703
|
removeCamera(nameOrRef: string | ZylemCamera): boolean;
|
|
702
704
|
render(scene: Scene): void;
|
|
@@ -2154,6 +2156,7 @@ export class GameBridge {
|
|
|
2154
2156
|
// (undocumented)
|
|
2155
2157
|
disconnect(): void;
|
|
2156
2158
|
onEditorAttached(callback: () => void): () => void;
|
|
2159
|
+
onEditorDetached(callback: () => void): () => void;
|
|
2157
2160
|
publishCatalog(entities: EntityTypeDescriptor[]): void;
|
|
2158
2161
|
// (undocumented)
|
|
2159
2162
|
publishConfig(config: GameConfigPayload): void;
|
|
@@ -6205,8 +6208,8 @@ export class ZylemZone extends GameEntity<ZylemZoneOptions> implements Collision
|
|
|
6205
6208
|
// dist/entity-XqvuWgPm.d.ts:343:9 - (ae-forgotten-export) The symbol "EntityMeshBuilder" needs to be exported by the entry point public.d.ts
|
|
6206
6209
|
// dist/entity-XqvuWgPm.d.ts:344:9 - (ae-forgotten-export) The symbol "EntityCollisionBuilder" needs to be exported by the entry point public.d.ts
|
|
6207
6210
|
// dist/entity-XqvuWgPm.d.ts:345:9 - (ae-forgotten-export) The symbol "MaterialBuilder" needs to be exported by the entry point public.d.ts
|
|
6208
|
-
// dist/game-
|
|
6209
|
-
// dist/stage-
|
|
6211
|
+
// dist/game-DBNxY6mb.d.ts:258:5 - (ae-forgotten-export) The symbol "StageInterface" needs to be exported by the entry point public.d.ts
|
|
6212
|
+
// dist/stage-bVLyYnOQ.d.ts:1148:5 - (ae-forgotten-export) The symbol "StageAssetLoaderConfig" needs to be exported by the entry point public.d.ts
|
|
6210
6213
|
|
|
6211
6214
|
// (No @packageDocumentation comment for this package)
|
|
6212
6215
|
|
package/dist/api/game-lib.d.ts
CHANGED
|
@@ -458,8 +458,9 @@ declare type ActorOptions = BaseNode | ZylemActorOptions;
|
|
|
458
458
|
* hover/select/delete/spawn, the `DebugEntityCursor` highlight and the
|
|
459
459
|
* `PlacementGhost` — is live whenever a tool is armed, so the toolbar's buttons
|
|
460
460
|
* work on their own. The debug layer — the wasm simulation's collider
|
|
461
|
-
* wireframes
|
|
462
|
-
*
|
|
461
|
+
* wireframes — is the part `debugState.enabled` gates, and is torn down when
|
|
462
|
+
* it goes off while the delegate stays alive to re-activate. Debug mode does
|
|
463
|
+
* not switch cameras; picking and gizmos use whichever camera is rendering.
|
|
463
464
|
*
|
|
464
465
|
* Centralizes all of this so `ZylemStage` doesn't have to know about
|
|
465
466
|
* raycasting, DOM input, or debug rendering.
|
|
@@ -958,28 +959,38 @@ export declare const CameraKeyframeSchema: _sinclair_typebox.TObject<{
|
|
|
958
959
|
* Responsibilities:
|
|
959
960
|
* - Named camera registry (add/remove/get by name or reference)
|
|
960
961
|
* - Active camera list management (determines which cameras render)
|
|
961
|
-
* -
|
|
962
|
+
* - Editor view cameras (side, top, isometric, free), created only while an editor is attached
|
|
962
963
|
* - Per-frame update of all active cameras' perspective controllers
|
|
963
964
|
* - Coordinating rendering via RendererManager for all active viewports
|
|
964
965
|
*/
|
|
965
|
-
export declare class CameraManager {
|
|
966
|
+
export declare class CameraManager implements EditorCameraHost {
|
|
966
967
|
/** Named camera registry */
|
|
967
968
|
private cameras;
|
|
968
969
|
/** Currently active cameras, ordered by render layer (first = bottom) */
|
|
969
970
|
private _activeCameras;
|
|
970
|
-
/**
|
|
971
|
-
private
|
|
972
|
-
/**
|
|
973
|
-
private
|
|
974
|
-
/**
|
|
975
|
-
private
|
|
971
|
+
/** Editor view cameras, keyed by `editor:*` id. */
|
|
972
|
+
private _editorCameras;
|
|
973
|
+
/** Which editor views freeze rotation. */
|
|
974
|
+
private _lockedEditorIds;
|
|
975
|
+
/** Game camera to restore when the editor releases the main view. */
|
|
976
|
+
private _rememberedGameCamera;
|
|
977
|
+
/**
|
|
978
|
+
* True while an editor view is the main camera. Game calls to
|
|
979
|
+
* {@link setActiveCamera} update {@link _rememberedGameCamera} and leave
|
|
980
|
+
* the view on screen.
|
|
981
|
+
*/
|
|
982
|
+
private _editorViewLocked;
|
|
983
|
+
/** Game cameras whose orbit input was suspended for an editor view. */
|
|
984
|
+
private _suspendedOrbits;
|
|
985
|
+
/** In-flight creation, so a second attach does not build a second set. */
|
|
986
|
+
private _editorCamerasPromise;
|
|
976
987
|
/** Reference to the shared renderer manager */
|
|
977
988
|
private _rendererManager;
|
|
978
989
|
/** Scene reference */
|
|
979
990
|
private _sceneRef;
|
|
980
991
|
/** Counter for auto-generated camera names */
|
|
981
992
|
private _autoNameCounter;
|
|
982
|
-
|
|
993
|
+
private _unregisterEditorHost;
|
|
983
994
|
/**
|
|
984
995
|
* Get the list of currently active cameras.
|
|
985
996
|
*/
|
|
@@ -988,14 +999,10 @@ export declare class CameraManager {
|
|
|
988
999
|
* Get the primary active camera (first in the active list).
|
|
989
1000
|
*/
|
|
990
1001
|
get primaryCamera(): ZylemCamera | null;
|
|
991
|
-
/**
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
/**
|
|
996
|
-
* Gameplay primary camera that was active before debug mode was enabled.
|
|
997
|
-
*/
|
|
998
|
-
get preDebugPrimary(): ZylemCamera | null;
|
|
1002
|
+
/** True while side, top, isometric, or free is the main view. */
|
|
1003
|
+
isEditorViewActive(): boolean;
|
|
1004
|
+
/** True after the four editor views have been created. */
|
|
1005
|
+
hasEditorCameras(): boolean;
|
|
999
1006
|
/**
|
|
1000
1007
|
* Get all registered cameras.
|
|
1001
1008
|
*/
|
|
@@ -1012,13 +1019,15 @@ export declare class CameraManager {
|
|
|
1012
1019
|
addCamera(camera: ZylemCamera, name?: string): string;
|
|
1013
1020
|
/**
|
|
1014
1021
|
* Remove a camera by name or reference.
|
|
1015
|
-
* Cannot remove the debug camera via this method.
|
|
1016
1022
|
*/
|
|
1017
1023
|
removeCamera(nameOrRef: string | ZylemCamera): boolean;
|
|
1018
1024
|
/**
|
|
1019
1025
|
* Set a camera as the primary active camera (replaces all active cameras
|
|
1020
1026
|
* except additional viewport cameras).
|
|
1021
1027
|
*
|
|
1028
|
+
* While an editor view owns the main view, a game camera is remembered
|
|
1029
|
+
* and the rendered camera does not change.
|
|
1030
|
+
*
|
|
1022
1031
|
* @param nameOrRef Camera name or reference to activate
|
|
1023
1032
|
*/
|
|
1024
1033
|
setActiveCamera(nameOrRef: string | ZylemCamera): boolean;
|
|
@@ -1036,19 +1045,27 @@ export declare class CameraManager {
|
|
|
1036
1045
|
getCamera(name: string): ZylemCamera | null;
|
|
1037
1046
|
/**
|
|
1038
1047
|
* Setup all cameras with the given scene and renderer manager.
|
|
1039
|
-
*
|
|
1048
|
+
* Editor view cameras are created here only when an editor is already attached.
|
|
1040
1049
|
*/
|
|
1041
1050
|
setup(scene: Scene, rendererManager: RendererManager): Promise<void>;
|
|
1042
1051
|
/**
|
|
1043
|
-
*
|
|
1044
|
-
*
|
|
1052
|
+
* Create side, top, isometric, and free cameras seeded from the current
|
|
1053
|
+
* game camera. Does not change which camera is rendering.
|
|
1054
|
+
*/
|
|
1055
|
+
ensureEditorCameras(): Promise<void>;
|
|
1056
|
+
/**
|
|
1057
|
+
* Restore the game camera when an editor view is showing, then destroy
|
|
1058
|
+
* the four editor cameras.
|
|
1045
1059
|
*/
|
|
1046
|
-
|
|
1060
|
+
destroyEditorCameras(): void;
|
|
1047
1061
|
/**
|
|
1048
|
-
*
|
|
1049
|
-
*
|
|
1062
|
+
* Switch the main view.
|
|
1063
|
+
*
|
|
1064
|
+
* `game` releases to the remembered game camera. Editor view ids show
|
|
1065
|
+
* that view. Any other id activates a game-registered camera and clears
|
|
1066
|
+
* the editor override.
|
|
1050
1067
|
*/
|
|
1051
|
-
|
|
1068
|
+
activateCameraById(id: string): boolean;
|
|
1052
1069
|
/**
|
|
1053
1070
|
* Update all active cameras' controllers.
|
|
1054
1071
|
*/
|
|
@@ -1068,16 +1085,19 @@ export declare class CameraManager {
|
|
|
1068
1085
|
* Dispose all cameras and cleanup.
|
|
1069
1086
|
*/
|
|
1070
1087
|
dispose(): void;
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
private
|
|
1076
|
-
/**
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
private
|
|
1088
|
+
private createEditorCameras;
|
|
1089
|
+
private showEditorCamera;
|
|
1090
|
+
private showGameCamera;
|
|
1091
|
+
/** Enable orbit on the active editor view only. Inactive views keep their pose. */
|
|
1092
|
+
private syncEditorOrbit;
|
|
1093
|
+
/** Stop game-camera orbit controls from sharing the canvas with an editor view. */
|
|
1094
|
+
private suspendOtherOrbits;
|
|
1095
|
+
private restoreOrbitFor;
|
|
1096
|
+
private gameCameraToRestore;
|
|
1097
|
+
private cameraIsRegistered;
|
|
1098
|
+
private isEditorCamera;
|
|
1099
|
+
/** Replace the primary camera and keep picture-in-picture viewports. */
|
|
1100
|
+
private commitActive;
|
|
1081
1101
|
/**
|
|
1082
1102
|
* Resolve a camera from a name or reference.
|
|
1083
1103
|
*/
|
|
@@ -2694,6 +2714,19 @@ export { dot }
|
|
|
2694
2714
|
*/
|
|
2695
2715
|
export declare function easeValue(easing: CutsceneEasing, t: number): number;
|
|
2696
2716
|
|
|
2717
|
+
/**
|
|
2718
|
+
* Editor-view cameras exist only while an editor is attached.
|
|
2719
|
+
*
|
|
2720
|
+
* `GameBridge.connect()` runs for every game, so it is not the signal. The
|
|
2721
|
+
* bridge marks the session attached when an editor subscribes, and every live
|
|
2722
|
+
* camera manager creates or destroys its four view cameras from that flag.
|
|
2723
|
+
*/
|
|
2724
|
+
declare interface EditorCameraHost {
|
|
2725
|
+
ensureEditorCameras(): Promise<void>;
|
|
2726
|
+
destroyEditorCameras(): void;
|
|
2727
|
+
activateCameraById(id: string): boolean;
|
|
2728
|
+
}
|
|
2729
|
+
|
|
2697
2730
|
export { EditorToGameMessages }
|
|
2698
2731
|
|
|
2699
2732
|
export declare type EffectType = Static<typeof EffectTypeSchema>;
|
|
@@ -3322,8 +3355,9 @@ export { floor }
|
|
|
3322
3355
|
export { Fn }
|
|
3323
3356
|
|
|
3324
3357
|
/**
|
|
3325
|
-
* Select an entity by UUID and frame the
|
|
3326
|
-
*
|
|
3358
|
+
* Select an entity by UUID and frame the active editor camera to fit it.
|
|
3359
|
+
* When the game camera is showing, the stage switches to the free editor
|
|
3360
|
+
* camera first. Enables debug mode so the selection is visible.
|
|
3327
3361
|
*
|
|
3328
3362
|
* @returns true if the entity was found and framed
|
|
3329
3363
|
*/
|
|
@@ -3490,6 +3524,8 @@ export declare class GameBridge {
|
|
|
3490
3524
|
* not themselves recorded as new operations.
|
|
3491
3525
|
*/
|
|
3492
3526
|
private applyingSceneOperation;
|
|
3527
|
+
/** Frame watch used when the channel cannot report subscriber removal. */
|
|
3528
|
+
private editorCameraFrame;
|
|
3493
3529
|
constructor();
|
|
3494
3530
|
/**
|
|
3495
3531
|
* Subscribe to editor commands and announce the game side as ready.
|
|
@@ -3542,6 +3578,29 @@ export declare class GameBridge {
|
|
|
3542
3578
|
* @returns An unsubscribe function.
|
|
3543
3579
|
*/
|
|
3544
3580
|
onEditorAttached(callback: () => void): () => void;
|
|
3581
|
+
/**
|
|
3582
|
+
* Run a callback when the editor drops both entity subscriptions.
|
|
3583
|
+
*
|
|
3584
|
+
* Mirrors {@link onEditorAttached}: the first of the pair to unsubscribe
|
|
3585
|
+
* is the same editor finishing teardown, so the callback waits until the
|
|
3586
|
+
* other type is already at zero.
|
|
3587
|
+
*
|
|
3588
|
+
* @returns An unsubscribe function.
|
|
3589
|
+
*/
|
|
3590
|
+
onEditorDetached(callback: () => void): () => void;
|
|
3591
|
+
/** True when an editor is listening for entity data. */
|
|
3592
|
+
private editorIsAttached;
|
|
3593
|
+
/** Create the view cameras and, if needed, watch for the editor leaving. */
|
|
3594
|
+
private attachEditorCameras;
|
|
3595
|
+
/** Destroy the view cameras and stop watching for editor removal. */
|
|
3596
|
+
private detachEditorCameras;
|
|
3597
|
+
/**
|
|
3598
|
+
* Published bridge builds do not report the last subscriber leaving.
|
|
3599
|
+
* While the editor is attached, look again each frame and tear the view
|
|
3600
|
+
* cameras down once both entity subscriptions are gone.
|
|
3601
|
+
*/
|
|
3602
|
+
private watchEditorDetached;
|
|
3603
|
+
private stopWatchingEditorDetached;
|
|
3545
3604
|
publishConfig(config: GameConfigPayload): void;
|
|
3546
3605
|
publishLoading(payload: BridgeLoadingPayload): void;
|
|
3547
3606
|
publishStatus(status: {
|
|
@@ -7620,7 +7679,6 @@ declare class StageDebugDelegate {
|
|
|
7620
7679
|
private debugCursor;
|
|
7621
7680
|
private placementGhost;
|
|
7622
7681
|
private debugLines;
|
|
7623
|
-
private cameraDebugDelegate;
|
|
7624
7682
|
private debugStateUnsubscribe;
|
|
7625
7683
|
private focusContextUnregister;
|
|
7626
7684
|
private entityResolverUnregister;
|
|
@@ -7642,7 +7700,7 @@ declare class StageDebugDelegate {
|
|
|
7642
7700
|
* point. Without one the tool warns instead of silently doing nothing.
|
|
7643
7701
|
*/
|
|
7644
7702
|
setAddEntityFactory(factory: AddEntityFactory | null): void;
|
|
7645
|
-
/** Camera used for
|
|
7703
|
+
/** Camera used for raycasts and gizmos: whichever one is rendering. */
|
|
7646
7704
|
private getDebugViewCamera;
|
|
7647
7705
|
private resolveEntity;
|
|
7648
7706
|
/**
|
|
@@ -7654,7 +7712,6 @@ declare class StageDebugDelegate {
|
|
|
7654
7712
|
private forEachSelectableEntity;
|
|
7655
7713
|
/** Copy all stage children into debugMap so raycast/select tools work after enabling debug mid-session. */
|
|
7656
7714
|
private populateDebugMap;
|
|
7657
|
-
private ensureCameraDebugDelegate;
|
|
7658
7715
|
/**
|
|
7659
7716
|
* Activate/deactivate only when `debugState.enabled` actually flips.
|
|
7660
7717
|
* Hover and selection write to `debugState` every frame, and `activate()`
|
|
@@ -7665,9 +7722,9 @@ declare class StageDebugDelegate {
|
|
|
7665
7722
|
/** Hand the transform tool its mode whenever the active tool changes. */
|
|
7666
7723
|
private syncToolMode;
|
|
7667
7724
|
private syncGrid;
|
|
7668
|
-
/** Initialize DOM listeners
|
|
7725
|
+
/** Initialize DOM listeners. The rendering camera stays whatever the editor selected. */
|
|
7669
7726
|
private activate;
|
|
7670
|
-
/** Tear down visuals
|
|
7727
|
+
/** Tear down visuals without changing which camera is rendering. */
|
|
7671
7728
|
private deactivate;
|
|
7672
7729
|
private rebindPostProcessing;
|
|
7673
7730
|
/**
|
|
@@ -9762,6 +9819,17 @@ declare class ZylemCamera {
|
|
|
9762
9819
|
* Disable user-configured orbital controls.
|
|
9763
9820
|
*/
|
|
9764
9821
|
disableOrbitalControls(): void;
|
|
9822
|
+
/**
|
|
9823
|
+
* Turn on orbit for an editor view camera.
|
|
9824
|
+
*
|
|
9825
|
+
* Locked views keep pan and zoom and freeze the seeded angle. The free
|
|
9826
|
+
* view can rotate. Controls stay allocated after this so a later visit
|
|
9827
|
+
* keeps the panned pose; use {@link setOrbitInteractionEnabled} to ignore
|
|
9828
|
+
* pointer input while another camera is showing.
|
|
9829
|
+
*/
|
|
9830
|
+
armEditorOrbit(lockRotation: boolean): void;
|
|
9831
|
+
/** Ignore pointer input without disposing orbit controls or their pose. */
|
|
9832
|
+
disarmEditorOrbit(): void;
|
|
9765
9833
|
/**
|
|
9766
9834
|
* Whether user orbital controls are enabled.
|
|
9767
9835
|
*/
|