@ignifx/editor-host 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -301,8 +301,9 @@ export type HostKind = (typeof HostKind)[keyof typeof HostKind];
301
301
  * The play controls send `"heartbeat"`, `"playControls"`, `"logRelay"` and `"queryRuntime"`, plus
302
302
  * `"screenshot"` when the game has a canvas and `"sendInput"` when it has `app.input`. The scene
303
303
  * host sends `"heartbeat"` and whichever of `"gizmos"`, `"screenshot"`, `"viewMode2d"`,
304
- * `"pick2d"`, `"gameView"`, `"gameViewOnDemand"`, `"gameViewSize"`, `"gameView2d"`, `"thumbnails"`,
305
- * `"grid"`, `"tilemapCells"`, `"editorLines"` and `"spriteAnimation"` it supports; every
304
+ * `"pick2d"`, `"pickRect"`, `"gameView"`, `"gameViewOnDemand"`, `"gameViewSize"`, `"gameView2d"`,
305
+ * `"thumbnails"`, `"thumbnailMaterials"`, `"thumbnailAtlases"`, `"thumbnailTextures"`, `"grid"`,
306
+ * `"gridOverlay"`, `"tilemapCells"`, `"editorLines"` and `"spriteAnimation"` it supports; every
306
307
  * `SceneMethod` not tied to one of them is required of a 0.3 scene host.
307
308
  *
308
309
  * @public
@@ -330,6 +331,12 @@ export declare const HostCapability: {
330
331
  * `pick` and view clicks in 2D mode resolve through the 3D picker only.
331
332
  */
332
333
  readonly pick2d: "pick2d";
334
+ /**
335
+ * The scene host answers `pickRect`: the document entities whose drawn bounds, projected to the
336
+ * view, a rectangle of the view covers (a box selection). Additive in 0.3; without it, the scene
337
+ * host answers `pickRect` with `RpcErrorCode.methodNotFound`.
338
+ */
339
+ readonly pickRect: "pickRect";
333
340
  /**
334
341
  * The host relays the app's reports: `log` lines with the first `Error` each carries, a
335
342
  * `hostError` with `AppErrorData` (entity, component, phase, stack) for every `app.onError`
@@ -388,6 +395,26 @@ export declare const HostCapability: {
388
395
  * `RpcErrorCode.methodNotFound`.
389
396
  */
390
397
  readonly thumbnails: "thumbnails";
398
+ /**
399
+ * The scene host's `renderThumbnail` also renders materials (`.material.json`, or a reference
400
+ * typed `"material"`): the material on a sphere under the thumbnail lighting. Listed only with
401
+ * `thumbnails`. Additive in 0.3; without it, a material answers `RpcErrorCode.invalidParams`.
402
+ */
403
+ readonly thumbnailMaterials: "thumbnailMaterials";
404
+ /**
405
+ * The scene host's `renderThumbnail` also renders sprite atlases (`.atlas.json`, or a reference
406
+ * typed `"spriteatlas"`): the atlas's whole image fitted in the square on a transparent
407
+ * background. Listed only with `thumbnails`. Additive in 0.3; without it, an atlas answers
408
+ * `RpcErrorCode.invalidParams`.
409
+ */
410
+ readonly thumbnailAtlases: "thumbnailAtlases";
411
+ /**
412
+ * The scene host's `renderThumbnail` also renders images (`.png`, `.jpg`, `.jpeg`, `.webp`, or
413
+ * a reference typed `"texture"`), fitted in the square on a transparent background; `.gif`,
414
+ * `.avif` and `.bmp` answer `RpcErrorCode.invalidParams`. Listed only with `thumbnails`.
415
+ * Additive in 0.3; without it, an image answers `RpcErrorCode.invalidParams`.
416
+ */
417
+ readonly thumbnailTextures: "thumbnailTextures";
391
418
  /**
392
419
  * The scene host draws a grid in the view and answers `setGrid`: a ground grid at `y = 0` in 3D
393
420
  * view mode and a unit grid (a pixel grid when zoomed in) over the 2D view. From engine ask E31
@@ -422,6 +449,14 @@ export declare const HostCapability: {
422
449
  * `RpcErrorCode.methodNotFound`.
423
450
  */
424
451
  readonly spriteAnimation: "spriteAnimation";
452
+ /**
453
+ * The scene host answers `bakeLightProbes` and `cancelBake` and sends `bakeProgress`
454
+ * (`LightProbeBakeMethod`): it bakes a `LightProbeVolume` from its live edit-mode world (prefab
455
+ * instances, models, lights, the environment's sky) and answers the `.probes.json` document for
456
+ * the editor to write. Additive in 0.3; without it, the host answers both with
457
+ * `RpcErrorCode.methodNotFound`.
458
+ */
459
+ readonly bakeLightProbes: "bakeLightProbes";
425
460
  };
426
461
  /**
427
462
  * The union of the names in `HostCapability`.
@@ -1136,6 +1171,11 @@ export declare const SceneMethod: {
1136
1171
  readonly frame: "frame";
1137
1172
  /** Asks which entity is under a point of the view, without selecting it. Answers {@link PickResult}. */
1138
1173
  readonly pick: "pick";
1174
+ /**
1175
+ * Asks which entities a rectangle of the view covers, for a box selection, without selecting
1176
+ * them. Needs `HostCapability.pickRect`. Answers {@link PickRectResult}. Additive in 0.3.
1177
+ */
1178
+ readonly pickRect: "pickRect";
1139
1179
  /** Captures the view as an image. Needs `HostCapability.screenshot`. Answers {@link ScreenshotResult}. */
1140
1180
  readonly screenshot: "screenshot";
1141
1181
  /** Describes every registered component's schema. Answers {@link SchemaSet}. */
@@ -1636,6 +1676,65 @@ interface PickResult {
1636
1676
  */
1637
1677
  readonly plane?: Vec3;
1638
1678
  }
1679
+ /**
1680
+ * How `pickRect` matches an entity's projected bounds against the rectangle.
1681
+ *
1682
+ * @public
1683
+ */
1684
+ export declare const PickRectMode: {
1685
+ /** The entity counts when its projected bounds overlap the rectangle at all. */
1686
+ readonly intersect: "intersect";
1687
+ /** The entity counts only when its projected bounds lie wholly inside the rectangle. */
1688
+ readonly contain: "contain";
1689
+ };
1690
+ /**
1691
+ * The union of the modes in `PickRectMode`.
1692
+ *
1693
+ * @public
1694
+ */
1695
+ export type PickRectMode = (typeof PickRectMode)[keyof typeof PickRectMode];
1696
+ /**
1697
+ * The most entities a `pickRect` answer lists; past it the answer sets `truncated`.
1698
+ *
1699
+ * @public
1700
+ */
1701
+ export declare const PICK_RECT_MAX_ENTITIES = 2e3;
1702
+ /**
1703
+ * The parameters of `pickRect`: two opposite corners of a rectangle of the view, in either order,
1704
+ * in the unit `pick` takes.
1705
+ *
1706
+ * @public
1707
+ */
1708
+ interface PickRectParams {
1709
+ /** One corner's x, from the view's left edge, in `unit`. */
1710
+ readonly x0: number;
1711
+ /** One corner's y, from the view's top edge, in `unit`. */
1712
+ readonly y0: number;
1713
+ /** The opposite corner's x, in `unit`. */
1714
+ readonly x1: number;
1715
+ /** The opposite corner's y, in `unit`. */
1716
+ readonly y1: number;
1717
+ /** The unit of the corners, as for `pick`. */
1718
+ readonly unit: PickUnit;
1719
+ /** How bounds match the rectangle. Defaults to `"intersect"`. */
1720
+ readonly mode?: PickRectMode;
1721
+ }
1722
+ /**
1723
+ * The answer to `pickRect`.
1724
+ *
1725
+ * @public
1726
+ */
1727
+ interface PickRectResult {
1728
+ /**
1729
+ * The document entities whose drawn bounds (meshes in 3D; sprites and tilemaps in 2D view mode),
1730
+ * projected to the view, match the rectangle, in document order. A mesh inside an instanced
1731
+ * scene counts for its instance root, as with `pick`; an entity that draws nothing is never
1732
+ * listed. At most {@link PICK_RECT_MAX_ENTITIES}.
1733
+ */
1734
+ readonly entities: readonly string[];
1735
+ /** True when more entities matched than `entities` lists. */
1736
+ readonly truncated: boolean;
1737
+ }
1639
1738
  /**
1640
1739
  * The image formats of a `screenshot`.
1641
1740
  *
@@ -2309,7 +2408,7 @@ interface RpcNotificationWithParams<M extends string, P> extends RpcNotification
2309
2408
  *
2310
2409
  * @public
2311
2410
  */
2312
- type SceneRequest = RpcRequestWithParams<typeof SceneMethod.openScene, OpenSceneParams> | RpcRequest<typeof SceneMethod.closeScene, never> | RpcRequestWithParams<typeof SceneMethod.applyOps, ApplyOpsParams> | RpcRequestWithParams<typeof SceneMethod.readBack, ReadBackParams> | RpcRequestWithParams<typeof SceneMethod.select, EntitySelection> | RpcRequestWithParams<typeof SceneMethod.setGizmo, SetGizmoParams> | RpcRequestWithParams<typeof SceneMethod.frame, FrameParams> | RpcRequestWithParams<typeof SceneMethod.pick, PickParams> | RpcRequestWithParams<typeof SceneMethod.screenshot, ScreenshotParams> | RpcRequest<typeof SceneMethod.getSchemas, never> | RpcRequest<typeof SceneMethod.describeSettings, never> | RpcRequestWithParams<typeof SceneMethod.setViewMode, SetViewModeParams> | RpcRequestWithParams<typeof SceneMethod.setAnimateMaterials, SetAnimateMaterialsParams> | RpcRequestWithParams<typeof SceneMethod.getColliderOutlines, EntitySelection> | RpcRequestWithParams<typeof SceneMethod.sampleAnimation, SampleAnimationParams> | RpcRequestWithParams<typeof SceneMethod.sampleSpriteAnimation, SampleSpriteAnimationParams> | RpcRequestWithParams<typeof SceneMethod.setGrid, SetGridParams> | RpcRequestWithParams<typeof SceneMethod.setTilemapCells, SetTilemapCellsParams> | RpcRequestWithParams<typeof SceneMethod.setEditorLines, SetEditorLinesParams> | RpcRequestWithParams<typeof SceneMethod.clearEditorLines, ClearEditorLinesParams>;
2411
+ type SceneRequest = RpcRequestWithParams<typeof SceneMethod.openScene, OpenSceneParams> | RpcRequest<typeof SceneMethod.closeScene, never> | RpcRequestWithParams<typeof SceneMethod.applyOps, ApplyOpsParams> | RpcRequestWithParams<typeof SceneMethod.readBack, ReadBackParams> | RpcRequestWithParams<typeof SceneMethod.select, EntitySelection> | RpcRequestWithParams<typeof SceneMethod.setGizmo, SetGizmoParams> | RpcRequestWithParams<typeof SceneMethod.frame, FrameParams> | RpcRequestWithParams<typeof SceneMethod.pick, PickParams> | RpcRequestWithParams<typeof SceneMethod.pickRect, PickRectParams> | RpcRequestWithParams<typeof SceneMethod.screenshot, ScreenshotParams> | RpcRequest<typeof SceneMethod.getSchemas, never> | RpcRequest<typeof SceneMethod.describeSettings, never> | RpcRequestWithParams<typeof SceneMethod.setViewMode, SetViewModeParams> | RpcRequestWithParams<typeof SceneMethod.setAnimateMaterials, SetAnimateMaterialsParams> | RpcRequestWithParams<typeof SceneMethod.getColliderOutlines, EntitySelection> | RpcRequestWithParams<typeof SceneMethod.sampleAnimation, SampleAnimationParams> | RpcRequestWithParams<typeof SceneMethod.sampleSpriteAnimation, SampleSpriteAnimationParams> | RpcRequestWithParams<typeof SceneMethod.setGrid, SetGridParams> | RpcRequestWithParams<typeof SceneMethod.setTilemapCells, SetTilemapCellsParams> | RpcRequestWithParams<typeof SceneMethod.setEditorLines, SetEditorLinesParams> | RpcRequestWithParams<typeof SceneMethod.clearEditorLines, ClearEditorLinesParams>;
2313
2412
  /**
2314
2413
  * The success answer of the `SceneMethod`s that return nothing: `closeScene`, `setGizmo`, `frame`,
2315
2414
  * `setViewMode`, `setAnimateMaterials`, `setGrid`, `setEditorLines` and `clearEditorLines`.
@@ -2347,6 +2446,12 @@ type SelectResponse = RpcSuccessResponse<EntitySelection>;
2347
2446
  * @public
2348
2447
  */
2349
2448
  type PickResponse = RpcSuccessResponse<PickResult>;
2449
+ /**
2450
+ * The success answer to `pickRect`.
2451
+ *
2452
+ * @public
2453
+ */
2454
+ type PickRectResponse = RpcSuccessResponse<PickRectResult>;
2350
2455
  /**
2351
2456
  * The success answer to `screenshot`.
2352
2457
  *
@@ -2516,6 +2621,24 @@ export declare function isPickParams(value: unknown): value is PickParams;
2516
2621
  * @public
2517
2622
  */
2518
2623
  export declare function isPickResult(value: unknown): value is PickResult;
2624
+ /**
2625
+ * Checks the parameters of `pickRect`.
2626
+ *
2627
+ * @param value - The received `params`.
2628
+ * @returns True for four finite corner coordinates, a known unit and, when present, a known mode.
2629
+ *
2630
+ * @public
2631
+ */
2632
+ export declare function isPickRectParams(value: unknown): value is PickRectParams;
2633
+ /**
2634
+ * Checks the result of `pickRect`.
2635
+ *
2636
+ * @param value - The received `result`.
2637
+ * @returns True for at most {@link PICK_RECT_MAX_ENTITIES} uids and a boolean `truncated`.
2638
+ *
2639
+ * @public
2640
+ */
2641
+ export declare function isPickRectResult(value: unknown): value is PickRectResult;
2519
2642
  /**
2520
2643
  * Checks the parameters of `screenshot`.
2521
2644
  *
@@ -3242,8 +3365,8 @@ export declare const RenderViewMethod: {
3242
3365
  */
3243
3366
  readonly gameViewFrame: "gameViewFrame";
3244
3367
  /**
3245
- * Renders one model or prefab asset on its own and answers the image: {@link ThumbnailResult}.
3246
- * It runs beside the one-at-a-time queue of the other methods, so a thumbnail never holds them
3368
+ * Renders one model or prefab asset on its own (and, with the matching capabilities, a material,
3369
+ * a sprite atlas or an image) and answers the image: {@link ThumbnailResult}. It runs beside the one-at-a-time queue of the other methods, so a thumbnail never holds them
3247
3370
  * up; thumbnails are answered in the order they were asked for.
3248
3371
  */
3249
3372
  readonly renderThumbnail: "renderThumbnail";
@@ -3353,7 +3476,10 @@ interface RenderThumbnailParams {
3353
3476
  /**
3354
3477
  * The asset: its address, or a reference whose `type` is `"model"` or `"scene"` (a prefab). An
3355
3478
  * address alone is typed by its extension: `.glb`/`.gltf` for a model, `.prefab.json` or
3356
- * `.scene.json` for a prefab.
3479
+ * `.scene.json` for a prefab. A host that lists `HostCapability.thumbnailMaterials` also takes
3480
+ * `"material"` (`.material.json`), one with `thumbnailAtlases` `"spriteatlas"` (`.atlas.json`) and
3481
+ * one with `thumbnailTextures` `"texture"` (`.png`, `.jpg`, `.jpeg`, `.webp`). Any other asset,
3482
+ * `.gif`, `.avif` and `.bmp` included, answers `RpcErrorCode.invalidParams`.
3357
3483
  */
3358
3484
  readonly asset: string | SceneFileAssetRef;
3359
3485
  /** The square image's side in pixels, 1 to {@link THUMBNAIL_MAX_SIZE}; {@link THUMBNAIL_DEFAULT_SIZE} when absent. */
@@ -3455,6 +3581,424 @@ export declare function isRenderThumbnailParams(value: unknown): value is Render
3455
3581
  */
3456
3582
  export declare function isThumbnailResult(value: unknown): value is ThumbnailResult;
3457
3583
  //#endregion
3584
+ //#region src/protocol/light-probe-bake.d.ts
3585
+ /**
3586
+ * Editor → scene host: the light-probe bake methods, answered after `ready`.
3587
+ *
3588
+ * @remarks
3589
+ * A host lists `HostCapability.bakeLightProbes` when it answers them; one that does not answers
3590
+ * `RpcErrorCode.methodNotFound`. Both run beside the one-at-a-time queue of the other methods:
3591
+ * the bake reads the world in a slot of the host's queue, then traces in slices while the queue
3592
+ * goes on, so the view keeps answering `applyOps`, `pick` and the rest. A document change the host
3593
+ * handles after the bake has read the world cancels it (`cancelled`, cause `sceneChanged`): a bake
3594
+ * never mixes the old world with the new, but it may start before a change sent just ahead of it.
3595
+ *
3596
+ * @public
3597
+ */
3598
+ export declare const LightProbeBakeMethod: {
3599
+ /**
3600
+ * Bakes one `LightProbeVolume` and answers {@link BakeLightProbesResult} when it is done. Fails
3601
+ * with `RpcErrorCode.noScene` while no scene is open, and otherwise with the code and the
3602
+ * {@link BakeFailureData} that `BakeFailureReason` lists.
3603
+ */
3604
+ readonly bakeLightProbes: "bakeLightProbes";
3605
+ /**
3606
+ * Cancels the running or pending bake, if any; answers {@link CancelBakeResult}. The bake then
3607
+ * fails as `cancelled` (cause `cancelBake`), a pending one without running. Takes `{}` or no
3608
+ * parameters.
3609
+ */
3610
+ readonly cancelBake: "cancelBake";
3611
+ };
3612
+ /**
3613
+ * The union of the names in `LightProbeBakeMethod`.
3614
+ *
3615
+ * @public
3616
+ */
3617
+ export type LightProbeBakeMethod = (typeof LightProbeBakeMethod)[keyof typeof LightProbeBakeMethod];
3618
+ /**
3619
+ * Scene host → editor: the light-probe bake notifications.
3620
+ *
3621
+ * @public
3622
+ */
3623
+ export declare const LightProbeBakeNotification: {
3624
+ /**
3625
+ * How far the running bake is: {@link BakeProgressParams}. At most one per
3626
+ * {@link BAKE_PROGRESS_INTERVAL_MS}; the first comes once the first probe is baked. The answer to
3627
+ * `bakeLightProbes` follows the last one.
3628
+ */
3629
+ readonly bakeProgress: "bakeProgress";
3630
+ };
3631
+ /**
3632
+ * The union of the names in `LightProbeBakeNotification`.
3633
+ *
3634
+ * @public
3635
+ */
3636
+ export type LightProbeBakeNotification = (typeof LightProbeBakeNotification)[keyof typeof LightProbeBakeNotification];
3637
+ /**
3638
+ * The shortest time between two `bakeProgress` notifications, in milliseconds (ten a second).
3639
+ *
3640
+ * @public
3641
+ */
3642
+ export declare const BAKE_PROGRESS_INTERVAL_MS = 100;
3643
+ /**
3644
+ * The distance between probes when a request gives neither `counts` nor `spacing`, in metres.
3645
+ *
3646
+ * @public
3647
+ */
3648
+ export declare const BAKE_DEFAULT_SPACING = 2;
3649
+ /**
3650
+ * The smallest `spacing` a request may give, in metres.
3651
+ *
3652
+ * @public
3653
+ */
3654
+ export declare const BAKE_SPACING_MIN = .05;
3655
+ /**
3656
+ * The largest `spacing` a request may give, in metres.
3657
+ *
3658
+ * @public
3659
+ */
3660
+ export declare const BAKE_SPACING_MAX = 1e3;
3661
+ /**
3662
+ * The most probes along X (the `.probes.json` format's limit).
3663
+ *
3664
+ * @public
3665
+ */
3666
+ export declare const BAKE_MAX_COUNT_X = 1024;
3667
+ /**
3668
+ * The most probes in one Y × Z slice (the `.probes.json` format's limit).
3669
+ *
3670
+ * @public
3671
+ */
3672
+ export declare const BAKE_MAX_COUNT_YZ = 4096;
3673
+ /**
3674
+ * The most probes one bake traces. With coefficients rounded to {@link BAKE_COEFFICIENT_DIGITS}
3675
+ * significant digits and bounded by {@link BAKE_MAX_COEFFICIENT}, the largest `probes` document is
3676
+ * under 3 MiB of JSON, inside the editor's 4 MiB message limits.
3677
+ *
3678
+ * @public
3679
+ */
3680
+ export declare const BAKE_MAX_PROBES = 16384;
3681
+ /**
3682
+ * The significant digits each answered coefficient is rounded to; a coefficient below `1e-6` in
3683
+ * magnitude is answered as `0`.
3684
+ *
3685
+ * @public
3686
+ */
3687
+ export declare const BAKE_COEFFICIENT_DIGITS = 6;
3688
+ /**
3689
+ * The largest coefficient magnitude a bake answers. A bake whose probes exceed it (lights or a sky
3690
+ * of absurd intensity) fails as `outOfRange` rather than writing a grid no renderer can use.
3691
+ *
3692
+ * @public
3693
+ */
3694
+ export declare const BAKE_MAX_COEFFICIENT = 0xe8d4a51000;
3695
+ /**
3696
+ * The largest magnitude of a sky channel or harmonic a request may give.
3697
+ *
3698
+ * @public
3699
+ */
3700
+ export declare const BAKE_MAX_SKY = 1e6;
3701
+ /**
3702
+ * The longest `volume` uid a request may give, in UTF-16 code units.
3703
+ *
3704
+ * @public
3705
+ */
3706
+ export declare const BAKE_MAX_UID_LENGTH = 128;
3707
+ /**
3708
+ * The most rays per probe (`bakeLightProbes`' own limit).
3709
+ *
3710
+ * @public
3711
+ */
3712
+ export declare const BAKE_MAX_RAYS = 4096;
3713
+ /**
3714
+ * The most skips an answer lists; the count in `stats.skipped` is never cut.
3715
+ *
3716
+ * @public
3717
+ */
3718
+ export declare const BAKE_MAX_SKIPS = 256;
3719
+ /**
3720
+ * A linear colour, each channel finite (`a` is ignored).
3721
+ *
3722
+ * @public
3723
+ */
3724
+ interface BakeColor {
3725
+ readonly r: number;
3726
+ readonly g: number;
3727
+ readonly b: number;
3728
+ readonly a?: number;
3729
+ }
3730
+ /**
3731
+ * What rays that hit nothing return, in linear radiance, as core's `LightProbeBakeSky` takes it: a
3732
+ * colour, a gradient, or nine spherical-harmonic RGB triples (27 numbers in the order
3733
+ * `Y00, Y1-1, Y10, Y11, Y2-2, Y2-1, Y20, Y21, Y22`, on the world axes, Y up).
3734
+ *
3735
+ * @public
3736
+ */
3737
+ type BakeSky = BakeColor | {
3738
+ readonly kind: "gradient";
3739
+ readonly sky: BakeColor;
3740
+ readonly horizon: BakeColor;
3741
+ readonly ground: BakeColor;
3742
+ } | {
3743
+ readonly kind: "sh9";
3744
+ readonly coefficients: readonly number[];
3745
+ };
3746
+ /**
3747
+ * The parameters of `bakeLightProbes`.
3748
+ *
3749
+ * @public
3750
+ */
3751
+ interface BakeLightProbesParams {
3752
+ /**
3753
+ * The uid of the entity whose `LightProbeVolume` is baked. Its world position is the box's
3754
+ * centre and its world scale the box's size in metres; the grid is axis-aligned (a rotation is
3755
+ * ignored). An axis with a size of 0 gets one probe, at the centre.
3756
+ */
3757
+ readonly volume: string;
3758
+ /**
3759
+ * The probes along X, Y and Z, each a whole number from 1, spread over the box (one probe on an
3760
+ * axis sits at the centre). Not with `spacing`.
3761
+ */
3762
+ readonly counts?: readonly [number, number, number];
3763
+ /**
3764
+ * The largest distance between neighbouring probes, in metres, from {@link BAKE_SPACING_MIN} to
3765
+ * {@link BAKE_SPACING_MAX}; each axis of size above 0 gets at least two probes, on its faces.
3766
+ * Defaults to {@link BAKE_DEFAULT_SPACING} when `counts` is absent too. Not with `counts`.
3767
+ */
3768
+ readonly spacing?: number;
3769
+ /**
3770
+ * Whether the probes also store the direct light of `"realtime"` lights (core's
3771
+ * `LightProbeBakeOptions.directLight`). Defaults to `"exclude"`.
3772
+ */
3773
+ readonly directLight?: "include" | "exclude";
3774
+ /**
3775
+ * What rays that hit nothing return. Absent: the scene's `Environment` diffuse harmonics, rotated
3776
+ * as the environment is, when the host has them (a host with a GPU, an installed `.env`); black
3777
+ * otherwise. `null`: black.
3778
+ */
3779
+ readonly sky?: BakeSky | null;
3780
+ /** Rays per probe, 1 to {@link BAKE_MAX_RAYS}. Defaults to 128. */
3781
+ readonly rays?: number;
3782
+ /** How far a ray looks for a surface, in metres; above 0. Defaults to 100. */
3783
+ readonly maxDistance?: number;
3784
+ }
3785
+ /**
3786
+ * The parameters of `bakeProgress`.
3787
+ *
3788
+ * @public
3789
+ */
3790
+ interface BakeProgressParams {
3791
+ /** The volume being baked. */
3792
+ readonly volume: string;
3793
+ /** Probes baked so far. */
3794
+ readonly done: number;
3795
+ /** Probes in the grid. */
3796
+ readonly total: number;
3797
+ }
3798
+ /**
3799
+ * Something the bake could not trace, and why (core's `LightProbeBakeSkip`).
3800
+ *
3801
+ * @public
3802
+ */
3803
+ interface BakeSkip {
3804
+ /** The entity's name. */
3805
+ readonly entity: string;
3806
+ /** The entity's uid. */
3807
+ readonly uid: string;
3808
+ /** The component's type id: `ignifx/MeshRenderer` or `ignifx/Model`. */
3809
+ readonly component: string;
3810
+ /** Why, in one line. */
3811
+ readonly reason: string;
3812
+ }
3813
+ /**
3814
+ * Where a bake's sky came from: the request, the scene's environment, or nowhere (black).
3815
+ *
3816
+ * @public
3817
+ */
3818
+ type BakeSkySource = "request" | "environment" | "none";
3819
+ /**
3820
+ * The answer to `bakeLightProbes`.
3821
+ *
3822
+ * @public
3823
+ */
3824
+ interface BakeLightProbesResult {
3825
+ /** The `.probes.json` document (`writeLightProbeFile`), for the editor to write. */
3826
+ readonly probes: JsonObject;
3827
+ /** What was baked. */
3828
+ readonly stats: {
3829
+ /** Probes in the grid. */
3830
+ readonly probes: number;
3831
+ /** Triangles the rays were traced against. */
3832
+ readonly triangles: number;
3833
+ /** Enabled mesh renderers and models that gave no triangles at all. */
3834
+ readonly skipped: number;
3835
+ /** Wall-clock milliseconds, from the start of the bake to its end. */
3836
+ readonly ms: number;
3837
+ };
3838
+ /** What the bake left out, and why; at most {@link BAKE_MAX_SKIPS}. */
3839
+ readonly skips: readonly BakeSkip[];
3840
+ /** Where the sky came from. */
3841
+ readonly sky: BakeSkySource;
3842
+ }
3843
+ /**
3844
+ * The answer to `cancelBake`.
3845
+ *
3846
+ * @public
3847
+ */
3848
+ interface CancelBakeResult {
3849
+ /** Whether a bake was running (it now fails as `cancelled`). */
3850
+ readonly cancelled: boolean;
3851
+ }
3852
+ /**
3853
+ * Why `bakeLightProbes` failed, in its error's `data.reason`, with the error code each comes with:
3854
+ *
3855
+ * - `unknownEntity` (`RpcErrorCode.unknownEntity`): `volume` names no entity of the open scene;
3856
+ * - `notAVolume` (`RpcErrorCode.invalidParams`): the entity has no `LightProbeVolume`;
3857
+ * - `invalidGrid` (`RpcErrorCode.invalidParams`): the grid (from `counts` or `spacing`) is more
3858
+ * than a `.probes.json` holds (X ≤ {@link BAKE_MAX_COUNT_X}, Y × Z ≤ {@link BAKE_MAX_COUNT_YZ}) or
3859
+ * more than {@link BAKE_MAX_PROBES}, or the volume's transform is not finite;
3860
+ * - `outOfRange` (`RpcErrorCode.invalidRequest`): a baked coefficient is not finite or above
3861
+ * {@link BAKE_MAX_COEFFICIENT} (a light of absurd intensity);
3862
+ * - `busy` (`RpcErrorCode.invalidRequest`): a bake is running; cancel it or wait;
3863
+ * - `cancelled` (`RpcErrorCode.invalidRequest`): `cancelBake`, or a change to the document, stopped
3864
+ * it (`data.cause`).
3865
+ *
3866
+ * @public
3867
+ */
3868
+ export declare const BakeFailureReason: {
3869
+ readonly unknownEntity: "unknownEntity";
3870
+ readonly notAVolume: "notAVolume";
3871
+ readonly invalidGrid: "invalidGrid";
3872
+ readonly outOfRange: "outOfRange";
3873
+ readonly busy: "busy";
3874
+ readonly cancelled: "cancelled";
3875
+ };
3876
+ /**
3877
+ * The union of the names in `BakeFailureReason`.
3878
+ *
3879
+ * @public
3880
+ */
3881
+ export type BakeFailureReason = (typeof BakeFailureReason)[keyof typeof BakeFailureReason];
3882
+ /**
3883
+ * What stopped a cancelled bake: `cancelBake`, or a change to the open document (`openScene`,
3884
+ * `closeScene`, `applyOps`, `setTilemapCells`, an asset reload that rebuilt instances, or a hot
3885
+ * reload's new defaults), since a bake must not mix the old world with the new.
3886
+ *
3887
+ * @public
3888
+ */
3889
+ export declare const BakeCancelCause: {
3890
+ readonly cancelBake: "cancelBake";
3891
+ readonly sceneChanged: "sceneChanged";
3892
+ };
3893
+ /**
3894
+ * The union of the names in `BakeCancelCause`.
3895
+ *
3896
+ * @public
3897
+ */
3898
+ export type BakeCancelCause = (typeof BakeCancelCause)[keyof typeof BakeCancelCause];
3899
+ /**
3900
+ * The `data` of a failed `bakeLightProbes`.
3901
+ *
3902
+ * @public
3903
+ */
3904
+ interface BakeFailureData {
3905
+ /** Why. */
3906
+ readonly reason: BakeFailureReason;
3907
+ /** What cancelled it, for `cancelled`. */
3908
+ readonly cause?: BakeCancelCause;
3909
+ }
3910
+ /**
3911
+ * Editor → scene host: one of the `LightProbeBakeMethod`s.
3912
+ *
3913
+ * @public
3914
+ */
3915
+ type LightProbeBakeRequest = RpcRequestWithParams<typeof LightProbeBakeMethod.bakeLightProbes, BakeLightProbesParams> | RpcRequestWithParams<typeof LightProbeBakeMethod.cancelBake, Readonly<Record<string, never>>>;
3916
+ /**
3917
+ * Scene host → editor: `bakeProgress`.
3918
+ *
3919
+ * @public
3920
+ */
3921
+ type BakeProgressNotification = RpcNotificationWithParams<typeof LightProbeBakeNotification.bakeProgress, BakeProgressParams>;
3922
+ /**
3923
+ * The success answer to `bakeLightProbes`.
3924
+ *
3925
+ * @public
3926
+ */
3927
+ type BakeLightProbesResponse = RpcSuccessResponse<BakeLightProbesResult>;
3928
+ /**
3929
+ * The success answer to `cancelBake`.
3930
+ *
3931
+ * @public
3932
+ */
3933
+ type CancelBakeResponse = RpcSuccessResponse<CancelBakeResult>;
3934
+ /**
3935
+ * Checks a sky.
3936
+ *
3937
+ * @param value - The value to test.
3938
+ * @returns True for a colour, a gradient of three colours, or 27 harmonics, every channel finite and
3939
+ * at most {@link BAKE_MAX_SKY} in magnitude.
3940
+ *
3941
+ * @public
3942
+ */
3943
+ export declare function isBakeSky(value: unknown): value is BakeSky;
3944
+ /**
3945
+ * Checks the parameters of `bakeLightProbes`.
3946
+ *
3947
+ * @param value - The received `params`.
3948
+ * @returns True for a volume uid of at most {@link BAKE_MAX_UID_LENGTH} and, when given, whole counts
3949
+ * from 1 or a spacing (not both), a direct-light
3950
+ * rule, a sky or `null`, rays and a ray length in range.
3951
+ *
3952
+ * @public
3953
+ */
3954
+ export declare function isBakeLightProbesParams(value: unknown): value is BakeLightProbesParams;
3955
+ /**
3956
+ * Checks the parameters of `bakeProgress`.
3957
+ *
3958
+ * @param value - The received `params`.
3959
+ * @returns True for a volume uid and `0 ≤ done ≤ total`, whole numbers.
3960
+ *
3961
+ * @public
3962
+ */
3963
+ export declare function isBakeProgressParams(value: unknown): value is BakeProgressParams;
3964
+ /**
3965
+ * Checks the result of `bakeLightProbes`.
3966
+ *
3967
+ * @param value - The received `result`.
3968
+ * @returns True for a `.probes.json` document, whole-number stats, at most {@link BAKE_MAX_SKIPS}
3969
+ * skips and a sky source.
3970
+ *
3971
+ * @public
3972
+ */
3973
+ export declare function isBakeLightProbesResult(value: unknown): value is BakeLightProbesResult;
3974
+ /**
3975
+ * Checks the result of `cancelBake`.
3976
+ *
3977
+ * @param value - The received `result`.
3978
+ * @returns True for `{ cancelled: boolean }`.
3979
+ *
3980
+ * @public
3981
+ */
3982
+ export declare function isCancelBakeResult(value: unknown): value is CancelBakeResult;
3983
+ /**
3984
+ * Checks the `data` of a failed `bakeLightProbes`.
3985
+ *
3986
+ * @param value - The received error `data`.
3987
+ * @returns True for a known reason and, when present, a known cause.
3988
+ *
3989
+ * @public
3990
+ */
3991
+ export declare function isBakeFailureData(value: unknown): value is BakeFailureData;
3992
+ /**
3993
+ * Checks the parameters of `cancelBake`.
3994
+ *
3995
+ * @param value - The received `params`.
3996
+ * @returns True for none, or an empty object.
3997
+ *
3998
+ * @public
3999
+ */
4000
+ export declare function isCancelBakeParams(value: unknown): boolean;
4001
+ //#endregion
3458
4002
  //#region src/channel.d.ts
3459
4003
  /**
3460
4004
  * Where a host listens for the editor's connect message: the view's `window` in a browser, or any
@@ -3732,5 +4276,5 @@ export declare function startEditorPlayControls(app: App, options: EditorPlayCon
3732
4276
  */
3733
4277
  export declare function listenForEditorPlayControls(options: EditorPlayControlsOptions): EditorPlayConnector;
3734
4278
  //#endregion
3735
- export { type AddComponentOp, type AppErrorData, type ApplyOpFailure, type ApplyOpsParams, type ApplyOpsResponse, type ApplyOpsResult, type AssetReloadedParams, type ClearEditorLinesParams, type ColliderOutlineRecord, type ColliderOutlineSet, type ColliderOutlinesResponse, type CreateEntityOp, type DescribeSettingsResponse, type DestroyEntityOp, type EditorAssetChange, type EditorConnectMessage, type EditorHost, EditorHostErrorCode, type EditorHostOptions, type EditorMessageTarget, type EditorPlayConnector, type EditorPlayControls, type EditorPlayControlsOptions, type EntityField, type EntityFieldValues, type EntitySelection, type FrameParams, type GameViewFrameParams, type GameViewFrameResponse, type GameViewFrameResult, type GameViewState, type GetSchemasResponse, type GizmoDragMode, type GizmoSnap, type HeartbeatNotification, type HelloParams, type HelloRequest, type HostErrorParams, type HotReloadError, type HotReloadReport, type HotReloadedParams, type IncompatibleProtocolData, type InstantiateOp, type InvalidSceneFileData, type JsonArray, type JsonObject, type JsonPath, type JsonValue, type LogLevel, type LogParams, type LoggedError, type NullResponse, type OpenSceneParams, type OpenSceneResponse, type OpenSceneResult, type PickParams, type PickRay, type PickResponse, type PickResult, type PingRequest, type PlayRequest, type PlayResponse, type PlayState, type PlayStateChangedNotification, type PlayStateReport, type PlayStateResponse, type PlayStats, type PlayStatsResponse, type PongResponse, type ProtocolVersion, type QueryRuntimeParams, type QueryRuntimeResponse, type QueryRuntimeResult, type ReadBackParams, type ReadBackResponse, type ReadBackResult, type ReadyResponse, type ReadyResult, type RemoveComponentOp, type RemoveOverrideOp, type RenderThumbnailParams, type RenderViewRequest, type ReorderOp, type ReparentOp, type RpcError, type RpcErrorResponse, type RpcId, type RpcMessage, type RpcNotification, type RpcNotificationWithParams, type RpcRequest, type RpcRequestWithParams, type RpcResponse, type RpcSuccessResponse, type SampleAnimationParams, type SampleAnimationResponse, type SampleAnimationResult, type SampleSpriteAnimationParams, type SampleSpriteAnimationResponse, type SampleSpriteAnimationResult, type SceneFile, type SceneFileAssetRef, type SceneFileComponent, type SceneFileEntity, type SceneFileInstance, type SceneFileIssue, type SceneFileOverride, type SceneFileTransform, type SceneHostNotification, type SceneIssue, type SceneOp, type SceneOpenedParams, type SceneRequest, type SchemaDescription, type SchemaFieldDescription, type SchemaSet, type ScreenshotParams, type ScreenshotResponse, type ScreenshotResult, type SelectResponse, type SendInputEvent, type SendInputKeyEvent, type SendInputParams, type SendInputPointerEvent, type SendInputResponse, type SendInputResult, type SetAnimateMaterialsParams, type SetEditorLinesParams, type SetEntityFieldOp, type SetGameViewParams, type SetGameViewResponse, type SetGizmoParams, type SetGridParams, type SetOverrideOp, type SetPropOp, type SetSceneSettingOp, type SetTilemapCellsParams, type SetTilemapCellsResponse, type SetTilemapCellsResult, type SetTransformOp, type SetViewModeParams, type SettingsSet, type StepParams, type ThumbnailResponse, type ThumbnailResult, type TransformDraggedParams, type TransformDraggingParams, type Vec3, isEditorOrigin };
4279
+ export { type AddComponentOp, type AppErrorData, type ApplyOpFailure, type ApplyOpsParams, type ApplyOpsResponse, type ApplyOpsResult, type AssetReloadedParams, type BakeColor, type BakeFailureData, type BakeLightProbesParams, type BakeLightProbesResponse, type BakeLightProbesResult, type BakeProgressNotification, type BakeProgressParams, type BakeSkip, type BakeSky, type BakeSkySource, type CancelBakeResponse, type CancelBakeResult, type ClearEditorLinesParams, type ColliderOutlineRecord, type ColliderOutlineSet, type ColliderOutlinesResponse, type CreateEntityOp, type DescribeSettingsResponse, type DestroyEntityOp, type EditorAssetChange, type EditorConnectMessage, type EditorHost, EditorHostErrorCode, type EditorHostOptions, type EditorMessageTarget, type EditorPlayConnector, type EditorPlayControls, type EditorPlayControlsOptions, type EntityField, type EntityFieldValues, type EntitySelection, type FrameParams, type GameViewFrameParams, type GameViewFrameResponse, type GameViewFrameResult, type GameViewState, type GetSchemasResponse, type GizmoDragMode, type GizmoSnap, type HeartbeatNotification, type HelloParams, type HelloRequest, type HostErrorParams, type HotReloadError, type HotReloadReport, type HotReloadedParams, type IncompatibleProtocolData, type InstantiateOp, type InvalidSceneFileData, type JsonArray, type JsonObject, type JsonPath, type JsonValue, type LightProbeBakeRequest, type LogLevel, type LogParams, type LoggedError, type NullResponse, type OpenSceneParams, type OpenSceneResponse, type OpenSceneResult, type PickParams, type PickRay, type PickRectParams, type PickRectResponse, type PickRectResult, type PickResponse, type PickResult, type PingRequest, type PlayRequest, type PlayResponse, type PlayState, type PlayStateChangedNotification, type PlayStateReport, type PlayStateResponse, type PlayStats, type PlayStatsResponse, type PongResponse, type ProtocolVersion, type QueryRuntimeParams, type QueryRuntimeResponse, type QueryRuntimeResult, type ReadBackParams, type ReadBackResponse, type ReadBackResult, type ReadyResponse, type ReadyResult, type RemoveComponentOp, type RemoveOverrideOp, type RenderThumbnailParams, type RenderViewRequest, type ReorderOp, type ReparentOp, type RpcError, type RpcErrorResponse, type RpcId, type RpcMessage, type RpcNotification, type RpcNotificationWithParams, type RpcRequest, type RpcRequestWithParams, type RpcResponse, type RpcSuccessResponse, type SampleAnimationParams, type SampleAnimationResponse, type SampleAnimationResult, type SampleSpriteAnimationParams, type SampleSpriteAnimationResponse, type SampleSpriteAnimationResult, type SceneFile, type SceneFileAssetRef, type SceneFileComponent, type SceneFileEntity, type SceneFileInstance, type SceneFileIssue, type SceneFileOverride, type SceneFileTransform, type SceneHostNotification, type SceneIssue, type SceneOp, type SceneOpenedParams, type SceneRequest, type SchemaDescription, type SchemaFieldDescription, type SchemaSet, type ScreenshotParams, type ScreenshotResponse, type ScreenshotResult, type SelectResponse, type SendInputEvent, type SendInputKeyEvent, type SendInputParams, type SendInputPointerEvent, type SendInputResponse, type SendInputResult, type SetAnimateMaterialsParams, type SetEditorLinesParams, type SetEntityFieldOp, type SetGameViewParams, type SetGameViewResponse, type SetGizmoParams, type SetGridParams, type SetOverrideOp, type SetPropOp, type SetSceneSettingOp, type SetTilemapCellsParams, type SetTilemapCellsResponse, type SetTilemapCellsResult, type SetTransformOp, type SetViewModeParams, type SettingsSet, type StepParams, type ThumbnailResponse, type ThumbnailResult, type TransformDraggedParams, type TransformDraggingParams, type Vec3, isEditorOrigin };
3736
4280
  //# sourceMappingURL=index.d.ts.map