gaesup-world 1.3.2 → 1.4.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.
Files changed (113) hide show
  1. package/dist/{ControllerWrapper-C6mzwejv.cjs → ControllerWrapper-DIZhLWzV.cjs} +1 -1
  2. package/dist/{ControllerWrapper-Bc_pRQSv.js → ControllerWrapper-guCfO0a-.js} +3 -3
  3. package/dist/{CoreBridge-DdJBUxmY.js → CoreBridge-CoU_vJOo.js} +1 -0
  4. package/dist/CoreBridge-L4l4UNtR.cjs +1 -0
  5. package/dist/{Gamepad-DpCgazVm.js → Gamepad-DuJ8qWlv.js} +4 -4
  6. package/dist/{Gamepad-BVhh5IfO.cjs → Gamepad-Xvf4z0S2.cjs} +1 -1
  7. package/dist/{NodeGpuSnow-lWPqrcUV.js → NodeGpuSnow-BvYQIWMj.js} +1 -1
  8. package/dist/{NodeGpuSnow-C3MwTvnW.cjs → NodeGpuSnow-By8_DPWF.cjs} +1 -1
  9. package/dist/{NodeGrassMaterial-BMwfsBMP.cjs → NodeGrassMaterial-CbcGJsx_.cjs} +1 -1
  10. package/dist/{NodeGrassMaterial-W9H9z72i.js → NodeGrassMaterial-DZSpsEzt.js} +1 -1
  11. package/dist/{NodeTreeParticles-DDpwPxpE.cjs → NodeTreeParticles-BbFBoQik.cjs} +1 -1
  12. package/dist/{NodeTreeParticles-DPjRQ0wj.js → NodeTreeParticles-CWqWgN2w.js} +1 -1
  13. package/dist/{NodeWaterMaterial-C5fHPHUG.cjs → NodeWaterMaterial-B1rA9DRv.cjs} +1 -1
  14. package/dist/{NodeWaterMaterial-Bc1nkYSw.js → NodeWaterMaterial-BKvyycqz.js} +2 -2
  15. package/dist/{Rideable-DTSh5xu3.js → Rideable-4ECPOR3x.js} +7 -7
  16. package/dist/{Rideable-CWddzOkn.cjs → Rideable-CNgjDUBh.cjs} +1 -1
  17. package/dist/{SaveSystem-DF5zSnEj.js → SaveSystem-B9TrEpWU.js} +2 -2
  18. package/dist/{SaveSystem-DwfckGGo.cjs → SaveSystem-Bj41IbmF.cjs} +1 -1
  19. package/dist/{WorldBridge-DmvFhm9b.cjs → WorldBridge-CBEkEehK.cjs} +1 -1
  20. package/dist/{WorldBridge-m64VREYb.js → WorldBridge-DtqzMddm.js} +1 -1
  21. package/dist/{WorldContainer-BjZj0uvZ.cjs → WorldContainer-CDC2nj9-.cjs} +1 -1
  22. package/dist/{WorldContainer-Ce5PVxSF.js → WorldContainer-DdHlM9IG.js} +7 -7
  23. package/dist/{WorldPhysics-CueqwH91.cjs → WorldPhysics-CQAfZYGi.cjs} +1 -1
  24. package/dist/{WorldPhysics-oZdWret8.js → WorldPhysics-Dry82NpQ.js} +1 -1
  25. package/dist/WorldPostProcessing-C40JqbKO.js +234 -0
  26. package/dist/WorldPostProcessing-C9qqKrpI.cjs +1 -0
  27. package/dist/{WorldProps-L3Izutxz.cjs → WorldProps-C0JF5fFD.cjs} +1 -1
  28. package/dist/{WorldProps-CQrtF4CO.js → WorldProps-Du0EDzmt.js} +6 -7
  29. package/dist/{blueprints-BHfyy363.cjs → blueprints-BRMf59iu.cjs} +1 -1
  30. package/dist/{blueprints-BlhgrXDo.js → blueprints-BzU37Tjs.js} +2 -2
  31. package/dist/blueprints-editor.cjs +1 -1
  32. package/dist/blueprints-editor.js +7 -7
  33. package/dist/blueprints.cjs +1 -1
  34. package/dist/blueprints.js +1 -1
  35. package/dist/building.cjs +1 -1
  36. package/dist/building.js +3 -3
  37. package/dist/core/building/components/mesh/model/merge.d.cts +2 -1
  38. package/dist/core/building/components/mesh/model/merge.d.ts +2 -1
  39. package/dist/core/camera/bridge/types.d.cts +3 -1
  40. package/dist/core/camera/bridge/types.d.ts +3 -1
  41. package/dist/core/camera/components/CameraController/defaults.d.cts +2 -1
  42. package/dist/core/camera/components/CameraController/defaults.d.ts +2 -1
  43. package/dist/core/camera/components/CameraController/index.d.cts +4 -4
  44. package/dist/core/camera/components/CameraController/index.d.ts +4 -4
  45. package/dist/core/camera/components/CameraController/types.d.cts +16 -1
  46. package/dist/core/camera/components/CameraController/types.d.ts +16 -1
  47. package/dist/core/camera/components/index.d.cts +2 -2
  48. package/dist/core/camera/components/index.d.ts +2 -2
  49. package/dist/core/camera/controllers/BaseController.d.cts +4 -0
  50. package/dist/core/camera/controllers/BaseController.d.ts +4 -0
  51. package/dist/core/camera/core/CameraOcclusion.d.cts +60 -0
  52. package/dist/core/camera/core/CameraOcclusion.d.ts +60 -0
  53. package/dist/core/camera/core/CameraSystem.d.cts +2 -0
  54. package/dist/core/camera/core/CameraSystem.d.ts +2 -0
  55. package/dist/core/camera/core/constants.d.cts +1 -0
  56. package/dist/core/camera/core/constants.d.ts +1 -0
  57. package/dist/core/camera/core/seeThrough.d.cts +64 -0
  58. package/dist/core/camera/core/seeThrough.d.ts +64 -0
  59. package/dist/core/camera/core/types.d.cts +17 -0
  60. package/dist/core/camera/core/types.d.ts +17 -0
  61. package/dist/core/camera/utils/camera.d.cts +6 -3
  62. package/dist/core/camera/utils/camera.d.ts +6 -3
  63. package/dist/core/camera/utils/sphereSweep.d.cts +8 -1
  64. package/dist/core/camera/utils/sphereSweep.d.ts +8 -1
  65. package/dist/core/editor/components/panels/CameraSettingsTab/types.d.cts +1 -1
  66. package/dist/core/editor/components/panels/CameraSettingsTab/types.d.ts +1 -1
  67. package/dist/core/rendering/postprocess/WorldPostProcessing.d.cts +26 -1
  68. package/dist/core/rendering/postprocess/WorldPostProcessing.d.ts +26 -1
  69. package/dist/core/rendering/postprocess/screenSpaceLighting.d.cts +51 -0
  70. package/dist/core/rendering/postprocess/screenSpaceLighting.d.ts +51 -0
  71. package/dist/core/rendering/webgpu.d.cts +2 -0
  72. package/dist/core/rendering/webgpu.d.ts +2 -0
  73. package/dist/core/world/components/WorldContainer/types.d.cts +1 -1
  74. package/dist/core/world/components/WorldContainer/types.d.ts +1 -1
  75. package/dist/{defaults-jVT3EUVe.js → defaults-BmnFvrSk.js} +13 -4
  76. package/dist/defaults-Y3XGbDmo.cjs +1 -0
  77. package/dist/editor.cjs +1 -1
  78. package/dist/editor.js +4 -4
  79. package/dist/{flow-DJRTbNvJ.js → flow-B_5Jtrhv.js} +1 -1
  80. package/dist/{flow-BnFTzumT.cjs → flow-CY0am38O.cjs} +1 -1
  81. package/dist/index.cjs +2 -2
  82. package/dist/index.css +1 -1
  83. package/dist/index.js +906 -904
  84. package/dist/network.cjs +1 -1
  85. package/dist/network.js +1 -1
  86. package/dist/{plugin-BUKo4q0N.cjs → plugin-BY3uYoSx.cjs} +32 -32
  87. package/dist/{plugin-Dsf9EwPP.js → plugin-uKCTitER.js} +907 -905
  88. package/dist/postprocessing.cjs +1 -1
  89. package/dist/postprocessing.js +1 -1
  90. package/dist/{quality-BLE1xXFm.js → quality--izFMxKn.js} +2 -2
  91. package/dist/{quality-0VukPLnv.cjs → quality-CxseVZ9x.cjs} +1 -1
  92. package/dist/runtime.cjs +1 -1
  93. package/dist/runtime.js +7 -7
  94. package/dist/sceneCompile-CWcdcntc.cjs +1 -0
  95. package/dist/{sceneCompile-BWpSal9S.js → sceneCompile-CuCsjsKm.js} +99 -91
  96. package/dist/{sfe-DnOKmvUM.cjs → sfe-BUv2sneT.cjs} +1 -1
  97. package/dist/{sfe-BAXSr5BB.js → sfe-DhJQcjMq.js} +1 -1
  98. package/dist/shell-C82J4LTq.cjs +1 -0
  99. package/dist/{shell-aiiC8SLL.js → shell-Ct-ZE2ZM.js} +2565 -2515
  100. package/dist/{useClicker-0Ln5ZSz0.cjs → useClicker-B-fGashd.cjs} +1 -1
  101. package/dist/{useClicker-DZrb1I0b.js → useClicker-ChI9FA0J.js} +1 -1
  102. package/dist/useGenericRefs-DzuTNaAX.cjs +1 -0
  103. package/dist/{useGenericRefs-D0cOKidj.js → useGenericRefs-PVX2F3On.js} +553 -270
  104. package/dist/{useVisitRoom-GXR8KyFN.cjs → useVisitRoom-BWf5YBiG.cjs} +1 -1
  105. package/dist/{useVisitRoom-C_UX2avV.js → useVisitRoom-qRZdBGlH.js} +6 -6
  106. package/package.json +3 -3
  107. package/dist/CoreBridge-CnLqWZNv.cjs +0 -1
  108. package/dist/WorldPostProcessing-C80qMk1k.cjs +0 -1
  109. package/dist/WorldPostProcessing-Dfq_RW-t.js +0 -158
  110. package/dist/defaults-BLDQhn77.cjs +0 -1
  111. package/dist/sceneCompile-D9xft0op.cjs +0 -1
  112. package/dist/shell-BRQStYy9.cjs +0 -1
  113. package/dist/useGenericRefs-CZ_HIQG_.cjs +0 -1
@@ -0,0 +1,60 @@
1
+ import * as THREE from 'three';
2
+ /**
3
+ * Fades what hides the camera's subject (`collisionMode: 'fade'`). One per scene, since materials and batches are shared
4
+ * scene state. A sweep collects contacts (`begin`, `collect`, `finish`); `update` animates each fade and restores what
5
+ * stopped occluding. How an occluder turns see-through is `SeeThrough`'s part.
6
+ */
7
+ export declare class CameraOcclusion {
8
+ /** Distance to the nearest contact of the current sweep that pushes the camera instead of fading. */
9
+ solid: number;
10
+ private readonly scene;
11
+ private readonly looks;
12
+ private readonly active;
13
+ private readonly idle;
14
+ private readonly hitMeshes;
15
+ private readonly hitParts;
16
+ private readonly hitDistances;
17
+ private hits;
18
+ private ray;
19
+ private radius;
20
+ private limit;
21
+ private mesh;
22
+ private kind;
23
+ private explicit;
24
+ private fadeMode;
25
+ private flush;
26
+ constructor(scene: THREE.Scene);
27
+ /** Starts collecting the contacts of a sweep along `ray` up to `limit`. */
28
+ begin(ray: THREE.Ray, radius: number, limit: number): this;
29
+ /**
30
+ * Collects the mesh's contacts: fades, or pushes for ground-like faces unless `explicit` (the mesh asked to fade).
31
+ * False when the mesh cannot fade and must push (see `SeeThrough.kindOf`).
32
+ */
33
+ collect(mesh: THREE.Mesh, explicit: boolean): boolean;
34
+ /** Fades what the sweep touched nearer than `distance`, where the camera ends up after pushing. */
35
+ finish(distance: number): void;
36
+ /**
37
+ * Moves every fade toward `opacity` while it occludes and back after, and restores what stopped occluding. Once the
38
+ * camera leaves fade mode (`fadeMode` false) and everything faded back, the kept copies are freed.
39
+ */
40
+ update(deltaTime: number, opacity?: number, fadeMode?: boolean): void;
41
+ /** Restores every faded occluder at once and frees every copy and proxy. */
42
+ dispose(): void;
43
+ private readonly onContact;
44
+ /**
45
+ * The batch holds its faded instances at zero scale and their proxies are intangible, so the sweep tests the proxies
46
+ * as the batch's own instances. A batch no longer collected (the camera went back to pushing) lets them fade back.
47
+ */
48
+ private collectProxies;
49
+ private addHit;
50
+ private touch;
51
+ /** The kept fade of this mesh and part, brought up to date, unless the mesh draws with other materials by now. */
52
+ private reuse;
53
+ private park;
54
+ private clearIdle;
55
+ }
56
+ export declare function getCameraOcclusion(scene: THREE.Scene): CameraOcclusion;
57
+ /** The scene's occlusion fader if a fade has ever been collected there; never creates one. */
58
+ export declare function peekCameraOcclusion(scene: THREE.Scene): CameraOcclusion | undefined;
59
+ /** Restores the scene's faded occluders and frees the fader. */
60
+ export declare function disposeCameraOcclusion(scene: THREE.Scene): void;
@@ -0,0 +1,60 @@
1
+ import * as THREE from 'three';
2
+ /**
3
+ * Fades what hides the camera's subject (`collisionMode: 'fade'`). One per scene, since materials and batches are shared
4
+ * scene state. A sweep collects contacts (`begin`, `collect`, `finish`); `update` animates each fade and restores what
5
+ * stopped occluding. How an occluder turns see-through is `SeeThrough`'s part.
6
+ */
7
+ export declare class CameraOcclusion {
8
+ /** Distance to the nearest contact of the current sweep that pushes the camera instead of fading. */
9
+ solid: number;
10
+ private readonly scene;
11
+ private readonly looks;
12
+ private readonly active;
13
+ private readonly idle;
14
+ private readonly hitMeshes;
15
+ private readonly hitParts;
16
+ private readonly hitDistances;
17
+ private hits;
18
+ private ray;
19
+ private radius;
20
+ private limit;
21
+ private mesh;
22
+ private kind;
23
+ private explicit;
24
+ private fadeMode;
25
+ private flush;
26
+ constructor(scene: THREE.Scene);
27
+ /** Starts collecting the contacts of a sweep along `ray` up to `limit`. */
28
+ begin(ray: THREE.Ray, radius: number, limit: number): this;
29
+ /**
30
+ * Collects the mesh's contacts: fades, or pushes for ground-like faces unless `explicit` (the mesh asked to fade).
31
+ * False when the mesh cannot fade and must push (see `SeeThrough.kindOf`).
32
+ */
33
+ collect(mesh: THREE.Mesh, explicit: boolean): boolean;
34
+ /** Fades what the sweep touched nearer than `distance`, where the camera ends up after pushing. */
35
+ finish(distance: number): void;
36
+ /**
37
+ * Moves every fade toward `opacity` while it occludes and back after, and restores what stopped occluding. Once the
38
+ * camera leaves fade mode (`fadeMode` false) and everything faded back, the kept copies are freed.
39
+ */
40
+ update(deltaTime: number, opacity?: number, fadeMode?: boolean): void;
41
+ /** Restores every faded occluder at once and frees every copy and proxy. */
42
+ dispose(): void;
43
+ private readonly onContact;
44
+ /**
45
+ * The batch holds its faded instances at zero scale and their proxies are intangible, so the sweep tests the proxies
46
+ * as the batch's own instances. A batch no longer collected (the camera went back to pushing) lets them fade back.
47
+ */
48
+ private collectProxies;
49
+ private addHit;
50
+ private touch;
51
+ /** The kept fade of this mesh and part, brought up to date, unless the mesh draws with other materials by now. */
52
+ private reuse;
53
+ private park;
54
+ private clearIdle;
55
+ }
56
+ export declare function getCameraOcclusion(scene: THREE.Scene): CameraOcclusion;
57
+ /** The scene's occlusion fader if a fade has ever been collected there; never creates one. */
58
+ export declare function peekCameraOcclusion(scene: THREE.Scene): CameraOcclusion | undefined;
59
+ /** Restores the scene's faded occluders and frees the fader. */
60
+ export declare function disposeCameraOcclusion(scene: THREE.Scene): void;
@@ -20,6 +20,8 @@ export declare class CameraSystem extends BaseCameraSystem {
20
20
  /** Frame-local orbit input; keep the owned configuration and controller view in sync. */
21
21
  updateOrbit(orbitYaw: number, orbitPitch: number): void;
22
22
  update(deltaTime: number): void;
23
+ /** Restores what the controllers changed in the scene, such as faded occluders. */
24
+ destroy(): void;
23
25
  calculate(props: CameraCalcProps): void;
24
26
  getCameraState(name: string): CameraState | undefined;
25
27
  getCurrentCameraState(): CameraState | undefined;
@@ -20,6 +20,8 @@ export declare class CameraSystem extends BaseCameraSystem {
20
20
  /** Frame-local orbit input; keep the owned configuration and controller view in sync. */
21
21
  updateOrbit(orbitYaw: number, orbitPitch: number): void;
22
22
  update(deltaTime: number): void;
23
+ /** Restores what the controllers changed in the scene, such as faded occluders. */
24
+ destroy(): void;
23
25
  calculate(props: CameraCalcProps): void;
24
26
  getCameraState(name: string): CameraState | undefined;
25
27
  getCurrentCameraState(): CameraState | undefined;
@@ -23,6 +23,7 @@ export declare const CAMERA_DEFAULTS: {
23
23
  readonly FOCUS: false;
24
24
  readonly ENABLE_COLLISION: true;
25
25
  readonly COLLISION_MARGIN: 0.1;
26
+ readonly COLLISION_FADE_OPACITY: 0.3;
26
27
  readonly SMOOTHING: {
27
28
  readonly POSITION: 0.08;
28
29
  readonly ROTATION: 0.1;
@@ -23,6 +23,7 @@ export declare const CAMERA_DEFAULTS: {
23
23
  readonly FOCUS: false;
24
24
  readonly ENABLE_COLLISION: true;
25
25
  readonly COLLISION_MARGIN: 0.1;
26
+ readonly COLLISION_FADE_OPACITY: 0.3;
26
27
  readonly SMOOTHING: {
27
28
  readonly POSITION: 0.08;
28
29
  readonly ROTATION: 0.1;
@@ -0,0 +1,64 @@
1
+ import * as THREE from 'three';
2
+ /**
3
+ * `geometry.userData` key under which a merged geometry lists its parts: the draw offset (index offset, or vertex offset
4
+ * without an index) where each part ends, ascending. Such a geometry fades part by part instead of as a whole.
5
+ */
6
+ export declare const MERGED_PARTS_KEY = "mergedParts";
7
+ /** A whole mesh swaps its material; an instance is drawn apart by a proxy; a merged part draws in its own group. */
8
+ export type FadeKind = 'whole' | 'instance' | 'part';
9
+ /** One occluder made see-through: a mesh, or one instance or merged part of it. */
10
+ export type Fade = {
11
+ kind: FadeKind;
12
+ mesh: THREE.Mesh;
13
+ /** The instance or merged part; -1 for a whole mesh. */
14
+ part: number;
15
+ /** What the mesh drew with when the fade was made. */
16
+ original: THREE.Material | THREE.Material[];
17
+ /** The distinct original materials, and a see-through copy and the opacity of each. */
18
+ sources: THREE.Material[];
19
+ copies: THREE.Material[];
20
+ opacities: number[];
21
+ /** `original` with each material replaced by its copy. */
22
+ faded: THREE.Material | THREE.Material[];
23
+ /** Draws the instance while its batch holds it at zero scale; its matrix is the instance's own. */
24
+ proxy: THREE.Mesh | null;
25
+ /** Draw range of a merged part. */
26
+ start: number;
27
+ count: number;
28
+ /** 0 opaque to 1 fully faded. */
29
+ amount: number;
30
+ /** Seconds it still counts as occluding; each contact sets it again. */
31
+ hold: number;
32
+ shown: boolean;
33
+ };
34
+ /** The part of a merged geometry that draw offset `offset` belongs to, or -1. */
35
+ export declare function partAt(geometry: THREE.BufferGeometry, offset: number): number;
36
+ /**
37
+ * Makes occluders see-through without changing anything they share: each fade draws with copies of its own. A whole mesh
38
+ * swaps its material, a batch holds the instance at zero scale while a proxy draws it, and a merged part draws in a group
39
+ * of its own. A fade is undone only where the mesh still draws what it made; an owner that replaced a material, geometry
40
+ * or instance keeps its change.
41
+ */
42
+ export declare class SeeThrough {
43
+ private readonly merged;
44
+ /** How the mesh can fade: null when invisible, batched, a shader material, or a merged mesh already split in groups. */
45
+ kindOf(mesh: THREE.Mesh): FadeKind | null;
46
+ /** A fade of the mesh, instance or part, not shown yet; null when the mesh cannot fade or a material cannot be copied. */
47
+ create(mesh: THREE.Mesh, part: number): Fade | null;
48
+ /**
49
+ * Brings a kept fade up to date with the mesh, whose materials, instances or merged parts may have changed since it
50
+ * last showed. False when it no longer fits: other materials, a part or instance gone, a material that no longer copies.
51
+ */
52
+ refresh(fade: Fade): boolean;
53
+ show(fade: Fade): void;
54
+ /** Puts back what the fade changed, where the mesh still draws what the fade left it. */
55
+ hide(fade: Fade): void;
56
+ /** Whether the mesh still draws what the fade made: its owner may have replaced a material, geometry or instances. */
57
+ owns(fade: Fade): boolean;
58
+ /** Undoes the fade where it still can and frees its copies. */
59
+ release(fade: Fade): void;
60
+ /** Takes the part's draw range, or the instance's geometry and color, from the mesh as it is now; false once gone. */
61
+ private locate;
62
+ /** Draws a merged mesh with one group per faded part, or as before once none is left. */
63
+ private layout;
64
+ }
@@ -0,0 +1,64 @@
1
+ import * as THREE from 'three';
2
+ /**
3
+ * `geometry.userData` key under which a merged geometry lists its parts: the draw offset (index offset, or vertex offset
4
+ * without an index) where each part ends, ascending. Such a geometry fades part by part instead of as a whole.
5
+ */
6
+ export declare const MERGED_PARTS_KEY = "mergedParts";
7
+ /** A whole mesh swaps its material; an instance is drawn apart by a proxy; a merged part draws in its own group. */
8
+ export type FadeKind = 'whole' | 'instance' | 'part';
9
+ /** One occluder made see-through: a mesh, or one instance or merged part of it. */
10
+ export type Fade = {
11
+ kind: FadeKind;
12
+ mesh: THREE.Mesh;
13
+ /** The instance or merged part; -1 for a whole mesh. */
14
+ part: number;
15
+ /** What the mesh drew with when the fade was made. */
16
+ original: THREE.Material | THREE.Material[];
17
+ /** The distinct original materials, and a see-through copy and the opacity of each. */
18
+ sources: THREE.Material[];
19
+ copies: THREE.Material[];
20
+ opacities: number[];
21
+ /** `original` with each material replaced by its copy. */
22
+ faded: THREE.Material | THREE.Material[];
23
+ /** Draws the instance while its batch holds it at zero scale; its matrix is the instance's own. */
24
+ proxy: THREE.Mesh | null;
25
+ /** Draw range of a merged part. */
26
+ start: number;
27
+ count: number;
28
+ /** 0 opaque to 1 fully faded. */
29
+ amount: number;
30
+ /** Seconds it still counts as occluding; each contact sets it again. */
31
+ hold: number;
32
+ shown: boolean;
33
+ };
34
+ /** The part of a merged geometry that draw offset `offset` belongs to, or -1. */
35
+ export declare function partAt(geometry: THREE.BufferGeometry, offset: number): number;
36
+ /**
37
+ * Makes occluders see-through without changing anything they share: each fade draws with copies of its own. A whole mesh
38
+ * swaps its material, a batch holds the instance at zero scale while a proxy draws it, and a merged part draws in a group
39
+ * of its own. A fade is undone only where the mesh still draws what it made; an owner that replaced a material, geometry
40
+ * or instance keeps its change.
41
+ */
42
+ export declare class SeeThrough {
43
+ private readonly merged;
44
+ /** How the mesh can fade: null when invisible, batched, a shader material, or a merged mesh already split in groups. */
45
+ kindOf(mesh: THREE.Mesh): FadeKind | null;
46
+ /** A fade of the mesh, instance or part, not shown yet; null when the mesh cannot fade or a material cannot be copied. */
47
+ create(mesh: THREE.Mesh, part: number): Fade | null;
48
+ /**
49
+ * Brings a kept fade up to date with the mesh, whose materials, instances or merged parts may have changed since it
50
+ * last showed. False when it no longer fits: other materials, a part or instance gone, a material that no longer copies.
51
+ */
52
+ refresh(fade: Fade): boolean;
53
+ show(fade: Fade): void;
54
+ /** Puts back what the fade changed, where the mesh still draws what the fade left it. */
55
+ hide(fade: Fade): void;
56
+ /** Whether the mesh still draws what the fade made: its owner may have replaced a material, geometry or instances. */
57
+ owns(fade: Fade): boolean;
58
+ /** Undoes the fade where it still can and frees its copies. */
59
+ release(fade: Fade): void;
60
+ /** Takes the part's draw range, or the instance's geometry and color, from the mesh as it is now; false once gone. */
61
+ private locate;
62
+ /** Draws a merged mesh with one group per faded part, or as before once none is left. */
63
+ private layout;
64
+ }
@@ -12,6 +12,12 @@ export interface CameraConstants {
12
12
  FRAME_RATE_LERP_SPEED: number;
13
13
  }
14
14
  export type CameraCollisionTargets = 'scene' | 'colliders';
15
+ /**
16
+ * What the camera does about a mesh between it and the character: `push` moves the camera in front of it, `fade` keeps
17
+ * the camera where it is and turns the mesh see-through until it stops occluding. A mesh (or an ancestor) overrides the
18
+ * option with `userData.cameraCollisionMode`.
19
+ */
20
+ export type CameraCollisionMode = 'push' | 'fade';
15
21
  export interface CameraBounds {
16
22
  minX?: number;
17
23
  maxX?: number;
@@ -40,6 +46,13 @@ export interface CameraOption {
40
46
  collisionMargin?: number;
41
47
  /** 'colliders' tests only meshes on CAMERA_COLLIDER_LAYER and falls back to the whole scene when none exist. */
42
48
  collisionTargets?: CameraCollisionTargets;
49
+ /**
50
+ * How `enableCollision` handles occluders; `push` (default) or `fade`. Fade still pushes for ground (surfaces facing
51
+ * up), meshes marked `userData.cameraCollisionMode: 'push'`, invisible meshes and materials it cannot fade.
52
+ */
53
+ collisionMode?: CameraCollisionMode;
54
+ /** Opacity a faded occluder reaches, 0–1, relative to its own (default 0.3). */
55
+ collisionFadeOpacity?: number;
43
56
  smoothing?: {
44
57
  position?: number;
45
58
  rotation?: number;
@@ -136,6 +149,8 @@ export interface CameraSystemConfig {
136
149
  enableCollision: boolean;
137
150
  collisionMargin?: number;
138
151
  collisionTargets?: CameraCollisionTargets;
152
+ collisionMode?: CameraCollisionMode;
153
+ collisionFadeOpacity?: number;
139
154
  orbitYaw?: number;
140
155
  orbitPitch?: number;
141
156
  smoothing?: {
@@ -172,6 +187,8 @@ export interface ICameraController {
172
187
  name: string;
173
188
  defaultConfig: Partial<CameraSystemConfig>;
174
189
  update(props: CameraCalcProps, state: CameraSystemState): void;
190
+ /** Restores what the controller changed in the scene (faded occluders) and frees what it made for that. */
191
+ dispose?(): void;
175
192
  }
176
193
  export interface Obstacle {
177
194
  object: THREE.Mesh;
@@ -12,6 +12,12 @@ export interface CameraConstants {
12
12
  FRAME_RATE_LERP_SPEED: number;
13
13
  }
14
14
  export type CameraCollisionTargets = 'scene' | 'colliders';
15
+ /**
16
+ * What the camera does about a mesh between it and the character: `push` moves the camera in front of it, `fade` keeps
17
+ * the camera where it is and turns the mesh see-through until it stops occluding. A mesh (or an ancestor) overrides the
18
+ * option with `userData.cameraCollisionMode`.
19
+ */
20
+ export type CameraCollisionMode = 'push' | 'fade';
15
21
  export interface CameraBounds {
16
22
  minX?: number;
17
23
  maxX?: number;
@@ -40,6 +46,13 @@ export interface CameraOption {
40
46
  collisionMargin?: number;
41
47
  /** 'colliders' tests only meshes on CAMERA_COLLIDER_LAYER and falls back to the whole scene when none exist. */
42
48
  collisionTargets?: CameraCollisionTargets;
49
+ /**
50
+ * How `enableCollision` handles occluders; `push` (default) or `fade`. Fade still pushes for ground (surfaces facing
51
+ * up), meshes marked `userData.cameraCollisionMode: 'push'`, invisible meshes and materials it cannot fade.
52
+ */
53
+ collisionMode?: CameraCollisionMode;
54
+ /** Opacity a faded occluder reaches, 0–1, relative to its own (default 0.3). */
55
+ collisionFadeOpacity?: number;
43
56
  smoothing?: {
44
57
  position?: number;
45
58
  rotation?: number;
@@ -136,6 +149,8 @@ export interface CameraSystemConfig {
136
149
  enableCollision: boolean;
137
150
  collisionMargin?: number;
138
151
  collisionTargets?: CameraCollisionTargets;
152
+ collisionMode?: CameraCollisionMode;
153
+ collisionFadeOpacity?: number;
139
154
  orbitYaw?: number;
140
155
  orbitPitch?: number;
141
156
  smoothing?: {
@@ -172,6 +187,8 @@ export interface ICameraController {
172
187
  name: string;
173
188
  defaultConfig: Partial<CameraSystemConfig>;
174
189
  update(props: CameraCalcProps, state: CameraSystemState): void;
190
+ /** Restores what the controller changed in the scene (faded occluders) and frees what it made for that. */
191
+ dispose?(): void;
175
192
  }
176
193
  export interface Obstacle {
177
194
  object: THREE.Mesh;
@@ -2,10 +2,13 @@ import { RapierRigidBody } from '@react-three/rapier';
2
2
  import * as THREE from 'three';
3
3
  import { ActiveStateType } from '../../motions/core/types.cjs';
4
4
  import { CAMERA_CONSTANTS } from '../core/constants.cjs';
5
- import { CameraOptionType, CameraBounds, CollisionCheckResult, type CameraCollisionTargets } from '../core/types.cjs';
5
+ import { CameraOptionType, CameraBounds, CollisionCheckResult, type CameraCollisionMode, type CameraCollisionTargets } from '../core/types.cjs';
6
6
  export declare function invalidateCollisionCache(): void;
7
- /** Frame hot path: writes the collision-safe camera position into `out` without collecting obstacles. */
8
- export declare function resolveCollisionPosition(from: THREE.Vector3, to: THREE.Vector3, scene: THREE.Scene, radius: number, excludedObjects: THREE.Object3D[] | undefined, out: THREE.Vector3, targets?: CameraCollisionTargets): THREE.Vector3;
7
+ /**
8
+ * Frame hot path: writes the collision-safe camera position into `out` without collecting obstacles. `mode` is the
9
+ * camera's collision mode; fading meshes leave the position alone and are faded by the scene's occlusion fader.
10
+ */
11
+ export declare function resolveCollisionPosition(from: THREE.Vector3, to: THREE.Vector3, scene: THREE.Scene, radius: number, excludedObjects: THREE.Object3D[] | undefined, out: THREE.Vector3, targets?: CameraCollisionTargets, mode?: CameraCollisionMode): THREE.Vector3;
9
12
  export { CAMERA_CONSTANTS };
10
13
  export declare const cameraUtils: {
11
14
  tempVectors: {
@@ -2,10 +2,13 @@ import { RapierRigidBody } from '@react-three/rapier';
2
2
  import * as THREE from 'three';
3
3
  import { ActiveStateType } from '../../motions/core/types.js';
4
4
  import { CAMERA_CONSTANTS } from '../core/constants.js';
5
- import { CameraOptionType, CameraBounds, CollisionCheckResult, type CameraCollisionTargets } from '../core/types.js';
5
+ import { CameraOptionType, CameraBounds, CollisionCheckResult, type CameraCollisionMode, type CameraCollisionTargets } from '../core/types.js';
6
6
  export declare function invalidateCollisionCache(): void;
7
- /** Frame hot path: writes the collision-safe camera position into `out` without collecting obstacles. */
8
- export declare function resolveCollisionPosition(from: THREE.Vector3, to: THREE.Vector3, scene: THREE.Scene, radius: number, excludedObjects: THREE.Object3D[] | undefined, out: THREE.Vector3, targets?: CameraCollisionTargets): THREE.Vector3;
7
+ /**
8
+ * Frame hot path: writes the collision-safe camera position into `out` without collecting obstacles. `mode` is the
9
+ * camera's collision mode; fading meshes leave the position alone and are faded by the scene's occlusion fader.
10
+ */
11
+ export declare function resolveCollisionPosition(from: THREE.Vector3, to: THREE.Vector3, scene: THREE.Scene, radius: number, excludedObjects: THREE.Object3D[] | undefined, out: THREE.Vector3, targets?: CameraCollisionTargets, mode?: CameraCollisionMode): THREE.Vector3;
9
12
  export { CAMERA_CONSTANTS };
10
13
  export declare const cameraUtils: {
11
14
  tempVectors: {
@@ -11,7 +11,14 @@ export declare function sweepSphereBounds(mesh: Mesh, ray: Ray, radius: number,
11
11
  * ray.direction must be normalized. Infinity means no contact within maxDistance.
12
12
  */
13
13
  export declare function sweepSphereTriangle(ray: Ray, radius: number, surface: Triangle, maxDistance: number, point: Vector3): number;
14
+ /**
15
+ * Receives every contact of a sweep that collects them, not only the nearest: the instance (-1 outside instanced and
16
+ * batched meshes), the index offset of the triangle's first corner, the distance, and the triangle's world normal turned
17
+ * toward the ray origin. The normal is reused by the next contact.
18
+ */
19
+ export type SweepContact = (instance: number, offset: number, distance: number, normal: Vector3) => void;
14
20
  /** Mesh sweep uses exact triangles after a conservative world-AABB broad phase.
15
21
  * Output point is caller-owned. Animated vertices use Mesh.getVertexPosition.
22
+ * `onContact` also receives every contact within `maxDistance`, per instance and triangle.
16
23
  */
17
- export declare function sweepSphereMesh(mesh: Mesh, ray: Ray, radius: number, maxDistance: number, point: Vector3): number;
24
+ export declare function sweepSphereMesh(mesh: Mesh, ray: Ray, radius: number, maxDistance: number, point: Vector3, onContact?: SweepContact): number;
@@ -11,7 +11,14 @@ export declare function sweepSphereBounds(mesh: Mesh, ray: Ray, radius: number,
11
11
  * ray.direction must be normalized. Infinity means no contact within maxDistance.
12
12
  */
13
13
  export declare function sweepSphereTriangle(ray: Ray, radius: number, surface: Triangle, maxDistance: number, point: Vector3): number;
14
+ /**
15
+ * Receives every contact of a sweep that collects them, not only the nearest: the instance (-1 outside instanced and
16
+ * batched meshes), the index offset of the triangle's first corner, the distance, and the triangle's world normal turned
17
+ * toward the ray origin. The normal is reused by the next contact.
18
+ */
19
+ export type SweepContact = (instance: number, offset: number, distance: number, normal: Vector3) => void;
14
20
  /** Mesh sweep uses exact triangles after a conservative world-AABB broad phase.
15
21
  * Output point is caller-owned. Animated vertices use Mesh.getVertexPosition.
22
+ * `onContact` also receives every contact within `maxDistance`, per instance and triangle.
16
23
  */
17
- export declare function sweepSphereMesh(mesh: Mesh, ray: Ray, radius: number, maxDistance: number, point: Vector3): number;
24
+ export declare function sweepSphereMesh(mesh: Mesh, ray: Ray, radius: number, maxDistance: number, point: Vector3, onContact?: SweepContact): number;
@@ -5,7 +5,7 @@ export type CameraSettingsMode = {
5
5
  };
6
6
  export type CameraSettingsFieldKind = 'range' | 'checkbox';
7
7
  export type CameraSettingsFieldValue = number | boolean;
8
- export type CameraSettingsFieldPath = 'xDistance' | 'yDistance' | 'zDistance' | 'fov' | 'enableZoom' | 'zoomSpeed' | 'minZoom' | 'maxZoom' | 'enableCollision' | 'enableFocus' | 'focusDistance' | 'smoothing.position' | 'smoothing.rotation' | 'smoothing.fov' | 'bounds.minY' | 'bounds.maxY';
8
+ export type CameraSettingsFieldPath = 'xDistance' | 'yDistance' | 'zDistance' | 'fov' | 'enableZoom' | 'zoomSpeed' | 'minZoom' | 'maxZoom' | 'enableCollision' | 'collisionMode' | 'collisionFadeOpacity' | 'enableFocus' | 'focusDistance' | 'smoothing.position' | 'smoothing.rotation' | 'smoothing.fov' | 'bounds.minY' | 'bounds.maxY';
9
9
  export type CameraSettingsField = {
10
10
  key: string;
11
11
  label: string;
@@ -5,7 +5,7 @@ export type CameraSettingsMode = {
5
5
  };
6
6
  export type CameraSettingsFieldKind = 'range' | 'checkbox';
7
7
  export type CameraSettingsFieldValue = number | boolean;
8
- export type CameraSettingsFieldPath = 'xDistance' | 'yDistance' | 'zDistance' | 'fov' | 'enableZoom' | 'zoomSpeed' | 'minZoom' | 'maxZoom' | 'enableCollision' | 'enableFocus' | 'focusDistance' | 'smoothing.position' | 'smoothing.rotation' | 'smoothing.fov' | 'bounds.minY' | 'bounds.maxY';
8
+ export type CameraSettingsFieldPath = 'xDistance' | 'yDistance' | 'zDistance' | 'fov' | 'enableZoom' | 'zoomSpeed' | 'minZoom' | 'maxZoom' | 'enableCollision' | 'collisionMode' | 'collisionFadeOpacity' | 'enableFocus' | 'focusDistance' | 'smoothing.position' | 'smoothing.rotation' | 'smoothing.fov' | 'bounds.minY' | 'bounds.maxY';
9
9
  export type CameraSettingsField = {
10
10
  key: string;
11
11
  label: string;
@@ -1,10 +1,35 @@
1
1
  export type WorldPostProcessingProps = {
2
- quality?: 'performance' | 'balanced' | 'quality';
2
+ /** Preset for the defaults below. `cinematic` is `quality` plus screen-space GI and reflections. */
3
+ quality?: 'performance' | 'balanced' | 'quality' | 'cinematic';
3
4
  antialias?: 'none' | 'traa';
4
5
  ambientOcclusion?: boolean;
5
6
  aoRadius?: number;
6
7
  aoSamples?: number;
7
8
  aoResolutionScale?: number;
9
+ /**
10
+ * Screen-space global illumination: one bounce of indirect diffuse light with its own occlusion, which takes the
11
+ * place of `ambientOcclusion`. Needs a WebGPU device and a perspective camera; elsewhere it stays off.
12
+ */
13
+ globalIllumination?: boolean;
14
+ /** World units a surface gathers bounced light and occlusion from. */
15
+ giRadius?: number;
16
+ /** Samples along each gathering direction, 1–32. Cost grows with it. */
17
+ giSteps?: number;
18
+ /** Strength of the bounced light. */
19
+ giIntensity?: number;
20
+ /** Fraction of the canvas resolution GI renders at, 0.25–1. */
21
+ giResolutionScale?: number;
22
+ /** Screen-space reflections on metals and glossy surfaces. Needs a WebGPU device; elsewhere it stays off. */
23
+ reflections?: boolean;
24
+ /** World units a reflected ray travels. */
25
+ reflectionDistance?: number;
26
+ /** Ray-march density, 0.05–1. Cost grows with it. */
27
+ reflectionQuality?: number;
28
+ reflectionIntensity?: number;
29
+ /** Fraction of the canvas resolution reflections render at, 0.25–1. */
30
+ reflectionResolutionScale?: number;
31
+ /** Surfaces rougher than this reflect nothing and march no rays. */
32
+ reflectionMaxRoughness?: number;
8
33
  /** Increment after teleport, world replacement, or authoritative network correction. */
9
34
  historyVersion?: number;
10
35
  bloomStrength?: number;
@@ -1,10 +1,35 @@
1
1
  export type WorldPostProcessingProps = {
2
- quality?: 'performance' | 'balanced' | 'quality';
2
+ /** Preset for the defaults below. `cinematic` is `quality` plus screen-space GI and reflections. */
3
+ quality?: 'performance' | 'balanced' | 'quality' | 'cinematic';
3
4
  antialias?: 'none' | 'traa';
4
5
  ambientOcclusion?: boolean;
5
6
  aoRadius?: number;
6
7
  aoSamples?: number;
7
8
  aoResolutionScale?: number;
9
+ /**
10
+ * Screen-space global illumination: one bounce of indirect diffuse light with its own occlusion, which takes the
11
+ * place of `ambientOcclusion`. Needs a WebGPU device and a perspective camera; elsewhere it stays off.
12
+ */
13
+ globalIllumination?: boolean;
14
+ /** World units a surface gathers bounced light and occlusion from. */
15
+ giRadius?: number;
16
+ /** Samples along each gathering direction, 1–32. Cost grows with it. */
17
+ giSteps?: number;
18
+ /** Strength of the bounced light. */
19
+ giIntensity?: number;
20
+ /** Fraction of the canvas resolution GI renders at, 0.25–1. */
21
+ giResolutionScale?: number;
22
+ /** Screen-space reflections on metals and glossy surfaces. Needs a WebGPU device; elsewhere it stays off. */
23
+ reflections?: boolean;
24
+ /** World units a reflected ray travels. */
25
+ reflectionDistance?: number;
26
+ /** Ray-march density, 0.05–1. Cost grows with it. */
27
+ reflectionQuality?: number;
28
+ reflectionIntensity?: number;
29
+ /** Fraction of the canvas resolution reflections render at, 0.25–1. */
30
+ reflectionResolutionScale?: number;
31
+ /** Surfaces rougher than this reflect nothing and march no rays. */
32
+ reflectionMaxRoughness?: number;
8
33
  /** Increment after teleport, world replacement, or authoritative network correction. */
9
34
  historyVersion?: number;
10
35
  bloomStrength?: number;
@@ -0,0 +1,51 @@
1
+ import { type Camera } from 'three';
2
+ import type { Node, PassNode, TextureNode } from 'three/webgpu';
3
+ type Tsl = typeof import('three/tsl');
4
+ type GiModule = typeof import('three/addons/tsl/display/SSGINode.js');
5
+ type ReflectionModule = typeof import('three/addons/tsl/display/SSRNode.js');
6
+ type DenoiseModule = typeof import('three/addons/tsl/display/DenoiseNode.js');
7
+ /** Uniform-only controls: changing them never rebuilds a shader or the pipeline. */
8
+ export type ScreenSpaceLightingSettings = {
9
+ giRadius: number;
10
+ giSteps: number;
11
+ giIntensity: number;
12
+ giResolutionScale: number;
13
+ reflectionDistance: number;
14
+ reflectionQuality: number;
15
+ reflectionIntensity: number;
16
+ reflectionResolutionScale: number;
17
+ reflectionMaxRoughness: number;
18
+ };
19
+ export type ScreenSpaceLightingModules = {
20
+ gi: GiModule | null;
21
+ reflections: ReflectionModule | null;
22
+ denoise: DenoiseModule | null;
23
+ };
24
+ export type ScreenSpaceLighting = {
25
+ /** The scene colour with bounced light, its occlusion and reflections, drawn once per frame. */
26
+ color: TextureNode;
27
+ update(settings: ScreenSpaceLightingSettings): void;
28
+ dispose(): void;
29
+ };
30
+ type Disposable = {
31
+ dispose(): void;
32
+ };
33
+ /** Disposes every resource even when one throws, then rethrows the first failure. */
34
+ export declare function disposeAll(resources: readonly (Disposable | null | undefined)[]): void;
35
+ /** Loads the addons the enabled effects need; GI comes with the filter that smooths it. */
36
+ export declare function loadScreenSpaceLighting(gi: boolean, reflections: boolean): Promise<ScreenSpaceLightingModules>;
37
+ /**
38
+ * Scene-pass outputs the GI and reflection passes read, picked per material when its shader builds: `normal` holds the
39
+ * view normal and roughness, `surface` the base colour and metalness. Only standard and physical materials reflect
40
+ * (others write roughness 1), and unlit materials write black, so they receive no bounced light.
41
+ */
42
+ export declare function surfaceOutputs(tsl: Tsl): {
43
+ normal: Node;
44
+ surface: Node;
45
+ };
46
+ /**
47
+ * Lumen-style screen-space lighting over a scene pass that writes `surfaceOutputs`. Both effects land in one texture,
48
+ * so temporal AA accumulates the GI noise and bloom reads the lit colour once.
49
+ */
50
+ export declare function createScreenSpaceLighting(tsl: Tsl, modules: ScreenSpaceLightingModules, scenePass: PassNode, camera: Camera, temporal: boolean): ScreenSpaceLighting;
51
+ export {};