@zylem/game-lib 0.8.3 → 0.8.6
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/actions.d.ts +7 -5
- package/dist/api/game-lib.api.json +3564 -395
- package/dist/api/game-lib.api.md +196 -12
- package/dist/api/game-lib.d.ts +547 -14
- package/dist/api/game-lib.typedoc.json +213478 -129350
- package/dist/base-node-idopiSw5.d.ts +96 -0
- package/dist/bridge.d.ts +41 -5
- package/dist/bridge.js +1 -1
- package/dist/catalog.d.ts +77 -0
- package/dist/catalog.js +1 -0
- package/dist/{chunk-CM5YRNBJ.js → chunk-7NYP4YAG.js} +1 -1
- package/dist/chunk-AE3CTVHY.js +1 -0
- package/dist/chunk-BCFFS3FP.js +1 -0
- package/dist/chunk-BMRFDDMR.js +1 -0
- package/dist/chunk-DECK4UEC.js +1 -0
- package/dist/chunk-DQQA3VJH.js +1 -0
- package/dist/chunk-FYQNZCIP.js +1 -0
- package/dist/chunk-GHJQ2HKI.js +1 -0
- package/dist/chunk-LD4KDRYL.js +24 -0
- package/dist/chunk-MXO4VGDB.js +1 -0
- package/dist/chunk-Q2YDBMVY.js +19 -0
- package/dist/chunk-QDQ4QMAI.js +1 -0
- package/dist/{chunk-TV3AZKT4.js → chunk-QVIUZEYA.js} +1 -1
- package/dist/chunk-SAQA4SXW.js +1 -0
- package/dist/chunk-VJZMSBKP.js +1 -0
- package/dist/{chunk-YAOXFYOD.js → chunk-WBQ5TNRZ.js} +1 -1
- package/dist/chunk-YOVE25NW.js +1 -0
- package/dist/{collision-builder-B_tm8OVy.d.ts → collision-builder-BckxkdmA.d.ts} +1 -1
- package/dist/core.d.ts +14 -11
- package/dist/core.js +1 -1
- package/dist/debug-state-B5awuDHl.d.ts +89 -0
- package/dist/debug.d.ts +200 -7
- package/dist/debug.js +1 -1
- package/dist/{entity-B9yZeBm4.d.ts → entity-BIf_a4dl.d.ts} +1 -1
- package/dist/{entity-BGEq1yfC.d.ts → entity-XZNGBeca.d.ts} +32 -98
- package/dist/{entity-type-map-CW6RHQkx.d.ts → entity-type-map-CkkFMSrL.d.ts} +42 -7
- package/dist/entity.d.ts +9 -7
- package/dist/entity.js +1 -1
- package/dist/{game-NHkubIfI.d.ts → game-Cy8f6gJm.d.ts} +181 -17
- package/dist/game-default-F3KPYZ7X.js +1 -0
- package/dist/graphics.d.ts +6 -5
- package/dist/graphics.js +1 -1
- package/dist/{material-DbSuZBbP.d.ts → material-CxxAyJYp.d.ts} +1 -1
- package/dist/public.d.ts +12 -10
- package/dist/public.js +1 -1
- package/dist/runtime.d.ts +3 -3
- package/dist/runtime.js +1 -1
- package/dist/{vector-DN6zlPoE.d.ts → simulation-body-zQw-emOr.d.ts} +11 -42
- package/dist/vector-D3eDzvcA.d.ts +41 -0
- package/dist/web-components.d.ts +12 -9
- package/dist/web-components.js +1 -1
- package/dist/{zylem-camera-Du2UPW9O.d.ts → zylem-camera-DZTpPOiD.d.ts} +12 -1
- package/package.json +21 -16
- package/LICENSE +0 -21
- package/dist/chunk-2VSVOPQN.js +0 -19
- package/dist/chunk-3I537JFL.js +0 -1
- package/dist/chunk-C5NEGC3S.js +0 -1
- package/dist/chunk-CV75NSES.js +0 -1
- package/dist/chunk-GKHAJ3MW.js +0 -1
- package/dist/chunk-LGS5N5M4.js +0 -1
- package/dist/chunk-LKFF6XJC.js +0 -1
- package/dist/chunk-Q27ULMXY.js +0 -24
- package/dist/chunk-W5SXED5T.js +0 -1
- package/dist/chunk-WVSYUWTT.js +0 -1
- package/dist/debug-state-Dp9CQQZ4.d.ts +0 -49
- package/dist/game-default-5TB3T5N7.js +0 -1
- /package/dist/{chunk-DFLI7ICU.js → chunk-MSCVL5OK.js} +0 -0
package/dist/api/game-lib.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ import { BridgeHandler } from '@zylem/bridge';
|
|
|
28
28
|
import { GameLoadingPayload as BridgeLoadingPayload } from '@zylem/bridge';
|
|
29
29
|
import { BridgeMessages } from '@zylem/bridge';
|
|
30
30
|
import { BridgeMessageType } from '@zylem/bridge';
|
|
31
|
+
import { BridgePose } from '@zylem/bridge';
|
|
31
32
|
import { BridgeVec3 } from '@zylem/bridge';
|
|
32
33
|
import { BufferGeometry } from 'three';
|
|
33
34
|
import { BurstParticlePresetOptions } from '@zylem/behaviors';
|
|
@@ -88,6 +89,7 @@ import { EntityDefinition } from '@zylem/behaviors/core';
|
|
|
88
89
|
import { EntityHandle } from '@zylem/behaviors/core';
|
|
89
90
|
import { EntitySummaryPayload } from '@zylem/bridge';
|
|
90
91
|
import { EntityThumbnailPayload } from '@zylem/bridge';
|
|
92
|
+
import { EntityTypeDescriptor } from '@zylem/bridge';
|
|
91
93
|
import { exp } from 'three/tsl';
|
|
92
94
|
import { FacingAngle2DEntity } from '@zylem/behaviors';
|
|
93
95
|
import { fireCooldown } from '@zylem/behaviors';
|
|
@@ -273,6 +275,7 @@ import { RuntimeTriggerRegion2DEvent } from '@zylem/behaviors/runtime-2d';
|
|
|
273
275
|
import { RuntimeTriggerRegion2DHandle } from '@zylem/behaviors/runtime-2d';
|
|
274
276
|
import { RuntimeTriggerRegion2DOptions } from '@zylem/behaviors/runtime-2d';
|
|
275
277
|
import { Scene } from 'three';
|
|
278
|
+
import { SceneOperationPayload } from '@zylem/bridge';
|
|
276
279
|
import { ScreenVisibilityBehavior } from '@zylem/behaviors';
|
|
277
280
|
import { ScreenVisibilityChangeContext } from '@zylem/behaviors';
|
|
278
281
|
import { ScreenVisibilityFSM } from '@zylem/behaviors';
|
|
@@ -333,6 +336,7 @@ import { StageTopDownPlane } from '@zylem/behaviors/core';
|
|
|
333
336
|
import { Static } from '@sinclair/typebox';
|
|
334
337
|
import { step } from 'three/tsl';
|
|
335
338
|
import { Texture } from 'three';
|
|
339
|
+
import * as three from 'three';
|
|
336
340
|
import { ThrusterBehavior } from '@zylem/behaviors';
|
|
337
341
|
import { ThrusterBehaviorOptions } from '@zylem/behaviors';
|
|
338
342
|
import { ThrusterEntity } from '@zylem/behaviors';
|
|
@@ -423,13 +427,16 @@ declare type ActorOptions = BaseNode | ZylemActorOptions;
|
|
|
423
427
|
/**
|
|
424
428
|
* Owns the stage's in-world debug/editor interaction layer.
|
|
425
429
|
*
|
|
426
|
-
* Self-manages around the global `debugState
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
431
|
-
*
|
|
432
|
-
*
|
|
430
|
+
* Self-manages around the global `debugState`, in two layers that switch on
|
|
431
|
+
* independently. The tool layer — mouse listeners, physics raycasts to
|
|
432
|
+
* hover/select/delete/spawn, the `DebugEntityCursor` highlight and the
|
|
433
|
+
* `PlacementGhost` — is live whenever a tool is armed, so the toolbar's buttons
|
|
434
|
+
* work on their own. The debug layer — the wasm simulation's collider
|
|
435
|
+
* wireframes and the orbit camera — is the part `debugState.enabled` gates, and
|
|
436
|
+
* is torn down when it goes off while the delegate stays alive to re-activate.
|
|
437
|
+
*
|
|
438
|
+
* Centralizes all of this so `ZylemStage` doesn't have to know about
|
|
439
|
+
* raycasting, DOM input, or debug rendering.
|
|
433
440
|
*/
|
|
434
441
|
|
|
435
442
|
declare type AddEntityFactory = (params: {
|
|
@@ -1217,6 +1224,14 @@ declare interface CleanupFunction<T, TGlobals extends GlobalRecord = any> {
|
|
|
1217
1224
|
*/
|
|
1218
1225
|
export declare function clearGlobalSubscriptions(): void;
|
|
1219
1226
|
|
|
1227
|
+
/**
|
|
1228
|
+
* Closest point along an infinite line to a ray, as a distance along the line.
|
|
1229
|
+
*
|
|
1230
|
+
* Returns `null` when the ray is close enough to parallel with the line that the
|
|
1231
|
+
* closest point becomes unstable; see {@link MAX_DRAG_GAIN}.
|
|
1232
|
+
*/
|
|
1233
|
+
export declare function closestAxisValue(ray: GizmoRay, origin: Vector3, axis: Vector3): number | null;
|
|
1234
|
+
|
|
1220
1235
|
/**
|
|
1221
1236
|
* Builds plain body + collider definitions consumable by the behaviors
|
|
1222
1237
|
* `Simulation` (`simulation.spawn(...)`). No physics-engine types appear
|
|
@@ -1345,6 +1360,31 @@ declare interface ConeMeshOptions extends BaseMeshOptions {
|
|
|
1345
1360
|
|
|
1346
1361
|
declare type ConeOptions = BaseNode | Partial<ZylemConeOptions>;
|
|
1347
1362
|
|
|
1363
|
+
/**
|
|
1364
|
+
* The y=0 construction plane, drawn so the snap lattice is legible.
|
|
1365
|
+
*
|
|
1366
|
+
* Two overlaid grids: fine lines at the translation snap increment, and heavier
|
|
1367
|
+
* lines every metre. Without the coarse pass a 0.25 grid over any useful area
|
|
1368
|
+
* reads as flat grey noise.
|
|
1369
|
+
*/
|
|
1370
|
+
|
|
1371
|
+
export declare class ConstructionGrid {
|
|
1372
|
+
private group;
|
|
1373
|
+
private scene;
|
|
1374
|
+
private fine;
|
|
1375
|
+
private coarse;
|
|
1376
|
+
private increment;
|
|
1377
|
+
constructor();
|
|
1378
|
+
addTo(scene: Scene): void;
|
|
1379
|
+
/** Rebuild only when the increment actually changed; this allocates. */
|
|
1380
|
+
setIncrement(increment: number): void;
|
|
1381
|
+
setVisible(visible: boolean): void;
|
|
1382
|
+
get visible(): boolean;
|
|
1383
|
+
dispose(): void;
|
|
1384
|
+
private rebuild;
|
|
1385
|
+
private clearHelpers;
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1348
1388
|
export { CooldownBehavior }
|
|
1349
1389
|
|
|
1350
1390
|
export { CooldownConfig }
|
|
@@ -1722,8 +1762,21 @@ declare interface DebugState {
|
|
|
1722
1762
|
* Proxy wrappers to engine code that expects real instances.
|
|
1723
1763
|
*/
|
|
1724
1764
|
selectedEntityId: string | null;
|
|
1765
|
+
/**
|
|
1766
|
+
* Full selection, in click order. `selectedEntityId` mirrors the first
|
|
1767
|
+
* entry. Only ever holds one uuid today, but the gizmo and scene operations
|
|
1768
|
+
* are already written against the list so multi-select needs no rework here.
|
|
1769
|
+
*/
|
|
1770
|
+
selectedEntityIds: string[];
|
|
1725
1771
|
/** UUID of the hovered entity. Same constraint as `selectedEntityId`. */
|
|
1726
1772
|
hoveredEntityId: string | null;
|
|
1773
|
+
snap: SnapSettings;
|
|
1774
|
+
/** Whether the construction-plane grid is drawn. */
|
|
1775
|
+
gridVisible: boolean;
|
|
1776
|
+
/** Catalog type the add tool will spawn, or null when disarmed. */
|
|
1777
|
+
addTypeId: string | null;
|
|
1778
|
+
/** Creation options merged over the armed type's defaults. */
|
|
1779
|
+
addTypeProps: Record<string, unknown> | null;
|
|
1727
1780
|
flags: Set<string>;
|
|
1728
1781
|
}
|
|
1729
1782
|
|
|
@@ -1731,6 +1784,8 @@ export declare const debugState: DebugState;
|
|
|
1731
1784
|
|
|
1732
1785
|
export declare type DebugTools = 'select' | 'translate' | 'rotate' | 'scale' | 'delete' | 'add' | 'none';
|
|
1733
1786
|
|
|
1787
|
+
export declare const DEFAULT_SNAP_SETTINGS: SnapSettings;
|
|
1788
|
+
|
|
1734
1789
|
/**
|
|
1735
1790
|
* Builds a ready-to-use {@link GameInputConfig} that wires up themed
|
|
1736
1791
|
* virtual touch controls for a player. Internally composes
|
|
@@ -1790,6 +1845,9 @@ export { defineBehavior }
|
|
|
1790
1845
|
|
|
1791
1846
|
export { DefineBehaviorConfig }
|
|
1792
1847
|
|
|
1848
|
+
/** Degrees to radians. */
|
|
1849
|
+
export declare function degreesToRadians(degrees: number): number;
|
|
1850
|
+
|
|
1793
1851
|
/**
|
|
1794
1852
|
* Wait for a duration. Useful inside `sequence()`.
|
|
1795
1853
|
*
|
|
@@ -1829,6 +1887,22 @@ export { DestructibleMesh }
|
|
|
1829
1887
|
|
|
1830
1888
|
export { DestructiblePrebakeWorkerAPI }
|
|
1831
1889
|
|
|
1890
|
+
/** A detached entity plus the pose to restore it at. */
|
|
1891
|
+
declare interface DetachedEntity {
|
|
1892
|
+
entity: any;
|
|
1893
|
+
position: {
|
|
1894
|
+
x: number;
|
|
1895
|
+
y: number;
|
|
1896
|
+
z: number;
|
|
1897
|
+
} | null;
|
|
1898
|
+
rotation: {
|
|
1899
|
+
x: number;
|
|
1900
|
+
y: number;
|
|
1901
|
+
z: number;
|
|
1902
|
+
w: number;
|
|
1903
|
+
} | null;
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1832
1906
|
export declare type DeviceProfile = 'auto' | 'desktop' | 'mobile';
|
|
1833
1907
|
|
|
1834
1908
|
export declare interface DirectionalLightOptions extends BaseLightOptions {
|
|
@@ -2055,6 +2129,12 @@ export { EntitySummaryPayload }
|
|
|
2055
2129
|
/**
|
|
2056
2130
|
* Generates and caches entity thumbnail previews for the editor entity list.
|
|
2057
2131
|
* Renders a cloned Object3D into an offscreen RenderTarget on the shared WebGPU renderer.
|
|
2132
|
+
*
|
|
2133
|
+
* A rendered URL leaves this cache the moment it is read, and the editor holds
|
|
2134
|
+
* it for as long as the entity is listed. Dropping an entry here therefore
|
|
2135
|
+
* must not revoke its blob URL — the consumer owns that lifetime and releases
|
|
2136
|
+
* it when the thumbnail is replaced, the entity is removed, or the stage
|
|
2137
|
+
* changes.
|
|
2058
2138
|
*/
|
|
2059
2139
|
export declare class EntityThumbnailCache {
|
|
2060
2140
|
private cache;
|
|
@@ -2130,6 +2210,9 @@ export declare interface EntityTypeMap {
|
|
|
2130
2210
|
[LINE_TYPE]: ZylemLine;
|
|
2131
2211
|
}
|
|
2132
2212
|
|
|
2213
|
+
/** Convert Euler angles (radians, XYZ order) to a quaternion. */
|
|
2214
|
+
export declare function eulerToQuaternion(rotation: Vec3): Quat;
|
|
2215
|
+
|
|
2133
2216
|
/**
|
|
2134
2217
|
* Reusable delegate for event emission and subscription.
|
|
2135
2218
|
* Use via composition in Game, Stage, and Entity classes.
|
|
@@ -2512,6 +2595,11 @@ export declare class GameBridge {
|
|
|
2512
2595
|
* an editor command can never echo back as a game update.
|
|
2513
2596
|
*/
|
|
2514
2597
|
private editorKnown;
|
|
2598
|
+
/**
|
|
2599
|
+
* True while an undo/redo is being applied, so the writes it performs are
|
|
2600
|
+
* not themselves recorded as new operations.
|
|
2601
|
+
*/
|
|
2602
|
+
private applyingSceneOperation;
|
|
2515
2603
|
constructor();
|
|
2516
2604
|
/**
|
|
2517
2605
|
* Subscribe to editor commands and announce the game side as ready.
|
|
@@ -2542,6 +2630,12 @@ export declare class GameBridge {
|
|
|
2542
2630
|
* Run a callback when an editor first subscribes to entity data, so the
|
|
2543
2631
|
* game can backfill state produced while nothing was listening.
|
|
2544
2632
|
*
|
|
2633
|
+
* An editor takes out both entity subscriptions as it mounts, and each is
|
|
2634
|
+
* a first-subscriber transition. Backfilling on both would republish the
|
|
2635
|
+
* config, the whole stage snapshot, and every thumbnail twice per mount,
|
|
2636
|
+
* so a signal is ignored while the other entity type still has a
|
|
2637
|
+
* listener — that is the same editor finishing its setup, not a new one.
|
|
2638
|
+
*
|
|
2545
2639
|
* @returns An unsubscribe function.
|
|
2546
2640
|
*/
|
|
2547
2641
|
onEditorAttached(callback: () => void): () => void;
|
|
@@ -2551,6 +2645,14 @@ export declare class GameBridge {
|
|
|
2551
2645
|
paused?: boolean;
|
|
2552
2646
|
debug?: boolean;
|
|
2553
2647
|
}): void;
|
|
2648
|
+
/**
|
|
2649
|
+
* Publish a global's new value.
|
|
2650
|
+
*
|
|
2651
|
+
* Sent rather than queued: a queued payload is merged into the pending one
|
|
2652
|
+
* for its type, and since each message names a single `path`, two globals
|
|
2653
|
+
* changing in the same frame would collapse into one and the first
|
|
2654
|
+
* variable's update would never reach the editor.
|
|
2655
|
+
*/
|
|
2554
2656
|
publishVariable(payload: GameVariablePayload): void;
|
|
2555
2657
|
/** Surface a diagnostic message in the editor console. */
|
|
2556
2658
|
publishNotice(level: GameNoticePayload['level'], message: string): void;
|
|
@@ -2561,6 +2663,17 @@ export declare class GameBridge {
|
|
|
2561
2663
|
queueEntityRemoved(uuids: string[]): void;
|
|
2562
2664
|
/** RAF-coalesced thumbnail stream; merged by uuid per frame. */
|
|
2563
2665
|
queueThumbnails(thumbnails: EntityThumbnailPayload[]): void;
|
|
2666
|
+
/** Publish the placeable entity types the editor's Add palette offers. */
|
|
2667
|
+
publishCatalog(entities: EntityTypeDescriptor[]): void;
|
|
2668
|
+
/**
|
|
2669
|
+
* Publish a committed, invertible change for the editor's undo stack.
|
|
2670
|
+
*
|
|
2671
|
+
* Sent rather than queued: coalescing merges same-type payloads within a
|
|
2672
|
+
* frame, which would fuse two operations into one and lose an undo step.
|
|
2673
|
+
*/
|
|
2674
|
+
publishSceneOperation(op: SceneOperationPayload): void;
|
|
2675
|
+
/** Whether an editor is tracking scene operations for undo. */
|
|
2676
|
+
wantsSceneOperations(): boolean;
|
|
2564
2677
|
}
|
|
2565
2678
|
|
|
2566
2679
|
/**
|
|
@@ -2583,6 +2696,10 @@ export declare interface GameBridgeHost {
|
|
|
2583
2696
|
resolveEntity(uuid: string): GameEntity<any> | null;
|
|
2584
2697
|
/** Write a stage variable (editor `stage:variable:set`). */
|
|
2585
2698
|
setStageVariable?(key: string, value: unknown): void;
|
|
2699
|
+
/** Spawn a catalog entity into the current stage (editor `entity:create`). */
|
|
2700
|
+
createEntity?(typeId: string, props: Record<string, unknown> | undefined, pose: BridgePose | undefined): void;
|
|
2701
|
+
/** Undo or redo a committed scene operation (`scene:operation:apply`). */
|
|
2702
|
+
applySceneOperation?(op: SceneOperationPayload, direction: 'undo' | 'redo'): void;
|
|
2586
2703
|
}
|
|
2587
2704
|
|
|
2588
2705
|
/**
|
|
@@ -2845,6 +2962,18 @@ export declare class GameEntity<O extends GameEntityOptions> extends BaseNode<O>
|
|
|
2845
2962
|
physicsWorldRef: unknown;
|
|
2846
2963
|
colliderDesc: SimulationColliderDefinition | undefined;
|
|
2847
2964
|
custom: Record<string, any>;
|
|
2965
|
+
/**
|
|
2966
|
+
* Pristine collider definitions captured before the first scale change, so
|
|
2967
|
+
* scaling stays absolute rather than compounding. See
|
|
2968
|
+
* {@link ensureColliderBaseline}.
|
|
2969
|
+
*/
|
|
2970
|
+
colliderBaseline: SimulationColliderDefinition[] | null;
|
|
2971
|
+
/**
|
|
2972
|
+
* Set when {@link GameEntity.setScale} has scaled the render object but the
|
|
2973
|
+
* colliders have not been rebuilt yet. Cleared by
|
|
2974
|
+
* {@link commitColliderScale}.
|
|
2975
|
+
*/
|
|
2976
|
+
colliderScaleDirty: boolean;
|
|
2848
2977
|
/** All collider descriptions for this entity (including primary) */
|
|
2849
2978
|
colliderDescs: SimulationColliderDefinition[];
|
|
2850
2979
|
/** Additional meshes for compound visual entities (added via add()) */
|
|
@@ -2884,6 +3013,8 @@ export declare class GameEntity<O extends GameEntityOptions> extends BaseNode<O>
|
|
|
2884
3013
|
private trackAddedComponents;
|
|
2885
3014
|
private trackedComponents;
|
|
2886
3015
|
transformStore: TransformState;
|
|
3016
|
+
/** Absolute scale, authored by the editor. Unit scale until changed. */
|
|
3017
|
+
private _scale;
|
|
2887
3018
|
/** Hide render target until spawn placement is confirmed. */
|
|
2888
3019
|
_spawnPlacementPending: boolean;
|
|
2889
3020
|
/** Author passed `position` in create options. */
|
|
@@ -2955,6 +3086,17 @@ export declare class GameEntity<O extends GameEntityOptions> extends BaseNode<O>
|
|
|
2955
3086
|
w: number;
|
|
2956
3087
|
};
|
|
2957
3088
|
}): boolean;
|
|
3089
|
+
/** Current absolute scale. */
|
|
3090
|
+
getScale(): Vec3;
|
|
3091
|
+
/**
|
|
3092
|
+
* Set absolute scale on the render object.
|
|
3093
|
+
*
|
|
3094
|
+
* Colliders are *not* resized here — they are baked into the wasm
|
|
3095
|
+
* simulation and can only be replaced by respawning the body, which is far
|
|
3096
|
+
* too costly to do per drag frame. The entity is flagged instead, and
|
|
3097
|
+
* {@link commitColliderScale} rebuilds them once the gesture commits.
|
|
3098
|
+
*/
|
|
3099
|
+
setScale(x: number, y: number, z: number): void;
|
|
2958
3100
|
/**
|
|
2959
3101
|
* Add meshes, collision components, or child entities to this entity.
|
|
2960
3102
|
* Supports fluent chaining: `entity.add(boxMesh()).add(boxCollision())`.
|
|
@@ -3383,6 +3525,12 @@ export declare function getSelectedEntity(): GameEntity<any> | null;
|
|
|
3383
3525
|
|
|
3384
3526
|
export declare function getSelectedEntityId(): string | null;
|
|
3385
3527
|
|
|
3528
|
+
/** Every selected uuid, in click order. */
|
|
3529
|
+
export declare function getSelectedEntityIds(): string[];
|
|
3530
|
+
|
|
3531
|
+
/** Current snap increments. */
|
|
3532
|
+
export declare function getSnapSettings(): SnapSettings;
|
|
3533
|
+
|
|
3386
3534
|
/**
|
|
3387
3535
|
* Get a variable from an object by path.
|
|
3388
3536
|
* @example getVariable(stage1, 'totalAngle') // 0.5
|
|
@@ -3394,6 +3542,30 @@ export { getVelocity }
|
|
|
3394
3542
|
|
|
3395
3543
|
export { getZylemBridge }
|
|
3396
3544
|
|
|
3545
|
+
/** Single-axis, planar, and uniform handle identifiers. */
|
|
3546
|
+
export declare type GizmoAxis = 'x' | 'y' | 'z' | 'xy' | 'yz' | 'xz' | 'xyz';
|
|
3547
|
+
|
|
3548
|
+
/** A raw, unsnapped drag result in world space. */
|
|
3549
|
+
export declare type GizmoDelta = {
|
|
3550
|
+
kind: 'translate';
|
|
3551
|
+
offset: Vector3;
|
|
3552
|
+
} | {
|
|
3553
|
+
kind: 'rotate';
|
|
3554
|
+
axis: Vector3;
|
|
3555
|
+
angle: number;
|
|
3556
|
+
} | {
|
|
3557
|
+
kind: 'scale';
|
|
3558
|
+
factor: Vector3;
|
|
3559
|
+
};
|
|
3560
|
+
|
|
3561
|
+
export declare type GizmoMode = 'translate' | 'rotate' | 'scale';
|
|
3562
|
+
|
|
3563
|
+
/** A mouse ray in world space. */
|
|
3564
|
+
export declare interface GizmoRay {
|
|
3565
|
+
origin: Vector3;
|
|
3566
|
+
direction: Vector3;
|
|
3567
|
+
}
|
|
3568
|
+
|
|
3397
3569
|
/**
|
|
3398
3570
|
* Listen for a single global key change inside an onUpdate pipeline.
|
|
3399
3571
|
* Usage: onUpdate(globalChange('p1Score', (value) => { ... }))
|
|
@@ -3614,6 +3786,14 @@ declare class InstanceManager {
|
|
|
3614
3786
|
private growPack;
|
|
3615
3787
|
}
|
|
3616
3788
|
|
|
3789
|
+
/**
|
|
3790
|
+
* Intersect a ray with the plane through `origin` with the given normal.
|
|
3791
|
+
*
|
|
3792
|
+
* Returns `null` for a plane seen too close to edge-on, where the hit point
|
|
3793
|
+
* races away across the plane for very little pointer motion.
|
|
3794
|
+
*/
|
|
3795
|
+
export declare function intersectPlane(ray: GizmoRay, origin: Vector3, normal: Vector3, target: Vector3): Vector3 | null;
|
|
3796
|
+
|
|
3617
3797
|
/**
|
|
3618
3798
|
* Check if a shader is a GLSL shader
|
|
3619
3799
|
*/
|
|
@@ -3631,6 +3811,8 @@ declare interface IStage {
|
|
|
3631
3811
|
onDestroy: (callback: DestroyFunction<IStage>) => void;
|
|
3632
3812
|
}
|
|
3633
3813
|
|
|
3814
|
+
export declare function isTransformTool(tool: DebugTools): tool is TransformTool;
|
|
3815
|
+
|
|
3634
3816
|
/**
|
|
3635
3817
|
* Check if a shader is a TSL shader
|
|
3636
3818
|
*/
|
|
@@ -4460,6 +4642,26 @@ declare interface PyramidMeshOptions extends BaseMeshOptions {
|
|
|
4460
4642
|
|
|
4461
4643
|
declare type PyramidOptions = BaseNode | Partial<ZylemPyramidOptions>;
|
|
4462
4644
|
|
|
4645
|
+
/**
|
|
4646
|
+
* Pure transform math shared by the editor gizmo, the bridge adapter, and
|
|
4647
|
+
* their tests. No THREE scene state and no simulation access, so it can be
|
|
4648
|
+
* exercised in a plain node environment.
|
|
4649
|
+
*/
|
|
4650
|
+
|
|
4651
|
+
/** Quaternion as carried by the bridge and the wasm runtime. */
|
|
4652
|
+
export declare interface Quat {
|
|
4653
|
+
x: number;
|
|
4654
|
+
y: number;
|
|
4655
|
+
z: number;
|
|
4656
|
+
w: number;
|
|
4657
|
+
}
|
|
4658
|
+
|
|
4659
|
+
/** Convert a quaternion to Euler angles (radians, XYZ order). */
|
|
4660
|
+
export declare function quaternionToEuler(rotation: Quat): Vec3;
|
|
4661
|
+
|
|
4662
|
+
/** Radians to degrees. */
|
|
4663
|
+
export declare function radiansToDegrees(radians: number): number;
|
|
4664
|
+
|
|
4463
4665
|
export declare const RECT_TYPE: unique symbol;
|
|
4464
4666
|
|
|
4465
4667
|
declare type RectOptions = BaseNode | Partial<ZylemRectOptions>;
|
|
@@ -5155,6 +5357,9 @@ export { SemanticParticlePresetOptions }
|
|
|
5155
5357
|
*/
|
|
5156
5358
|
export declare function sequence(...actions: Action[]): Action;
|
|
5157
5359
|
|
|
5360
|
+
/** Arm the add tool with a catalog type, or pass `null` to disarm it. */
|
|
5361
|
+
export declare function setAddType(typeId: string | null, props?: Record<string, unknown> | null): void;
|
|
5362
|
+
|
|
5158
5363
|
/**
|
|
5159
5364
|
* Display a camera's live feed on an entity's mesh surface.
|
|
5160
5365
|
*
|
|
@@ -5194,6 +5399,8 @@ export declare function setDebugTool(tool: DebugTools): void;
|
|
|
5194
5399
|
*/
|
|
5195
5400
|
export declare function setGlobal(path: string, value: unknown): void;
|
|
5196
5401
|
|
|
5402
|
+
export declare function setGridVisible(visible: boolean): void;
|
|
5403
|
+
|
|
5197
5404
|
export declare function setHoveredEntityId(uuid: string | null): void;
|
|
5198
5405
|
|
|
5199
5406
|
export declare function setPaused(paused: boolean): void;
|
|
@@ -5254,6 +5461,15 @@ export declare function setSelectedEntity(entity: GameEntity<any> | string | nul
|
|
|
5254
5461
|
|
|
5255
5462
|
export declare function setSelectedEntityId(uuid: string | null): void;
|
|
5256
5463
|
|
|
5464
|
+
/**
|
|
5465
|
+
* Replace the selection. `selectedEntityId` follows the first entry so the
|
|
5466
|
+
* single-select consumers (debug cursor, orbit focus target, bridge mirror)
|
|
5467
|
+
* keep working unchanged.
|
|
5468
|
+
*/
|
|
5469
|
+
export declare function setSelectedEntityIds(uuids: string[]): void;
|
|
5470
|
+
|
|
5471
|
+
export declare function setSnapSettings(snap: Partial<SnapSettings>): void;
|
|
5472
|
+
|
|
5257
5473
|
export declare function setStageFrameProfilerEnabled(value: boolean): void;
|
|
5258
5474
|
|
|
5259
5475
|
/** Setup */
|
|
@@ -5338,8 +5554,16 @@ export declare class SimulationBody implements PhysicsRenderPoseProvider {
|
|
|
5338
5554
|
*/
|
|
5339
5555
|
private interpolationValidAfterStep;
|
|
5340
5556
|
constructor(simulation: Simulation, handle: EntityHandle, clock: SimulationStepClock);
|
|
5341
|
-
/**
|
|
5342
|
-
|
|
5557
|
+
/**
|
|
5558
|
+
* Suppress interpolation until the render buffers catch up.
|
|
5559
|
+
*
|
|
5560
|
+
* Called automatically by the pose setters below. Wasm-side behaviors that
|
|
5561
|
+
* teleport a body during a step (e.g. `screen_wrap`) bypass those setters,
|
|
5562
|
+
* so their host systems must call this after the step and before render
|
|
5563
|
+
* poses are synced — otherwise the render buffers straddle the teleport and
|
|
5564
|
+
* the body is drawn sweeping between the two poses.
|
|
5565
|
+
*/
|
|
5566
|
+
markPoseDiscontinuity(): void;
|
|
5343
5567
|
private isInterpolationStale;
|
|
5344
5568
|
translation(): PhysicsVector3;
|
|
5345
5569
|
rotation(): PhysicsQuaternion;
|
|
@@ -5431,6 +5655,36 @@ export { sin }
|
|
|
5431
5655
|
|
|
5432
5656
|
export { smoothstep }
|
|
5433
5657
|
|
|
5658
|
+
/**
|
|
5659
|
+
* Snap a scale, clamped away from zero.
|
|
5660
|
+
*
|
|
5661
|
+
* A snapped-to-zero axis would collapse the collider into a degenerate shape
|
|
5662
|
+
* that the physics runtime cannot solve, so the smallest representable scale
|
|
5663
|
+
* is one increment.
|
|
5664
|
+
*/
|
|
5665
|
+
export declare function snapScale(value: Vec3, increment: number): Vec3;
|
|
5666
|
+
|
|
5667
|
+
/** Grid increments applied to gizmo drags, in world units and radians. */
|
|
5668
|
+
export declare interface SnapSettings {
|
|
5669
|
+
enabled: boolean;
|
|
5670
|
+
translate: number;
|
|
5671
|
+
/** Radians. Defaults to 15 degrees. */
|
|
5672
|
+
rotate: number;
|
|
5673
|
+
scale: number;
|
|
5674
|
+
}
|
|
5675
|
+
|
|
5676
|
+
/**
|
|
5677
|
+
* Snap a value onto an absolute lattice of `increment`-sized steps.
|
|
5678
|
+
*
|
|
5679
|
+
* Absolute rather than relative to where the drag started: the result is
|
|
5680
|
+
* always a multiple of the increment, so independently placed entities line up
|
|
5681
|
+
* with each other instead of each keeping its own arbitrary offset.
|
|
5682
|
+
*/
|
|
5683
|
+
export declare function snapToIncrement(value: number, increment: number): number;
|
|
5684
|
+
|
|
5685
|
+
/** {@link snapToIncrement} across all three components. */
|
|
5686
|
+
export declare function snapVec3(value: Vec3, increment: number): Vec3;
|
|
5687
|
+
|
|
5434
5688
|
export declare const SPHERE_TYPE: unique symbol;
|
|
5435
5689
|
|
|
5436
5690
|
/**
|
|
@@ -5497,6 +5751,21 @@ export declare type SpriteImage = {
|
|
|
5497
5751
|
|
|
5498
5752
|
declare type SpriteOptions = BaseNode | Partial<ZylemSpriteOptions>;
|
|
5499
5753
|
|
|
5754
|
+
/**
|
|
5755
|
+
* A single texture divided into a uniform grid of frames, addressed by UV
|
|
5756
|
+
* offset. Prefer this over {@link SpriteImage} lists for character sheets: one
|
|
5757
|
+
* texture and one draw call instead of one per frame.
|
|
5758
|
+
*/
|
|
5759
|
+
export declare type SpriteSheet = {
|
|
5760
|
+
file: string;
|
|
5761
|
+
columns: number;
|
|
5762
|
+
rows: number;
|
|
5763
|
+
/** Frame names in row-major order. `null` marks an unused cell. */
|
|
5764
|
+
frames: Array<string | null>;
|
|
5765
|
+
/** Texture filtering. Defaults to `nearest`, which keeps pixel art crisp. */
|
|
5766
|
+
filter?: 'nearest' | 'linear';
|
|
5767
|
+
};
|
|
5768
|
+
|
|
5500
5769
|
declare class Stage {
|
|
5501
5770
|
wrappedStage: ZylemStage | null;
|
|
5502
5771
|
options: StageOptionItem[];
|
|
@@ -5678,10 +5947,10 @@ declare class StageDebugDelegate {
|
|
|
5678
5947
|
private options;
|
|
5679
5948
|
private mouseNdc;
|
|
5680
5949
|
private raycaster;
|
|
5681
|
-
private isMouseDown;
|
|
5682
5950
|
private domDisposeFns;
|
|
5683
5951
|
private domListenersAttached;
|
|
5684
5952
|
private debugCursor;
|
|
5953
|
+
private placementGhost;
|
|
5685
5954
|
private debugLines;
|
|
5686
5955
|
private cameraDebugDelegate;
|
|
5687
5956
|
private debugStateUnsubscribe;
|
|
@@ -5689,6 +5958,11 @@ declare class StageDebugDelegate {
|
|
|
5689
5958
|
private entityResolverUnregister;
|
|
5690
5959
|
private lastDebugEnabled;
|
|
5691
5960
|
private warnedMissingAddFactory;
|
|
5961
|
+
private transformTool;
|
|
5962
|
+
private grid;
|
|
5963
|
+
private lastTool;
|
|
5964
|
+
/** Element the current gizmo drag captured, so pointerup is never missed. */
|
|
5965
|
+
private capturedPointer;
|
|
5692
5966
|
constructor(stage: ZylemStage, options?: StageDebugDelegateOptions);
|
|
5693
5967
|
/**
|
|
5694
5968
|
* Supply the factory the `add` tool uses to spawn entities at the clicked
|
|
@@ -5708,18 +5982,107 @@ declare class StageDebugDelegate {
|
|
|
5708
5982
|
* rebuild the render pipeline once per frame.
|
|
5709
5983
|
*/
|
|
5710
5984
|
private syncWithDebugState;
|
|
5985
|
+
/** Hand the transform tool its mode whenever the active tool changes. */
|
|
5986
|
+
private syncToolMode;
|
|
5987
|
+
private syncGrid;
|
|
5711
5988
|
/** Initialize DOM listeners and switch rendering to the debug orbit camera. */
|
|
5712
5989
|
private activate;
|
|
5713
5990
|
/** Tear down visuals and restore the gameplay primary camera. */
|
|
5714
5991
|
private deactivate;
|
|
5715
5992
|
private rebindPostProcessing;
|
|
5993
|
+
/**
|
|
5994
|
+
* Collider wireframes: the one overlay that really is debug-mode-only, since
|
|
5995
|
+
* it draws the simulation itself rather than anything being edited.
|
|
5996
|
+
*/
|
|
5716
5997
|
private initDebugVisuals;
|
|
5717
5998
|
private disposeDebugVisuals;
|
|
5999
|
+
/**
|
|
6000
|
+
* Tool feedback, built on first use and kept for the delegate's life.
|
|
6001
|
+
*
|
|
6002
|
+
* Separate from {@link initDebugVisuals} because the hover highlight and the
|
|
6003
|
+
* placement ghost belong to the tools, not to debug mode: they have to be
|
|
6004
|
+
* available when a tool is armed with debug off.
|
|
6005
|
+
*/
|
|
6006
|
+
private ensureToolVisuals;
|
|
6007
|
+
/**
|
|
6008
|
+
* Hide the overlays whose tool has just gone away.
|
|
6009
|
+
*
|
|
6010
|
+
* `update()` normally does this, but it stops being called once nothing is
|
|
6011
|
+
* armed and debug is off — so the frame that would have hidden a disarmed
|
|
6012
|
+
* Add's ghost never arrives, and the preview is left floating in the scene.
|
|
6013
|
+
* Driven from the tool transition, which always fires.
|
|
6014
|
+
*/
|
|
6015
|
+
private parkToolVisuals;
|
|
6016
|
+
private disposeToolVisuals;
|
|
5718
6017
|
update(): void;
|
|
6018
|
+
/** Collider wireframes, straight from the wasm simulation. */
|
|
6019
|
+
private updateColliderWireframes;
|
|
6020
|
+
/**
|
|
6021
|
+
* Make sure an armed tool can actually receive the pointer.
|
|
6022
|
+
*
|
|
6023
|
+
* The listeners outlive debug mode once attached — `deactivate()` leaves them
|
|
6024
|
+
* in place and only `dispose()` removes them — so this only ever has to run
|
|
6025
|
+
* until it succeeds.
|
|
6026
|
+
*/
|
|
6027
|
+
private ensureInteraction;
|
|
6028
|
+
/**
|
|
6029
|
+
* Drive the translucent preview of the armed entity type from the cursor.
|
|
6030
|
+
*
|
|
6031
|
+
* Runs while the game is paused as well as while it plays: only the
|
|
6032
|
+
* fixed-step `step()` is pause-gated, so this pass still ticks and the
|
|
6033
|
+
* ghost keeps following the mouse in a frozen scene — which is exactly when
|
|
6034
|
+
* a scene is usually being built. It runs with debug mode off too, for the
|
|
6035
|
+
* same reason: arming Add is a request to place something, not to inspect
|
|
6036
|
+
* colliders.
|
|
6037
|
+
*
|
|
6038
|
+
* The ghost is a scene overlay, not an entity, so it is invisible to the
|
|
6039
|
+
* physics raycast here and cannot preview itself.
|
|
6040
|
+
*/
|
|
6041
|
+
private updatePlacementGhost;
|
|
5719
6042
|
/** Full teardown — unsubscribes from debugState and cleans up all resources. */
|
|
5720
6043
|
dispose(): void;
|
|
5721
|
-
|
|
6044
|
+
/**
|
|
6045
|
+
* Undo or redo a committed operation.
|
|
6046
|
+
*
|
|
6047
|
+
* The editor holds the history but cannot apply it: reverting a delete means
|
|
6048
|
+
* producing the original entity, which only the stage can do. So the editor
|
|
6049
|
+
* hands the record back and the inversion happens here.
|
|
6050
|
+
*/
|
|
6051
|
+
applySceneOperation(op: SceneOperationPayload, direction: 'undo' | 'redo'): void;
|
|
6052
|
+
/** The mouse ray in world space, from the last pointer position. */
|
|
6053
|
+
private currentRay;
|
|
6054
|
+
private handleAction;
|
|
6055
|
+
/**
|
|
6056
|
+
* Spawn the armed entity type at the clicked point.
|
|
6057
|
+
*
|
|
6058
|
+
* Placement resolves in two steps because a click into empty sky is the
|
|
6059
|
+
* common case when building a scene from nothing: the physics hit is
|
|
6060
|
+
* preferred (the entity rests on the surface it was dropped onto), and
|
|
6061
|
+
* otherwise the ray is intersected with the y=0 construction plane. Before
|
|
6062
|
+
* this, clicking anywhere without an existing collider under the cursor did
|
|
6063
|
+
* nothing at all.
|
|
6064
|
+
*/
|
|
6065
|
+
private placeEntity;
|
|
6066
|
+
/**
|
|
6067
|
+
* Nudge a freshly placed entity out along the surface normal by half its
|
|
6068
|
+
* own size, so it sits on the surface rather than half-buried in it.
|
|
6069
|
+
*
|
|
6070
|
+
* Runs after spawn because the entity's bounds are not known until its mesh
|
|
6071
|
+
* exists.
|
|
6072
|
+
*/
|
|
6073
|
+
private restOnSurface;
|
|
6074
|
+
private warnMissingAddSource;
|
|
5722
6075
|
private attachDomListeners;
|
|
6076
|
+
/**
|
|
6077
|
+
* Own the pointer for the duration of a gizmo drag.
|
|
6078
|
+
*
|
|
6079
|
+
* Capture keeps events coming even when the cursor leaves the canvas, which
|
|
6080
|
+
* happens constantly when dragging an axis toward the edge of the viewport.
|
|
6081
|
+
* Orbit is suspended for the same window so the drag does not also swing the
|
|
6082
|
+
* camera.
|
|
6083
|
+
*/
|
|
6084
|
+
private beginPointerCapture;
|
|
6085
|
+
private endPointerCapture;
|
|
5723
6086
|
}
|
|
5724
6087
|
|
|
5725
6088
|
declare interface StageDebugDelegateOptions {
|
|
@@ -5762,6 +6125,11 @@ declare class StageEntityDelegate {
|
|
|
5762
6125
|
readonly childrenMap: Map<string, BaseNode>;
|
|
5763
6126
|
/** UUID → BaseNode map populated when debug mode is active. */
|
|
5764
6127
|
readonly debugMap: Map<string, BaseNode>;
|
|
6128
|
+
/**
|
|
6129
|
+
* Entities detached from the stage but kept alive so an editor undo can put
|
|
6130
|
+
* them back. See {@link StageEntityDelegate.detachEntity}.
|
|
6131
|
+
*/
|
|
6132
|
+
readonly detachedMap: Map<string, DetachedEntity>;
|
|
5765
6133
|
private pendingEntities;
|
|
5766
6134
|
private pendingPromises;
|
|
5767
6135
|
private _isLoaded;
|
|
@@ -5811,10 +6179,48 @@ declare class StageEntityDelegate {
|
|
|
5811
6179
|
/** Add the entity to internal maps and notify listeners. */
|
|
5812
6180
|
addEntityToStage(entity: BaseNode): void;
|
|
5813
6181
|
/**
|
|
5814
|
-
* Remove an entity
|
|
6182
|
+
* Remove an entity from the stage by its UUID.
|
|
6183
|
+
*
|
|
6184
|
+
* Detaches rather than destroys, so an editor undo can put the same
|
|
6185
|
+
* instance back. See {@link StageEntityDelegate.detachEntity}.
|
|
6186
|
+
*
|
|
5815
6187
|
* @returns true if removed, false if not found or stage not ready
|
|
5816
6188
|
*/
|
|
5817
6189
|
removeEntityByUuid(uuid: string): boolean;
|
|
6190
|
+
/**
|
|
6191
|
+
* Take an entity out of the stage while keeping the instance alive.
|
|
6192
|
+
*
|
|
6193
|
+
* The editor cannot rebuild an entity — all it ever receives is a summary of
|
|
6194
|
+
* name, type, and transform, with no material, behaviors, or collider
|
|
6195
|
+
* config. So undoing a delete has to restore the original object, which
|
|
6196
|
+
* means holding onto it here. Keeping the same instance also keeps its uuid
|
|
6197
|
+
* stable, which every other entry in the undo stack depends on.
|
|
6198
|
+
*
|
|
6199
|
+
* Observers are still told the entity is gone: from the outside it has left
|
|
6200
|
+
* the stage, and leaving it in the editor's list or the thumbnail cache
|
|
6201
|
+
* would leak.
|
|
6202
|
+
*
|
|
6203
|
+
* @returns true when the entity was found and detached.
|
|
6204
|
+
*/
|
|
6205
|
+
detachEntity(uuid: string): boolean;
|
|
6206
|
+
/**
|
|
6207
|
+
* Put a detached entity back into the stage at the pose it left.
|
|
6208
|
+
*
|
|
6209
|
+
* Unlike {@link StageEntityDelegate.spawnEntity} this never calls
|
|
6210
|
+
* `create()`: the entity is already fully built, and rebuilding it would
|
|
6211
|
+
* discard its meshes and colliders along with any editor scale applied to
|
|
6212
|
+
* them.
|
|
6213
|
+
*
|
|
6214
|
+
* @returns true when the entity was found and restored.
|
|
6215
|
+
*/
|
|
6216
|
+
restoreEntity(uuid: string): boolean;
|
|
6217
|
+
/** Whether a uuid is currently recoverable via {@link restoreEntity}. */
|
|
6218
|
+
isDetached(uuid: string): boolean;
|
|
6219
|
+
/**
|
|
6220
|
+
* Destroy detached entities past the recoverable window. Insertion-ordered,
|
|
6221
|
+
* so the oldest detachments go first.
|
|
6222
|
+
*/
|
|
6223
|
+
private evictOldestDetached;
|
|
5818
6224
|
/** Get an entity by its name; returns null if not found. */
|
|
5819
6225
|
getEntityByName(name: string): BaseNode | null;
|
|
5820
6226
|
/** Build a serializable state snapshot for an entity. */
|
|
@@ -6532,6 +6938,9 @@ export declare const touchThemes: {
|
|
|
6532
6938
|
readonly lagoon: TouchTheme;
|
|
6533
6939
|
};
|
|
6534
6940
|
|
|
6941
|
+
/** Tools that manipulate a selected entity's transform via the gizmo. */
|
|
6942
|
+
export declare const TRANSFORM_TOOLS: readonly ["translate", "rotate", "scale"];
|
|
6943
|
+
|
|
6535
6944
|
/**
|
|
6536
6945
|
* Structural slice of the simulation body facade used to flush transform
|
|
6537
6946
|
* intents. `SimulationBody` satisfies this shape.
|
|
@@ -6589,6 +6998,91 @@ declare interface TransformableEntity {
|
|
|
6589
6998
|
|
|
6590
6999
|
export { TransformComponent }
|
|
6591
7000
|
|
|
7001
|
+
export declare class TransformGizmo {
|
|
7002
|
+
/** Root added to the scene; carries the pivot transform. */
|
|
7003
|
+
readonly root: Group<three.Object3DEventMap>;
|
|
7004
|
+
private scene;
|
|
7005
|
+
private modeGroups;
|
|
7006
|
+
private handles;
|
|
7007
|
+
private materials;
|
|
7008
|
+
private geometries;
|
|
7009
|
+
private mode;
|
|
7010
|
+
private highlighted;
|
|
7011
|
+
private drag;
|
|
7012
|
+
private raycaster;
|
|
7013
|
+
constructor();
|
|
7014
|
+
addTo(scene: Scene): void;
|
|
7015
|
+
removeFromScene(): void;
|
|
7016
|
+
dispose(): void;
|
|
7017
|
+
setMode(mode: GizmoMode): void;
|
|
7018
|
+
getMode(): GizmoMode;
|
|
7019
|
+
/** Place the gizmo at a pivot and show it. */
|
|
7020
|
+
show(pivot: Vector3): void;
|
|
7021
|
+
hide(): void;
|
|
7022
|
+
get visible(): boolean;
|
|
7023
|
+
get pivot(): Vector3;
|
|
7024
|
+
/**
|
|
7025
|
+
* Keep the gizmo a constant size on screen.
|
|
7026
|
+
*
|
|
7027
|
+
* A world-sized gizmo is unusable in an orbit view: it fills the screen up
|
|
7028
|
+
* close and disappears from a distance.
|
|
7029
|
+
*/
|
|
7030
|
+
update(camera: Camera): void;
|
|
7031
|
+
/**
|
|
7032
|
+
* Which handle a ray hits, or `null`.
|
|
7033
|
+
*
|
|
7034
|
+
* Raycasts the gizmo's own meshes rather than the physics world. Handles are
|
|
7035
|
+
* render-only objects with no colliders, so the physics raycast used to pick
|
|
7036
|
+
* entities cannot see them at all.
|
|
7037
|
+
*/
|
|
7038
|
+
pick(ray: GizmoRay): GizmoAxis | null;
|
|
7039
|
+
/**
|
|
7040
|
+
* Whether a handle can be dragged from the current viewing angle.
|
|
7041
|
+
*
|
|
7042
|
+
* Each handle type degenerates differently: an arrow aimed at the camera has
|
|
7043
|
+
* no screen-space direction left to follow, while a plane quad or rotation
|
|
7044
|
+
* ring seen edge-on turns a pixel of motion into a huge sweep across it.
|
|
7045
|
+
*/
|
|
7046
|
+
private isHandleDraggable;
|
|
7047
|
+
/** Tint a handle to show it is hovered or being dragged. */
|
|
7048
|
+
setHighlight(axis: GizmoAxis | null): void;
|
|
7049
|
+
/**
|
|
7050
|
+
* Begin a drag on a handle.
|
|
7051
|
+
*
|
|
7052
|
+
* @returns `false` when the gesture cannot be tracked (a near-parallel view
|
|
7053
|
+
* of the drag axis), so the caller can ignore the press rather than start a
|
|
7054
|
+
* drag that would jump.
|
|
7055
|
+
*/
|
|
7056
|
+
beginDrag(axis: GizmoAxis, ray: GizmoRay, camera: Camera): boolean;
|
|
7057
|
+
/** Raw delta for the current pointer position, or `null` when unusable. */
|
|
7058
|
+
updateDrag(ray: GizmoRay, camera: Camera): GizmoDelta | null;
|
|
7059
|
+
endDrag(): void;
|
|
7060
|
+
get isDragging(): boolean;
|
|
7061
|
+
get draggingAxis(): GizmoAxis | null;
|
|
7062
|
+
private isPlaneAxis;
|
|
7063
|
+
/** Signed angle of the ray's hit point around `normal`, in radians. */
|
|
7064
|
+
private angleOnPlane;
|
|
7065
|
+
/** Distance from pivot to the ray hit on the camera-facing plane. */
|
|
7066
|
+
private cameraPlaneRadius;
|
|
7067
|
+
private applyModeVisibility;
|
|
7068
|
+
private makeMaterial;
|
|
7069
|
+
private track;
|
|
7070
|
+
/**
|
|
7071
|
+
* An invisible, generously sized mesh used only for hit testing.
|
|
7072
|
+
*
|
|
7073
|
+
* The visible shafts and rings are a couple of pixels wide, which is
|
|
7074
|
+
* miserable to click. The raycaster still reaches `visible: false` meshes,
|
|
7075
|
+
* so picking accuracy is decoupled from how thin the handle looks.
|
|
7076
|
+
*/
|
|
7077
|
+
private makePicker;
|
|
7078
|
+
private orientAlongAxis;
|
|
7079
|
+
private buildTranslate;
|
|
7080
|
+
private positionPlaneHandle;
|
|
7081
|
+
private buildRotate;
|
|
7082
|
+
private orientRing;
|
|
7083
|
+
private buildScale;
|
|
7084
|
+
}
|
|
7085
|
+
|
|
6592
7086
|
/**
|
|
6593
7087
|
* Minimal transform representation for pipeline targets.
|
|
6594
7088
|
*/
|
|
@@ -6599,6 +7093,8 @@ export declare interface TransformLike {
|
|
|
6599
7093
|
|
|
6600
7094
|
export { TransformState }
|
|
6601
7095
|
|
|
7096
|
+
export declare type TransformTool = (typeof TRANSFORM_TOOLS)[number];
|
|
7097
|
+
|
|
6602
7098
|
export { uniform }
|
|
6603
7099
|
|
|
6604
7100
|
export { updateBoundaryRicochet }
|
|
@@ -7394,6 +7890,17 @@ declare class ZylemCamera {
|
|
|
7394
7890
|
* Frame the debug orbit camera on an Object3D (AABB fit).
|
|
7395
7891
|
*/
|
|
7396
7892
|
frameObject(object: Object3D): void;
|
|
7893
|
+
/**
|
|
7894
|
+
* Suspend or resume orbit input. Used by the debug transform tools so a
|
|
7895
|
+
* gizmo drag does not also swing the camera.
|
|
7896
|
+
*/
|
|
7897
|
+
setOrbitInteractionEnabled(enabled: boolean): void;
|
|
7898
|
+
/**
|
|
7899
|
+
* Stop or resume tracking the debug selection with the orbit target. Used by
|
|
7900
|
+
* the transform tools, which cannot be dragged accurately while the camera
|
|
7901
|
+
* re-aims at the entity being moved.
|
|
7902
|
+
*/
|
|
7903
|
+
setOrbitFollowEnabled(enabled: boolean): void;
|
|
7397
7904
|
/**
|
|
7398
7905
|
* Directly set the camera position.
|
|
7399
7906
|
*/
|
|
@@ -7728,6 +8235,8 @@ declare class ZylemGame<TGlobals extends BaseGlobals> {
|
|
|
7728
8235
|
private lastPublishedGameConfig;
|
|
7729
8236
|
/** Editor ↔ game bridge adapter (RAF-coalesced publishes, command intake). */
|
|
7730
8237
|
private gameBridge;
|
|
8238
|
+
/** Stops republishing the entity catalog on registry changes. */
|
|
8239
|
+
private catalogUnsubscribe;
|
|
7731
8240
|
private readonly gameUpdateParams;
|
|
7732
8241
|
private readonly stageSetupParams;
|
|
7733
8242
|
private readonly stageUpdateParams;
|
|
@@ -7738,6 +8247,10 @@ declare class ZylemGame<TGlobals extends BaseGlobals> {
|
|
|
7738
8247
|
static FRAME_DURATION: number;
|
|
7739
8248
|
static MAX_DELTA_SECONDS: number;
|
|
7740
8249
|
constructor(options: ZylemGameOptions<TGlobals>, wrapperRef: Game<TGlobals>, displayRuntime?: ResolveGameConfigRuntime);
|
|
8250
|
+
/** Publish the placeable entity types the editor's Add palette lists. */
|
|
8251
|
+
private publishEntityCatalog;
|
|
8252
|
+
/** Spawn a catalog type programmatically (editor `entity:create`). */
|
|
8253
|
+
private createCatalogEntity;
|
|
7741
8254
|
setDisplayRuntime(runtime: ResolveGameConfigRuntime): void;
|
|
7742
8255
|
loadGameCanvas(config: GameConfig): void;
|
|
7743
8256
|
loadDebugOptions(options: ZylemGameOptions<TGlobals>): void;
|
|
@@ -8255,15 +8768,34 @@ export declare class ZylemSprite extends GameEntity<ZylemSpriteOptions> {
|
|
|
8255
8768
|
protected spriteMap: Map<string, number>;
|
|
8256
8769
|
protected currentSpriteIndex: number;
|
|
8257
8770
|
protected animations: Map<string, any>;
|
|
8258
|
-
protected currentAnimation:
|
|
8771
|
+
protected currentAnimation: string | null;
|
|
8259
8772
|
protected currentAnimationFrame: string;
|
|
8260
8773
|
protected currentAnimationIndex: number;
|
|
8261
8774
|
protected currentAnimationTime: number;
|
|
8775
|
+
/** Set only in sheet mode; the shared texture whose UV window we shift. */
|
|
8776
|
+
protected sheetTexture: Texture | null;
|
|
8777
|
+
protected flippedX: boolean;
|
|
8262
8778
|
constructor(options?: ZylemSpriteOptions);
|
|
8263
8779
|
create(): this;
|
|
8264
8780
|
protected createSpritesFromImages(images: SpriteImage[]): void;
|
|
8781
|
+
protected createSpriteFromSheet(sheet: SpriteSheet): void;
|
|
8265
8782
|
protected createAnimations(animations: SpriteAnimation[]): void;
|
|
8266
8783
|
setSprite(key: string): void;
|
|
8784
|
+
/**
|
|
8785
|
+
* Mirror the sprite horizontally, for characters whose sheet only contains
|
|
8786
|
+
* one facing direction.
|
|
8787
|
+
*
|
|
8788
|
+
* In sheet mode this flips the UV window rather than the sprite scale,
|
|
8789
|
+
* because {@link syncSpriteMaterials} rewrites scale from `options.size`
|
|
8790
|
+
* every frame and would immediately undo a negative scale.
|
|
8791
|
+
*/
|
|
8792
|
+
setFlipX(flip: boolean): void;
|
|
8793
|
+
isFlippedX(): boolean;
|
|
8794
|
+
private applySheetFrame;
|
|
8795
|
+
/**
|
|
8796
|
+
* Advance a named clip. Call once per frame from an update loop; `delta` is
|
|
8797
|
+
* seconds, so scaling it scales playback rate.
|
|
8798
|
+
*/
|
|
8267
8799
|
setAnimation(name: string, delta: number): void;
|
|
8268
8800
|
private getCurrentRotationQuaternion;
|
|
8269
8801
|
private syncSpriteMaterials;
|
|
@@ -8275,6 +8807,7 @@ export declare class ZylemSprite extends GameEntity<ZylemSpriteOptions> {
|
|
|
8275
8807
|
|
|
8276
8808
|
declare type ZylemSpriteOptions = GameEntityOptions & {
|
|
8277
8809
|
images?: SpriteImage[];
|
|
8810
|
+
sheet?: SpriteSheet;
|
|
8278
8811
|
animations?: SpriteAnimation[];
|
|
8279
8812
|
size?: Vec3Input;
|
|
8280
8813
|
collisionSize?: Vec3Input;
|
|
@@ -8342,7 +8875,7 @@ declare class ZylemStage extends LifeCycleBase<ZylemStage> {
|
|
|
8342
8875
|
protected _setup(params: SetupContext<ZylemStage>): void;
|
|
8343
8876
|
protected _update(params: UpdateContext<ZylemStage>): void;
|
|
8344
8877
|
outOfLoop(): void;
|
|
8345
|
-
/** Update debug overlays and
|
|
8878
|
+
/** Update debug overlays and the editor's pointer tools. */
|
|
8346
8879
|
debugUpdate(): void;
|
|
8347
8880
|
/** Cleanup owned resources when the stage is destroyed. */
|
|
8348
8881
|
protected _destroy(params: DestroyContext<ZylemStage>): void;
|