@pascal-app/viewer 1.0.3 → 1.0.5

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 (276) hide show
  1. package/dist/capture/capture-runtime.js +1 -1
  2. package/dist/components/error-boundary.d.ts.map +1 -1
  3. package/dist/components/renderers/node-renderer.d.ts +1 -1
  4. package/dist/components/renderers/node-renderer.d.ts.map +1 -1
  5. package/dist/components/renderers/node-renderer.js +12 -4
  6. package/dist/components/renderers/parametric-node-renderer.d.ts.map +1 -1
  7. package/dist/components/viewer/bvh-ecctrl.d.ts.map +1 -1
  8. package/dist/components/viewer/frame-limiter.d.ts +1 -0
  9. package/dist/components/viewer/frame-limiter.d.ts.map +1 -1
  10. package/dist/components/viewer/frame-limiter.js +22 -3
  11. package/dist/components/viewer/glb-interactive.d.ts +25 -1
  12. package/dist/components/viewer/glb-interactive.d.ts.map +1 -1
  13. package/dist/components/viewer/glb-interactive.js +253 -86
  14. package/dist/components/viewer/glb-mechanisms.d.ts +10 -0
  15. package/dist/components/viewer/glb-mechanisms.d.ts.map +1 -0
  16. package/dist/components/viewer/glb-mechanisms.js +19 -0
  17. package/dist/components/viewer/glb-reference-nodes.js +1 -1
  18. package/dist/components/viewer/glb-replace-instances.js +1 -1
  19. package/dist/components/viewer/glb-scene.d.ts +45 -27
  20. package/dist/components/viewer/glb-scene.d.ts.map +1 -1
  21. package/dist/components/viewer/glb-scene.js +421 -508
  22. package/dist/components/viewer/glb-walkthrough-controller.d.ts +1 -1
  23. package/dist/components/viewer/glb-walkthrough-controller.d.ts.map +1 -1
  24. package/dist/components/viewer/glb-walkthrough-controller.js +13 -2
  25. package/dist/components/viewer/index.d.ts +24 -1
  26. package/dist/components/viewer/index.d.ts.map +1 -1
  27. package/dist/components/viewer/index.js +111 -37
  28. package/dist/components/viewer/lights.d.ts.map +1 -1
  29. package/dist/components/viewer/lights.js +113 -22
  30. package/dist/components/viewer/perf-monitor.d.ts.map +1 -1
  31. package/dist/components/viewer/perf-monitor.js +6 -0
  32. package/dist/components/viewer/perf-panel.d.ts.map +1 -1
  33. package/dist/components/viewer/perf-panel.js +1 -1
  34. package/dist/components/viewer/post-processing.d.ts.map +1 -1
  35. package/dist/components/viewer/post-processing.js +104 -36
  36. package/dist/components/viewer/registered-systems.d.ts.map +1 -1
  37. package/dist/components/viewer/registered-systems.js +17 -3
  38. package/dist/components/viewer/render-error.d.ts +18 -0
  39. package/dist/components/viewer/render-error.d.ts.map +1 -0
  40. package/dist/components/viewer/render-error.js +29 -0
  41. package/dist/components/viewer/scene-bvh.d.ts.map +1 -1
  42. package/dist/components/viewer/scene-bvh.js +1 -1
  43. package/dist/components/viewer/scene-environment.d.ts.map +1 -1
  44. package/dist/components/viewer/scene-environment.js +31 -11
  45. package/dist/components/viewer/scene-ground-replacement.d.ts +6 -0
  46. package/dist/components/viewer/scene-ground-replacement.d.ts.map +1 -1
  47. package/dist/components/viewer/scene-ground-replacement.js +15 -0
  48. package/dist/components/viewer/selection-manager.d.ts.map +1 -1
  49. package/dist/components/viewer/selection-manager.js +25 -7
  50. package/dist/components/viewer/underground-ambiance.d.ts +9 -0
  51. package/dist/components/viewer/underground-ambiance.d.ts.map +1 -0
  52. package/dist/components/viewer/underground-ambiance.js +105 -0
  53. package/dist/components/viewer/viewer-camera.d.ts +4 -0
  54. package/dist/components/viewer/viewer-camera.d.ts.map +1 -1
  55. package/dist/components/viewer/viewer-camera.js +12 -2
  56. package/dist/components/viewer/viewer-presentations.d.ts.map +1 -1
  57. package/dist/hooks/use-gltf-ktx2.d.ts.map +1 -1
  58. package/dist/hooks/use-gltf-ktx2.js +2 -0
  59. package/dist/hooks/use-node-events.d.ts.map +1 -1
  60. package/dist/index.d.ts +36 -16
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +34 -19
  63. package/dist/lib/asset-url.d.ts.map +1 -1
  64. package/dist/lib/asset-url.js +7 -1
  65. package/dist/lib/backdrop.d.ts +17 -0
  66. package/dist/lib/backdrop.d.ts.map +1 -1
  67. package/dist/lib/backdrop.js +18 -1
  68. package/dist/lib/construction-dust.d.ts +57 -0
  69. package/dist/lib/construction-dust.d.ts.map +1 -0
  70. package/dist/lib/construction-dust.js +187 -0
  71. package/dist/lib/csg-utils.js +1 -1
  72. package/dist/lib/display-state.d.ts +25 -0
  73. package/dist/lib/display-state.d.ts.map +1 -0
  74. package/dist/lib/display-state.js +1 -0
  75. package/dist/lib/foundation-materials.d.ts +26 -0
  76. package/dist/lib/foundation-materials.d.ts.map +1 -0
  77. package/dist/lib/foundation-materials.js +65 -0
  78. package/dist/lib/gltf-unlit.d.ts +10 -0
  79. package/dist/lib/gltf-unlit.d.ts.map +1 -0
  80. package/dist/lib/gltf-unlit.js +23 -0
  81. package/dist/lib/ground-window.d.ts +33 -0
  82. package/dist/lib/ground-window.d.ts.map +1 -0
  83. package/dist/lib/ground-window.js +114 -0
  84. package/dist/lib/hero-pose.d.ts +13 -3
  85. package/dist/lib/hero-pose.d.ts.map +1 -1
  86. package/dist/lib/hero-pose.js +72 -5
  87. package/dist/lib/ink-edges.d.ts +6 -3
  88. package/dist/lib/ink-edges.d.ts.map +1 -1
  89. package/dist/lib/ink-edges.js +17 -7
  90. package/dist/lib/key-light-override.d.ts +11 -0
  91. package/dist/lib/key-light-override.d.ts.map +1 -0
  92. package/dist/lib/key-light-override.js +14 -0
  93. package/dist/lib/ktx2-loader.d.ts +7 -0
  94. package/dist/lib/ktx2-loader.d.ts.map +1 -1
  95. package/dist/lib/ktx2-loader.js +35 -0
  96. package/dist/lib/layer-pass.d.ts.map +1 -1
  97. package/dist/lib/layers.d.ts +11 -7
  98. package/dist/lib/layers.d.ts.map +1 -1
  99. package/dist/lib/layers.js +16 -6
  100. package/dist/lib/live-frame-hold.d.ts +14 -0
  101. package/dist/lib/live-frame-hold.d.ts.map +1 -0
  102. package/dist/lib/live-frame-hold.js +28 -0
  103. package/dist/lib/materials.d.ts +19 -7
  104. package/dist/lib/materials.d.ts.map +1 -1
  105. package/dist/lib/materials.js +65 -9
  106. package/dist/lib/merged-outline-node.d.ts +5 -0
  107. package/dist/lib/merged-outline-node.d.ts.map +1 -1
  108. package/dist/lib/merged-outline-node.js +80 -2
  109. package/dist/lib/node-top-surface-height.d.ts +6 -0
  110. package/dist/lib/node-top-surface-height.d.ts.map +1 -0
  111. package/dist/lib/node-top-surface-height.js +74 -0
  112. package/dist/lib/perf-probe-state.d.ts +39 -0
  113. package/dist/lib/perf-probe-state.d.ts.map +1 -0
  114. package/dist/lib/perf-probe-state.js +17 -0
  115. package/dist/lib/pointer-events.d.ts +26 -2
  116. package/dist/lib/pointer-events.d.ts.map +1 -1
  117. package/dist/lib/pointer-events.js +99 -12
  118. package/dist/lib/post-processing-resources.d.ts.map +1 -1
  119. package/dist/lib/procedural-emission.d.ts +7 -0
  120. package/dist/lib/procedural-emission.d.ts.map +1 -0
  121. package/dist/lib/procedural-emission.js +54 -0
  122. package/dist/lib/reveal-candidates.d.ts +80 -0
  123. package/dist/lib/reveal-candidates.d.ts.map +1 -0
  124. package/dist/lib/reveal-candidates.js +524 -0
  125. package/dist/lib/reveal-ghost.d.ts +9 -0
  126. package/dist/lib/reveal-ghost.d.ts.map +1 -0
  127. package/dist/lib/reveal-ghost.js +62 -0
  128. package/dist/lib/reveal-pending.d.ts +12 -0
  129. package/dist/lib/reveal-pending.d.ts.map +1 -0
  130. package/dist/lib/reveal-pending.js +12 -0
  131. package/dist/lib/reveal-pose.d.ts +70 -0
  132. package/dist/lib/reveal-pose.d.ts.map +1 -0
  133. package/dist/lib/reveal-pose.js +248 -0
  134. package/dist/lib/reveal-schedule.d.ts +208 -0
  135. package/dist/lib/reveal-schedule.d.ts.map +1 -0
  136. package/dist/lib/reveal-schedule.js +410 -0
  137. package/dist/lib/reveal-texture-scale.d.ts +5 -0
  138. package/dist/lib/reveal-texture-scale.d.ts.map +1 -0
  139. package/dist/lib/reveal-texture-scale.js +113 -0
  140. package/dist/lib/reveal-windows.d.ts +23 -0
  141. package/dist/lib/reveal-windows.d.ts.map +1 -0
  142. package/dist/lib/reveal-windows.js +31 -0
  143. package/dist/lib/reveal-wipe.d.ts +71 -0
  144. package/dist/lib/reveal-wipe.d.ts.map +1 -0
  145. package/dist/lib/reveal-wipe.js +105 -0
  146. package/dist/lib/scene-pass-mrt.d.ts +12 -0
  147. package/dist/lib/scene-pass-mrt.d.ts.map +1 -0
  148. package/dist/lib/scene-pass-mrt.js +23 -0
  149. package/dist/lib/scene-support-height.d.ts +4 -0
  150. package/dist/lib/scene-support-height.d.ts.map +1 -0
  151. package/dist/lib/scene-support-height.js +34 -0
  152. package/dist/lib/scene-themes.d.ts +30 -8
  153. package/dist/lib/scene-themes.d.ts.map +1 -1
  154. package/dist/lib/scene-themes.js +36 -0
  155. package/dist/lib/scene-visibility.d.ts +17 -1
  156. package/dist/lib/scene-visibility.d.ts.map +1 -1
  157. package/dist/lib/scene-visibility.js +53 -3
  158. package/dist/lib/scripted-opening.d.ts +11 -0
  159. package/dist/lib/scripted-opening.d.ts.map +1 -0
  160. package/dist/lib/scripted-opening.js +20 -0
  161. package/dist/lib/site-surfaces.d.ts +32 -0
  162. package/dist/lib/site-surfaces.d.ts.map +1 -0
  163. package/dist/lib/site-surfaces.js +70 -0
  164. package/dist/lib/snapshot-pipeline.d.ts +34 -3
  165. package/dist/lib/snapshot-pipeline.d.ts.map +1 -1
  166. package/dist/lib/snapshot-pipeline.js +247 -117
  167. package/dist/lib/terrain-perimeter-fill.d.ts.map +1 -1
  168. package/dist/lib/terrain-perimeter-fill.js +22 -14
  169. package/dist/lib/tsl-compat.d.ts +2 -2
  170. package/dist/lib/tsl-compat.d.ts.map +1 -1
  171. package/dist/lib/underground-ambiance.d.ts +168 -0
  172. package/dist/lib/underground-ambiance.d.ts.map +1 -0
  173. package/dist/lib/underground-ambiance.js +334 -0
  174. package/dist/lib/zone-geometry.d.ts +11 -0
  175. package/dist/lib/zone-geometry.d.ts.map +1 -0
  176. package/dist/lib/zone-geometry.js +46 -0
  177. package/dist/store/use-item-light-pool.d.ts +14 -10
  178. package/dist/store/use-item-light-pool.d.ts.map +1 -1
  179. package/dist/store/use-item-light-pool.js +52 -26
  180. package/dist/store/use-viewer.d.ts +194 -26
  181. package/dist/store/use-viewer.d.ts.map +1 -1
  182. package/dist/store/use-viewer.js +164 -21
  183. package/dist/systems/ceiling/ceiling-system.d.ts +15 -1
  184. package/dist/systems/ceiling/ceiling-system.d.ts.map +1 -1
  185. package/dist/systems/ceiling/ceiling-system.js +88 -6
  186. package/dist/systems/construction-reveal/construction-dust.d.ts +16 -0
  187. package/dist/systems/construction-reveal/construction-dust.d.ts.map +1 -0
  188. package/dist/systems/construction-reveal/construction-dust.js +92 -0
  189. package/dist/systems/construction-reveal/construction-reveal.d.ts +276 -0
  190. package/dist/systems/construction-reveal/construction-reveal.d.ts.map +1 -0
  191. package/dist/systems/construction-reveal/construction-reveal.js +2383 -0
  192. package/dist/systems/construction-reveal/dust-material.d.ts +10 -0
  193. package/dist/systems/construction-reveal/dust-material.d.ts.map +1 -0
  194. package/dist/systems/construction-reveal/dust-material.js +17 -0
  195. package/dist/systems/construction-reveal/ghost-dress.d.ts +10 -0
  196. package/dist/systems/construction-reveal/ghost-dress.d.ts.map +1 -0
  197. package/dist/systems/construction-reveal/ghost-dress.js +24 -0
  198. package/dist/systems/door/door-system.d.ts.map +1 -1
  199. package/dist/systems/door/door-system.js +55 -17
  200. package/dist/systems/elevator/elevator-interaction-system.d.ts +7 -0
  201. package/dist/systems/elevator/elevator-interaction-system.d.ts.map +1 -1
  202. package/dist/systems/elevator/elevator-interaction-system.js +18 -1
  203. package/dist/systems/floor-elevation/floor-elevation-system.d.ts +3 -1
  204. package/dist/systems/floor-elevation/floor-elevation-system.d.ts.map +1 -1
  205. package/dist/systems/floor-elevation/floor-elevation-system.js +33 -5
  206. package/dist/systems/geometry/geometry-system.d.ts.map +1 -1
  207. package/dist/systems/geometry/geometry-system.js +71 -11
  208. package/dist/systems/interactive/control-widget.d.ts.map +1 -1
  209. package/dist/systems/interactive/interactive-system.d.ts.map +1 -1
  210. package/dist/systems/interactive/interactive-system.js +52 -17
  211. package/dist/systems/interactive/procedural-controls.d.ts +13 -0
  212. package/dist/systems/interactive/procedural-controls.d.ts.map +1 -0
  213. package/dist/systems/interactive/procedural-controls.js +17 -0
  214. package/dist/systems/interactive/scripted-clips.d.ts +19 -0
  215. package/dist/systems/interactive/scripted-clips.d.ts.map +1 -0
  216. package/dist/systems/interactive/scripted-clips.js +134 -0
  217. package/dist/systems/item/item-system.d.ts.map +1 -1
  218. package/dist/systems/item/item-system.js +9 -3
  219. package/dist/systems/item/object-cut-invalidation.d.ts +3 -0
  220. package/dist/systems/item/object-cut-invalidation.d.ts.map +1 -0
  221. package/dist/systems/item/object-cut-invalidation.js +68 -0
  222. package/dist/systems/item-light/item-light-system.d.ts +1 -1
  223. package/dist/systems/item-light/item-light-system.d.ts.map +1 -1
  224. package/dist/systems/item-light/item-light-system.js +48 -53
  225. package/dist/systems/level/level-hold.d.ts +4 -0
  226. package/dist/systems/level/level-hold.d.ts.map +1 -0
  227. package/dist/systems/level/level-hold.js +14 -0
  228. package/dist/systems/level/level-system.d.ts.map +1 -1
  229. package/dist/systems/level/level-system.js +19 -6
  230. package/dist/systems/level/level-utils.d.ts +19 -6
  231. package/dist/systems/level/level-utils.d.ts.map +1 -1
  232. package/dist/systems/level/level-utils.js +68 -9
  233. package/dist/systems/level/shadow-only-levels.d.ts +9 -0
  234. package/dist/systems/level/shadow-only-levels.d.ts.map +1 -0
  235. package/dist/systems/level/shadow-only-levels.js +7 -0
  236. package/dist/systems/roof/__fixtures__/roof-plane-cases.d.ts +103 -0
  237. package/dist/systems/roof/__fixtures__/roof-plane-cases.d.ts.map +1 -0
  238. package/dist/systems/roof/__fixtures__/roof-plane-cases.js +317 -0
  239. package/dist/systems/roof/roof-materials.d.ts +16 -2
  240. package/dist/systems/roof/roof-materials.d.ts.map +1 -1
  241. package/dist/systems/roof/roof-materials.js +64 -31
  242. package/dist/systems/roof/roof-system.d.ts +21 -4
  243. package/dist/systems/roof/roof-system.d.ts.map +1 -1
  244. package/dist/systems/roof/roof-system.js +374 -49
  245. package/dist/systems/slab/slab-system.d.ts +1 -1
  246. package/dist/systems/slab/slab-system.d.ts.map +1 -1
  247. package/dist/systems/slab/slab-system.js +49 -19
  248. package/dist/systems/stair/stair-system.d.ts.map +1 -1
  249. package/dist/systems/stair/stair-system.js +133 -354
  250. package/dist/systems/wall/wall-cutout-cache.d.ts +39 -3
  251. package/dist/systems/wall/wall-cutout-cache.d.ts.map +1 -1
  252. package/dist/systems/wall/wall-cutout-cache.js +141 -19
  253. package/dist/systems/wall/wall-cutout.d.ts +6 -0
  254. package/dist/systems/wall/wall-cutout.d.ts.map +1 -1
  255. package/dist/systems/wall/wall-cutout.js +42 -28
  256. package/dist/systems/wall/wall-finish-data.d.ts +22 -0
  257. package/dist/systems/wall/wall-finish-data.d.ts.map +1 -0
  258. package/dist/systems/wall/wall-finish-data.js +17 -0
  259. package/dist/systems/wall/wall-material-variant.d.ts.map +1 -1
  260. package/dist/systems/wall/wall-materials.d.ts +9 -4
  261. package/dist/systems/wall/wall-materials.d.ts.map +1 -1
  262. package/dist/systems/wall/wall-materials.js +135 -153
  263. package/dist/systems/wall/wall-placeholder-sweep.d.ts.map +1 -1
  264. package/dist/systems/wall/wall-system.d.ts +33 -2
  265. package/dist/systems/wall/wall-system.d.ts.map +1 -1
  266. package/dist/systems/wall/wall-system.js +621 -159
  267. package/dist/systems/window/corner-frame.d.ts +10 -0
  268. package/dist/systems/window/corner-frame.d.ts.map +1 -0
  269. package/dist/systems/window/corner-frame.js +17 -0
  270. package/dist/systems/window/window-system.d.ts +1 -1
  271. package/dist/systems/window/window-system.d.ts.map +1 -1
  272. package/dist/systems/window/window-system.js +71 -27
  273. package/package.json +10 -10
  274. package/dist/systems/fence/fence-system.d.ts +0 -22
  275. package/dist/systems/fence/fence-system.d.ts.map +0 -1
  276. package/dist/systems/fence/fence-system.js +0 -357
@@ -21,11 +21,12 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  *
24
- * Vendored from R3F 9.6.1:
25
- * https://raw.githubusercontent.com/pmndrs/react-three-fiber/v9.6.1/packages/fiber/src/core/events.ts
24
+ * Vendored from R3F 9.8.2:
25
+ * https://raw.githubusercontent.com/pmndrs/react-three-fiber/v9.8.2/packages/fiber/src/core/events.ts
26
26
  * Ray collection is cached; camera-drag moves are throttled before stock dispatch.
27
27
  * The throttle is a vendored-manager policy; dev ?stockEvents uses untouched R3F.
28
28
  */
29
+ import { sceneRegistry, useScene } from '@pascal-app/core';
29
30
  import { events as createWebEvents, getRootState, } from '@react-three/fiber';
30
31
  import * as THREE from 'three';
31
32
  import { acceleratedRaycast } from 'three-mesh-bvh';
@@ -61,10 +62,10 @@ function isSupportedRaycast(raycast) {
61
62
  supportedRaycasts.has(raycast) ||
62
63
  raycast[pureRaycast] === true);
63
64
  }
64
- export function choosePointerEvents(search = typeof window !== 'undefined' ? window.location.search : '') {
65
+ export function choosePointerEvents(search = typeof window !== 'undefined' ? window.location.search : '', onBreadcrumb) {
65
66
  return process.env.NODE_ENV !== 'production' && new URLSearchParams(search).has('stockEvents')
66
67
  ? createWebEvents
67
- : createPascalPointerEvents;
68
+ : (store) => createPascalPointerEvents(store, onBreadcrumb);
68
69
  }
69
70
  function querySnapshot(raycaster) {
70
71
  if (Object.getPrototypeOf(raycaster) !== THREE.Raycaster.prototype ||
@@ -112,10 +113,92 @@ function querySnapshot(raycaster) {
112
113
  }
113
114
  return snapshot;
114
115
  }
116
+ /**
117
+ * Whether a mesh has a material for everything a raycast reads: three indexes
118
+ * a material array by each geometry group, and one with no entry throws on
119
+ * `material.side`. A mesh caught mid-swap (a preview restored an older array
120
+ * over a rebuilt geometry) is skipped for this move instead of taking the whole
121
+ * pointer event down; its children are still tested. `material` asks the same of
122
+ * an array the mesh would wear.
123
+ */
124
+ export function hasMaterialsForGroups(object, material = object.material) {
125
+ const mesh = object;
126
+ if (!mesh.isMesh)
127
+ return true;
128
+ if (!material)
129
+ return false;
130
+ if (!Array.isArray(material))
131
+ return true;
132
+ for (const group of mesh.geometry?.groups ?? []) {
133
+ if (!material[group.materialIndex ?? 0])
134
+ return false;
135
+ }
136
+ return true;
137
+ }
115
138
  function distanceOrder(a, b) {
116
139
  return a.distance - b.distance;
117
140
  }
118
- function createCachedRaycast() {
141
+ /** The scene node `object` draws for: itself or its nearest registered ancestor. */
142
+ function owningNode(object) {
143
+ const owners = new Map();
144
+ for (const [id, registered] of sceneRegistry.nodes)
145
+ owners.set(registered, id);
146
+ for (let at = object; at; at = at.parent) {
147
+ const id = owners.get(at);
148
+ if (id === undefined)
149
+ continue;
150
+ const node = useScene.getState().nodes[id];
151
+ return { id, type: node?.type ?? null };
152
+ }
153
+ return null;
154
+ }
155
+ /**
156
+ * Reports each mesh a pointer raycast skips for groups with no material, once
157
+ * per material it wears: pointer moves would otherwise repeat it every frame.
158
+ */
159
+ function createInvalidMaterialReporter(onBreadcrumb) {
160
+ const reported = new WeakMap();
161
+ return (object) => {
162
+ const material = object.material;
163
+ if (!onBreadcrumb || (reported.has(object) && reported.get(object) === material))
164
+ return;
165
+ reported.set(object, material);
166
+ const node = owningNode(object);
167
+ onBreadcrumb({
168
+ category: 'raycast_invalid_material',
169
+ message: 'Pointer raycast skipped a mesh whose geometry groups have no material',
170
+ level: 'warning',
171
+ data: { nodeType: node?.type ?? null, nodeId: node?.id ?? null, objectName: object.name },
172
+ });
173
+ };
174
+ }
175
+ /**
176
+ * Three's recursive `intersectObject`, skipping meshes `hasMaterialsForGroups`
177
+ * rejects. A raycaster with its own `intersectObject` is asked directly.
178
+ */
179
+ export function intersectDrawable(raycaster, object, skip) {
180
+ if (raycaster.intersectObject !== stockIntersectObject) {
181
+ return raycaster.intersectObject(object, true);
182
+ }
183
+ const hits = [];
184
+ const visit = (current) => {
185
+ let result;
186
+ if (current.layers.test(raycaster.layers)) {
187
+ if (hasMaterialsForGroups(current))
188
+ result = current.raycast(raycaster, hits);
189
+ else
190
+ skip(current);
191
+ }
192
+ if (result === false)
193
+ return;
194
+ const children = current.children;
195
+ for (let i = 0, length = children.length; i < length; i++)
196
+ visit(children[i]);
197
+ };
198
+ visit(object);
199
+ return hits.sort(distanceOrder);
200
+ }
201
+ function createCachedRaycast(skip) {
119
202
  const queries = new WeakMap();
120
203
  const activeQueries = [];
121
204
  const rootHits = [];
@@ -140,7 +223,10 @@ function createCachedRaycast() {
140
223
  unsupportedObject = object;
141
224
  return false;
142
225
  }
143
- result = object.raycast(raycaster, hits);
226
+ if (hasMaterialsForGroups(object))
227
+ result = object.raycast(raycaster, hits);
228
+ else
229
+ skip(object);
144
230
  }
145
231
  if (result !== false) {
146
232
  const children = object.children;
@@ -223,9 +309,9 @@ function createCachedRaycast() {
223
309
  },
224
310
  };
225
311
  }
226
- export function createPascalPointerEvents(store) {
312
+ export function createPascalPointerEvents(store, onBreadcrumb) {
227
313
  const manager = createWebEvents(store);
228
- const { handlePointer } = createEvents(store);
314
+ const { handlePointer } = createEvents(store, onBreadcrumb);
229
315
  for (const name of Object.keys(manager.handlers)) {
230
316
  manager.handlers[name] = handlePointer(name);
231
317
  }
@@ -246,7 +332,7 @@ export function createPascalPointerEvents(store) {
246
332
  return manager;
247
333
  }
248
334
  function makeId(event) {
249
- // biome-ignore lint/style/useTemplate: Keep the vendored dispatch identical to R3F 9.6.1.
335
+ // biome-ignore lint/style/useTemplate: Keep the vendored dispatch identical to R3F 9.8.2.
250
336
  return (event.eventObject || event.object).uuid + '/' + event.index + event.instanceId;
251
337
  }
252
338
  /**
@@ -264,7 +350,8 @@ function releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {
264
350
  }
265
351
  }
266
352
  }
267
- function createEvents(store) {
353
+ function createEvents(store, onBreadcrumb) {
354
+ const skipInvalidMaterial = createInvalidMaterialReporter(onBreadcrumb);
268
355
  const stats = {
269
356
  events: 0,
270
357
  cachedEvents: 0,
@@ -320,7 +407,7 @@ function createEvents(store) {
320
407
  // Make sure root-level pointer and ray are set up
321
408
  state.events.compute?.(event, state);
322
409
  }
323
- collectors[collectionDepth] ??= createCachedRaycast();
410
+ collectors[collectionDepth] ??= createCachedRaycast(skipInvalidMaterial);
324
411
  const collector = collectors[collectionDepth++];
325
412
  let hits = [];
326
413
  let stock = false;
@@ -342,7 +429,7 @@ function createEvents(store) {
342
429
  }
343
430
  if (layer.raycaster.camera) {
344
431
  const rootHits = stock
345
- ? layer.raycaster.intersectObject(obj, true)
432
+ ? intersectDrawable(layer.raycaster, obj, skipInvalidMaterial)
346
433
  : collector.intersectObject(obj, layer);
347
434
  if (!rootHits) {
348
435
  const unsupported = collector.unsupportedObject;
@@ -1 +1 @@
1
- {"version":3,"file":"post-processing-resources.d.ts","sourceRoot":"","sources":["../../src/lib/post-processing-resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAIlD,qBAAa,uBAAuB;IAClC,UAAU,EAAE,cAAc,GAAG,IAAI,CAAO;IACxC,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAK;IAChC,OAAO,EAAE;QAAE,OAAO,IAAI,IAAI,CAAA;KAAE,GAAG,IAAI,CAAO;IAC1C,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAO;IAEtC,OAAO;CAUR"}
1
+ {"version":3,"file":"post-processing-resources.d.ts","sourceRoot":"","sources":["../../src/lib/post-processing-resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAIlD,qBAAa,uBAAuB;IAClC,UAAU,EAAE,cAAc,GAAG,IAAI,CAAO;IACxC,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAK;IAChC,OAAO,EAAE;QAAE,OAAO,IAAI,IAAI,CAAA;KAAE,GAAG,IAAI,CAAO;IAC1C,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAO;IAEtC,OAAO,SASN;CACF"}
@@ -0,0 +1,7 @@
1
+ import type { EvaluatedLight } from '@pascal-app/core/procedural-items';
2
+ import type { Material, Mesh, Object3D } from 'three';
3
+ export declare function cloneWithProceduralEmission(material: Material, color: string, on: boolean): Material;
4
+ export declare function setProceduralEmission(material: Material, on: boolean): void;
5
+ export declare function proceduralSlotMeshes(root: Object3D, slots: Set<string>): Mesh[];
6
+ export declare function decorateProceduralEmission(root: Object3D, lights: EvaluatedLight[], on: boolean): () => void;
7
+ //# sourceMappingURL=procedural-emission.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"procedural-emission.d.ts","sourceRoot":"","sources":["../../src/lib/procedural-emission.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AACvE,OAAO,KAAK,EAAS,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAQ5D,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,OAAO,GACV,QAAQ,CAQV;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,GAAG,IAAI,CAG3E;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,CAW/E;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,cAAc,EAAE,EACxB,EAAE,EAAE,OAAO,GACV,MAAM,IAAI,CAwBZ"}
@@ -0,0 +1,54 @@
1
+ export function cloneWithProceduralEmission(material, color, on) {
2
+ const clone = material.clone();
3
+ clone.userData = { ...clone.userData, __pascalCachedMaterial: false };
4
+ if (clone.emissive)
5
+ clone.emissive.set(color);
6
+ if ('emissiveIntensity' in clone)
7
+ clone.emissiveIntensity = on ? 1 : 0;
8
+ if ('emissiveMap' in clone)
9
+ clone.emissiveMap = null;
10
+ clone.needsUpdate = true;
11
+ return clone;
12
+ }
13
+ export function setProceduralEmission(material, on) {
14
+ const controlled = material;
15
+ if ('emissiveIntensity' in controlled)
16
+ controlled.emissiveIntensity = on ? 1 : 0;
17
+ }
18
+ export function proceduralSlotMeshes(root, slots) {
19
+ const meshes = [];
20
+ const owner = root.userData.pascalId;
21
+ const visit = (object) => {
22
+ if (object !== root && object.userData.pascalId && object.userData.pascalId !== owner)
23
+ return;
24
+ const mesh = object;
25
+ if (mesh.isMesh && slots.has(mesh.userData.slotId))
26
+ meshes.push(mesh);
27
+ for (const child of object.children)
28
+ visit(child);
29
+ };
30
+ visit(root);
31
+ return meshes;
32
+ }
33
+ export function decorateProceduralEmission(root, lights, on) {
34
+ const colors = new Map(lights.flatMap((light) => light.emissiveSlot ? [[light.emissiveSlot, light.color]] : []));
35
+ const restores = [];
36
+ for (const mesh of proceduralSlotMeshes(root, new Set(colors.keys()))) {
37
+ const slot = mesh.userData.slotId;
38
+ const color = colors.get(slot);
39
+ if (!color)
40
+ continue;
41
+ const previous = mesh.material;
42
+ const clones = (Array.isArray(previous) ? previous : [previous]).map((material) => cloneWithProceduralEmission(material, color, on));
43
+ mesh.material = Array.isArray(previous) ? clones : clones[0];
44
+ restores.push(() => {
45
+ mesh.material = previous;
46
+ for (const clone of clones)
47
+ clone.dispose();
48
+ });
49
+ }
50
+ return () => {
51
+ for (const restore of restores)
52
+ restore();
53
+ };
54
+ }
@@ -0,0 +1,80 @@
1
+ import { type AnyNode, type AnyNodeId, type RevealStyle, type SceneCommit } from '@pascal-app/core';
2
+ import type { RevealCandidate } from './reveal-schedule';
3
+ import type { PlayedStyle } from './reveal-wipe';
4
+ /**
5
+ * How much of the construction plays. `off` shows a build at once; `simple`
6
+ * keeps the scattered order with only `rise` and `scale`; `full` adds the
7
+ * falls, settles, cuts, assembled roofs and the dust. `framing` plays the
8
+ * same motions on the lazy, nested schedule (floor by floor, room by room,
9
+ * piece by piece; `planLazyReveal`), overdone a little, and plugins that stage
10
+ * their own members (the framing) read it and play them in the prerolls.
11
+ */
12
+ export type ConstructionRevealLevel = 'off' | 'simple' | 'full' | 'framing';
13
+ /** A candidate; for an assembled node's part, also the node it assembles. */
14
+ export type StagedCandidate = RevealCandidate & {
15
+ host?: string;
16
+ };
17
+ /** A roof piece lifts this share of its drop before it falls: a hair, 20 cm of 4 m. */
18
+ export declare const PART_LEAD = 0.05;
19
+ /** `simple` keeps the stagger with only the two slice-one motions. */
20
+ export declare function styleAt(style: RevealStyle, at: ConstructionRevealLevel): PlayedStyle;
21
+ /** Kinds that hold the others: staging one would unmount everything under it. */
22
+ export declare const CONTAINERS: ReadonlySet<string>;
23
+ /**
24
+ * What `commit` stages at `at`: each node it creates whose kind declares a
25
+ * reveal, and the new parts (children declaring none) of each one that
26
+ * assembles. A new node of a kind that declares none comes in with a default
27
+ * reveal when what holds it was already there (under a new host, it comes in
28
+ * with the host). `seq` counts on from `firstSeq` in arrival order. Each
29
+ * candidate carries its room and its place in it (`layoutRevealCandidates`).
30
+ */
31
+ export declare function commitRevealCandidates({ before, current, author }: SceneCommit, at: ConstructionRevealLevel, firstSeq?: number): StagedCandidate[];
32
+ /**
33
+ * Gives each candidate its room for the lazy schedule: the room it stands in (a node on a line, the
34
+ * room on either side of its middle), else, for a node on a line, a run of the lines it meets end to
35
+ * end (`capabilities.revealLayout`); its room's
36
+ * sweep across the floor; and its place in the room (around the room's centre, or along the run).
37
+ * What stands in no room keeps none: it belongs to the floor.
38
+ */
39
+ export declare function layoutRevealCandidates(candidates: StagedCandidate[], nodes: Record<AnyNodeId, AnyNode>): void;
40
+ /** Where a piece stood in its level: its position, and its turn about the vertical. */
41
+ export type Placement = {
42
+ position: [number, number, number];
43
+ yaw: number;
44
+ };
45
+ /**
46
+ * A piece changed by a commit. `from` is where a moved piece stood when it can glide from there, else
47
+ * null; `edited` marks a piece whose picture was edited (a wall bent, a slab resized), which plays its
48
+ * reveal again, quickly (`commitEditCandidates`).
49
+ */
50
+ export type ChangeCandidate = StagedCandidate & {
51
+ from: Placement | null;
52
+ edited?: true;
53
+ };
54
+ /**
55
+ * What `commit` moves: each piece of furniture it finds already there that is placed differently
56
+ * (another position, turn or parent). Furniture only, for now: walls and openings move with the
57
+ * rooms and walls that hold them.
58
+ */
59
+ export declare function commitChangeCandidates({ before, current, author }: SceneCommit, at: ConstructionRevealLevel, firstSeq?: number): ChangeCandidate[];
60
+ /**
61
+ * What taking `ids` back reveals: each of them, and everything under them (a wall's openings, a
62
+ * room's furniture), as the build would have staged it: by what its kind declares, or the default
63
+ * reveal a kind that declares none came in with. What stands in a host that goes (a segment of a
64
+ * stair, a part of a pool) goes with it; an assembled node (a roof) goes whole, not part by part.
65
+ */
66
+ export declare function nodeRevealCandidates(ids: Iterable<string>, nodes: Record<AnyNodeId, AnyNode>, at: ConstructionRevealLevel): RevealCandidate[];
67
+ /**
68
+ * What `commit` edits: each node already there whose kind lists `capabilities.revealOnEdit` and one of
69
+ * those fields (the ones that make its picture) changed. A change to any other field stays instant, and
70
+ * so does what the structure reconciler derived from an edit (`derivedWrites`: the plates and ceilings it
71
+ * owns, the fields it wrote on a node): a wall moved does not make its room's floor rise again.
72
+ */
73
+ export declare function commitEditCandidates({ before, current, author, derivedWrites }: SceneCommit, at: ConstructionRevealLevel, firstSeq?: number): ChangeCandidate[];
74
+ /**
75
+ * What `commit` deletes that the picture can play out: each node that was there and is gone whose kind
76
+ * stages a reveal, as it was staged when built (a node standing in a host that goes with it goes with
77
+ * its host). Derived construction the reconciler retires is not a deletion the person or the agent made.
78
+ */
79
+ export declare function commitDeleteCandidates({ before, current, author, derivedWrites }: SceneCommit, at: ConstructionRevealLevel, firstSeq?: number): StagedCandidate[];
80
+ //# sourceMappingURL=reveal-candidates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reveal-candidates.d.ts","sourceRoot":"","sources":["../../src/lib/reveal-candidates.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,SAAS,EAMd,KAAK,WAAW,EAChB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;;;;;;GAOG;AACH,MAAM,MAAM,uBAAuB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAA;AAE3E,6EAA6E;AAC7E,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEjE,uFAAuF;AACvF,eAAO,MAAM,SAAS,OAAO,CAAA;AAE7B,sEAAsE;AACtE,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,uBAAuB,GAAG,WAAW,CAKpF;AAED,iFAAiF;AACjF,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,MAAM,CAA0C,CAAA;AAiFrF;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,WAAW,EACxC,EAAE,EAAE,uBAAuB,EAC3B,QAAQ,SAAI,GACX,eAAe,EAAE,CA0CnB;AA2FD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,eAAe,EAAE,EAC7B,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAChC,IAAI,CAqEN;AAoED,uFAAuF;AACvF,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3E;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG;IAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,IAAI,CAAA;CAAE,CAAA;AAmCzF;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,WAAW,EACxC,EAAE,EAAE,uBAAuB,EAC3B,QAAQ,SAAI,GACX,eAAe,EAAE,CAoBnB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,EACrB,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,EACjC,EAAE,EAAE,uBAAuB,GAC1B,eAAe,EAAE,CAsBnB;AAgBD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,WAAW,EACvD,EAAE,EAAE,uBAAuB,EAC3B,QAAQ,SAAI,GACX,eAAe,EAAE,CA4BnB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,WAAW,EACvD,EAAE,EAAE,uBAAuB,EAC3B,QAAQ,SAAI,GACX,eAAe,EAAE,CA4BnB"}