@pascal-app/viewer 0.9.1 → 0.9.2

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 (176) hide show
  1. package/dist/components/error-boundary.d.ts +6 -0
  2. package/dist/components/error-boundary.d.ts.map +1 -1
  3. package/dist/components/error-boundary.js +6 -0
  4. package/dist/components/renderers/node-renderer.d.ts +5 -1
  5. package/dist/components/renderers/node-renderer.d.ts.map +1 -1
  6. package/dist/components/renderers/node-renderer.js +5 -2
  7. package/dist/components/renderers/parametric-node-renderer.d.ts.map +1 -1
  8. package/dist/components/renderers/parametric-node-renderer.js +7 -4
  9. package/dist/components/viewer/bvh-ecctrl.d.ts +77 -0
  10. package/dist/components/viewer/bvh-ecctrl.d.ts.map +1 -0
  11. package/dist/components/viewer/bvh-ecctrl.js +552 -0
  12. package/dist/components/viewer/frame-limiter.d.ts.map +1 -1
  13. package/dist/components/viewer/frame-limiter.js +39 -4
  14. package/dist/components/viewer/glb-interactive.d.ts +41 -0
  15. package/dist/components/viewer/glb-interactive.d.ts.map +1 -0
  16. package/dist/components/viewer/glb-interactive.js +394 -0
  17. package/dist/components/viewer/glb-reference-nodes.d.ts +29 -0
  18. package/dist/components/viewer/glb-reference-nodes.d.ts.map +1 -0
  19. package/dist/components/viewer/glb-reference-nodes.js +80 -0
  20. package/dist/components/viewer/glb-replace-instances.d.ts +18 -0
  21. package/dist/components/viewer/glb-replace-instances.d.ts.map +1 -0
  22. package/dist/components/viewer/glb-replace-instances.js +61 -0
  23. package/dist/components/viewer/glb-scene.d.ts +54 -0
  24. package/dist/components/viewer/glb-scene.d.ts.map +1 -0
  25. package/dist/components/viewer/glb-scene.js +920 -0
  26. package/dist/components/viewer/glb-walkthrough-controller.d.ts +12 -0
  27. package/dist/components/viewer/glb-walkthrough-controller.d.ts.map +1 -0
  28. package/dist/components/viewer/glb-walkthrough-controller.js +357 -0
  29. package/dist/components/viewer/index.d.ts +19 -2
  30. package/dist/components/viewer/index.d.ts.map +1 -1
  31. package/dist/components/viewer/index.js +104 -12
  32. package/dist/components/viewer/lights.d.ts.map +1 -1
  33. package/dist/components/viewer/lights.js +36 -5
  34. package/dist/components/viewer/perf-monitor.d.ts.map +1 -1
  35. package/dist/components/viewer/perf-monitor.js +17 -2
  36. package/dist/components/viewer/post-processing.d.ts +7 -1
  37. package/dist/components/viewer/post-processing.d.ts.map +1 -1
  38. package/dist/components/viewer/post-processing.js +179 -24
  39. package/dist/components/viewer/registered-systems.d.ts.map +1 -1
  40. package/dist/components/viewer/registered-systems.js +6 -4
  41. package/dist/components/viewer/scene-bvh.d.ts +2 -1
  42. package/dist/components/viewer/scene-bvh.d.ts.map +1 -1
  43. package/dist/components/viewer/scene-bvh.js +3 -0
  44. package/dist/components/viewer/scene-bvh.test.d.ts +2 -0
  45. package/dist/components/viewer/scene-bvh.test.d.ts.map +1 -0
  46. package/dist/components/viewer/scene-bvh.test.js +13 -0
  47. package/dist/components/viewer/scene-environment.d.ts +2 -0
  48. package/dist/components/viewer/scene-environment.d.ts.map +1 -0
  49. package/dist/components/viewer/scene-environment.js +79 -0
  50. package/dist/components/viewer/selection-manager.d.ts.map +1 -1
  51. package/dist/components/viewer/selection-manager.js +18 -10
  52. package/dist/components/viewer/walkthrough-controls.d.ts +1 -0
  53. package/dist/components/viewer/walkthrough-controls.d.ts.map +1 -1
  54. package/dist/components/viewer/walkthrough-controls.js +20 -0
  55. package/dist/hooks/use-gltf-ktx2.d.ts.map +1 -1
  56. package/dist/hooks/use-gltf-ktx2.js +3 -22
  57. package/dist/hooks/use-node-events.d.ts +1 -1
  58. package/dist/hooks/use-node-events.d.ts.map +1 -1
  59. package/dist/hooks/use-node-events.js +22 -14
  60. package/dist/index.d.ts +19 -8
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +22 -8
  63. package/dist/lib/backdrop.d.ts +33 -0
  64. package/dist/lib/backdrop.d.ts.map +1 -0
  65. package/dist/lib/backdrop.js +92 -0
  66. package/dist/lib/box-uv.d.ts +13 -0
  67. package/dist/lib/box-uv.d.ts.map +1 -0
  68. package/dist/lib/box-uv.js +32 -0
  69. package/dist/lib/csg-utils.d.ts +3 -9
  70. package/dist/lib/csg-utils.d.ts.map +1 -1
  71. package/dist/lib/csg-utils.js +65 -5
  72. package/dist/lib/csg-utils.test.d.ts +2 -0
  73. package/dist/lib/csg-utils.test.d.ts.map +1 -0
  74. package/dist/lib/csg-utils.test.js +45 -0
  75. package/dist/lib/edge-style.d.ts +1 -0
  76. package/dist/lib/edge-style.d.ts.map +1 -1
  77. package/dist/lib/edge-style.js +26 -6
  78. package/dist/lib/ink-edges.d.ts +1 -1
  79. package/dist/lib/ink-edges.d.ts.map +1 -1
  80. package/dist/lib/ink-edges.js +13 -7
  81. package/dist/lib/ktx2-loader.d.ts +43 -0
  82. package/dist/lib/ktx2-loader.d.ts.map +1 -0
  83. package/dist/lib/ktx2-loader.js +136 -0
  84. package/dist/lib/layers.d.ts +10 -0
  85. package/dist/lib/layers.d.ts.map +1 -1
  86. package/dist/lib/layers.js +10 -0
  87. package/dist/lib/materials.d.ts +14 -1
  88. package/dist/lib/materials.d.ts.map +1 -1
  89. package/dist/lib/materials.js +103 -26
  90. package/dist/lib/scene-themes.d.ts +1 -0
  91. package/dist/lib/scene-themes.d.ts.map +1 -1
  92. package/dist/lib/scene-themes.js +25 -16
  93. package/dist/lib/shadow-only.d.ts +4 -0
  94. package/dist/lib/shadow-only.d.ts.map +1 -0
  95. package/dist/lib/shadow-only.js +36 -0
  96. package/dist/lib/tsl-compat.d.ts +12 -0
  97. package/dist/lib/tsl-compat.d.ts.map +1 -0
  98. package/dist/lib/tsl-compat.js +13 -0
  99. package/dist/store/use-viewer.d.ts +60 -18
  100. package/dist/store/use-viewer.d.ts.map +1 -1
  101. package/dist/store/use-viewer.js +175 -3
  102. package/dist/store/use-viewer.test.d.ts +2 -0
  103. package/dist/store/use-viewer.test.d.ts.map +1 -0
  104. package/dist/store/use-viewer.test.js +42 -0
  105. package/dist/systems/ceiling/ceiling-system.d.ts.map +1 -1
  106. package/dist/systems/ceiling/ceiling-system.js +4 -1
  107. package/dist/systems/door/door-animation.test.d.ts +2 -0
  108. package/dist/systems/door/door-animation.test.d.ts.map +1 -0
  109. package/dist/systems/door/door-animation.test.js +51 -0
  110. package/dist/systems/door/door-floor-alignment.test.d.ts +2 -0
  111. package/dist/systems/door/door-floor-alignment.test.d.ts.map +1 -0
  112. package/dist/systems/door/door-floor-alignment.test.js +50 -0
  113. package/dist/systems/door/door-system.d.ts +24 -0
  114. package/dist/systems/door/door-system.d.ts.map +1 -1
  115. package/dist/systems/door/door-system.js +494 -161
  116. package/dist/systems/fence/fence-system.d.ts +17 -0
  117. package/dist/systems/fence/fence-system.d.ts.map +1 -1
  118. package/dist/systems/fence/fence-system.js +221 -53
  119. package/dist/systems/geometry/geometry-system.d.ts +7 -0
  120. package/dist/systems/geometry/geometry-system.d.ts.map +1 -1
  121. package/dist/systems/geometry/geometry-system.js +95 -26
  122. package/dist/systems/geometry/geometry-system.test.d.ts +2 -0
  123. package/dist/systems/geometry/geometry-system.test.d.ts.map +1 -0
  124. package/dist/systems/geometry/geometry-system.test.js +30 -0
  125. package/dist/systems/interactive/control-widget.d.ts +10 -0
  126. package/dist/systems/interactive/control-widget.d.ts.map +1 -0
  127. package/dist/systems/interactive/control-widget.js +35 -0
  128. package/dist/systems/interactive/interactive-system.d.ts.map +1 -1
  129. package/dist/systems/interactive/interactive-system.js +55 -56
  130. package/dist/systems/item/item-system.d.ts.map +1 -1
  131. package/dist/systems/item/item-system.js +20 -6
  132. package/dist/systems/level/level-system.d.ts.map +1 -1
  133. package/dist/systems/level/level-system.js +28 -4
  134. package/dist/systems/level/level-utils.d.ts +0 -3
  135. package/dist/systems/level/level-utils.d.ts.map +1 -1
  136. package/dist/systems/level/level-utils.js +2 -41
  137. package/dist/systems/roof/roof-materials.d.ts.map +1 -1
  138. package/dist/systems/roof/roof-materials.js +29 -8
  139. package/dist/systems/roof/roof-system.d.ts +21 -8
  140. package/dist/systems/roof/roof-system.d.ts.map +1 -1
  141. package/dist/systems/roof/roof-system.js +1079 -221
  142. package/dist/systems/slab/slab-system.d.ts +5 -3
  143. package/dist/systems/slab/slab-system.d.ts.map +1 -1
  144. package/dist/systems/slab/slab-system.js +41 -23
  145. package/dist/systems/slab/slab-system.test.js +3 -2
  146. package/dist/systems/stair/stair-system.js +6 -3
  147. package/dist/systems/wall/opening-cutout-geometry.d.ts +31 -0
  148. package/dist/systems/wall/opening-cutout-geometry.d.ts.map +1 -0
  149. package/dist/systems/wall/opening-cutout-geometry.js +167 -0
  150. package/dist/systems/wall/opening-cutout-geometry.test.d.ts +2 -0
  151. package/dist/systems/wall/opening-cutout-geometry.test.d.ts.map +1 -0
  152. package/dist/systems/wall/opening-cutout-geometry.test.js +172 -0
  153. package/dist/systems/wall/wall-cutout.d.ts.map +1 -1
  154. package/dist/systems/wall/wall-cutout.js +46 -17
  155. package/dist/systems/wall/wall-materials.d.ts +11 -7
  156. package/dist/systems/wall/wall-materials.d.ts.map +1 -1
  157. package/dist/systems/wall/wall-materials.js +244 -35
  158. package/dist/systems/wall/wall-opening-cutout.test.d.ts +2 -0
  159. package/dist/systems/wall/wall-opening-cutout.test.d.ts.map +1 -0
  160. package/dist/systems/wall/wall-opening-cutout.test.js +59 -0
  161. package/dist/systems/wall/wall-support-extension.test.d.ts +2 -0
  162. package/dist/systems/wall/wall-support-extension.test.d.ts.map +1 -0
  163. package/dist/systems/wall/wall-support-extension.test.js +48 -0
  164. package/dist/systems/wall/wall-system.d.ts +2 -2
  165. package/dist/systems/wall/wall-system.d.ts.map +1 -1
  166. package/dist/systems/wall/wall-system.js +329 -174
  167. package/dist/systems/window/window-animation-system.d.ts +12 -0
  168. package/dist/systems/window/window-animation-system.d.ts.map +1 -1
  169. package/dist/systems/window/window-animation-system.js +16 -5
  170. package/dist/systems/window/window-system.d.ts +7 -0
  171. package/dist/systems/window/window-system.d.ts.map +1 -1
  172. package/dist/systems/window/window-system.js +240 -14
  173. package/package.json +4 -4
  174. package/dist/components/viewer/ground-occluder.d.ts +0 -2
  175. package/dist/components/viewer/ground-occluder.d.ts.map +0 -1
  176. package/dist/components/viewer/ground-occluder.js +0 -67
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scene-environment.d.ts","sourceRoot":"","sources":["../../../src/components/viewer/scene-environment.tsx"],"names":[],"mappings":"AAmEA,wBAAgB,gBAAgB,SAkB/B"}
@@ -0,0 +1,79 @@
1
+ 'use client';
2
+ import { useThree } from '@react-three/fiber';
3
+ import { useEffect, useMemo } from 'react';
4
+ import * as THREE from 'three/webgpu';
5
+ import { getSceneTheme } from '../../lib/scene-themes';
6
+ import useViewer from '../../store/use-viewer';
7
+ /**
8
+ * Scene IBL — a small procedural gradient sky (cool zenith → warm horizon →
9
+ * dim ground bounce) used purely as the environment light source. The visible
10
+ * backdrop stays the flat theme background (composited in post-processing);
11
+ * this texture is never shown. Replaces the old `venice_sunset_1k.hdr` fetch:
12
+ * no network dependency, and the vertical color split means upward-facing
13
+ * surfaces read cooler than vertical ones instead of everything getting the
14
+ * same directionless warm wash. Exported as an opt-in <Viewer> child so
15
+ * embed / thumbnail surfaces that don't want IBL simply don't mount it.
16
+ * Only affects `rendered` shading (Lambert ignores env maps).
17
+ */
18
+ // Linear-space gradient stops.
19
+ const ZENITH = [0.4, 0.56, 0.78];
20
+ const HORIZON = [0.95, 0.84, 0.66];
21
+ const GROUND = [0.38, 0.35, 0.3];
22
+ const ENV_INTENSITY = 0.6;
23
+ // The gradient sky is a daylight source; dark themes only want a whisper of it.
24
+ const ENV_INTENSITY_DARK = 0.2;
25
+ const WIDTH = 64;
26
+ const HEIGHT = 32;
27
+ function buildGradientSky() {
28
+ const data = new Float32Array(WIDTH * HEIGHT * 4);
29
+ for (let y = 0; y < HEIGHT; y++) {
30
+ // Row 0 = v0 = nadir, top row = zenith (equirect v spans -90°..+90°).
31
+ const lat = ((y + 0.5) / HEIGHT) * 2 - 1;
32
+ let r;
33
+ let g;
34
+ let b;
35
+ if (lat <= 0) {
36
+ // Below the horizon: flat ground bounce, slightly darker toward nadir.
37
+ const k = 1 + lat * 0.35;
38
+ r = GROUND[0] * k;
39
+ g = GROUND[1] * k;
40
+ b = GROUND[2] * k;
41
+ }
42
+ else {
43
+ // pow < 1 widens the warm horizon band.
44
+ const t = lat ** 0.65;
45
+ r = HORIZON[0] + (ZENITH[0] - HORIZON[0]) * t;
46
+ g = HORIZON[1] + (ZENITH[1] - HORIZON[1]) * t;
47
+ b = HORIZON[2] + (ZENITH[2] - HORIZON[2]) * t;
48
+ }
49
+ for (let x = 0; x < WIDTH; x++) {
50
+ const i = (y * WIDTH + x) * 4;
51
+ data[i] = r;
52
+ data[i + 1] = g;
53
+ data[i + 2] = b;
54
+ data[i + 3] = 1;
55
+ }
56
+ }
57
+ const texture = new THREE.DataTexture(data, WIDTH, HEIGHT, THREE.RGBAFormat, THREE.FloatType);
58
+ texture.mapping = THREE.EquirectangularReflectionMapping;
59
+ texture.colorSpace = THREE.LinearSRGBColorSpace;
60
+ texture.needsUpdate = true;
61
+ return texture;
62
+ }
63
+ export function SceneEnvironment() {
64
+ const scene = useThree((state) => state.scene);
65
+ const texture = useMemo(buildGradientSky, []);
66
+ const appearance = useViewer((state) => getSceneTheme(state.sceneTheme).appearance);
67
+ useEffect(() => {
68
+ const prevEnvironment = scene.environment;
69
+ const prevIntensity = scene.environmentIntensity;
70
+ scene.environment = texture;
71
+ scene.environmentIntensity = appearance === 'dark' ? ENV_INTENSITY_DARK : ENV_INTENSITY;
72
+ return () => {
73
+ scene.environment = prevEnvironment;
74
+ scene.environmentIntensity = prevIntensity;
75
+ texture.dispose();
76
+ };
77
+ }, [scene, texture, appearance]);
78
+ return null;
79
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"selection-manager.d.ts","sourceRoot":"","sources":["../../../src/components/viewer/selection-manager.tsx"],"names":[],"mappings":"AA0SA,eAAO,MAAM,gBAAgB,mCA0F5B,CAAA"}
1
+ {"version":3,"file":"selection-manager.d.ts","sourceRoot":"","sources":["../../../src/components/viewer/selection-manager.tsx"],"names":[],"mappings":"AAiTA,eAAO,MAAM,gBAAgB,mCAqG5B,CAAA"}
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { emitter, getSelectableKinds, pointInPolygon, sceneRegistry, useScene, } from '@pascal-app/core';
3
+ import { emitter, getSelectableKinds, pointInPolygon, resolveSelectionProxyId, sceneRegistry, useScene, } from '@pascal-app/core';
4
4
  import { useThree } from '@react-three/fiber';
5
5
  import { useEffect, useRef } from 'react';
6
6
  import { Vector3 } from 'three';
@@ -122,16 +122,18 @@ const isNodeInZone = (node, levelId, zoneId) => {
122
122
  };
123
123
  const getStrategy = () => {
124
124
  const { buildingId, levelId, zoneId } = useViewer.getState().selection;
125
- const computeNextIds = (node, selectedIds, event) => {
125
+ const computeNextIds = (nodeId, selectedIds, event) => {
126
126
  const isMeta = event?.metaKey || event?.nativeEvent?.metaKey;
127
127
  const isCtrl = event?.ctrlKey || event?.nativeEvent?.ctrlKey;
128
- if (isMeta || isCtrl) {
129
- if (selectedIds.includes(node.id)) {
130
- return selectedIds.filter((id) => id !== node.id);
128
+ // Shift toggles membership like Cmd/Ctrl.
129
+ const isShift = event?.shiftKey || event?.nativeEvent?.shiftKey;
130
+ if (isMeta || isCtrl || isShift) {
131
+ if (selectedIds.includes(nodeId)) {
132
+ return selectedIds.filter((id) => id !== nodeId);
131
133
  }
132
- return [...selectedIds, node.id];
134
+ return [...selectedIds, nodeId];
133
135
  }
134
- return [node.id];
136
+ return [nodeId];
135
137
  };
136
138
  // No building selected -> can select buildings
137
139
  if (!buildingId) {
@@ -195,9 +197,10 @@ const getStrategy = () => {
195
197
  }
196
198
  }
197
199
  const { selectedIds } = useViewer.getState().selection;
200
+ const proxyId = resolveSelectionProxyId(nodeToSelect, useScene.getState().nodes);
198
201
  useViewer
199
202
  .getState()
200
- .setSelection({ selectedIds: computeNextIds(nodeToSelect, selectedIds, nativeEvent) });
203
+ .setSelection({ selectedIds: computeNextIds(proxyId, selectedIds, nativeEvent) });
201
204
  },
202
205
  handleDeselect: () => {
203
206
  const { selectedIds } = useViewer.getState().selection;
@@ -248,7 +251,9 @@ export const SelectionManager = () => {
248
251
  useViewer.setState({ hoveredId: null });
249
252
  return;
250
253
  }
251
- useViewer.setState({ hoveredId: event.node.id });
254
+ useViewer.setState({
255
+ hoveredId: resolveSelectionProxyId(event.node, useScene.getState().nodes),
256
+ });
252
257
  }
253
258
  };
254
259
  const onLeave = (event) => {
@@ -259,7 +264,10 @@ export const SelectionManager = () => {
259
264
  return;
260
265
  if (strategy.isValid(event.node)) {
261
266
  event.stopPropagation();
262
- useViewer.setState({ hoveredId: null });
267
+ const targetId = resolveSelectionProxyId(event.node, useScene.getState().nodes);
268
+ if (useViewer.getState().hoveredId === targetId) {
269
+ useViewer.setState({ hoveredId: null });
270
+ }
263
271
  }
264
272
  };
265
273
  const onClick = (event) => {
@@ -1,2 +1,3 @@
1
+ export declare const WALKTHROUGH_FOV = 60;
1
2
  export declare const WalkthroughControls: () => import("react").JSX.Element | null;
2
3
  //# sourceMappingURL=walkthrough-controls.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"walkthrough-controls.d.ts","sourceRoot":"","sources":["../../../src/components/viewer/walkthrough-controls.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,mBAAmB,0CAwH/B,CAAA"}
1
+ {"version":3,"file":"walkthrough-controls.d.ts","sourceRoot":"","sources":["../../../src/components/viewer/walkthrough-controls.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,eAAe,KAAK,CAAA;AAMjC,eAAO,MAAM,mBAAmB,0CAsI/B,CAAA"}
@@ -7,6 +7,11 @@ import { Vector3 } from 'three';
7
7
  import useViewer from '../../store/use-viewer';
8
8
  const MOVE_SPEED = 5;
9
9
  const EYE_HEIGHT = 1.6;
10
+ // First-person FOV. The orbit camera is 50° (set on the Canvas), which feels
11
+ // cramped on foot; ~60° vertical (~90° horizontal at 16:9) restores peripheral
12
+ // awareness without wide-angle distortion. Applied only while walking — both
13
+ // walkthrough controllers read this and restore the orbit FOV on exit.
14
+ export const WALKTHROUGH_FOV = 60;
10
15
  const _direction = new Vector3();
11
16
  const _forward = new Vector3();
12
17
  const _right = new Vector3();
@@ -21,6 +26,21 @@ export const WalkthroughControls = () => {
21
26
  camera.position.y = EYE_HEIGHT;
22
27
  }
23
28
  }, [walkthroughMode, camera]);
29
+ // Widen FOV while walking; restore the orbit FOV on exit.
30
+ useEffect(() => {
31
+ if (!walkthroughMode)
32
+ return;
33
+ const cam = camera;
34
+ if (!cam.isPerspectiveCamera)
35
+ return;
36
+ const prevFov = cam.fov;
37
+ cam.fov = WALKTHROUGH_FOV;
38
+ cam.updateProjectionMatrix();
39
+ return () => {
40
+ cam.fov = prevFov;
41
+ cam.updateProjectionMatrix();
42
+ };
43
+ }, [walkthroughMode, camera]);
24
44
  // Keyboard handlers
25
45
  useEffect(() => {
26
46
  if (!walkthroughMode)
@@ -1 +1 @@
1
- {"version":3,"file":"use-gltf-ktx2.d.ts","sourceRoot":"","sources":["../../src/hooks/use-gltf-ktx2.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAU3C,QAAA,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,UAAU,CAAC,OAAO,OAAO,CA2B5D,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
1
+ {"version":3,"file":"use-gltf-ktx2.d.ts","sourceRoot":"","sources":["../../src/hooks/use-gltf-ktx2.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAK3C,QAAA,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,UAAU,CAAC,OAAO,OAAO,CAU5D,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -1,32 +1,13 @@
1
1
  import { useGLTF } from '@react-three/drei';
2
2
  import { useThree } from '@react-three/fiber';
3
- import { KTX2Loader } from 'three/examples/jsm/Addons.js';
4
3
  import { MeshoptDecoder } from 'three/examples/jsm/libs/meshopt_decoder.module.js';
5
- const ktx2LoaderInstance = new KTX2Loader();
6
- ktx2LoaderInstance.setTranscoderPath('https://cdn.jsdelivr.net/gh/pmndrs/drei-assets@master/basis/');
7
- const ktx2ConfiguredRenderers = new WeakSet();
8
- const ktx2WarningLoggedRenderers = new WeakSet();
4
+ import { ensureKtx2Support, ktx2Loader } from '../lib/ktx2-loader';
9
5
  const useGLTFKTX2 = (path) => {
10
6
  const gl = useThree((state) => state.gl);
11
7
  return useGLTF(path, true, true, (loader) => {
12
- const renderer = gl;
13
- if (!ktx2ConfiguredRenderers.has(renderer)) {
14
- try {
15
- ktx2LoaderInstance.detectSupport(gl);
16
- ktx2ConfiguredRenderers.add(renderer);
17
- }
18
- catch (error) {
19
- // Some WebGPU flows can transiently call this before backend init.
20
- // Avoid crashing the whole scene; scans may render without KTX2 on this pass.
21
- if (!ktx2WarningLoggedRenderers.has(renderer)) {
22
- console.warn('[viewer] Skipping KTX2 support detection for now.', error);
23
- ktx2WarningLoggedRenderers.add(renderer);
24
- }
25
- }
26
- }
27
- if (ktx2ConfiguredRenderers.has(renderer)) {
8
+ if (ensureKtx2Support(gl)) {
28
9
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
- loader.setKTX2Loader(ktx2LoaderInstance);
10
+ loader.setKTX2Loader(ktx2Loader);
30
11
  }
31
12
  loader.setMeshoptDecoder(MeshoptDecoder);
32
13
  });
@@ -6,7 +6,7 @@ type NodeByKind<K extends AnyNodeType> = Extract<AnyNode, {
6
6
  export declare function useNodeEvents<K extends AnyNodeType>(node: NodeByKind<K>, type: K): {
7
7
  onPointerDown: (e: ThreeEvent<PointerEvent>) => void;
8
8
  onPointerUp: (e: ThreeEvent<PointerEvent>) => void;
9
- onClick: (e: ThreeEvent<PointerEvent>) => void;
9
+ onClick: (_e: ThreeEvent<PointerEvent>) => void;
10
10
  onPointerEnter: (e: ThreeEvent<PointerEvent>) => void;
11
11
  onPointerLeave: (e: ThreeEvent<PointerEvent>) => void;
12
12
  onPointerMove: (e: ThreeEvent<PointerEvent>) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"use-node-events.d.ts","sourceRoot":"","sources":["../../src/hooks/use-node-events.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,WAAW,EAIjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAQpD,KAAK,UAAU,CAAC,CAAC,SAAS,WAAW,IAAI,OAAO,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,CAAA;AAEtE,wBAAgB,aAAa,CAAC,CAAC,SAAS,WAAW,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;uBAgC1D,UAAU,CAAC,YAAY,CAAC;qBAK1B,UAAU,CAAC,YAAY,CAAC;iBAQ5B,UAAU,CAAC,YAAY,CAAC;wBAIjB,UAAU,CAAC,YAAY,CAAC;wBAIxB,UAAU,CAAC,YAAY,CAAC;uBAIzB,UAAU,CAAC,YAAY,CAAC;uBAIxB,UAAU,CAAC,YAAY,CAAC;uBAIxB,UAAU,CAAC,YAAY,CAAC;EAK9C"}
1
+ {"version":3,"file":"use-node-events.d.ts","sourceRoot":"","sources":["../../src/hooks/use-node-events.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,WAAW,EAIjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAQpD,KAAK,UAAU,CAAC,CAAC,SAAS,WAAW,IAAI,OAAO,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,CAAA;AAEtE,wBAAgB,aAAa,CAAC,CAAC,SAAS,WAAW,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;uBAwC1D,UAAU,CAAC,YAAY,CAAC;qBAK1B,UAAU,CAAC,YAAY,CAAC;kBAQ3B,UAAU,CAAC,YAAY,CAAC;wBAIlB,UAAU,CAAC,YAAY,CAAC;wBAIxB,UAAU,CAAC,YAAY,CAAC;uBAIzB,UAAU,CAAC,YAAY,CAAC;uBAIxB,UAAU,CAAC,YAAY,CAAC;uBAIxB,UAAU,CAAC,YAAY,CAAC;EAK9C"}
@@ -19,25 +19,33 @@ export function useNodeEvents(node, type) {
19
19
  // through that generic surface without enumerating every kind.
20
20
  emitter.emit(eventKey, payload);
21
21
  };
22
- // Suppress node pointer events while an interaction drag is in
23
- // progress. `cameraDragging` covers orbit/pan/dolly; `inputDragging`
24
- // covers host-driven drags (editor handle arrows etc.). Without
25
- // this, the synthesized click on pointerup would reroute selection
26
- // to whatever mesh the cursor lands on at release.
27
- const isInteractionActive = () => {
22
+ // Camera drags (orbit / pan / dolly) suppress ALL node pointer events.
23
+ //
24
+ // `inputDragging` (host-driven drags: handle arrows, press-drag moves)
25
+ // additionally suppresses the SELECTION events — without it the click
26
+ // synthesized on pointer-release would reroute selection to whatever mesh
27
+ // sits under the cursor at release. It must NOT suppress the SPATIAL events
28
+ // (`enter` / `move` / `leave`): a surface-following move tool — a door /
29
+ // window sliding along a wall — runs WITH `inputDragging` set and depends on
30
+ // those events to track the cursor. Consumers that should ignore drag-time
31
+ // spatial events gate on `inputDragging` themselves (the editor's hover and
32
+ // paint paths, box-select), so emitting them during a drag only reaches the
33
+ // active move tool that wants them.
34
+ const spatialSuppressed = () => useViewer.getState().cameraDragging;
35
+ const selectionSuppressed = () => {
28
36
  const s = useViewer.getState();
29
37
  return s.cameraDragging || s.inputDragging;
30
38
  };
31
39
  return {
32
40
  onPointerDown: (e) => {
33
- if (isInteractionActive())
41
+ if (selectionSuppressed())
34
42
  return;
35
43
  if (e.button !== 0)
36
44
  return;
37
45
  emit('pointerdown', e);
38
46
  },
39
47
  onPointerUp: (e) => {
40
- if (isInteractionActive())
48
+ if (selectionSuppressed())
41
49
  return;
42
50
  if (e.button !== 0)
43
51
  return;
@@ -46,32 +54,32 @@ export function useNodeEvents(node, type) {
46
54
  // which often fails if the mouse moves even 1 pixel.
47
55
  emit('click', e);
48
56
  },
49
- onClick: (e) => {
57
+ onClick: (_e) => {
50
58
  // Disable default R3F click since we synthesize it on pointerup
51
59
  // This prevents double-clicks from firing twice.
52
60
  },
53
61
  onPointerEnter: (e) => {
54
- if (isInteractionActive())
62
+ if (spatialSuppressed())
55
63
  return;
56
64
  emit('enter', e);
57
65
  },
58
66
  onPointerLeave: (e) => {
59
- if (isInteractionActive())
67
+ if (spatialSuppressed())
60
68
  return;
61
69
  emit('leave', e);
62
70
  },
63
71
  onPointerMove: (e) => {
64
- if (isInteractionActive())
72
+ if (spatialSuppressed())
65
73
  return;
66
74
  emit('move', e);
67
75
  },
68
76
  onDoubleClick: (e) => {
69
- if (isInteractionActive())
77
+ if (selectionSuppressed())
70
78
  return;
71
79
  emit('double-click', e);
72
80
  },
73
81
  onContextMenu: (e) => {
74
- if (isInteractionActive())
82
+ if (selectionSuppressed())
75
83
  return;
76
84
  emit('context-menu', e);
77
85
  },
package/dist/index.d.ts CHANGED
@@ -2,29 +2,39 @@ export type { SurfaceRole } from '@pascal-app/core';
2
2
  export { ErrorBoundary } from './components/error-boundary';
3
3
  export { NodeRenderer } from './components/renderers/node-renderer';
4
4
  export { default as Viewer, type ViewerHandle } from './components/viewer';
5
+ export { type BVHEcctrlApi, default as BVHEcctrl, type MovementInput, } from './components/viewer/bvh-ecctrl';
6
+ export { buildGlbInteractiveItems, GlbInteractive, type GlbInteractiveItem, } from './components/viewer/glb-interactive';
7
+ export { buildGlbReferenceNodes, buildGlbReplaceNodes, } from './components/viewer/glb-reference-nodes';
8
+ export { type GlbHover, type GlbIdentity, type GlbLevel, GlbScene, type GlbWalkthrough, } from './components/viewer/glb-scene';
9
+ export { GlbWalkthroughController } from './components/viewer/glb-walkthrough-controller';
5
10
  export type { HoverStyle, HoverStyles } from './components/viewer/post-processing';
6
11
  export { DEFAULT_HOVER_STYLES, SSGI_PARAMS, } from './components/viewer/post-processing';
12
+ export { SceneEnvironment } from './components/viewer/scene-environment';
7
13
  export { WalkthroughControls } from './components/viewer/walkthrough-controls';
8
14
  export { useAssetUrl } from './hooks/use-asset-url';
9
15
  export { useGLTFKTX2 } from './hooks/use-gltf-ktx2';
10
16
  export { useNodeEvents } from './hooks/use-node-events';
11
17
  export { ASSETS_CDN_URL, resolveAssetUrl, resolveCdnUrl } from './lib/asset-url';
12
- export { ADDITION, Brush, computeGeometryBoundsTree, csgEvaluator, csgGeometry, csgMaterials, prepareBrushForCSG, SUBTRACTION, } from './lib/csg-utils';
18
+ export { backdropGradient, deepSkyColor, horizonHazeColor } from './lib/backdrop';
19
+ export { applyWorldScaleBoxUVs } from './lib/box-uv';
20
+ export { ADDITION, Brush, computeGeometryBoundsTree, csgEvaluator, csgGeometry, csgMaterials, INTERSECTION, prepareBrushForCSG, SUBTRACTION, } from './lib/csg-utils';
13
21
  export type { EdgeMode } from './lib/edge-style';
14
22
  export { applyIsolation, clearIsolation, collectIsolationSubtree, isIsolationActive, } from './lib/isolation';
23
+ export { ensureKtx2Support } from './lib/ktx2-loader';
15
24
  export { GRID_LAYER, OVERLAY_LAYER, SCENE_LAYER, ZONE_LAYER } from './lib/layers';
16
- export { applyMaterialPresetToMaterials, BLUEPRINT_PALETTE, baseMaterial, CLAY_PALETTE, type ColorPreset, clearMaterialCache, createDefaultMaterial, createMaterial, createMaterialFromPresetRef, createSurfaceRoleMaterial, DEFAULT_CEILING_MATERIAL, DEFAULT_DOOR_MATERIAL, DEFAULT_ROOF_MATERIAL, DEFAULT_SHELF_MATERIAL, DEFAULT_SLAB_MATERIAL, DEFAULT_STAIR_MATERIAL, DEFAULT_WALL_MATERIAL, DEFAULT_WINDOW_MATERIAL, disposeMaterial, glassMaterial, MONO_PALETTE, PRESET_PALETTES, type RenderShading, resolveSurfaceColor, WHITE_PALETTE, } from './lib/materials';
25
+ export { applyMaterialPresetToMaterials, BLUEPRINT_PALETTE, baseMaterial, CLAY_PALETTE, type ColorPreset, clearMaterialCache, createDefaultMaterial, createMaterial, createMaterialFromPresetRef, createSurfaceRoleMaterial, DEFAULT_CEILING_MATERIAL, DEFAULT_DOOR_MATERIAL, DEFAULT_ROOF_MATERIAL, DEFAULT_SHELF_MATERIAL, DEFAULT_SLAB_MATERIAL, DEFAULT_STAIR_MATERIAL, DEFAULT_WALL_MATERIAL, DEFAULT_WINDOW_MATERIAL, disposeMaterial, glassMaterial, MONO_PALETTE, PRESET_PALETTES, type RenderShading, resolveMaterialRef, resolveSlotDefaultMaterial, resolveSurfaceColor, WHITE_PALETTE, } from './lib/materials';
17
26
  export { mergedOutline } from './lib/merged-outline-node';
18
27
  export { unionPolygons } from './lib/polygon-union';
19
28
  export { getSceneTheme, SCENE_THEME_IDS, SCENE_THEMES, type SceneTheme, } from './lib/scene-themes';
29
+ export { packNormalToRGB, unpackRGBToNormal } from './lib/tsl-compat';
20
30
  export { useItemLightPool } from './store/use-item-light-pool';
21
- export { default as useViewer } from './store/use-viewer';
31
+ export { applyCountryUnitDefault, default as useViewer } from './store/use-viewer';
22
32
  export { CeilingSystem } from './systems/ceiling/ceiling-system';
23
33
  export { createColumnBoxGeometry, createColumnCylinderGeometry, createColumnSphereGeometry, createColumnTorusGeometry, } from './systems/column/column-geometry';
24
34
  export { DoorAnimationSystem } from './systems/door/door-animation-system';
25
- export { DoorSystem } from './systems/door/door-system';
35
+ export { buildDoorPreviewMesh, DoorSystem, poseDoorMovingParts } from './systems/door/door-system';
26
36
  export { ElevatorInteractionSystem } from './systems/elevator/elevator-interaction-system';
27
- export { FenceSystem, generateFenceGeometry } from './systems/fence/fence-system';
37
+ export { FenceSystem, generateFenceGeometry, generateFenceSlotGeometries, } from './systems/fence/fence-system';
28
38
  export { FloorElevationSystem } from './systems/floor-elevation/floor-elevation-system';
29
39
  export { GuideSystem } from './systems/guide/guide-system';
30
40
  export { InteractiveSystem } from './systems/interactive/interactive-system';
@@ -33,15 +43,16 @@ export { ItemLightSystem } from './systems/item-light/item-light-system';
33
43
  export { LevelSystem } from './systems/level/level-system';
34
44
  export { snapLevelsToTruePositions } from './systems/level/level-utils';
35
45
  export { getRoofMaterialArray } from './systems/roof/roof-materials';
36
- export { getRoofOuterSurfaceFrameAtPoint, getRoofSegmentBrushes, mapRoofGroupMaterialIndex, ROOF_MATERIAL_SLOT_COUNT, RoofSystem, remapRoofShellFaces, roofCsgDummyMats, type SurfaceFrame, } from './systems/roof/roof-system';
46
+ export { clipGeometryBySegmentTrim, generateRoofSegmentGeometry, getRoofOuterSurfaceFrameAtPoint, getRoofSegmentBrushes, mapRoofGroupMaterialIndex, ROOF_MATERIAL_SLOT_COUNT, RoofSystem, remapRoofShellFaces, roofCsgDummyMats, type SurfaceFrame, } from './systems/roof/roof-system';
37
47
  export { ScanSystem } from './systems/scan/scan-system';
38
48
  export { generateSlabGeometry, SlabSystem } from './systems/slab/slab-system';
39
49
  export { getStairBodyMaterials, getStairRailingMaterial, getStraightStairSegmentBodyMaterials, type StairBodyMaterials, } from './systems/stair/stair-materials';
40
50
  export { StairSystem } from './systems/stair/stair-system';
51
+ export { buildOpeningCutoutGeometry, getOpeningCutoutBottomPadding, hasFlatOpeningCutoutBottom, } from './systems/wall/opening-cutout-geometry';
41
52
  export { WallCutout } from './systems/wall/wall-cutout';
42
53
  export { getVisibleWallMaterials } from './systems/wall/wall-materials';
43
54
  export { WallSystem } from './systems/wall/wall-system';
44
- export { WindowAnimationSystem } from './systems/window/window-animation-system';
45
- export { WindowSystem } from './systems/window/window-system';
55
+ export { poseWindowMovingParts, WindowAnimationSystem, } from './systems/window/window-animation-system';
56
+ export { buildWindowPreviewMesh, WindowSystem } from './systems/window/window-system';
46
57
  export { ZoneSystem } from './systems/zone/zone-system';
47
58
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAO3D,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAA;AACnE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAC1E,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAA;AAClF,OAAO,EACL,oBAAoB,EACpB,WAAW,GACZ,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAA;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAIhF,OAAO,EACL,QAAQ,EACR,KAAK,EACL,yBAAyB,EACzB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,WAAW,GACZ,MAAM,iBAAiB,CAAA;AACxB,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EACL,cAAc,EACd,cAAc,EACd,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACjF,OAAO,EACL,8BAA8B,EAC9B,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ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B,CAAA;AAKvE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EACL,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,0CAA0C,CAAA;AACjD,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA"}
package/dist/index.js CHANGED
@@ -11,33 +11,43 @@ export { ErrorBoundary } from './components/error-boundary';
11
11
  // — no per-kind re-exports needed.
12
12
  export { NodeRenderer } from './components/renderers/node-renderer';
13
13
  export { default as Viewer } from './components/viewer';
14
+ export { default as BVHEcctrl, } from './components/viewer/bvh-ecctrl';
15
+ export { buildGlbInteractiveItems, GlbInteractive, } from './components/viewer/glb-interactive';
16
+ export { buildGlbReferenceNodes, buildGlbReplaceNodes, } from './components/viewer/glb-reference-nodes';
17
+ export { GlbScene, } from './components/viewer/glb-scene';
18
+ export { GlbWalkthroughController } from './components/viewer/glb-walkthrough-controller';
14
19
  export { DEFAULT_HOVER_STYLES, SSGI_PARAMS, } from './components/viewer/post-processing';
20
+ export { SceneEnvironment } from './components/viewer/scene-environment';
15
21
  export { WalkthroughControls } from './components/viewer/walkthrough-controls';
16
22
  export { useAssetUrl } from './hooks/use-asset-url';
17
23
  export { useGLTFKTX2 } from './hooks/use-gltf-ktx2';
18
24
  export { useNodeEvents } from './hooks/use-node-events';
19
25
  export { ASSETS_CDN_URL, resolveAssetUrl, resolveCdnUrl } from './lib/asset-url';
26
+ export { backdropGradient, deepSkyColor, horizonHazeColor } from './lib/backdrop';
27
+ export { applyWorldScaleBoxUVs } from './lib/box-uv';
20
28
  // CSG primitives — used by chimney's roof-trim and other kinds whose
21
29
  // geometry subtracts pieces against their host. Lives in viewer
22
30
  // because three-bvh-csg / three-mesh-bvh are viewer-only deps.
23
- export { ADDITION, Brush, computeGeometryBoundsTree, csgEvaluator, csgGeometry, csgMaterials, prepareBrushForCSG, SUBTRACTION, } from './lib/csg-utils';
31
+ export { ADDITION, Brush, computeGeometryBoundsTree, csgEvaluator, csgGeometry, csgMaterials, INTERSECTION, prepareBrushForCSG, SUBTRACTION, } from './lib/csg-utils';
24
32
  export { applyIsolation, clearIsolation, collectIsolationSubtree, isIsolationActive, } from './lib/isolation';
33
+ export { ensureKtx2Support } from './lib/ktx2-loader';
25
34
  export { GRID_LAYER, OVERLAY_LAYER, SCENE_LAYER, ZONE_LAYER } from './lib/layers';
26
- export { applyMaterialPresetToMaterials, BLUEPRINT_PALETTE, baseMaterial, CLAY_PALETTE, clearMaterialCache, createDefaultMaterial, createMaterial, createMaterialFromPresetRef, createSurfaceRoleMaterial, DEFAULT_CEILING_MATERIAL, DEFAULT_DOOR_MATERIAL, DEFAULT_ROOF_MATERIAL, DEFAULT_SHELF_MATERIAL, DEFAULT_SLAB_MATERIAL, DEFAULT_STAIR_MATERIAL, DEFAULT_WALL_MATERIAL, DEFAULT_WINDOW_MATERIAL, disposeMaterial, glassMaterial, MONO_PALETTE, PRESET_PALETTES, resolveSurfaceColor, WHITE_PALETTE, } from './lib/materials';
35
+ export { applyMaterialPresetToMaterials, BLUEPRINT_PALETTE, baseMaterial, CLAY_PALETTE, clearMaterialCache, createDefaultMaterial, createMaterial, createMaterialFromPresetRef, createSurfaceRoleMaterial, DEFAULT_CEILING_MATERIAL, DEFAULT_DOOR_MATERIAL, DEFAULT_ROOF_MATERIAL, DEFAULT_SHELF_MATERIAL, DEFAULT_SLAB_MATERIAL, DEFAULT_STAIR_MATERIAL, DEFAULT_WALL_MATERIAL, DEFAULT_WINDOW_MATERIAL, disposeMaterial, glassMaterial, MONO_PALETTE, PRESET_PALETTES, resolveMaterialRef, resolveSlotDefaultMaterial, resolveSurfaceColor, WHITE_PALETTE, } from './lib/materials';
27
36
  export { mergedOutline } from './lib/merged-outline-node';
28
37
  export { unionPolygons } from './lib/polygon-union';
29
38
  export { getSceneTheme, SCENE_THEME_IDS, SCENE_THEMES, } from './lib/scene-themes';
39
+ export { packNormalToRGB, unpackRGBToNormal } from './lib/tsl-compat';
30
40
  export { useItemLightPool } from './store/use-item-light-pool';
31
- export { default as useViewer } from './store/use-viewer';
41
+ export { applyCountryUnitDefault, default as useViewer } from './store/use-viewer';
32
42
  export { CeilingSystem } from './systems/ceiling/ceiling-system';
33
43
  export { createColumnBoxGeometry, createColumnCylinderGeometry, createColumnSphereGeometry, createColumnTorusGeometry, } from './systems/column/column-geometry';
34
44
  export { DoorAnimationSystem } from './systems/door/door-animation-system';
35
- export { DoorSystem } from './systems/door/door-system';
45
+ export { buildDoorPreviewMesh, DoorSystem, poseDoorMovingParts } from './systems/door/door-system';
36
46
  export { ElevatorInteractionSystem } from './systems/elevator/elevator-interaction-system';
37
47
  // Fence system follows the wall re-export pattern — composed into the
38
48
  // registry-driven fence definition's `def.system`. Removed in Phase 6
39
49
  // alongside the legacy fence mount point.
40
- export { FenceSystem, generateFenceGeometry } from './systems/fence/fence-system';
50
+ export { FenceSystem, generateFenceGeometry, generateFenceSlotGeometries, } from './systems/fence/fence-system';
41
51
  // Generic floor-elevation system. Lifts the rendered mesh of any kind
42
52
  // whose definition declares `capabilities.floorPlaced` by the slab
43
53
  // elevation under its footprint. Replaces the per-kind elevation block
@@ -57,7 +67,7 @@ export { getRoofMaterialArray } from './systems/roof/roof-materials';
57
67
  // the roof shell (chimney's self-trim, dormer's virtual-segment cut)
58
68
  // read these through the public surface. No kind-specific helpers
59
69
  // belong here — those live in `@pascal-app/nodes/<kind>/`.
60
- export { getRoofOuterSurfaceFrameAtPoint, getRoofSegmentBrushes, mapRoofGroupMaterialIndex, ROOF_MATERIAL_SLOT_COUNT, RoofSystem, remapRoofShellFaces, roofCsgDummyMats, } from './systems/roof/roof-system';
70
+ export { clipGeometryBySegmentTrim, generateRoofSegmentGeometry, getRoofOuterSurfaceFrameAtPoint, getRoofSegmentBrushes, mapRoofGroupMaterialIndex, ROOF_MATERIAL_SLOT_COUNT, RoofSystem, remapRoofShellFaces, roofCsgDummyMats, } from './systems/roof/roof-system';
61
71
  export { ScanSystem } from './systems/scan/scan-system';
62
72
  // Slab system follows the wall + fence re-export pattern — composed into
63
73
  // the registry-driven slab definition's `def.system`. Removed in Phase 6
@@ -65,6 +75,10 @@ export { ScanSystem } from './systems/scan/scan-system';
65
75
  export { generateSlabGeometry, SlabSystem } from './systems/slab/slab-system';
66
76
  export { getStairBodyMaterials, getStairRailingMaterial, getStraightStairSegmentBodyMaterials, } from './systems/stair/stair-materials';
67
77
  export { StairSystem } from './systems/stair/stair-system';
78
+ // Pure opening-cutout profile math shared by the wall CSG pipeline and
79
+ // roof-wall opening cuts in `@pascal-app/nodes` — keeps shaped holes
80
+ // (arch / rounded / frameless opening) identical across both hosts.
81
+ export { buildOpeningCutoutGeometry, getOpeningCutoutBottomPadding, hasFlatOpeningCutoutBottom, } from './systems/wall/opening-cutout-geometry';
68
82
  export { WallCutout } from './systems/wall/wall-cutout';
69
83
  export { getVisibleWallMaterials } from './systems/wall/wall-materials';
70
84
  // Wall internals re-exported so `@pascal-app/nodes`' registry-driven wall
@@ -72,6 +86,6 @@ export { getVisibleWallMaterials } from './systems/wall/wall-materials';
72
86
  // 800+ lines of CSG / mitering logic during Phase 3. These exports are
73
87
  // removed in Phase 6 when the legacy mount points are deleted.
74
88
  export { WallSystem } from './systems/wall/wall-system';
75
- export { WindowAnimationSystem } from './systems/window/window-animation-system';
76
- export { WindowSystem } from './systems/window/window-system';
89
+ export { poseWindowMovingParts, WindowAnimationSystem, } from './systems/window/window-animation-system';
90
+ export { buildWindowPreviewMesh, WindowSystem } from './systems/window/window-system';
77
91
  export { ZoneSystem } from './systems/zone/zone-system';
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Shared backdrop gradient: flat background looking down, a warm haze band
3
+ * hugging the horizon, the theme sky arriving just above it and deepening
4
+ * toward the zenith. One formula serves the post-processing backdrop and the
5
+ * thumbnail pipeline (per-pixel view ray) AND the site horizon disc's
6
+ * far-field dissolve (per-fragment view direction) — the disc converges to
7
+ * exactly this colour, so ground and backdrop meet without a seam from any
8
+ * camera pose.
9
+ *
10
+ * `dirY` is the world-space view direction's Y component (horizon = 0).
11
+ * Colour inputs are TSL nodes (uniforms or literals).
12
+ */
13
+ export declare function backdropGradient({ dirY, background, haze, sky, skyDeep, }: {
14
+ dirY: any;
15
+ background: any;
16
+ haze: any;
17
+ sky: any;
18
+ skyDeep: any;
19
+ }): any;
20
+ /**
21
+ * Atmospheric haze at the horizon: the theme's *sky* colour pulled toward a
22
+ * warm sun tint — skyish and sunish at once, so the band reads as part of
23
+ * the sky rather than a white stripe. Dark themes keep it faint (a low glow
24
+ * over the night zenith).
25
+ */
26
+ export declare function horizonHazeColor(sky: string, appearance: 'light' | 'dark'): string;
27
+ /**
28
+ * Zenith colour derived from the theme's sky: saturated and darkened in HSL
29
+ * so the hue stays the theme's own (blue studio, lavender sunset, near-black
30
+ * night) while the top of the frame gets real colour depth.
31
+ */
32
+ export declare function deepSkyColor(sky: string): string;
33
+ //# sourceMappingURL=backdrop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backdrop.d.ts","sourceRoot":"","sources":["../../src/lib/backdrop.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,GAAG,EACH,OAAO,GACR,EAAE;IACD,IAAI,EAAE,GAAG,CAAA;IACT,UAAU,EAAE,GAAG,CAAA;IACf,IAAI,EAAE,GAAG,CAAA;IACT,GAAG,EAAE,GAAG,CAAA;IACR,OAAO,EAAE,GAAG,CAAA;CACb,GAAG,GAAG,CAUN;AAMD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAWlF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAyChD"}