@ifc-lite/renderer 3.2.0 → 5.0.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 (399) hide show
  1. package/dist/aabb-edges.d.ts +10 -0
  2. package/dist/aabb-edges.d.ts.map +1 -1
  3. package/dist/aabb-edges.js +13 -0
  4. package/dist/aabb-edges.js.map +1 -1
  5. package/dist/ao-params.d.ts +85 -0
  6. package/dist/ao-params.d.ts.map +1 -0
  7. package/dist/ao-params.js +109 -0
  8. package/dist/ao-params.js.map +1 -0
  9. package/dist/ao-pass.d.ts +47 -0
  10. package/dist/ao-pass.d.ts.map +1 -0
  11. package/dist/ao-pass.js +157 -0
  12. package/dist/ao-pass.js.map +1 -0
  13. package/dist/camera-matrices.d.ts +3 -0
  14. package/dist/camera-matrices.d.ts.map +1 -1
  15. package/dist/camera-matrices.js +12 -1
  16. package/dist/camera-matrices.js.map +1 -1
  17. package/dist/camera-orientation.d.ts +62 -0
  18. package/dist/camera-orientation.d.ts.map +1 -0
  19. package/dist/camera-orientation.js +155 -0
  20. package/dist/camera-orientation.js.map +1 -0
  21. package/dist/camera-projection.d.ts +3 -1
  22. package/dist/camera-projection.d.ts.map +1 -1
  23. package/dist/camera-projection.js +26 -20
  24. package/dist/camera-projection.js.map +1 -1
  25. package/dist/camera-surface-zoom.d.ts +32 -0
  26. package/dist/camera-surface-zoom.d.ts.map +1 -0
  27. package/dist/camera-surface-zoom.js +37 -0
  28. package/dist/camera-surface-zoom.js.map +1 -0
  29. package/dist/camera.d.ts +32 -61
  30. package/dist/camera.d.ts.map +1 -1
  31. package/dist/camera.js +71 -167
  32. package/dist/camera.js.map +1 -1
  33. package/dist/clash-solid-pipeline.d.ts +9 -3
  34. package/dist/clash-solid-pipeline.d.ts.map +1 -1
  35. package/dist/clash-solid-pipeline.js +31 -8
  36. package/dist/clash-solid-pipeline.js.map +1 -1
  37. package/dist/constants.d.ts +1 -1
  38. package/dist/constants.d.ts.map +1 -1
  39. package/dist/constants.js +4 -3
  40. package/dist/constants.js.map +1 -1
  41. package/dist/depth-reconstruct.d.ts +43 -0
  42. package/dist/depth-reconstruct.d.ts.map +1 -0
  43. package/dist/depth-reconstruct.js +35 -0
  44. package/dist/depth-reconstruct.js.map +1 -0
  45. package/dist/device.js +1 -1
  46. package/dist/device.js.map +1 -1
  47. package/dist/edge-params.d.ts +43 -0
  48. package/dist/edge-params.d.ts.map +1 -0
  49. package/dist/edge-params.js +63 -0
  50. package/dist/edge-params.js.map +1 -0
  51. package/dist/edge-pass.d.ts +38 -0
  52. package/dist/edge-pass.d.ts.map +1 -0
  53. package/dist/edge-pass.js +111 -0
  54. package/dist/edge-pass.js.map +1 -0
  55. package/dist/environment.d.ts +26 -15
  56. package/dist/environment.d.ts.map +1 -1
  57. package/dist/environment.js +24 -13
  58. package/dist/environment.js.map +1 -1
  59. package/dist/federation-registry.d.ts +16 -0
  60. package/dist/federation-registry.d.ts.map +1 -1
  61. package/dist/federation-registry.js +80 -9
  62. package/dist/federation-registry.js.map +1 -1
  63. package/dist/gpu-static-upload.d.ts +39 -0
  64. package/dist/gpu-static-upload.d.ts.map +1 -0
  65. package/dist/gpu-static-upload.js +70 -0
  66. package/dist/gpu-static-upload.js.map +1 -0
  67. package/dist/gpu-upload-guard.d.ts +12 -23
  68. package/dist/gpu-upload-guard.d.ts.map +1 -1
  69. package/dist/gpu-upload-guard.js +12 -26
  70. package/dist/gpu-upload-guard.js.map +1 -1
  71. package/dist/index.d.ts +58 -35
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +255 -284
  74. package/dist/index.js.map +1 -1
  75. package/dist/instanced-render.d.ts +25 -5
  76. package/dist/instanced-render.d.ts.map +1 -1
  77. package/dist/instanced-render.js +50 -13
  78. package/dist/instanced-render.js.map +1 -1
  79. package/dist/instanced-rte.d.ts +17 -0
  80. package/dist/instanced-rte.d.ts.map +1 -0
  81. package/dist/instanced-rte.js +32 -0
  82. package/dist/instanced-rte.js.map +1 -0
  83. package/dist/mesh-material.d.ts +26 -0
  84. package/dist/mesh-material.d.ts.map +1 -0
  85. package/dist/mesh-material.js +52 -0
  86. package/dist/mesh-material.js.map +1 -0
  87. package/dist/mesh-rte-uniforms.d.ts +47 -0
  88. package/dist/mesh-rte-uniforms.d.ts.map +1 -0
  89. package/dist/mesh-rte-uniforms.js +60 -0
  90. package/dist/mesh-rte-uniforms.js.map +1 -0
  91. package/dist/model-bounds-tracker.d.ts +7 -0
  92. package/dist/model-bounds-tracker.d.ts.map +1 -1
  93. package/dist/model-bounds-tracker.js +16 -5
  94. package/dist/model-bounds-tracker.js.map +1 -1
  95. package/dist/model-translation.d.ts +1 -1
  96. package/dist/model-translation.d.ts.map +1 -1
  97. package/dist/model-translation.js +50 -2
  98. package/dist/model-translation.js.map +1 -1
  99. package/dist/overlay-theme-uniforms.d.ts +54 -0
  100. package/dist/overlay-theme-uniforms.d.ts.map +1 -0
  101. package/dist/overlay-theme-uniforms.js +89 -0
  102. package/dist/overlay-theme-uniforms.js.map +1 -0
  103. package/dist/overlay-theme.d.ts +73 -0
  104. package/dist/overlay-theme.d.ts.map +1 -0
  105. package/dist/overlay-theme.js +24 -0
  106. package/dist/overlay-theme.js.map +1 -0
  107. package/dist/pick-rte-snapshot.d.ts +7 -0
  108. package/dist/pick-rte-snapshot.d.ts.map +1 -0
  109. package/dist/pick-rte-snapshot.js +15 -0
  110. package/dist/pick-rte-snapshot.js.map +1 -0
  111. package/dist/pick-types.d.ts +17 -0
  112. package/dist/pick-types.d.ts.map +1 -0
  113. package/dist/pick-types.js +5 -0
  114. package/dist/pick-types.js.map +1 -0
  115. package/dist/pick-uniforms.d.ts +6 -0
  116. package/dist/pick-uniforms.d.ts.map +1 -1
  117. package/dist/pick-uniforms.js +22 -18
  118. package/dist/pick-uniforms.js.map +1 -1
  119. package/dist/pick-world-position.d.ts +18 -0
  120. package/dist/pick-world-position.d.ts.map +1 -0
  121. package/dist/pick-world-position.js +21 -0
  122. package/dist/pick-world-position.js.map +1 -0
  123. package/dist/picker-readbacks.d.ts +6 -0
  124. package/dist/picker-readbacks.d.ts.map +1 -0
  125. package/dist/picker-readbacks.js +20 -0
  126. package/dist/picker-readbacks.js.map +1 -0
  127. package/dist/picker-rte-uniforms.d.ts +6 -0
  128. package/dist/picker-rte-uniforms.d.ts.map +1 -0
  129. package/dist/picker-rte-uniforms.js +41 -0
  130. package/dist/picker-rte-uniforms.js.map +1 -0
  131. package/dist/picker.d.ts +6 -7
  132. package/dist/picker.d.ts.map +1 -1
  133. package/dist/picker.js +88 -115
  134. package/dist/picker.js.map +1 -1
  135. package/dist/picking-manager.d.ts +8 -0
  136. package/dist/picking-manager.d.ts.map +1 -1
  137. package/dist/picking-manager.js +46 -19
  138. package/dist/picking-manager.js.map +1 -1
  139. package/dist/pipeline.d.ts +3 -7
  140. package/dist/pipeline.d.ts.map +1 -1
  141. package/dist/pipeline.js +27 -31
  142. package/dist/pipeline.js.map +1 -1
  143. package/dist/point-picker.d.ts +5 -1
  144. package/dist/point-picker.d.ts.map +1 -1
  145. package/dist/point-picker.js +49 -9
  146. package/dist/point-picker.js.map +1 -1
  147. package/dist/pointcloud/point-cloud-handle-ids.d.ts +22 -0
  148. package/dist/pointcloud/point-cloud-handle-ids.d.ts.map +1 -0
  149. package/dist/pointcloud/point-cloud-handle-ids.js +31 -0
  150. package/dist/pointcloud/point-cloud-handle-ids.js.map +1 -0
  151. package/dist/pointcloud/point-cloud-node.d.ts +14 -6
  152. package/dist/pointcloud/point-cloud-node.d.ts.map +1 -1
  153. package/dist/pointcloud/point-cloud-node.js.map +1 -1
  154. package/dist/pointcloud/point-cloud-pick-sources.d.ts +47 -0
  155. package/dist/pointcloud/point-cloud-pick-sources.d.ts.map +1 -0
  156. package/dist/pointcloud/point-cloud-pick-sources.js +32 -0
  157. package/dist/pointcloud/point-cloud-pick-sources.js.map +1 -0
  158. package/dist/pointcloud/point-cloud-placement.d.ts.map +1 -1
  159. package/dist/pointcloud/point-cloud-placement.js +20 -5
  160. package/dist/pointcloud/point-cloud-placement.js.map +1 -1
  161. package/dist/pointcloud/point-cloud-ray-transform.d.ts +78 -4
  162. package/dist/pointcloud/point-cloud-ray-transform.d.ts.map +1 -1
  163. package/dist/pointcloud/point-cloud-ray-transform.js +31 -84
  164. package/dist/pointcloud/point-cloud-ray-transform.js.map +1 -1
  165. package/dist/pointcloud/point-cloud-renderer.d.ts +21 -19
  166. package/dist/pointcloud/point-cloud-renderer.d.ts.map +1 -1
  167. package/dist/pointcloud/point-cloud-renderer.js +46 -52
  168. package/dist/pointcloud/point-cloud-renderer.js.map +1 -1
  169. package/dist/pointcloud/point-cloud-stream-lifecycle.d.ts +44 -0
  170. package/dist/pointcloud/point-cloud-stream-lifecycle.d.ts.map +1 -0
  171. package/dist/pointcloud/point-cloud-stream-lifecycle.js +44 -0
  172. package/dist/pointcloud/point-cloud-stream-lifecycle.js.map +1 -0
  173. package/dist/pointcloud/point-cloud-uniforms.d.ts +5 -0
  174. package/dist/pointcloud/point-cloud-uniforms.d.ts.map +1 -1
  175. package/dist/pointcloud/point-cloud-uniforms.js +55 -44
  176. package/dist/pointcloud/point-cloud-uniforms.js.map +1 -1
  177. package/dist/pointcloud/point-cloud-visibility.d.ts +10 -0
  178. package/dist/pointcloud/point-cloud-visibility.d.ts.map +1 -0
  179. package/dist/pointcloud/point-cloud-visibility.js +18 -0
  180. package/dist/pointcloud/point-cloud-visibility.js.map +1 -0
  181. package/dist/pointcloud/point-pipeline.d.ts +4 -9
  182. package/dist/pointcloud/point-pipeline.d.ts.map +1 -1
  183. package/dist/pointcloud/point-pipeline.js +4 -9
  184. package/dist/pointcloud/point-pipeline.js.map +1 -1
  185. package/dist/pointcloud/point-shader.wgsl.d.ts +1 -21
  186. package/dist/pointcloud/point-shader.wgsl.d.ts.map +1 -1
  187. package/dist/pointcloud/point-shader.wgsl.js +25 -5
  188. package/dist/pointcloud/point-shader.wgsl.js.map +1 -1
  189. package/dist/post-pass-chain.d.ts +38 -0
  190. package/dist/post-pass-chain.d.ts.map +1 -0
  191. package/dist/post-pass-chain.js +105 -0
  192. package/dist/post-pass-chain.js.map +1 -0
  193. package/dist/raycast-engine.d.ts +7 -5
  194. package/dist/raycast-engine.d.ts.map +1 -1
  195. package/dist/raycast-engine.js +17 -20
  196. package/dist/raycast-engine.js.map +1 -1
  197. package/dist/raycast-point-cloud-query.d.ts +1 -1
  198. package/dist/raycast-point-cloud-query.d.ts.map +1 -1
  199. package/dist/reference-image-pipeline.d.ts +1 -1
  200. package/dist/reference-image-pipeline.d.ts.map +1 -1
  201. package/dist/reference-image-pipeline.js +25 -7
  202. package/dist/reference-image-pipeline.js.map +1 -1
  203. package/dist/reference-images.d.ts +1 -1
  204. package/dist/reference-images.d.ts.map +1 -1
  205. package/dist/reference-images.js +13 -5
  206. package/dist/reference-images.js.map +1 -1
  207. package/dist/relative-to-eye.d.ts +146 -0
  208. package/dist/relative-to-eye.d.ts.map +1 -0
  209. package/dist/relative-to-eye.js +326 -0
  210. package/dist/relative-to-eye.js.map +1 -0
  211. package/dist/render-section-draw.d.ts +11 -0
  212. package/dist/render-section-draw.d.ts.map +1 -1
  213. package/dist/render-section-draw.js +6 -3
  214. package/dist/render-section-draw.js.map +1 -1
  215. package/dist/renderer-color-readback.d.ts +50 -0
  216. package/dist/renderer-color-readback.d.ts.map +1 -0
  217. package/dist/renderer-color-readback.js +145 -0
  218. package/dist/renderer-color-readback.js.map +1 -0
  219. package/dist/renderer-overlays.d.ts +20 -10
  220. package/dist/renderer-overlays.d.ts.map +1 -1
  221. package/dist/renderer-overlays.js +44 -34
  222. package/dist/renderer-overlays.js.map +1 -1
  223. package/dist/renderer-screenshot.d.ts +4 -0
  224. package/dist/renderer-screenshot.d.ts.map +1 -0
  225. package/dist/renderer-screenshot.js +17 -0
  226. package/dist/renderer-screenshot.js.map +1 -0
  227. package/dist/renderer-symbolic-overlays.d.ts +4 -2
  228. package/dist/renderer-symbolic-overlays.d.ts.map +1 -1
  229. package/dist/renderer-symbolic-overlays.js +33 -13
  230. package/dist/renderer-symbolic-overlays.js.map +1 -1
  231. package/dist/renderer-viewport.d.ts +45 -0
  232. package/dist/renderer-viewport.d.ts.map +1 -1
  233. package/dist/renderer-viewport.js +44 -0
  234. package/dist/renderer-viewport.js.map +1 -1
  235. package/dist/rte-clip-space.d.ts +12 -0
  236. package/dist/rte-clip-space.d.ts.map +1 -0
  237. package/dist/rte-clip-space.js +22 -0
  238. package/dist/rte-clip-space.js.map +1 -0
  239. package/dist/rte-frustum.d.ts +24 -0
  240. package/dist/rte-frustum.d.ts.map +1 -0
  241. package/dist/rte-frustum.js +45 -0
  242. package/dist/rte-frustum.js.map +1 -0
  243. package/dist/scene-batch-upload.d.ts.map +1 -1
  244. package/dist/scene-batch-upload.js +14 -38
  245. package/dist/scene-batch-upload.js.map +1 -1
  246. package/dist/scene-device-recovery.d.ts.map +1 -1
  247. package/dist/scene-device-recovery.js +5 -9
  248. package/dist/scene-device-recovery.js.map +1 -1
  249. package/dist/scene-finalize-regroup.d.ts +54 -0
  250. package/dist/scene-finalize-regroup.d.ts.map +1 -0
  251. package/dist/scene-finalize-regroup.js +136 -0
  252. package/dist/scene-finalize-regroup.js.map +1 -0
  253. package/dist/scene-instance-bounds.d.ts +12 -0
  254. package/dist/scene-instance-bounds.d.ts.map +1 -0
  255. package/dist/scene-instance-bounds.js +48 -0
  256. package/dist/scene-instance-bounds.js.map +1 -0
  257. package/dist/scene-instance-materialization.d.ts +4 -1
  258. package/dist/scene-instance-materialization.d.ts.map +1 -1
  259. package/dist/scene-instance-materialization.js +21 -6
  260. package/dist/scene-instance-materialization.js.map +1 -1
  261. package/dist/scene-instance-translation.d.ts +17 -0
  262. package/dist/scene-instance-translation.d.ts.map +1 -0
  263. package/dist/scene-instance-translation.js +50 -0
  264. package/dist/scene-instance-translation.js.map +1 -0
  265. package/dist/scene-instance-types.d.ts +6 -0
  266. package/dist/scene-instance-types.d.ts.map +1 -1
  267. package/dist/scene-model-translation.d.ts +2 -0
  268. package/dist/scene-model-translation.d.ts.map +1 -1
  269. package/dist/scene-model-translation.js +1 -1
  270. package/dist/scene-model-translation.js.map +1 -1
  271. package/dist/scene-rect-select.d.ts +11 -1
  272. package/dist/scene-rect-select.d.ts.map +1 -1
  273. package/dist/scene-rect-select.js +7 -4
  274. package/dist/scene-rect-select.js.map +1 -1
  275. package/dist/scene.d.ts +27 -20
  276. package/dist/scene.d.ts.map +1 -1
  277. package/dist/scene.js +109 -238
  278. package/dist/scene.js.map +1 -1
  279. package/dist/section-2d-lift.d.ts +10 -2
  280. package/dist/section-2d-lift.d.ts.map +1 -1
  281. package/dist/section-2d-lift.js +14 -6
  282. package/dist/section-2d-lift.js.map +1 -1
  283. package/dist/section-2d-line-buffer.d.ts +12 -4
  284. package/dist/section-2d-line-buffer.d.ts.map +1 -1
  285. package/dist/section-2d-line-buffer.js +59 -33
  286. package/dist/section-2d-line-buffer.js.map +1 -1
  287. package/dist/section-2d-overlay.d.ts +18 -72
  288. package/dist/section-2d-overlay.d.ts.map +1 -1
  289. package/dist/section-2d-overlay.js +72 -103
  290. package/dist/section-2d-overlay.js.map +1 -1
  291. package/dist/section-2d-types.d.ts +38 -0
  292. package/dist/section-2d-types.d.ts.map +1 -0
  293. package/dist/section-2d-types.js +6 -0
  294. package/dist/section-2d-types.js.map +1 -0
  295. package/dist/section-cap-pipelines.d.ts +6 -0
  296. package/dist/section-cap-pipelines.d.ts.map +1 -0
  297. package/dist/section-cap-pipelines.js +87 -0
  298. package/dist/section-cap-pipelines.js.map +1 -0
  299. package/dist/section-plane-geometry.d.ts +24 -0
  300. package/dist/section-plane-geometry.d.ts.map +1 -0
  301. package/dist/section-plane-geometry.js +93 -0
  302. package/dist/section-plane-geometry.js.map +1 -0
  303. package/dist/section-plane.d.ts +26 -24
  304. package/dist/section-plane.d.ts.map +1 -1
  305. package/dist/section-plane.js +57 -182
  306. package/dist/section-plane.js.map +1 -1
  307. package/dist/shaders/ao.wgsl.d.ts +2 -0
  308. package/dist/shaders/ao.wgsl.d.ts.map +1 -0
  309. package/dist/shaders/ao.wgsl.js +234 -0
  310. package/dist/shaders/ao.wgsl.js.map +1 -0
  311. package/dist/shaders/color-transfer.wgsl.d.ts +28 -0
  312. package/dist/shaders/color-transfer.wgsl.d.ts.map +1 -0
  313. package/dist/shaders/color-transfer.wgsl.js +55 -0
  314. package/dist/shaders/color-transfer.wgsl.js.map +1 -0
  315. package/dist/shaders/depth-reconstruct.wgsl.d.ts +16 -0
  316. package/dist/shaders/depth-reconstruct.wgsl.d.ts.map +1 -0
  317. package/dist/shaders/depth-reconstruct.wgsl.js +69 -0
  318. package/dist/shaders/depth-reconstruct.wgsl.js.map +1 -0
  319. package/dist/shaders/edges.wgsl.d.ts +2 -0
  320. package/dist/shaders/edges.wgsl.d.ts.map +1 -0
  321. package/dist/shaders/edges.wgsl.js +158 -0
  322. package/dist/shaders/edges.wgsl.js.map +1 -0
  323. package/dist/shaders/main-rte-shadow.wgsl.d.ts +4 -0
  324. package/dist/shaders/main-rte-shadow.wgsl.d.ts.map +1 -0
  325. package/dist/shaders/main-rte-shadow.wgsl.js +54 -0
  326. package/dist/shaders/main-rte-shadow.wgsl.js.map +1 -0
  327. package/dist/shaders/main.wgsl.d.ts +1 -6
  328. package/dist/shaders/main.wgsl.d.ts.map +1 -1
  329. package/dist/shaders/main.wgsl.js +183 -228
  330. package/dist/shaders/main.wgsl.js.map +1 -1
  331. package/dist/shaders/relative-to-eye.wgsl.d.ts +12 -0
  332. package/dist/shaders/relative-to-eye.wgsl.d.ts.map +1 -0
  333. package/dist/shaders/relative-to-eye.wgsl.js +40 -0
  334. package/dist/shaders/relative-to-eye.wgsl.js.map +1 -0
  335. package/dist/shaders/section-2d-overlay.wgsl.d.ts +28 -12
  336. package/dist/shaders/section-2d-overlay.wgsl.d.ts.map +1 -1
  337. package/dist/shaders/section-2d-overlay.wgsl.js +40 -13
  338. package/dist/shaders/section-2d-overlay.wgsl.js.map +1 -1
  339. package/dist/shaders/shadow.wgsl.d.ts +1 -1
  340. package/dist/shaders/shadow.wgsl.d.ts.map +1 -1
  341. package/dist/shaders/shadow.wgsl.js +25 -7
  342. package/dist/shaders/shadow.wgsl.js.map +1 -1
  343. package/dist/shaders/sky.wgsl.d.ts +1 -11
  344. package/dist/shaders/sky.wgsl.d.ts.map +1 -1
  345. package/dist/shaders/sky.wgsl.js +17 -19
  346. package/dist/shaders/sky.wgsl.js.map +1 -1
  347. package/dist/shaders/specular.wgsl.d.ts +34 -0
  348. package/dist/shaders/specular.wgsl.d.ts.map +1 -0
  349. package/dist/shaders/specular.wgsl.js +134 -0
  350. package/dist/shaders/specular.wgsl.js.map +1 -0
  351. package/dist/shaders/symbolic-overlay.wgsl.d.ts +2 -9
  352. package/dist/shaders/symbolic-overlay.wgsl.d.ts.map +1 -1
  353. package/dist/shaders/symbolic-overlay.wgsl.js +88 -17
  354. package/dist/shaders/symbolic-overlay.wgsl.js.map +1 -1
  355. package/dist/shaders/textured.wgsl.d.ts.map +1 -1
  356. package/dist/shaders/textured.wgsl.js +11 -9
  357. package/dist/shaders/textured.wgsl.js.map +1 -1
  358. package/dist/shadow-light-matrix.d.ts +7 -0
  359. package/dist/shadow-light-matrix.d.ts.map +1 -1
  360. package/dist/shadow-light-matrix.js +11 -0
  361. package/dist/shadow-light-matrix.js.map +1 -1
  362. package/dist/shadow-occluder-batches.d.ts +10 -0
  363. package/dist/shadow-occluder-batches.d.ts.map +1 -0
  364. package/dist/shadow-occluder-batches.js +39 -0
  365. package/dist/shadow-occluder-batches.js.map +1 -0
  366. package/dist/shadow-occluders.d.ts.map +1 -1
  367. package/dist/shadow-occluders.js +4 -0
  368. package/dist/shadow-occluders.js.map +1 -1
  369. package/dist/shadow-pass.d.ts +5 -51
  370. package/dist/shadow-pass.d.ts.map +1 -1
  371. package/dist/shadow-pass.js +49 -45
  372. package/dist/shadow-pass.js.map +1 -1
  373. package/dist/shadow-types.d.ts +39 -0
  374. package/dist/shadow-types.d.ts.map +1 -0
  375. package/dist/shadow-types.js +15 -0
  376. package/dist/shadow-types.js.map +1 -0
  377. package/dist/symbolic-overlay-geometry.d.ts +7 -0
  378. package/dist/symbolic-overlay-geometry.d.ts.map +1 -0
  379. package/dist/symbolic-overlay-geometry.js +43 -0
  380. package/dist/symbolic-overlay-geometry.js.map +1 -0
  381. package/dist/symbolic-overlay-pipelines.d.ts +24 -36
  382. package/dist/symbolic-overlay-pipelines.d.ts.map +1 -1
  383. package/dist/symbolic-overlay-pipelines.js +175 -182
  384. package/dist/symbolic-overlay-pipelines.js.map +1 -1
  385. package/dist/symbolic-text-atlas.d.ts +21 -0
  386. package/dist/symbolic-text-atlas.d.ts.map +1 -1
  387. package/dist/symbolic-text-atlas.js +29 -1
  388. package/dist/symbolic-text-atlas.js.map +1 -1
  389. package/dist/types.d.ts +20 -26
  390. package/dist/types.d.ts.map +1 -1
  391. package/dist/visual-enhancement.d.ts +30 -1
  392. package/dist/visual-enhancement.d.ts.map +1 -1
  393. package/dist/visual-enhancement.js +44 -12
  394. package/dist/visual-enhancement.js.map +1 -1
  395. package/package.json +3 -3
  396. package/dist/post-processor.d.ts +0 -60
  397. package/dist/post-processor.d.ts.map +0 -1
  398. package/dist/post-processor.js +0 -353
  399. package/dist/post-processor.js.map +0 -1
package/dist/scene.js CHANGED
@@ -4,6 +4,7 @@
4
4
  import { materializeInstances } from './scene-instance-materialization.js';
5
5
  import { InstanceSuppression } from './scene-instance-suppression.js';
6
6
  import { createSceneBatch } from './scene-batch-upload.js';
7
+ import { createStaticGpuBuffer } from './gpu-static-upload.js';
7
8
  import { createSceneAppearancePreview, rebindSceneAppearanceAccess } from './scene-appearance-preview.js';
8
9
  import { AppearanceBuckets } from './scene-appearance-buckets.js';
9
10
  import { AuthoredPreparationRegistry, prepareSceneAuthoredOwner } from './scene-authored-owner.js';
@@ -27,10 +28,13 @@ import { selectEvictions } from './residency.js';
27
28
  import { OPAQUE_ALPHA_CUTOFF } from './overlay-routing.js';
28
29
  import { translateSceneModel, rotateSceneModelInstances, releaseInstanceVertices, refreshTexturedBounds } from './scene-model-translation.js';
29
30
  import { ModelTranslations } from './model-translation.js';
31
+ import { unionInstancedWorldAabb as unionInstanceBounds } from './scene-instance-bounds.js';
30
32
  import { DerivedMeshProvenance } from './scene-derived-mesh-provenance.js';
31
33
  import { rebuildSceneBatches } from './scene-batch-rebuild.js';
34
+ import { regroupStreamedBuckets } from './scene-finalize-regroup.js';
32
35
  import { dropAllPartialCaches as dropAllPartialCachesIn, dropPartialCacheForBatch as dropPartialCacheForBatchIn, retireUnusedAlphaSlots as retireUnusedAlphaSlotsIn, } from './partial-batch-cache.js';
33
36
  import { prepareInstancedRender, foldOccurrenceWorldBox, INSTANCE_STRIDE_BYTES, INSTANCE_COLOR_OFFSET, INSTANCE_FLAGS_OFFSET, INSTANCE_FLAG_SELECTED, INSTANCE_FLAG_HIDDEN, } from './instanced-render.js';
37
+ import { translateInstanceRecord } from './scene-instance-translation.js';
34
38
  import { discardSceneGpuResourcesForRecovery, prepareSceneDeviceRecovery, repartitionHydratedRecoveryBucket, restoreSceneGpuResourcesAfterRecovery } from './scene-device-recovery.js';
35
39
  const EMPTY_INSTANCED_TEMPLATES = [];
36
40
  /**
@@ -300,6 +304,9 @@ export class Scene {
300
304
  // Temporary fragment batches created during streaming for immediate rendering.
301
305
  // Destroyed and replaced by proper merged batches in finalizeStreaming().
302
306
  streamingFragments = [];
307
+ // Buckets that received streamed meshes since the last finalize — the only
308
+ // ones a finalize re-groups and rebuilds (#5358).
309
+ streamedBucketKeys = new Set();
303
310
  // ─── Mesh command queue ────────────────────────────────────────────
304
311
  // Decouples React state updates from GPU work. Callers push meshes
305
312
  // via queueMeshes() (instant, no GPU), and the animation loop drains
@@ -1084,7 +1091,7 @@ export class Scene {
1084
1091
  * STREAMING OPTIMIZATION: During streaming, creates lightweight "fragment"
1085
1092
  * batches from ONLY the new meshes instead of re-merging all accumulated
1086
1093
  * data. This reduces streaming from O(N²) to O(N). Call finalizeStreaming()
1087
- * when streaming completes to do one O(N) full merge.
1094
+ * when streaming completes to merge the streamed buckets (only those, #5358).
1088
1095
  */
1089
1096
  appendToBatches(meshDataArray, device, pipeline, isStreaming = false) {
1090
1097
  meshDataArray = meshDataArray.map((mesh) => this.modelTranslations.placeMesh(mesh));
@@ -1146,16 +1153,17 @@ export class Scene {
1146
1153
  this.meshDataBucket.set(meshData, bucket);
1147
1154
  // Also store individual mesh data for visibility filtering
1148
1155
  this.addMeshData(meshData);
1149
- // Track pending keys for non-streaming rebuild only
1150
- if (!isStreaming) {
1156
+ // Non-streaming rebuilds now; streamed buckets wait for finalize.
1157
+ if (isStreaming)
1158
+ this.streamedBucketKeys.add(bucketKey);
1159
+ else
1151
1160
  this.pendingBatchKeys.add(bucketKey);
1152
- }
1153
1161
  }
1154
1162
  }
1155
1163
  if (isStreaming) {
1156
1164
  // STREAMING: Create small fragment batches from ONLY the new meshes.
1157
1165
  // Avoids the O(N²) cost of re-merging all accumulated data every batch.
1158
- // finalizeStreaming() destroys fragments and does one O(N) full merge.
1166
+ // finalizeStreaming() destroys fragments and merges the streamed buckets.
1159
1167
  // `renderable` excludes textured meshes (drawn via the textured pipeline).
1160
1168
  this.createStreamingFragments(renderable, device, pipeline);
1161
1169
  return;
@@ -1504,22 +1512,17 @@ export class Scene {
1504
1512
  const cpu = this.instancedTemplateCpu[occ.templateIndex];
1505
1513
  if (!cpu)
1506
1514
  continue;
1507
- // Column-major mat4: the translation column is floats 12,13,14, i.e. bytes
1508
- // +48/+52/+56 of the occurrence's record (matches unionInstancedWorldAabb).
1509
- const dv = new DataView(cpu.instanceData);
1510
1515
  const b = occ.byteOffset;
1511
- const tx = dv.getFloat32(b + 48, true) + dx;
1512
- const ty = dv.getFloat32(b + 52, true) + dy;
1513
- const tz = dv.getFloat32(b + 56, true) + dz;
1514
- dv.setFloat32(b + 48, tx, true);
1515
- dv.setFloat32(b + 52, ty, true);
1516
- dv.setFloat32(b + 56, tz, true);
1516
+ const translated = translateInstanceRecord(cpu, b, [dx, dy, dz]);
1517
1517
  // Push only the 12 translation bytes to the GPU buffer (in place). Guarded
1518
1518
  // on the cached device so CPU-only tests still exercise the matrix math.
1519
1519
  if (device) {
1520
1520
  const gpu = this.instancedTemplates[occ.templateIndex]?.instanceBuffer;
1521
- if (gpu)
1522
- device.queue.writeBuffer(gpu, b + 48, new Float32Array([tx, ty, tz]));
1521
+ if (gpu) {
1522
+ device.queue.writeBuffer(gpu, b + 48, translated.translation);
1523
+ if (translated.legacyAnchors)
1524
+ device.queue.writeBuffer(gpu, b + 88, translated.legacyAnchors);
1525
+ }
1523
1526
  }
1524
1527
  moved = true;
1525
1528
  }
@@ -1773,7 +1776,7 @@ export class Scene {
1773
1776
  // yielding the frame back at the TOP of the loop. The mesh-count-only chunker
1774
1777
  // could merge a 512-mesh chunk of high-poly meshes (e.g. 899 Velux roof
1775
1778
  // windows at 7624 tris each → ~3.9M tris) in ONE indivisible mergeGeometry +
1776
- // mappedAtCreation buffer copy — hundreds of ms that parked the main thread
1779
+ // GPU buffer upload copy — hundreds of ms that parked the main thread
1777
1780
  // past the 16s stream watchdog. Capping each appendToBatches by index volume
1778
1781
  // keeps every synchronous slice ≈ one bounded fragment merge (~12-15ms).
1779
1782
  const MAX_MESHES_PER_FLUSH = 4096;
@@ -1863,15 +1866,14 @@ export class Scene {
1863
1866
  return splitMeshForStreaming(meshData, Scene.STREAMING_FRAGMENT_MAX_INDICES, Scene.STREAMING_FRAGMENT_MAX_VERTEX_BYTES);
1864
1867
  }
1865
1868
  /**
1866
- * Finalize streaming: destroy temporary fragment batches and do one full
1867
- * O(N) merge of all accumulated mesh data into proper batches.
1869
+ * Finalize streaming: destroy the temporary fragment batches and merge the
1870
+ * meshes streamed since the last finalize into proper batches.
1868
1871
  * Call this when streaming completes instead of rebuildPendingBatches().
1869
1872
  *
1870
- * IMPORTANT: During streaming, external code (applyColorUpdatesToMeshes)
1871
- * may mutate meshData.color in-place for deferred style/material colors.
1872
- * This means the bucket keys (computed at insertion time from the ORIGINAL
1873
- * color) no longer match the meshes' current colors. We must re-group all
1874
- * meshData by their CURRENT color to produce correct batches.
1873
+ * Only the buckets that received streamed meshes are re-grouped and rebuilt
1874
+ * (plus any key already pending); every other model's batches stay as they
1875
+ * are (#5358). See `regroupStreamedBuckets` for why the streamed meshes are
1876
+ * re-grouped by their CURRENT colour.
1875
1877
  */
1876
1878
  finalizeStreaming(device, pipeline) {
1877
1879
  if (this.streamingFragments.length === 0)
@@ -1884,6 +1886,27 @@ export class Scene {
1884
1886
  this.finalizeInProgress = false;
1885
1887
  }
1886
1888
  }
1889
+ regroupStreamed() {
1890
+ return regroupStreamedBuckets({
1891
+ buckets: this.buckets,
1892
+ meshDataBucket: this.meshDataBucket,
1893
+ activeBucketKey: this.activeBucketKey,
1894
+ coldBuckets: this.coldBuckets,
1895
+ pendingBatchKeys: this.pendingBatchKeys,
1896
+ streamedBucketKeys: this.streamedBucketKeys,
1897
+ bucketBaseKey: (md) => this.bucketBaseKey(md),
1898
+ resolveActiveBucket: (base, md) => this.resolveActiveBucket(base, md),
1899
+ createBucket: (key) => ({ key, meshData: [], batchedMesh: null, vertexBytes: 0 }),
1900
+ });
1901
+ }
1902
+ /** Free batches the finalize swap replaced, with their per-batch caches. */
1903
+ retireFinalizedBatches(batches) {
1904
+ for (const batch of batches) {
1905
+ this.dropPartialCacheForBatch(batch);
1906
+ this.lastDrawnFrame.delete(batch.id);
1907
+ destroyGpuResources(batch);
1908
+ }
1909
+ }
1887
1910
  finalizeStreamingInner(device, pipeline) {
1888
1911
  // Save references to old fragments/batches — keep them rendering
1889
1912
  // until the new proper batches are fully built (no visual gap).
@@ -1891,103 +1914,47 @@ export class Scene {
1891
1914
  const oldBatches = this.batchedMeshes;
1892
1915
  const fragmentSet = new Set(oldFragments);
1893
1916
  const oldBatchSet = new Set(oldBatches);
1894
- // Steps 1-4 detach the old drawables (streamingFragments = [],
1895
- // batchedMeshes = []) BEFORE the replacement GPU buffers exist. If a
1896
- // createBuffer fails part-way through, callers that CONTAIN the throw to
1897
- // keep the canvas alive would otherwise be left rendering a half-built —
1898
- // often empty — scene, turning a crash into a silently blank model.
1917
+ // The re-group detaches the streamed buckets BEFORE the replacement GPU
1918
+ // buffers exist. If a createBuffer fails part-way through, callers that
1919
+ // CONTAIN the throw to keep the canvas alive would otherwise be left
1920
+ // rendering a half-built scene, turning a crash into a silently blank model.
1921
+ let regroup = null;
1899
1922
  let rebuilt = false;
1900
1923
  try {
1901
1924
  this.streamingFragments = [];
1902
- // 1. Collect ALL accumulated meshData before clearing state.
1903
- // Cold buckets (issue #1682 phase 3b) hold NO meshData — their
1904
- // geometry lives on disk — so they are carried through the rebuild as
1905
- // sealed shells instead of being re-grouped (re-grouping would
1906
- // silently drop them).
1907
- const allMeshData = [];
1908
- const carriedCold = [];
1909
- for (const [key, bucket] of this.buckets) {
1910
- if (this.coldBuckets.has(key) && bucket.meshData.length === 0 && bucket.batchedMesh) {
1911
- carriedCold.push([key, bucket]);
1912
- continue;
1913
- }
1914
- for (const md of bucket.meshData)
1915
- allMeshData.push(md);
1916
- }
1917
- // 2. Clear all bucket/batch state for a clean rebuild
1918
- // NOTE: batchedMeshes keeps the OLD array reference — the renderer
1919
- // continues to draw from it until we swap in the new array below.
1920
- this.buckets.clear();
1921
- this.meshDataBucket = new Map();
1922
- this.activeBucketKey.clear();
1923
- this.lastDrawnFrame.clear();
1924
- this.residencyRestoreQueue.clear();
1925
- this.pendingBatchKeys.clear();
1926
- // Re-seat the carried cold shells in the fresh bucket map (their GPU
1927
- // shells re-enter the flat array via rebuildPendingBatches below).
1928
- for (const [key, bucket] of carriedCold)
1929
- this.buckets.set(key, bucket);
1930
- // 3. Re-group ALL meshData by their CURRENT color (and grid cell).
1931
- // meshData.color may have been mutated in-place since the mesh was
1932
- // first bucketed, so the original bucket key is stale. Re-grouping
1933
- // by current color ensures batches render with correct colors.
1934
- for (const meshData of allMeshData) {
1935
- const baseKey = this.bucketBaseKey(meshData);
1936
- const bucketKey = this.resolveActiveBucket(baseKey, meshData);
1937
- let bucket = this.buckets.get(bucketKey);
1938
- if (!bucket) {
1939
- bucket = { key: bucketKey, meshData: [], batchedMesh: null, vertexBytes: 0 };
1940
- this.buckets.set(bucketKey, bucket);
1941
- }
1942
- bucket.meshData.push(meshData);
1943
- this.meshDataBucket.set(meshData, bucket);
1944
- this.pendingBatchKeys.add(bucketKey);
1945
- }
1946
- // 4. Build new proper batches into a fresh array
1925
+ regroup = this.regroupStreamed();
1926
+ // Build into a fresh array; rebuildPendingBatches republishes every
1927
+ // bucket's batch, untouched ones included.
1947
1928
  this.batchedMeshes = [];
1948
1929
  this.rebuildPendingBatches(device, pipeline);
1949
1930
  rebuilt = true;
1950
- // Cached partial (filtered-visibility) batches are keyed by their SOURCE
1951
- // batch, so they only go stale once the replacement batches are live.
1952
- // Dropping them up in step 2 destroyed their GPU resources BEFORE the
1953
- // rebuild could fail, and the rollback cannot bring them back — an active
1954
- // hide/isolate view lost its visible subset and had to recreate it
1955
- // against the very device that just failed. On the failure path they now
1956
- // survive, still matching the restored batches.
1957
- this.dropAllPartialCaches();
1958
1931
  }
1959
1932
  finally {
1960
1933
  if (!rebuilt) {
1961
- // Free ONLY what this attempt created. Carried cold shells are aliased
1962
- // into BOTH the old and the new array, so anything that was already
1963
- // live before the rebuild must be left alone — destroying it would
1964
- // leave the restored arrays pointing at dead buffers.
1934
+ // Free ONLY what this attempt created: anything live before the
1935
+ // rebuild is what the restored arrays point back at.
1965
1936
  for (const created of this.batchedMeshes) {
1966
1937
  if (!oldBatchSet.has(created) && !fragmentSet.has(created)) {
1967
1938
  destroyGpuResources(created);
1968
1939
  }
1969
1940
  }
1970
- // Step 5 never ran, so every old fragment/batch is still a live GPU
1971
- // resource: putting the arrays back restores exactly what was on
1972
- // screen.
1941
+ regroup?.rollback();
1973
1942
  this.streamingFragments = oldFragments;
1974
1943
  this.batchedMeshes = oldBatches;
1975
1944
  }
1976
1945
  }
1977
- // 5. NOW destroy old fragment/batch GPU resources (new batches are live)
1978
- for (const fragment of oldFragments)
1979
- destroyGpuResources(fragment);
1980
- for (const batch of oldBatches) {
1981
- if (!fragmentSet.has(batch))
1982
- destroyGpuResources(batch);
1983
- }
1946
+ // NOW free the fragments and the dissolved buckets' batches (the
1947
+ // replacements are live). Batches of rebuilt surviving buckets were
1948
+ // already retired by rebuildPendingBatches.
1949
+ this.retireFinalizedBatches(oldFragments);
1950
+ this.retireFinalizedBatches(regroup?.retired ?? []);
1984
1951
  this.reapplyColorOverrides(device, pipeline);
1985
1952
  }
1986
1953
  /**
1987
1954
  * Time-sliced version of finalizeStreaming.
1988
- * Re-groups mesh data and rebuilds GPU batches in small chunks,
1989
- * yielding to the event loop between chunks so orbit/pan stays responsive.
1990
- * Streaming fragments continue rendering until each new batch replaces them.
1955
+ * Rebuilds the streamed buckets' batches in small chunks, yielding to the
1956
+ * event loop between chunks so orbit/pan stays responsive. The fragments
1957
+ * keep rendering until the rebuilt batches are swapped in.
1991
1958
  *
1992
1959
  * @param device GPU device
1993
1960
  * @param pipeline Render pipeline
@@ -2019,21 +1986,18 @@ export class Scene {
2019
1986
  // spec). Every entry point that can fail — the synchronous preamble AND
2020
1987
  // each chunked continuation — must therefore run under its own try/catch
2021
1988
  // that explicitly calls `reject`, mirroring finalizeStreamingInner's
2022
- // try/finally contract: restore oldFragments/oldBatches, free only what
2023
- // this attempt created, defer dropAllPartialCaches() until success, and
2024
- // always clear finalizeInProgress.
1989
+ // try/finally contract: restore oldFragments/oldBatches and the bucket
1990
+ // map, free only what this attempt created, and always clear
1991
+ // finalizeInProgress.
2025
1992
  return new Promise((resolve, reject) => {
2026
- const newBatches = [];
2027
1993
  const createdOwned = [];
2028
- let carriedCold = [];
1994
+ // Pending keys whose bucket ended up empty: deleted (and their batch
1995
+ // retired) at the swap, exactly as rebuildPendingBatches would.
1996
+ const emptied = [];
1997
+ let regroup = null;
2029
1998
  let pendingKeys = [];
2030
1999
  let keyIdx = 0;
2031
2000
  function rollback() {
2032
- // Free ONLY what this attempt created — carried cold shells and
2033
- // anything already live before the rebuild must be left alone (they
2034
- // are what the restored arrays point back at). Iterating the owned
2035
- // pairs rather than `newBatches` also skips the carried cold shells
2036
- // appended just before the swap, which this attempt did not create.
2037
2001
  for (const { bucket, previous, previousFrameOrigin, batch } of createdOwned) {
2038
2002
  // Repair the owner BEFORE the free, so no bucket is ever observable
2039
2003
  // holding a destroyed batch; its frame origin (what a later
@@ -2046,7 +2010,8 @@ export class Scene {
2046
2010
  destroyGpuResources(batch);
2047
2011
  }
2048
2012
  }
2049
- scene.streamingFragments = oldFragments;
2013
+ regroup?.rollback();
2014
+ scene.streamingFragments = [...oldFragments, ...scene.streamingFragments]; // + any streamed in meanwhile
2050
2015
  scene.batchedMeshes = oldBatches;
2051
2016
  scene.finalizeInProgress = false;
2052
2017
  }
@@ -2057,7 +2022,7 @@ export class Scene {
2057
2022
  const key = pendingKeys[keyIdx++];
2058
2023
  const bucket = scene.buckets.get(key);
2059
2024
  if (!bucket || bucket.meshData.length === 0) {
2060
- scene.buckets.delete(key);
2025
+ emptied.push(key);
2061
2026
  continue;
2062
2027
  }
2063
2028
  const color = bucket.meshData[0].color;
@@ -2067,35 +2032,31 @@ export class Scene {
2067
2032
  bucket.batchedMesh = batchedMesh;
2068
2033
  bucket.frameOrigin = batchedMesh.origin;
2069
2034
  createdOwned.push({ bucket, previous, previousFrameOrigin, batch: batchedMesh });
2070
- newBatches.push(batchedMesh);
2071
2035
  // Check time budget — yield if exceeded
2072
2036
  if (performance.now() - chunkStart >= budgetMs) {
2073
2037
  setTimeout(processChunk, 0);
2074
2038
  return;
2075
2039
  }
2076
2040
  }
2077
- // Carried cold shells stay drawable-when-restored: keep them in the
2078
- // flat array (their buffers are already destroyed; the draw loop
2079
- // skips gpuResident === false and the restore path revives them).
2080
- for (const [, bucket] of carriedCold) {
2081
- if (bucket.batchedMesh)
2082
- newBatches.push(bucket.batchedMesh);
2083
- }
2084
- // All batches built — atomic swap so renderer never sees an empty array
2085
- scene.batchedMeshes = newBatches;
2086
- // Cached partial (filtered-visibility) batches are keyed by their
2087
- // SOURCE batch, so they only go stale once the replacement batches
2088
- // are live — dropping them any earlier destroys GPU resources a
2089
- // mid-rebuild failure could never get back (same rationale as
2090
- // finalizeStreamingInner).
2091
- scene.dropAllPartialCaches();
2092
- // Destroy old fragment/batch GPU resources
2093
- for (const fragment of oldFragments)
2094
- destroyGpuResources(fragment);
2095
- for (const batch of oldBatches) {
2096
- if (!fragmentSet.has(batch))
2097
- destroyGpuResources(batch);
2041
+ const retired = [...oldFragments, ...(regroup?.retired ?? [])];
2042
+ for (const { previous } of createdOwned)
2043
+ if (previous)
2044
+ retired.push(previous);
2045
+ for (const key of emptied) {
2046
+ const batch = scene.buckets.get(key)?.batchedMesh;
2047
+ if (batch)
2048
+ retired.push(batch);
2049
+ scene.buckets.delete(key);
2098
2050
  }
2051
+ // Atomic swap so the renderer never sees an empty array: every
2052
+ // bucket's live batch (untouched models included, evicted shells
2053
+ // too — the draw loop skips gpuResident === false and the restore
2054
+ // path revives them) plus any fragment streamed in meanwhile.
2055
+ scene.batchedMeshes = [
2056
+ ...[...scene.buckets.values()].flatMap((b) => (b.batchedMesh ? [b.batchedMesh] : [])),
2057
+ ...scene.streamingFragments,
2058
+ ];
2059
+ scene.retireFinalizedBatches(retired);
2099
2060
  scene.finalizeInProgress = false;
2100
2061
  scene.reapplyColorOverrides(device, pipeline); // never throws: the swap above is committed
2101
2062
  resolve();
@@ -2106,45 +2067,9 @@ export class Scene {
2106
2067
  }
2107
2068
  }
2108
2069
  try {
2109
- // --- Synchronous preamble (fast O(N) bookkeeping) ---
2070
+ // --- Synchronous preamble: re-group the streamed meshes only ---
2110
2071
  scene.streamingFragments = [];
2111
- // 1. Collect ALL accumulated meshData (cold buckets carried as sealed
2112
- // shells — see the sync finalize for the rationale)
2113
- const allMeshData = [];
2114
- for (const [key, bucket] of scene.buckets) {
2115
- if (scene.coldBuckets.has(key) && bucket.meshData.length === 0 && bucket.batchedMesh) {
2116
- carriedCold.push([key, bucket]);
2117
- continue;
2118
- }
2119
- for (const md of bucket.meshData)
2120
- allMeshData.push(md);
2121
- }
2122
- // 2. Clear bucket/batch state. dropAllPartialCaches() is deliberately
2123
- // NOT called here — see the success path above.
2124
- scene.buckets.clear();
2125
- scene.meshDataBucket = new Map();
2126
- scene.activeBucketKey.clear();
2127
- scene.lastDrawnFrame.clear();
2128
- scene.residencyRestoreQueue.clear();
2129
- scene.pendingBatchKeys.clear();
2130
- // Re-seat the carried cold shells in the fresh bucket map.
2131
- for (const [key, bucket] of carriedCold)
2132
- scene.buckets.set(key, bucket);
2133
- // 3. Re-group meshData by current color (and grid cell) — fast
2134
- for (const meshData of allMeshData) {
2135
- const baseKey = scene.bucketBaseKey(meshData);
2136
- const bucketKey = scene.resolveActiveBucket(baseKey, meshData);
2137
- let bucket = scene.buckets.get(bucketKey);
2138
- if (!bucket) {
2139
- bucket = { key: bucketKey, meshData: [], batchedMesh: null, vertexBytes: 0 };
2140
- scene.buckets.set(bucketKey, bucket);
2141
- }
2142
- bucket.meshData.push(meshData);
2143
- scene.meshDataBucket.set(meshData, bucket);
2144
- scene.pendingBatchKeys.add(bucketKey);
2145
- }
2146
- // Build new batches into a temporary array so the old batchedMeshes
2147
- // (streaming fragments) keep rendering until the swap is complete.
2072
+ regroup = scene.regroupStreamed();
2148
2073
  pendingKeys = Array.from(scene.pendingBatchKeys);
2149
2074
  scene.pendingBatchKeys.clear();
2150
2075
  }
@@ -2185,6 +2110,7 @@ export class Scene {
2185
2110
  this.coldBuckets.clear();
2186
2111
  this.dirtyBuckets.clear();
2187
2112
  this.pendingBatchKeys.clear();
2113
+ this.streamedBucketKeys.clear();
2188
2114
  this.dropAllPartialCaches();
2189
2115
  this.geometryReleased = true;
2190
2116
  this.ephemeralStreamingMode = false;
@@ -2887,31 +2813,13 @@ export class Scene {
2887
2813
  vf[o + 5] = i * 3 + 2 < t.normals.length ? t.normals[i * 3 + 2] : 0;
2888
2814
  // vf[o + 6] (entityId lane) stays 0.
2889
2815
  }
2890
- const vertexBuffer = device.createBuffer({
2891
- size: vtx.byteLength,
2892
- usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST,
2893
- mappedAtCreation: true,
2894
- });
2895
- new Uint8Array(vertexBuffer.getMappedRange()).set(new Uint8Array(vtx));
2896
- vertexBuffer.unmap();
2897
- const indexBuffer = device.createBuffer({
2898
- size: t.indices.byteLength,
2899
- usage: GPUBufferUsage.INDEX | GPUBufferUsage.COPY_DST,
2900
- mappedAtCreation: true,
2901
- });
2902
- new Uint32Array(indexBuffer.getMappedRange()).set(t.indices);
2903
- indexBuffer.unmap();
2816
+ const vertexBuffer = createStaticGpuBuffer(device, vtx, GPUBufferUsage.VERTEX);
2817
+ const indexBuffer = createStaticGpuBuffer(device, t.indices, GPUBufferUsage.INDEX);
2904
2818
  // instanceBuffer is already the interleaved mat4 + entityId + rgba block
2905
2819
  // (INSTANCE_STRIDE_BYTES per occurrence) from prepareInstancedRender.
2906
- this.modelTranslations.placeInstances(t.instanceBuffer, modelIndex, INSTANCE_STRIDE_BYTES);
2820
+ this.modelTranslations.placeInstances(t.instanceBuffer, modelIndex, INSTANCE_STRIDE_BYTES, t.canonicalAnchors, t.canonicalMatrixTranslations);
2907
2821
  const instSize = t.instanceCount * INSTANCE_STRIDE_BYTES;
2908
- const instanceBuffer = device.createBuffer({
2909
- size: instSize,
2910
- usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST,
2911
- mappedAtCreation: true,
2912
- });
2913
- new Uint8Array(instanceBuffer.getMappedRange()).set(new Uint8Array(t.instanceBuffer, 0, instSize));
2914
- instanceBuffer.unmap();
2822
+ const instanceBuffer = createStaticGpuBuffer(device, new Uint8Array(t.instanceBuffer, 0, instSize), GPUBufferUsage.VERTEX);
2915
2823
  // Always append: slots are stable identities, never recycled.
2916
2824
  const templateIndex = this.instancedTemplates.length;
2917
2825
  const template = {
@@ -2921,6 +2829,7 @@ export class Scene {
2921
2829
  indexCount: t.indices.length,
2922
2830
  instanceBuffer,
2923
2831
  instanceCount: t.instanceCount,
2832
+ canonicalAnchors: t.canonicalAnchors,
2924
2833
  bounds: null,
2925
2834
  maxOccRadius: 0,
2926
2835
  selectedCount: 0,
@@ -2954,6 +2863,8 @@ export class Scene {
2954
2863
  normals: t.normals,
2955
2864
  indices: t.indices,
2956
2865
  instanceData: t.instanceBuffer,
2866
+ canonicalAnchors: t.canonicalAnchors,
2867
+ canonicalMatrixTranslations: t.canonicalMatrixTranslations,
2957
2868
  localMin: [lmnx, lmny, lmnz],
2958
2869
  localMax: [lmxx, lmxy, lmxz],
2959
2870
  };
@@ -3024,51 +2935,10 @@ export class Scene {
3024
2935
  this.instancedVisibilityDirty = true;
3025
2936
  this.instancedGhostDirty = true;
3026
2937
  }
3027
- /** Transform a template's local AABB by an occurrence's column-major mat4 (read
3028
- * from the packed instance record at `matOffset`) and union the world box into
3029
- * boundingBoxes[eid]. Returns the occurrence's world box so the caller can also
3030
- * fold it into the template's cull metadata. */
3031
2938
  unionInstancedWorldAabb(eid, dv, matOffset, lmnx, lmny, lmnz, lmxx, lmxy, lmxz) {
3032
- const m0 = dv.getFloat32(matOffset + 0, true), m1 = dv.getFloat32(matOffset + 4, true), m2 = dv.getFloat32(matOffset + 8, true);
3033
- const m4 = dv.getFloat32(matOffset + 16, true), m5 = dv.getFloat32(matOffset + 20, true), m6 = dv.getFloat32(matOffset + 24, true);
3034
- const m8 = dv.getFloat32(matOffset + 32, true), m9 = dv.getFloat32(matOffset + 36, true), m10 = dv.getFloat32(matOffset + 40, true);
3035
- const m12 = dv.getFloat32(matOffset + 48, true), m13 = dv.getFloat32(matOffset + 52, true), m14 = dv.getFloat32(matOffset + 56, true);
3036
- let minX = Infinity, minY = Infinity, minZ = Infinity, maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;
3037
- for (let c = 0; c < 8; c++) {
3038
- const x = (c & 1) ? lmxx : lmnx, y = (c & 2) ? lmxy : lmny, z = (c & 4) ? lmxz : lmnz;
3039
- const wx = m0 * x + m4 * y + m8 * z + m12;
3040
- const wy = m1 * x + m5 * y + m9 * z + m13;
3041
- const wz = m2 * x + m6 * y + m10 * z + m14;
3042
- if (wx < minX)
3043
- minX = wx;
3044
- if (wy < minY)
3045
- minY = wy;
3046
- if (wz < minZ)
3047
- minZ = wz;
3048
- if (wx > maxX)
3049
- maxX = wx;
3050
- if (wy > maxY)
3051
- maxY = wy;
3052
- if (wz > maxZ)
3053
- maxZ = wz;
3054
- }
3055
- const existing = this.boundingBoxes.get(eid);
3056
- if (existing) {
3057
- existing.min.x = Math.min(existing.min.x, minX);
3058
- existing.min.y = Math.min(existing.min.y, minY);
3059
- existing.min.z = Math.min(existing.min.z, minZ);
3060
- existing.max.x = Math.max(existing.max.x, maxX);
3061
- existing.max.y = Math.max(existing.max.y, maxY);
3062
- existing.max.z = Math.max(existing.max.z, maxZ);
3063
- }
3064
- else {
3065
- this.boundingBoxes.set(eid, { min: { x: minX, y: minY, z: minZ }, max: { x: maxX, y: maxY, z: maxZ } });
3066
- }
3067
- return { minX, minY, minZ, maxX, maxY, maxZ };
2939
+ return unionInstanceBounds(this.boundingBoxes, eid, dv, matOffset, lmnx, lmny, lmnz, lmxx, lmxy, lmxz);
3068
2940
  }
3069
- /** True if `expressId` is a GPU-instanced occurrence (lives only in the instanced
3070
- * shard, not the flat meshDataMap). CPU consumers use this to decide whether to
3071
- * fall back to the instanced accessors below. */
2941
+ /** True when `expressId` has a GPU-instanced occurrence. */
3072
2942
  isInstancedEntity(expressId) {
3073
2943
  return this.instancedEntityMap.has(expressId);
3074
2944
  }
@@ -3635,6 +3505,7 @@ export class Scene {
3635
3505
  this.dirtyBuckets.clear();
3636
3506
  this.cachedMaxBufferSize = 0;
3637
3507
  this.pendingBatchKeys.clear();
3508
+ this.streamedBucketKeys.clear();
3638
3509
  this.meshQueue = [];
3639
3510
  this.meshQueueReadIndex = 0;
3640
3511
  this.geometryReleased = false;
@@ -3933,7 +3804,7 @@ export class Scene {
3933
3804
  * covered: their world AABBs are registered in `boundingBoxes` when the
3934
3805
  * instanced shard is built.
3935
3806
  */
3936
- selectRect(x0, y0, x1, y1, viewportWidth, viewportHeight, viewProj, hiddenIds, isolatedIds, clip) {
3807
+ selectRect(x0, y0, x1, y1, viewportWidth, viewportHeight, viewProj, hiddenIds, isolatedIds, clip, rte) {
3937
3808
  // After release the cache is already the complete set; before it, boxes are
3938
3809
  // computed lazily, so make sure every entity that still has mesh data has
3939
3810
  // one. Same authoritative id set pick() uses, so colour-fused fillers whose
@@ -3951,7 +3822,7 @@ export class Scene {
3951
3822
  this.getEntityBoundingBox(expressId);
3952
3823
  }
3953
3824
  }
3954
- return selectBoundingBoxesInRect(this.boundingBoxes, viewProj, { x0, y0, x1, y1 }, viewportWidth, viewportHeight, hiddenIds, isolatedIds, clip);
3825
+ return selectBoundingBoxesInRect(this.boundingBoxes, viewProj, { x0, y0, x1, y1 }, viewportWidth, viewportHeight, hiddenIds, isolatedIds, clip, rte);
3955
3826
  }
3956
3827
  }
3957
3828
  //# sourceMappingURL=scene.js.map