@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
@@ -0,0 +1,234 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ /**
5
+ * Screen-space ambient occlusion (#5384), SAO-style, in four fullscreen
6
+ * passes that share this module:
7
+ *
8
+ * 1. `fs_ao` (AO resolution): reconstruct the view-space position and
9
+ * normal from depth, then take `samples` taps on a per-pixel rotated
10
+ * spiral whose radius is `radius` world units projected to pixels. A tap
11
+ * occludes by how far it rises above the tangent plane (cosine, minus a
12
+ * bias), fading to zero at `radius` so distant geometry does not count.
13
+ * Writes (occlusion, linear depth).
14
+ * 2. `fs_blur_h`, 3. `fs_blur_v`: separable 9-tap bilateral blur that stops
15
+ * at depth discontinuities.
16
+ * 4. `fs_composite` (full resolution): depth-aware upsample, then output
17
+ * the darkening as alpha for a multiply blend. Background pixels (clear
18
+ * depth) output 0, so the sky and the clear colour are never darkened.
19
+ *
20
+ * `ao-params.ts` owns the uniform layout (`AO_UNIFORM_LAYOUT`) and the
21
+ * kernel; `depth-reconstruct.wgsl.ts` owns the reconstruction.
22
+ */
23
+ import { AO_GAIN, AO_MAX_DARKEN } from '../ao-params.js';
24
+ import { depthReconstructWgsl, depthTextureWgsl } from './depth-reconstruct.wgsl.js';
25
+ export function aoShaderSource(multisampled) {
26
+ return `
27
+ struct AoParams {
28
+ depthParams: vec4<f32>, // m10, m11, m14, m15
29
+ xyParams: vec4<f32>, // m0, m5, m12, m13
30
+ viewport: vec4<f32>, // full-res width, height, 1/width, 1/height
31
+ ao: vec4<f32>, // radius (world), px per world unit at w=1, max radius px, intensity
32
+ misc: vec4<f32>, // resolution divisor, samples, cosine bias, depth tolerance
33
+ kernel: array<vec4<f32>, 8>, // 16 unit-disk offsets, two per vec4
34
+ }
35
+
36
+ ${depthTextureWgsl(0, multisampled)}
37
+ @group(0) @binding(1) var<uniform> params: AoParams;
38
+ @group(0) @binding(2) var aoIn: texture_2d<f32>;
39
+
40
+ ${depthReconstructWgsl}
41
+
42
+ const TAU: f32 = 6.28318530718;
43
+ const AO_GAIN: f32 = ${AO_GAIN.toFixed(3)};
44
+ const AO_MAX_DARKEN: f32 = ${AO_MAX_DARKEN.toFixed(3)};
45
+
46
+ struct VsOut {
47
+ @builtin(position) pos: vec4<f32>,
48
+ }
49
+
50
+ @vertex
51
+ fn vs_fullscreen(@builtin(vertex_index) v: u32) -> VsOut {
52
+ var p = array<vec2<f32>, 3>(
53
+ vec2<f32>(-1.0, -3.0),
54
+ vec2<f32>(-1.0, 1.0),
55
+ vec2<f32>( 3.0, 1.0)
56
+ );
57
+ var o: VsOut;
58
+ o.pos = vec4<f32>(p[v], 0.0, 1.0);
59
+ return o;
60
+ }
61
+
62
+ fn viewPosAt(ip: vec2<i32>, d: f32) -> vec3<f32> {
63
+ return viewPositionFromDepth(ndcFromPixel(ip, params.viewport.zw), d, params.depthParams, params.xyParams);
64
+ }
65
+
66
+ // A neighbour for the normal. Background pushes it far away, so
67
+ // normalFromNeighbours takes the other side.
68
+ fn neighbourPos(ip: vec2<i32>, center: vec3<f32>) -> vec3<f32> {
69
+ let d = loadDepth(ip);
70
+ if (d <= BACKGROUND_DEPTH) {
71
+ return center - vec3<f32>(0.0, 0.0, 1e6);
72
+ }
73
+ return viewPosAt(ip, d);
74
+ }
75
+
76
+ fn kernelTap(i: u32) -> vec2<f32> {
77
+ let v = params.kernel[i / 2u];
78
+ return select(v.xy, v.zw, (i & 1u) == 1u);
79
+ }
80
+
81
+ // Interleaved gradient noise (Jimenez 2014): a per-pixel rotation the
82
+ // 9-tap blur removes without a visible pattern.
83
+ fn interleavedGradientNoise(p: vec2<f32>) -> f32 {
84
+ return fract(52.9829189 * fract(dot(p, vec2<f32>(0.06711056, 0.00583715))));
85
+ }
86
+
87
+ @fragment
88
+ fn fs_ao(@builtin(position) fragPos: vec4<f32>) -> @location(0) vec4<f32> {
89
+ let divisor = i32(params.misc.x);
90
+ let p = vec2<i32>(fragPos.xy) * divisor;
91
+ let dims = vec2<i32>(params.viewport.xy);
92
+ let d = loadDepth(p);
93
+ if (d <= BACKGROUND_DEPTH) {
94
+ return vec4<f32>(0.0, 0.0, 0.0, 0.0);
95
+ }
96
+ let P = viewPosAt(p, d);
97
+ let N = normalFromNeighbours(
98
+ P,
99
+ neighbourPos(p + vec2<i32>(1, 0), P),
100
+ neighbourPos(p - vec2<i32>(1, 0), P),
101
+ neighbourPos(p + vec2<i32>(0, 1), P),
102
+ neighbourPos(p - vec2<i32>(0, 1), P),
103
+ );
104
+ let depthKey = -P.z;
105
+
106
+ let radius = params.ao.x;
107
+ let w = clipWFromViewZ(P.z, params.depthParams);
108
+ let radiusPx = min(radius * params.ao.y / w, params.ao.z);
109
+ if (radiusPx < 1.0) {
110
+ // Smaller than a pixel: nothing to resolve at this distance.
111
+ return vec4<f32>(0.0, depthKey, 0.0, 0.0);
112
+ }
113
+
114
+ let angle = interleavedGradientNoise(fragPos.xy) * TAU;
115
+ let rot = vec2<f32>(cos(angle), sin(angle));
116
+ let invR2 = 1.0 / (radius * radius);
117
+ let bias = params.misc.z;
118
+ let samples = u32(params.misc.y);
119
+ var occlusion = 0.0;
120
+ for (var i = 0u; i < samples; i = i + 1u) {
121
+ let k = kernelTap(i);
122
+ let offset = vec2<f32>(k.x * rot.x - k.y * rot.y, k.x * rot.y + k.y * rot.x) * radiusPx;
123
+ let q = p + vec2<i32>(round(offset));
124
+ if (any(q < vec2<i32>(0)) || any(q >= dims)) {
125
+ continue;
126
+ }
127
+ let dq = loadDepth(q);
128
+ if (dq <= BACKGROUND_DEPTH) {
129
+ continue;
130
+ }
131
+ let v = viewPosAt(q, dq) - P;
132
+ let vv = dot(v, v);
133
+ // Range check: taps beyond the world radius do not occlude.
134
+ let falloff = max(1.0 - vv * invR2, 0.0);
135
+ let cosine = dot(v, N) * inverseSqrt(vv + 1e-8);
136
+ occlusion = occlusion + falloff * max(cosine - bias, 0.0);
137
+ }
138
+ occlusion = occlusion / (f32(samples) * (1.0 - bias));
139
+ return vec4<f32>(occlusion, depthKey, 0.0, 0.0);
140
+ }
141
+
142
+ // Relative depth closeness in [0, 1]: 1 on the same surface, 0 across
143
+ // a step larger than the tolerance.
144
+ fn depthWeight(key: f32, centerKey: f32) -> f32 {
145
+ return max(0.0, 1.0 - abs(key - centerKey) / (centerKey * params.misc.w));
146
+ }
147
+
148
+ fn bilateralBlur(t: vec2<i32>, dir: vec2<i32>) -> vec4<f32> {
149
+ let center = textureLoad(aoIn, t, 0);
150
+ if (center.y <= 0.0) {
151
+ return center;
152
+ }
153
+ let dims = vec2<i32>(textureDimensions(aoIn));
154
+ // Gaussian, sigma ~2 texels. A var: it is indexed at runtime.
155
+ var gauss = array<f32, 5>(0.2270, 0.1945, 0.1216, 0.0540, 0.0162);
156
+ var sum = center.x * gauss[0];
157
+ var wsum = gauss[0];
158
+ for (var i = 1; i <= 4; i = i + 1) {
159
+ for (var s = -1; s <= 1; s = s + 2) {
160
+ let q = t + dir * (i * s);
161
+ if (any(q < vec2<i32>(0)) || any(q >= dims)) {
162
+ continue;
163
+ }
164
+ let tap = textureLoad(aoIn, q, 0);
165
+ if (tap.y <= 0.0) {
166
+ continue;
167
+ }
168
+ let wgt = gauss[i] * depthWeight(tap.y, center.y);
169
+ sum = sum + tap.x * wgt;
170
+ wsum = wsum + wgt;
171
+ }
172
+ }
173
+ return vec4<f32>(sum / wsum, center.y, 0.0, 0.0);
174
+ }
175
+
176
+ @fragment
177
+ fn fs_blur_h(@builtin(position) fragPos: vec4<f32>) -> @location(0) vec4<f32> {
178
+ return bilateralBlur(vec2<i32>(fragPos.xy), vec2<i32>(1, 0));
179
+ }
180
+
181
+ @fragment
182
+ fn fs_blur_v(@builtin(position) fragPos: vec4<f32>) -> @location(0) vec4<f32> {
183
+ return bilateralBlur(vec2<i32>(fragPos.xy), vec2<i32>(0, 1));
184
+ }
185
+
186
+ // Joint bilateral upsample: the (up to) four AO texels around this
187
+ // pixel, weighted bilinearly and by depth closeness. When none is on
188
+ // this pixel's surface, the closest in depth wins.
189
+ fn upsampledOcclusion(p: vec2<i32>, key: f32) -> f32 {
190
+ let divisor = params.misc.x;
191
+ if (divisor <= 1.0) {
192
+ return textureLoad(aoIn, p, 0).x;
193
+ }
194
+ let dims = vec2<i32>(textureDimensions(aoIn));
195
+ // AO texel t was computed at full-res pixel t * divisor.
196
+ let f = vec2<f32>(p) / divisor;
197
+ let base = vec2<i32>(floor(f));
198
+ let fr = f - floor(f);
199
+ var sum = 0.0;
200
+ var wsum = 0.0;
201
+ var nearest = 0.0;
202
+ var nearestDiff = 1e30;
203
+ for (var j = 0; j < 4; j = j + 1) {
204
+ let o = vec2<i32>(j & 1, j >> 1u);
205
+ let q = clamp(base + o, vec2<i32>(0), dims - 1);
206
+ let tap = textureLoad(aoIn, q, 0);
207
+ let bw = select(1.0 - fr.x, fr.x, o.x == 1) * select(1.0 - fr.y, fr.y, o.y == 1);
208
+ let wgt = bw * depthWeight(tap.y, key);
209
+ sum = sum + tap.x * wgt;
210
+ wsum = wsum + wgt;
211
+ let diff = abs(tap.y - key);
212
+ if (diff < nearestDiff) {
213
+ nearestDiff = diff;
214
+ nearest = tap.x;
215
+ }
216
+ }
217
+ return select(nearest, sum / wsum, wsum > 1e-3);
218
+ }
219
+
220
+ @fragment
221
+ fn fs_composite(@builtin(position) fragPos: vec4<f32>) -> @location(0) vec4<f32> {
222
+ let p = vec2<i32>(fragPos.xy);
223
+ let d = loadDepth(p);
224
+ if (d <= BACKGROUND_DEPTH) {
225
+ return vec4<f32>(0.0, 0.0, 0.0, 0.0);
226
+ }
227
+ let key = -viewZFromDepth(d, params.depthParams);
228
+ let occlusion = upsampledOcclusion(p, key);
229
+ let darken = clamp(occlusion * AO_GAIN * params.ao.w, 0.0, AO_MAX_DARKEN);
230
+ return vec4<f32>(0.0, 0.0, 0.0, darken);
231
+ }
232
+ `;
233
+ }
234
+ //# sourceMappingURL=ao.wgsl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ao.wgsl.js","sourceRoot":"","sources":["../../src/shaders/ao.wgsl.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAErF,MAAM,UAAU,cAAc,CAAC,YAAqB;IAClD,OAAO;;;;;;;;;;UAUC,gBAAgB,CAAC,CAAC,EAAE,YAAY,CAAC;;;;UAIjC,oBAAoB;;;+BAGC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;qCACZ,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4L5D,CAAC;AACF,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Colour transfer shared by every shader that lights or tone-maps: the
3
+ * geometry fragment stage (`main.wgsl.ts`, and the textured variant derived
4
+ * from it) and the procedural sky (`sky.wgsl.ts`). One home, so the model and
5
+ * the sky cannot drift onto different "film stocks".
6
+ *
7
+ * The contract:
8
+ *
9
+ * - Authored colours (IfcColourRgb, IFC5 / glTF base colours, overlay tints,
10
+ * texture texels) are display-referred sRGB. `srgbToLinear` decodes them
11
+ * before they are multiplied by light, because light adds and multiplies
12
+ * linearly and sRGB values do not.
13
+ * - `neutralCompress` rolls off highlights only. Anything whose brightest
14
+ * channel is below 0.76 (about 227/255 once encoded) passes through
15
+ * untouched, so a colour up to that brightness, lit at unit neutral
16
+ * irradiance, renders as authored; brighter colours roll off with their
17
+ * hue preserved (pure white lands at 0.88, about 241/255, leaving
18
+ * headroom for sunlit highlights). It is the Khronos PBR Neutral operator
19
+ * without its toe: the toe subtracts up to 0.04 to cancel the specular F0
20
+ * offset a dielectric picks up under a unit-radiance environment. This
21
+ * renderer's sky is far dimmer, so its specular term (specular.wgsl.ts)
22
+ * lifts a dark matte surface by only about 0.01-0.02, and keeping the toe
23
+ * would crush dark materials below their authored value.
24
+ * - `linearToSrgb` is the exact piecewise encode. The canvas is configured
25
+ * with a non-sRGB format, so the shader must encode.
26
+ */
27
+ export declare const colorTransferWgsl = "\n fn srgbToLinear(c: vec3<f32>) -> vec3<f32> {\n let lo = c / 12.92;\n let hi = pow((max(c, vec3<f32>(0.0)) + 0.055) / 1.055, vec3<f32>(2.4));\n return select(hi, lo, c <= vec3<f32>(0.04045));\n }\n\n fn linearToSrgb(c: vec3<f32>) -> vec3<f32> {\n let lo = c * 12.92;\n let hi = 1.055 * pow(max(c, vec3<f32>(0.0)), vec3<f32>(1.0 / 2.4)) - 0.055;\n return select(hi, lo, c <= vec3<f32>(0.0031308));\n }\n\n fn neutralCompress(cIn: vec3<f32>) -> vec3<f32> {\n let startCompression = 0.76;\n let desaturation = 0.15;\n let c = max(cIn, vec3<f32>(0.0));\n let peak = max(c.r, max(c.g, c.b));\n if (peak < startCompression) { return c; }\n let d = 1.0 - startCompression;\n let newPeak = 1.0 - d * d / (peak + d - startCompression);\n let g = 1.0 - 1.0 / (desaturation * (peak - newPeak) + 1.0);\n return mix(c * (newPeak / peak), vec3<f32>(newPeak), g);\n }\n";
28
+ //# sourceMappingURL=color-transfer.wgsl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-transfer.wgsl.d.ts","sourceRoot":"","sources":["../../src/shaders/color-transfer.wgsl.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,iBAAiB,8gCAwB7B,CAAC"}
@@ -0,0 +1,55 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ /**
5
+ * Colour transfer shared by every shader that lights or tone-maps: the
6
+ * geometry fragment stage (`main.wgsl.ts`, and the textured variant derived
7
+ * from it) and the procedural sky (`sky.wgsl.ts`). One home, so the model and
8
+ * the sky cannot drift onto different "film stocks".
9
+ *
10
+ * The contract:
11
+ *
12
+ * - Authored colours (IfcColourRgb, IFC5 / glTF base colours, overlay tints,
13
+ * texture texels) are display-referred sRGB. `srgbToLinear` decodes them
14
+ * before they are multiplied by light, because light adds and multiplies
15
+ * linearly and sRGB values do not.
16
+ * - `neutralCompress` rolls off highlights only. Anything whose brightest
17
+ * channel is below 0.76 (about 227/255 once encoded) passes through
18
+ * untouched, so a colour up to that brightness, lit at unit neutral
19
+ * irradiance, renders as authored; brighter colours roll off with their
20
+ * hue preserved (pure white lands at 0.88, about 241/255, leaving
21
+ * headroom for sunlit highlights). It is the Khronos PBR Neutral operator
22
+ * without its toe: the toe subtracts up to 0.04 to cancel the specular F0
23
+ * offset a dielectric picks up under a unit-radiance environment. This
24
+ * renderer's sky is far dimmer, so its specular term (specular.wgsl.ts)
25
+ * lifts a dark matte surface by only about 0.01-0.02, and keeping the toe
26
+ * would crush dark materials below their authored value.
27
+ * - `linearToSrgb` is the exact piecewise encode. The canvas is configured
28
+ * with a non-sRGB format, so the shader must encode.
29
+ */
30
+ export const colorTransferWgsl = `
31
+ fn srgbToLinear(c: vec3<f32>) -> vec3<f32> {
32
+ let lo = c / 12.92;
33
+ let hi = pow((max(c, vec3<f32>(0.0)) + 0.055) / 1.055, vec3<f32>(2.4));
34
+ return select(hi, lo, c <= vec3<f32>(0.04045));
35
+ }
36
+
37
+ fn linearToSrgb(c: vec3<f32>) -> vec3<f32> {
38
+ let lo = c * 12.92;
39
+ let hi = 1.055 * pow(max(c, vec3<f32>(0.0)), vec3<f32>(1.0 / 2.4)) - 0.055;
40
+ return select(hi, lo, c <= vec3<f32>(0.0031308));
41
+ }
42
+
43
+ fn neutralCompress(cIn: vec3<f32>) -> vec3<f32> {
44
+ let startCompression = 0.76;
45
+ let desaturation = 0.15;
46
+ let c = max(cIn, vec3<f32>(0.0));
47
+ let peak = max(c.r, max(c.g, c.b));
48
+ if (peak < startCompression) { return c; }
49
+ let d = 1.0 - startCompression;
50
+ let newPeak = 1.0 - d * d / (peak + d - startCompression);
51
+ let g = 1.0 - 1.0 / (desaturation * (peak - newPeak) + 1.0);
52
+ return mix(c * (newPeak / peak), vec3<f32>(newPeak), g);
53
+ }
54
+ `;
55
+ //# sourceMappingURL=color-transfer.wgsl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-transfer.wgsl.js","sourceRoot":"","sources":["../../src/shaders/color-transfer.wgsl.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBhC,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * WGSL twin of `depth-reconstruct.ts`: view-space position and normal from
3
+ * the scene's reverse-Z depth buffer, shared by the screen-space passes so
4
+ * each one reconstructs geometry the same way.
5
+ *
6
+ * `dp` is `[m10, m11, m14, m15]` and `xy` is `[m0, m5, m12, m13]` of the
7
+ * camera projection (see `depthReconstructParams`).
8
+ */
9
+ /**
10
+ * Declares `depthTex` at `@group(0) @binding(binding)` and `loadDepth(ip)`,
11
+ * which clamps the coordinate to the texture and reads sample 0 when the
12
+ * attachment is multisampled.
13
+ */
14
+ export declare function depthTextureWgsl(binding: number, multisampled: boolean): string;
15
+ export declare const depthReconstructWgsl = "\n // Reverse-Z clears to 0, so anything at or below this is background.\n const BACKGROUND_DEPTH: f32 = 1e-7;\n\n fn viewZFromDepth(d: f32, dp: vec4<f32>) -> f32 {\n return (dp.z - d * dp.w) / (d * dp.y - dp.x);\n }\n\n fn clipWFromViewZ(z: f32, dp: vec4<f32>) -> f32 {\n return dp.y * z + dp.w;\n }\n\n // Pixel centre to NDC (y up), for a buffer whose texel size is invDims.\n fn ndcFromPixel(ip: vec2<i32>, invDims: vec2<f32>) -> vec2<f32> {\n let uv = (vec2<f32>(ip) + 0.5) * invDims;\n return vec2<f32>(uv.x * 2.0 - 1.0, 1.0 - uv.y * 2.0);\n }\n\n fn viewPositionFromDepth(ndc: vec2<f32>, d: f32, dp: vec4<f32>, xy: vec4<f32>) -> vec3<f32> {\n let z = viewZFromDepth(d, dp);\n let w = clipWFromViewZ(z, dp);\n return vec3<f32>((ndc.x * w - xy.z) / xy.x, (ndc.y * w - xy.w) / xy.y, z);\n }\n\n // Normal facing the camera, from a position and its four pixel\n // neighbours. On each axis it takes the neighbour with the smaller\n // depth step, so a pixel on a silhouette or a crease uses the side\n // on its own surface instead of averaging across the edge.\n fn normalFromNeighbours(\n p: vec3<f32>, right: vec3<f32>, left: vec3<f32>, down: vec3<f32>, up: vec3<f32>,\n ) -> vec3<f32> {\n let dxR = right - p;\n let dxL = p - left;\n let dx = select(dxR, dxL, abs(dxL.z) < abs(dxR.z));\n let dyD = down - p;\n let dyU = p - up;\n let dy = select(dyD, dyU, abs(dyU.z) < abs(dyD.z));\n // Pixel +x is view +x and pixel +y is view -y, so dy x dx faces +z.\n return normalize(cross(dy, dx));\n }\n";
16
+ //# sourceMappingURL=depth-reconstruct.wgsl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"depth-reconstruct.wgsl.d.ts","sourceRoot":"","sources":["../../src/shaders/depth-reconstruct.wgsl.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,MAAM,CAU/E;AAED,eAAO,MAAM,oBAAoB,+uDAwChC,CAAC"}
@@ -0,0 +1,69 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ /**
5
+ * WGSL twin of `depth-reconstruct.ts`: view-space position and normal from
6
+ * the scene's reverse-Z depth buffer, shared by the screen-space passes so
7
+ * each one reconstructs geometry the same way.
8
+ *
9
+ * `dp` is `[m10, m11, m14, m15]` and `xy` is `[m0, m5, m12, m13]` of the
10
+ * camera projection (see `depthReconstructParams`).
11
+ */
12
+ /**
13
+ * Declares `depthTex` at `@group(0) @binding(binding)` and `loadDepth(ip)`,
14
+ * which clamps the coordinate to the texture and reads sample 0 when the
15
+ * attachment is multisampled.
16
+ */
17
+ export function depthTextureWgsl(binding, multisampled) {
18
+ const type = multisampled ? 'texture_depth_multisampled_2d' : 'texture_depth_2d';
19
+ return `
20
+ @group(0) @binding(${binding}) var depthTex: ${type};
21
+
22
+ fn loadDepth(ip: vec2<i32>) -> f32 {
23
+ let dims = vec2<i32>(textureDimensions(depthTex));
24
+ return textureLoad(depthTex, clamp(ip, vec2<i32>(0), dims - 1), 0);
25
+ }
26
+ `;
27
+ }
28
+ export const depthReconstructWgsl = `
29
+ // Reverse-Z clears to 0, so anything at or below this is background.
30
+ const BACKGROUND_DEPTH: f32 = 1e-7;
31
+
32
+ fn viewZFromDepth(d: f32, dp: vec4<f32>) -> f32 {
33
+ return (dp.z - d * dp.w) / (d * dp.y - dp.x);
34
+ }
35
+
36
+ fn clipWFromViewZ(z: f32, dp: vec4<f32>) -> f32 {
37
+ return dp.y * z + dp.w;
38
+ }
39
+
40
+ // Pixel centre to NDC (y up), for a buffer whose texel size is invDims.
41
+ fn ndcFromPixel(ip: vec2<i32>, invDims: vec2<f32>) -> vec2<f32> {
42
+ let uv = (vec2<f32>(ip) + 0.5) * invDims;
43
+ return vec2<f32>(uv.x * 2.0 - 1.0, 1.0 - uv.y * 2.0);
44
+ }
45
+
46
+ fn viewPositionFromDepth(ndc: vec2<f32>, d: f32, dp: vec4<f32>, xy: vec4<f32>) -> vec3<f32> {
47
+ let z = viewZFromDepth(d, dp);
48
+ let w = clipWFromViewZ(z, dp);
49
+ return vec3<f32>((ndc.x * w - xy.z) / xy.x, (ndc.y * w - xy.w) / xy.y, z);
50
+ }
51
+
52
+ // Normal facing the camera, from a position and its four pixel
53
+ // neighbours. On each axis it takes the neighbour with the smaller
54
+ // depth step, so a pixel on a silhouette or a crease uses the side
55
+ // on its own surface instead of averaging across the edge.
56
+ fn normalFromNeighbours(
57
+ p: vec3<f32>, right: vec3<f32>, left: vec3<f32>, down: vec3<f32>, up: vec3<f32>,
58
+ ) -> vec3<f32> {
59
+ let dxR = right - p;
60
+ let dxL = p - left;
61
+ let dx = select(dxR, dxL, abs(dxL.z) < abs(dxR.z));
62
+ let dyD = down - p;
63
+ let dyU = p - up;
64
+ let dy = select(dyD, dyU, abs(dyU.z) < abs(dyD.z));
65
+ // Pixel +x is view +x and pixel +y is view -y, so dy x dx faces +z.
66
+ return normalize(cross(dy, dx));
67
+ }
68
+ `;
69
+ //# sourceMappingURL=depth-reconstruct.wgsl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"depth-reconstruct.wgsl.js","sourceRoot":"","sources":["../../src/shaders/depth-reconstruct.wgsl.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;GAOG;AAEH;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe,EAAE,YAAqB;IACrE,MAAM,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,kBAAkB,CAAC;IACjF,OAAO;6BACoB,OAAO,mBAAmB,IAAI;;;;;;CAM1D,CAAC;AACF,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCnC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function edgeShaderSource(multisampled: boolean): string;
2
+ //# sourceMappingURL=edges.wgsl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edges.wgsl.d.ts","sourceRoot":"","sources":["../../src/shaders/edges.wgsl.ts"],"names":[],"mappings":"AA0BA,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,OAAO,GAAG,MAAM,CAqI9D"}
@@ -0,0 +1,158 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ /**
5
+ * Edge pass (#5385): a single fullscreen pass that darkens along entity-id
6
+ * changes, normal creases, and depth silhouettes, replacing the separation-
7
+ * line pass in `post-processor.ts`.
8
+ *
9
+ * View-space position and normal come from `depth-reconstruct.wgsl.ts`
10
+ * (shared with the ambient-occlusion pass, #5384: one reconstruction, not
11
+ * two). The entity-id attachment is decoded the same way the old
12
+ * separation-line pass did (`encodeId24`/`decodeId24` in `main.wgsl.ts`).
13
+ *
14
+ * Each of `directions` tap offsets (4 cardinal at `low`, +4 diagonal at
15
+ * `high`) votes 0/1 on three cues — id change, normal crease, depth
16
+ * silhouette — and the pass darkens by the AVERAGE vote across directions.
17
+ * That average is a coverage estimate, not a single hard sample, so a line
18
+ * that only grazes one direction fades instead of dashing on/off between
19
+ * frames of the same seam (the bug this pass replaces, `post-processor.ts`
20
+ * introduced its own version of this coverage trick for the id test alone;
21
+ * this generalises it to all three cues and both new tests).
22
+ */
23
+ import { EDGE_CREASE_COS, EDGE_MAX_DARKEN, EDGE_SILHOUETTE_REL_THRESHOLD } from '../edge-params.js';
24
+ import { depthReconstructWgsl, depthTextureWgsl } from './depth-reconstruct.wgsl.js';
25
+ export function edgeShaderSource(multisampled) {
26
+ // Multisampled and non-multisampled `textureLoad` share this call shape:
27
+ // the third argument is the sample index (MS) or the mip level (non-MS),
28
+ // both 0, so one call site covers both declarations (`post-processor.ts`
29
+ // used the same trick).
30
+ const idTexDecl = multisampled
31
+ ? '@group(0) @binding(1) var idTex: texture_multisampled_2d<f32>;'
32
+ : '@group(0) @binding(1) var idTex: texture_2d<f32>;';
33
+ return `
34
+ struct EdgeParams {
35
+ depthParams: vec4<f32>, // m10, m11, m14, m15
36
+ xyParams: vec4<f32>, // m0, m5, m12, m13
37
+ viewport: vec4<f32>, // full-res width, height, 1/width, 1/height
38
+ edge: vec4<f32>, // tap radius px, intensity, highQuality (0/1), _pad
39
+ }
40
+
41
+ ${depthTextureWgsl(0, multisampled)}
42
+ ${idTexDecl}
43
+ @group(0) @binding(2) var<uniform> params: EdgeParams;
44
+
45
+ ${depthReconstructWgsl}
46
+
47
+ const EDGE_CREASE_COS: f32 = ${EDGE_CREASE_COS.toFixed(6)};
48
+ const EDGE_SILHOUETTE_REL: f32 = ${EDGE_SILHOUETTE_REL_THRESHOLD.toFixed(6)};
49
+ const EDGE_MAX_DARKEN: f32 = ${EDGE_MAX_DARKEN.toFixed(3)};
50
+
51
+ struct VsOut {
52
+ @builtin(position) pos: vec4<f32>,
53
+ }
54
+
55
+ @vertex
56
+ fn vs_fullscreen(@builtin(vertex_index) v: u32) -> VsOut {
57
+ var p = array<vec2<f32>, 3>(
58
+ vec2<f32>(-1.0, -3.0),
59
+ vec2<f32>(-1.0, 1.0),
60
+ vec2<f32>( 3.0, 1.0)
61
+ );
62
+ var o: VsOut;
63
+ o.pos = vec4<f32>(p[v], 0.0, 1.0);
64
+ return o;
65
+ }
66
+
67
+ fn decodeId24(encoded: vec4<f32>) -> u32 {
68
+ let r = u32(round(encoded.r * 255.0)) & 255u;
69
+ let g = u32(round(encoded.g * 255.0)) & 255u;
70
+ let b = u32(round(encoded.b * 255.0)) & 255u;
71
+ return (r << 16u) | (g << 8u) | b;
72
+ }
73
+
74
+ fn loadId(ip: vec2<i32>, dims: vec2<i32>) -> u32 {
75
+ let c = clamp(ip, vec2<i32>(0), dims - 1);
76
+ return decodeId24(textureLoad(idTex, c, 0));
77
+ }
78
+
79
+ fn viewPosAt(ip: vec2<i32>, d: f32) -> vec3<f32> {
80
+ return viewPositionFromDepth(ndcFromPixel(ip, params.viewport.zw), d, params.depthParams, params.xyParams);
81
+ }
82
+
83
+ // One tap direction's edge vote in [0, 1]: 1 if the id changes, the
84
+ // local normal creases past the angle threshold, or the view-space
85
+ // depth steps past the silhouette threshold.
86
+ fn tapVote(p: vec2<i32>, q: vec2<i32>, dims: vec2<i32>, centerId: u32, centerP: vec3<f32>, centerN: vec3<f32>) -> f32 {
87
+ let qc = clamp(q, vec2<i32>(0), dims - 1);
88
+ let dq = loadDepth(qc);
89
+ if (dq <= BACKGROUND_DEPTH) {
90
+ return 0.0;
91
+ }
92
+ let neighbourId = loadId(qc, dims);
93
+ let idVote = f32(neighbourId != centerId && neighbourId != 0u && centerId != 0u);
94
+
95
+ let Pq = viewPosAt(qc, dq);
96
+ let depthRef = max(-centerP.z, 1e-4);
97
+ let silhouetteVote = f32(abs(Pq.z - centerP.z) / depthRef > EDGE_SILHOUETTE_REL);
98
+
99
+ // Neighbour normal from ITS OWN neighbours (not just the two
100
+ // points), so a grazing coplanar surface (large positional slope,
101
+ // near-zero normal change) does not misread as a crease.
102
+ let dLeft = loadDepth(clamp(qc + vec2<i32>(-1, 0), vec2<i32>(0), dims - 1));
103
+ let dRight = loadDepth(clamp(qc + vec2<i32>(1, 0), vec2<i32>(0), dims - 1));
104
+ let dUp = loadDepth(clamp(qc + vec2<i32>(0, -1), vec2<i32>(0), dims - 1));
105
+ let dDown = loadDepth(clamp(qc + vec2<i32>(0, 1), vec2<i32>(0), dims - 1));
106
+ let Nq = normalFromNeighbours(
107
+ Pq,
108
+ select(centerP, viewPosAt(qc + vec2<i32>(1, 0), dRight), dRight > BACKGROUND_DEPTH),
109
+ select(centerP, viewPosAt(qc + vec2<i32>(-1, 0), dLeft), dLeft > BACKGROUND_DEPTH),
110
+ select(centerP, viewPosAt(qc + vec2<i32>(0, 1), dDown), dDown > BACKGROUND_DEPTH),
111
+ select(centerP, viewPosAt(qc + vec2<i32>(0, -1), dUp), dUp > BACKGROUND_DEPTH),
112
+ );
113
+ let creaseVote = f32(dot(centerN, Nq) < EDGE_CREASE_COS);
114
+
115
+ return max(idVote, max(creaseVote, silhouetteVote));
116
+ }
117
+
118
+ @fragment
119
+ fn fs_edges(@builtin(position) fragPos: vec4<f32>) -> @location(0) vec4<f32> {
120
+ let dims = vec2<i32>(params.viewport.xy);
121
+ let p = vec2<i32>(fragPos.xy);
122
+ let d = loadDepth(p);
123
+ if (d <= BACKGROUND_DEPTH) {
124
+ return vec4<f32>(0.0, 0.0, 0.0, 0.0);
125
+ }
126
+ let centerId = loadId(p, dims);
127
+ let centerP = viewPosAt(p, d);
128
+ let centerN = normalFromNeighbours(
129
+ centerP,
130
+ viewPosAt(clamp(p + vec2<i32>(1, 0), vec2<i32>(0), dims - 1), loadDepth(p + vec2<i32>(1, 0))),
131
+ viewPosAt(clamp(p - vec2<i32>(1, 0), vec2<i32>(0), dims - 1), loadDepth(p - vec2<i32>(1, 0))),
132
+ viewPosAt(clamp(p + vec2<i32>(0, 1), vec2<i32>(0), dims - 1), loadDepth(p + vec2<i32>(0, 1))),
133
+ viewPosAt(clamp(p - vec2<i32>(0, 1), vec2<i32>(0), dims - 1), loadDepth(p - vec2<i32>(0, 1))),
134
+ );
135
+
136
+ let r = i32(round(params.edge.x));
137
+ var votes = 0.0;
138
+ votes = votes + tapVote(p, p + vec2<i32>( r, 0), dims, centerId, centerP, centerN);
139
+ votes = votes + tapVote(p, p + vec2<i32>(-r, 0), dims, centerId, centerP, centerN);
140
+ votes = votes + tapVote(p, p + vec2<i32>( 0, r), dims, centerId, centerP, centerN);
141
+ votes = votes + tapVote(p, p + vec2<i32>( 0, -r), dims, centerId, centerP, centerN);
142
+ var directions = 4.0;
143
+
144
+ if (params.edge.z > 0.5) {
145
+ votes = votes + tapVote(p, p + vec2<i32>( r, r), dims, centerId, centerP, centerN);
146
+ votes = votes + tapVote(p, p + vec2<i32>(-r, r), dims, centerId, centerP, centerN);
147
+ votes = votes + tapVote(p, p + vec2<i32>( r, -r), dims, centerId, centerP, centerN);
148
+ votes = votes + tapVote(p, p + vec2<i32>(-r, -r), dims, centerId, centerP, centerN);
149
+ directions = 8.0;
150
+ }
151
+
152
+ let coverage = votes / directions;
153
+ let darken = clamp(coverage * params.edge.y, 0.0, EDGE_MAX_DARKEN);
154
+ return vec4<f32>(0.0, 0.0, 0.0, darken);
155
+ }
156
+ `;
157
+ }
158
+ //# sourceMappingURL=edges.wgsl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edges.wgsl.js","sourceRoot":"","sources":["../../src/shaders/edges.wgsl.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAErF,MAAM,UAAU,gBAAgB,CAAC,YAAqB;IACpD,yEAAyE;IACzE,yEAAyE;IACzE,yEAAyE;IACzE,wBAAwB;IACxB,MAAM,SAAS,GAAG,YAAY;QAC5B,CAAC,CAAC,gEAAgE;QAClE,CAAC,CAAC,mDAAmD,CAAC;IAExD,OAAO;;;;;;;;UAQC,gBAAgB,CAAC,CAAC,EAAE,YAAY,CAAC;UACjC,SAAS;;;UAGT,oBAAoB;;uCAES,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;2CACtB,6BAA6B,CAAC,OAAO,CAAC,CAAC,CAAC;uCAC5C,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2GhE,CAAC;AACF,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** RTE vertex reconstruction and shadow sampling composed into the main WGSL. */
2
+ export declare const mainRteWgsl = "\n fn rtePosition(local: vec3<f32>) -> vec4<f32> {\n let linear = (uniforms.model * vec4<f32>(local, 0.0)).xyz;\n return rteWorldPosition(linear, RteDrawableUniform(\n uniforms.drawableDeltaHigh,\n uniforms.drawableDeltaLow,\n ));\n }\n fn rteInstancePosition(local: vec3<f32>, anchorHigh: vec3<f32>, anchorLow: vec3<f32>) -> vec4<f32> {\n return rteWorldPosition(local, RteDrawableUniform(\n vec4<f32>(anchorHigh, 0.0),\n vec4<f32>(anchorLow, 0.0),\n ));\n }";
3
+ export declare const mainShadowWgsl = "\n @binding(1) @group(1) var shadowMap: texture_depth_2d;\n @binding(2) @group(1) var shadowCmp: sampler_comparison;\n struct Shadow { lightViewProj: mat4x4<f32>, params: vec4<f32>, params2: vec4<f32>, }\n @binding(3) @group(1) var<uniform> shadowU: Shadow;\n const SHADOW_POISSON = array<vec2<f32>, 12>(\n vec2<f32>(-0.326, -0.406), vec2<f32>(-0.840, -0.074), vec2<f32>(-0.696, 0.457),\n vec2<f32>(-0.203, 0.621), vec2<f32>( 0.962, -0.195), vec2<f32>( 0.473, -0.480),\n vec2<f32>( 0.519, 0.767), vec2<f32>( 0.185, -0.893), vec2<f32>( 0.507, 0.064),\n vec2<f32>( 0.896, 0.412), vec2<f32>(-0.322, -0.933), vec2<f32>(-0.792, -0.598),\n );\n fn sunShadowFactor(eyePos: vec3<f32>, N: vec3<f32>, fragCoord: vec2<f32>) -> f32 {\n if (shadowU.params.y < 0.5) { return 1.0; }\n let L = normalize(env.sunDirection);\n let Ns = N * select(-1.0, 1.0, dot(N, L) >= 0.0);\n let biased = eyePos + Ns * shadowU.params.z;\n let clip = shadowU.lightViewProj * vec4<f32>(biased, 1.0);\n let ndc = clip.xyz / clip.w;\n let uv = vec2<f32>(ndc.x * 0.5 + 0.5, ndc.y * -0.5 + 0.5);\n let inBounds = uv.x >= 0.0 && uv.x <= 1.0 && uv.y >= 0.0 && uv.y <= 1.0 && ndc.z > 0.0;\n if (!inBounds) { return 1.0; }\n let NdotL = max(dot(Ns, L), 0.0);\n let slope = clamp(sqrt(max(1.0 - NdotL * NdotL, 0.0)) / max(NdotL, 0.1), 1.0, 12.0);\n let refDepth = ndc.z + shadowU.params2.x * slope * (1.0 + shadowU.params.w);\n let radius = shadowU.params.x * shadowU.params.w;\n let ign = fract(52.9829189 * fract(dot(fragCoord, vec2<f32>(0.06711056, 0.00583715))));\n let ang = ign * 6.2831853;\n let cr = cos(ang); let sr = sin(ang); var sum = 0.0;\n for (var i = 0; i < 12; i = i + 1) {\n let p = SHADOW_POISSON[i];\n let off = vec2<f32>(p.x * cr - p.y * sr, p.x * sr + p.y * cr) * radius;\n sum = sum + textureSampleCompareLevel(shadowMap, shadowCmp, uv + off, refDepth);\n }\n return mix(1.0, sum / 12.0, smoothstep(0.0, 0.3, NdotL));\n }";
4
+ //# sourceMappingURL=main-rte-shadow.wgsl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main-rte-shadow.wgsl.d.ts","sourceRoot":"","sources":["../../src/shaders/main-rte-shadow.wgsl.ts"],"names":[],"mappings":"AAIA,iFAAiF;AAEjF,eAAO,MAAM,WAAW,qkBAad,CAAC;AAEX,eAAO,MAAM,cAAc,gqEAkCjB,CAAC"}