@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
@@ -2,31 +2,63 @@
2
2
  * License, v. 2.0. If a copy of the MPL was not distributed with this
3
3
  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
4
  /**
5
- * Main PBR rendering shader for IFC geometry.
6
- * Features: PBR lighting, section plane clipping, selection highlight,
7
- * glass fresnel, ACES tone mapping, screen-space edge enhancement.
5
+ * Main rendering shader for IFC geometry.
6
+ * Features: linear-space lighting of sRGB-authored colours with a GGX
7
+ * specular term (specular.wgsl.ts), section plane clipping, selection
8
+ * highlight, glass, hue-preserving highlight roll-off, screen-space edge
9
+ * enhancement.
8
10
  */
11
+ import { MESH_FLAG_RTE_DRAWABLE } from '../mesh-rte-uniforms.js';
12
+ import { colorTransferWgsl } from './color-transfer.wgsl.js';
13
+ import { mainRteWgsl, mainShadowWgsl } from './main-rte-shadow.wgsl.js';
14
+ import { relativeToEyeWgsl } from './relative-to-eye.wgsl.js';
15
+ import { specularWgsl } from './specular.wgsl.js';
16
+ /**
17
+ * Translucent surfaces draw at this fraction of their alpha, so interiors
18
+ * read through windows and X-Ray ghosts stay faint. A viewer choice that
19
+ * predates #5386, not optics.
20
+ */
21
+ const TRANSLUCENT_OPACITY_SCALE = 0.7;
22
+ /**
23
+ * Converts the environment's light intensities to linear irradiance.
24
+ *
25
+ * The intensity scale predates the linear pipeline (#5381), which lights in
26
+ * linear rather than lighting sRGB values and brightening them with a 2.2
27
+ * gamma; one factor maps it instead of restating every preset. The default
28
+ * rig delivers 0.6464 (luma) to a sun-facing horizontal surface and the
29
+ * default exposure is 0.85, so this factor puts that surface at unit
30
+ * irradiance by luma. The default sky tint leaves the channels within about
31
+ * 2% of that, and colours brighter than the highlight roll-off's 0.76
32
+ * threshold compress (see color-transfer.wgsl.ts), so mid-tones render
33
+ * within about 2% of authored and pure white lands near 241/255. Every
34
+ * preset and user exposure is scaled by the same factor, so their relative
35
+ * brightness holds.
36
+ * `light-rig.test.ts` re-derives it from the default rig.
37
+ */
38
+ const IRRADIANCE_CALIBRATION = 1.82;
9
39
  export const mainShaderSource = `
10
40
  struct Uniforms {
11
41
  viewProj: mat4x4<f32>,
12
42
  model: mat4x4<f32>,
13
43
  baseColor: vec4<f32>,
14
- metallicRoughness: vec2<f32>, // x = metallic, y = roughness
15
- _padding1: vec2<f32>,
44
+ metallicRoughness: vec2<f32>, // x = metallic, y = roughness (mesh-material.ts)
45
+ transmission: vec2<f32>, // x = 1: authored translucent, drawn as glass; y = pad
16
46
  sectionPlane: vec4<f32>, // xyz = plane normal, w = plane distance
17
47
  flags: vec4<u32>, // x = isSelected, y = section/clip bits, z = edgeEnabled, w = edgeIntensityMilli
18
48
  clipBoxMin: vec4<f32>, // xyz = clip-box min corner (world), w = pad
19
49
  clipBoxMax: vec4<f32>, // xyz = clip-box max corner (world), w = pad
20
- // Quantized-vertex dequantization (issue #1682 phase 6):
21
- // xyz = lattice-aligned quantMin (batch-origin-relative), w = step.
22
- // Only read by vs_main_quantized; zero elsewhere.
23
- quantParams: vec4<f32>,
50
+ quantParams: vec4<f32>, // local min xyz, lattice step w
51
+ rteViewProj: mat4x4<f32>, // appended frame; bit 16 selects it
52
+ drawableDeltaHigh: vec4<f32>,
53
+ drawableDeltaLow: vec4<f32>,
54
+ rteCameraHigh: vec4<f32>,
55
+ rteCameraLow: vec4<f32>,
24
56
  }
25
57
  @binding(0) @group(0) var<uniform> uniforms: Uniforms;
26
-
27
- // Global lighting environment — one buffer shared by every mesh in
28
- // the pass (bound once per frame at group(1)). Field packing must
29
- // match packEnvironmentUniforms() in environment.ts.
58
+ const RTE_DRAWABLE_FLAG: u32 = ${MESH_FLAG_RTE_DRAWABLE}u;
59
+ ${relativeToEyeWgsl}
60
+ ${mainRteWgsl}
61
+ // Shared group(1) lighting; packing matches packEnvironmentUniforms().
30
62
  struct Environment {
31
63
  sunDirection: vec3<f32>, // unit vector TOWARD the sun
32
64
  sunIntensity: f32,
@@ -42,89 +74,17 @@ export const mainShaderSource = `
42
74
  _pad2: f32,
43
75
  }
44
76
  @binding(0) @group(1) var<uniform> env: Environment;
45
-
46
- // Sun shadow map (#2670, Phase 2b) at group(1). The depth map, a
47
- // comparison sampler, and the light matrix + params. Bound on every
48
- // main-family pipeline; sampling is gated by shadowU.params.y (enabled),
49
- // so when shadows are off this reads the 1×1 dummy and returns 1.0.
50
- @binding(1) @group(1) var shadowMap: texture_depth_2d;
51
- @binding(2) @group(1) var shadowCmp: sampler_comparison;
52
- struct Shadow {
53
- lightViewProj: mat4x4<f32>,
54
- // x = texelSize (1/resolution), y = enabled (0/1),
55
- // z = normalBias (world units), w = pcfRadius (texels).
56
- params: vec4<f32>,
57
- // x = depthBias (reverse-Z clip units, nudges toward lit).
58
- params2: vec4<f32>,
59
- }
60
- @binding(3) @group(1) var<uniform> shadowU: Shadow;
61
-
62
- // Fraction of the sun reaching this surface point (1 = lit, 0 = fully
63
- // shadowed). Normal-offset + slope-scaled bias defeats acne without
64
- // peter-panning; the penumbra is sampled with a 12-tap Poisson disk
65
- // ROTATED per pixel (interleaved gradient noise). A fixed grid kernel
66
- // undersamples a wide penumbra and breaks into discrete bands (the
67
- // "tripled shadow" at high softness); a rotated disk turns that banding
68
- // into fine dither that reads as smooth at any softness.
69
- // textureSampleCompareLevel is used (not ...Compare) so it is legal in
70
- // this non-uniform control flow.
71
- const SHADOW_POISSON = array<vec2<f32>, 12>(
72
- vec2<f32>(-0.326, -0.406), vec2<f32>(-0.840, -0.074), vec2<f32>(-0.696, 0.457),
73
- vec2<f32>(-0.203, 0.621), vec2<f32>( 0.962, -0.195), vec2<f32>( 0.473, -0.480),
74
- vec2<f32>( 0.519, 0.767), vec2<f32>( 0.185, -0.893), vec2<f32>( 0.507, 0.064),
75
- vec2<f32>( 0.896, 0.412), vec2<f32>(-0.322, -0.933), vec2<f32>(-0.792, -0.598),
76
- );
77
-
78
- fn sunShadowFactor(worldPos: vec3<f32>, N: vec3<f32>, fragCoord: vec2<f32>) -> f32 {
79
- if (shadowU.params.y < 0.5) { return 1.0; }
80
- // The diffuse sun term is TWO-SIDED (abs(dot(N, sun)) in the shading
81
- // below), so a face whose stabilized normal points away from the sun is
82
- // still lit. Orient the normal toward the sun before biasing: otherwise
83
- // the normal-offset push (params.z) moves the sample AWAY from the light
84
- // (deeper behind the surface), and the slope term below collapses to its
85
- // max (NdotL→0), together biasing the compare toward "lit" — which leaks
86
- // direct sun onto interior faces the roof occludes (#2670 review).
87
- let L = normalize(env.sunDirection);
88
- let Ns = N * select(-1.0, 1.0, dot(N, L) >= 0.0);
89
- let biased = worldPos + Ns * shadowU.params.z;
90
- let clip = shadowU.lightViewProj * vec4<f32>(biased, 1.0);
91
- let ndc = clip.xyz / clip.w;
92
- let uv = vec2<f32>(ndc.x * 0.5 + 0.5, ndc.y * -0.5 + 0.5);
93
- let inBounds = uv.x >= 0.0 && uv.x <= 1.0 && uv.y >= 0.0 && uv.y <= 1.0 && ndc.z > 0.0;
94
- if (!inBounds) { return 1.0; }
95
- // Slope-scaled depth bias: at a grazing sun the receiver's light-space
96
- // depth changes fast across the kernel, so a constant bias can't clear
97
- // the whole footprint and the surface rings with moiré. Grow the bias
98
- // as the surface tilts away from the sun (NdotL → 0) and with the
99
- // kernel width. The hardware slope bias in the depth pass covers the
100
- // occluder side; this covers the receiver side.
101
- let NdotL = max(dot(Ns, L), 0.0);
102
- let slope = clamp(sqrt(max(1.0 - NdotL * NdotL, 0.0)) / max(NdotL, 0.1), 1.0, 12.0);
103
- let refDepth = ndc.z + shadowU.params2.x * slope * (1.0 + shadowU.params.w);
104
- let radius = shadowU.params.x * shadowU.params.w; // penumbra, uv units
105
- // Per-pixel rotation (interleaved gradient noise) dithers the disk so
106
- // the discrete taps never line up into bands.
107
- let ign = fract(52.9829189 * fract(dot(fragCoord, vec2<f32>(0.06711056, 0.00583715))));
108
- let ang = ign * 6.2831853;
109
- let cr = cos(ang);
110
- let sr = sin(ang);
111
- var sum = 0.0;
112
- for (var i = 0; i < 12; i = i + 1) {
113
- let p = SHADOW_POISSON[i];
114
- let off = vec2<f32>(p.x * cr - p.y * sr, p.x * sr + p.y * cr) * radius;
115
- sum = sum + textureSampleCompareLevel(shadowMap, shadowCmp, uv + off, refDepth);
116
- }
117
- let pcf = sum / 12.0;
118
- // Terminator fade. On a surface nearly PARALLEL to the sun rays
119
- // (NdotL → 0, e.g. a vertical wall under a midday sun) the receiver
120
- // straddles the shadow threshold, so the rotated-disk taps randomly
121
- // pass/fail and the wall breaks into salt-and-pepper speckle. The
122
- // direct sun term is near zero there anyway, so fade the cast shadow
123
- // smoothly toward lit as the surface goes grazing: a clean gradient
124
- // replaces the ripple (#2670).
125
- let graze = smoothstep(0.0, 0.3, NdotL);
126
- return mix(1.0, pcf, graze);
127
- }
77
+ // Selection highlight tint (#5484), set by Renderer.setOverlayTheme via
78
+ // updateSelectionColor — written only on theme change, never per frame.
79
+ // TRUE LINEAR-LIGHT RGB: re-lit by lightTerm below exactly like the WGSL
80
+ // constant it replaces, then ACES-tonemapped + gamma-encoded on output.
81
+ @binding(4) @group(1) var<uniform> selectionColor: vec4<f32>;
82
+ const IRRADIANCE_CALIBRATION: f32 = ${IRRADIANCE_CALIBRATION};
83
+ const TRANSLUCENT_OPACITY_SCALE: f32 = ${TRANSLUCENT_OPACITY_SCALE};
84
+ ${colorTransferWgsl}
85
+ ${specularWgsl}
86
+
87
+ ${mainShadowWgsl}
128
88
 
129
89
  struct VertexInput {
130
90
  @location(0) position: vec3<f32>,
@@ -150,6 +110,12 @@ export const mainShaderSource = `
150
110
  // vs_instanced writes the per-instance flag from the instance buffer, so a
151
111
  // single selected occurrence highlights without re-drawing.
152
112
  @location(5) @interpolate(flat) instSelected: u32,
113
+ // Camera-relative position for fragment operations that compare
114
+ // geometry to section/crop boundaries or take derivatives. This is
115
+ // intentionally separate from worldPos: shadow maps still consume
116
+ // their established world-space light matrix until their depth pass
117
+ // is migrated as one transaction.
118
+ @location(6) eyePos: vec3<f32>,
153
119
  }
154
120
 
155
121
  // Per-instance vertex-buffer inputs (slot 1, stepMode 'instance') used by
@@ -171,6 +137,8 @@ export const mainShaderSource = `
171
137
  @location(7) instEntityId: u32,
172
138
  @location(8) instColor: vec4<f32>,
173
139
  @location(9) instSelected: u32,
140
+ @location(10) anchorHigh: vec4<f32>,
141
+ @location(11) anchorLow: vec4<f32>,
174
142
  }
175
143
 
176
144
  // 12-byte quantized vertex (issue #1682 phase 6): uint16x4 (lattice
@@ -201,7 +169,9 @@ export const mainShaderSource = `
201
169
  fn shadeFlatVertex(localPos: vec3<f32>, localNormal: vec3<f32>, entityId: u32) -> VertexOutput {
202
170
  var output: VertexOutput;
203
171
  let worldPos = uniforms.model * vec4<f32>(localPos, 1.0);
204
- output.position = uniforms.viewProj * worldPos;
172
+ let eyePos = rtePosition(localPos).xyz;
173
+ let rte = (uniforms.flags.x & RTE_DRAWABLE_FLAG) != 0u;
174
+ output.position = select(uniforms.viewProj * worldPos, uniforms.rteViewProj * vec4<f32>(eyePos, 1.0), rte);
205
175
  // Anti z-fighting depth nudge — see vs_main's comment.
206
176
  let colorSalt = (entityId >> 24u) * 2654435761u;
207
177
  let zHash = (((entityId & 0x00FFFFFFu) ^ colorSalt) * 2654435761u) & 255u;
@@ -211,7 +181,8 @@ export const mainShaderSource = `
211
181
  output.entityId = entityId;
212
182
  output.color = uniforms.baseColor;
213
183
  output.instSelected = 0u;
214
- output.viewPos = (uniforms.viewProj * worldPos).xyz;
184
+ output.eyePos = eyePos;
185
+ output.viewPos = select((uniforms.viewProj * worldPos).xyz, (uniforms.rteViewProj * vec4<f32>(eyePos, 1.0)).xyz, rte);
215
186
  return output;
216
187
  }
217
188
 
@@ -226,7 +197,9 @@ export const mainShaderSource = `
226
197
  fn vs_main(input: VertexInput, @builtin(instance_index) instanceIndex: u32) -> VertexOutput {
227
198
  var output: VertexOutput;
228
199
  let worldPos = uniforms.model * vec4<f32>(input.position, 1.0);
229
- output.position = uniforms.viewProj * worldPos;
200
+ let eyePos = rtePosition(input.position).xyz;
201
+ let rte = (uniforms.flags.x & RTE_DRAWABLE_FLAG) != 0u;
202
+ output.position = select(uniforms.viewProj * worldPos, uniforms.rteViewProj * vec4<f32>(eyePos, 1.0), rte);
230
203
  // Anti z-fighting: deterministic depth nudge.
231
204
  // Knuth multiplicative hash spreads sequential IDs across 0-255 so
232
205
  // coplanar faces from different entities always get distinct depths.
@@ -251,8 +224,9 @@ export const mainShaderSource = `
251
224
  output.entityId = input.entityId;
252
225
  output.color = uniforms.baseColor;
253
226
  output.instSelected = 0u; // flat path selects via uniforms.flags.x
227
+ output.eyePos = eyePos;
254
228
  // Store view-space position for edge detection
255
- output.viewPos = (uniforms.viewProj * worldPos).xyz;
229
+ output.viewPos = select((uniforms.viewProj * worldPos).xyz, (uniforms.rteViewProj * vec4<f32>(eyePos, 1.0)).xyz, rte);
256
230
  return output;
257
231
  }
258
232
 
@@ -267,7 +241,9 @@ export const mainShaderSource = `
267
241
  var output: VertexOutput;
268
242
  let instMat = mat4x4<f32>(inst.m0, inst.m1, inst.m2, inst.m3);
269
243
  let worldPos = instMat * vec4<f32>(input.position, 1.0);
270
- output.position = uniforms.viewProj * worldPos;
244
+ let linearLocal = (instMat * vec4<f32>(input.position, 0.0)).xyz;
245
+ let eyePos = rteInstancePosition(linearLocal, inst.anchorHigh.xyz, inst.anchorLow.xyz).xyz;
246
+ output.position = uniforms.rteViewProj * vec4<f32>(eyePos, 1.0);
271
247
  // Same per-entity depth nudge as vs_main. No colour salt here: the
272
248
  // instanced path has no base-vs-overlay coincident redraw (yet), so the
273
249
  // raw picking id is enough to separate coplanar entities.
@@ -278,39 +254,11 @@ export const mainShaderSource = `
278
254
  output.entityId = inst.instEntityId;
279
255
  output.color = inst.instColor;
280
256
  output.instSelected = inst.instSelected;
281
- output.viewPos = (uniforms.viewProj * worldPos).xyz;
257
+ output.eyePos = eyePos;
258
+ output.viewPos = (uniforms.rteViewProj * vec4<f32>(eyePos, 1.0)).xyz;
282
259
  return output;
283
260
  }
284
261
 
285
- // PBR helper functions
286
- fn fresnelSchlick(cosTheta: f32, F0: vec3<f32>) -> vec3<f32> {
287
- return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);
288
- }
289
-
290
- fn distributionGGX(NdotH: f32, roughness: f32) -> f32 {
291
- let a = roughness * roughness;
292
- let a2 = a * a;
293
- let NdotH2 = NdotH * NdotH;
294
- let num = a2;
295
- let denomBase = (NdotH2 * (a2 - 1.0) + 1.0);
296
- let denom = 3.14159265 * denomBase * denomBase;
297
- return num / max(denom, 0.0000001);
298
- }
299
-
300
- fn geometrySchlickGGX(NdotV: f32, roughness: f32) -> f32 {
301
- let r = (roughness + 1.0);
302
- let k = (r * r) / 8.0;
303
- let num = NdotV;
304
- let denom = NdotV * (1.0 - k) + k;
305
- return num / max(denom, 0.0000001);
306
- }
307
-
308
- fn geometrySmith(NdotV: f32, NdotL: f32, roughness: f32) -> f32 {
309
- let ggx2 = geometrySchlickGGX(NdotV, roughness);
310
- let ggx1 = geometrySchlickGGX(NdotL, roughness);
311
- return ggx1 * ggx2;
312
- }
313
-
314
262
  fn encodeId24(id: u32) -> vec4<f32> {
315
263
  let r = f32((id >> 16u) & 255u) / 255.0;
316
264
  let g = f32((id >> 8u) & 255u) / 255.0;
@@ -325,6 +273,12 @@ export const mainShaderSource = `
325
273
 
326
274
  @fragment
327
275
  fn fs_main(input: VertexOutput) -> FragmentOutput {
276
+ // The flat/quantized/textured mesh paths submit this in one
277
+ // camera-relative frame. Do all camera-local fragment arithmetic in
278
+ // that frame; otherwise the RTE vertex precision is thrown away at
279
+ // section/crop/derivative ingress. Instanced geometry is not yet
280
+ // anchored, so its worldPos remains the authoritative input.
281
+ let fragmentPos = select(input.worldPos, input.eyePos, (uniforms.flags.x & RTE_DRAWABLE_FLAG) != 0u);
328
282
  // Per-instance hide/isolate: bit 1 of the instance flags lane marks a hidden
329
283
  // occurrence. Discard it so it neither draws nor writes depth (and the pick
330
284
  // pass applies the same discard, so it isn't pickable). vs_main writes
@@ -354,7 +308,7 @@ export const mainShaderSource = `
354
308
  let planeDistance = uniforms.sectionPlane.w;
355
309
  let flipped = (uniforms.flags.y & 2u) == 2u;
356
310
  let side = select(1.0, -1.0, flipped);
357
- let distToPlane = (dot(input.worldPos, planeNormal) - planeDistance) * side;
311
+ let distToPlane = (dot(fragmentPos, planeNormal) - planeDistance) * side;
358
312
  if (distToPlane > 0.0) {
359
313
  discard;
360
314
  }
@@ -362,7 +316,7 @@ export const mainShaderSource = `
362
316
  // Clip box (section / crop box): discard fragments OUTSIDE the AABB.
363
317
  // flags.y bit 2 = clip-box enabled.
364
318
  if ((uniforms.flags.y & 4u) != 0u) {
365
- let p = input.worldPos;
319
+ let p = fragmentPos;
366
320
  if (any(p < uniforms.clipBoxMin.xyz) || any(p > uniforms.clipBoxMax.xyz)) {
367
321
  discard;
368
322
  }
@@ -402,7 +356,7 @@ export const mainShaderSource = `
402
356
  // We still fall back to the vertex normal when derivatives
403
357
  // are unavailable (extreme polygon degeneracy where dpdx /
404
358
  // dpdy collapse to zero — practically never on real geometry).
405
- let faceN = cross(dpdx(input.worldPos), dpdy(input.worldPos));
359
+ let faceN = cross(dpdx(fragmentPos), dpdy(fragmentPos));
406
360
  let fLen2 = dot(faceN, faceN);
407
361
  var N: vec3<f32>;
408
362
  if (fLen2 > 1e-10) {
@@ -435,57 +389,58 @@ export const mainShaderSource = `
435
389
  }
436
390
 
437
391
  // Lighting environment — sun/hemisphere/exposure come from the
438
- // global env uniform (defaults reproduce the historic hardcoded
439
- // values); fill + rim directions stay fixed in view-agnostic
440
- // world space as stylistic shaping lights.
392
+ // global env uniform. The fill follows the sun (it bounces in from
393
+ // the opposite side); the rim stays fixed in world space as a
394
+ // stylistic shaping light.
441
395
  let sunLight = env.sunDirection;
442
- let fillLight = normalize(vec3<f32>(-0.5, 0.3, -0.3)); // Fill light
396
+ // Horizontal mirror of the sun, lifted slightly. An overhead sun
397
+ // leaves (0, 0.25, 0), which normalizes to straight up.
398
+ let fillLight = normalize(vec3<f32>(-sunLight.x, 0.25, -sunLight.z));
443
399
  let rimLight = normalize(vec3<f32>(0.0, 0.2, -1.0)); // Rim light for edge definition
444
400
 
445
- // Hemisphere ambient
401
+ // Hemisphere ambient. This, not the sun, keeps faces turned away
402
+ // from the sun readable (I-beam webs and flange undersides, #5382).
446
403
  let hemisphereFactor = N.y * 0.5 + 0.5;
447
404
  let ambient = mix(env.groundColor, env.skyColor, hemisphereFactor) * env.ambientIntensity;
448
405
 
449
- // Two-sided sun light so inner faces (I-beam channels) stay visible.
406
+ // One-sided sun, so a building has a lit side and a shaded side.
450
407
  // sunSoftness is the diffuse wrap (env uniform): 0 = crisp
451
408
  // terminator (hard shadows), larger = softer wrap-around (overcast).
452
- let NdotL = abs(dot(N, sunLight));
409
+ let NdotL = dot(N, sunLight);
453
410
  let wrap = env.sunSoftness;
454
411
  let diffuseSun = max((NdotL + wrap) / (1.0 + wrap), 0.0) * env.sunIntensity;
455
412
 
456
- // Fill light - two-sided
457
- let NdotFill = abs(dot(N, fillLight));
413
+ // Fill light, one-sided like the sun.
414
+ let NdotFill = max(dot(N, fillLight), 0.0);
458
415
  let diffuseFill = NdotFill * env.fillIntensity;
459
416
 
460
417
  // Rim light for edge definition
461
418
  let NdotRim = max(dot(N, rimLight), 0.0);
462
419
  let rim = pow(NdotRim, 4.0) * env.rimIntensity;
463
420
 
421
+ // The authored colour is display-referred sRGB; light it in linear.
422
+ // (textured.wgsl.ts anchors on the first line to multiply in the texel.)
464
423
  var baseColor = input.color.rgb;
465
-
466
- // Detect if the color is close to white/gray (low saturation)
467
- let baseGray = dot(baseColor, vec3<f32>(0.299, 0.587, 0.114));
468
- let baseSaturation = length(baseColor - vec3<f32>(baseGray)) / max(baseGray, 0.001);
469
- let isWhiteish = 1.0 - smoothstep(0.0, 0.3, baseSaturation);
470
-
471
- // Darken whites/grays more to reduce washed-out appearance
472
- baseColor = mix(baseColor, baseColor * 0.7, isWhiteish * 0.4);
424
+ baseColor = srgbToLinear(baseColor);
473
425
 
474
426
  // Combine all lighting. Only the DIRECT sun term is occluded by cast
475
427
  // shadows (#2670); ambient/fill/rim are indirect and stay unshadowed.
476
- let sunShadow = sunShadowFactor(input.worldPos, N, input.position.xy);
428
+ // Exposure scales the light, so the selection shade below and every
429
+ // later stage see one exposed irradiance.
430
+ let sunShadow = sunShadowFactor(input.eyePos, N, input.position.xy);
477
431
  let lightTerm = ambient + env.sunColor * (diffuseSun * sunShadow) + vec3<f32>(diffuseFill + rim);
478
- var color = baseColor * lightTerm;
432
+ let irradiance = lightTerm * (env.exposure * IRRADIANCE_CALIBRATION);
433
+ var color = baseColor * irradiance;
479
434
 
480
435
  // flags.x is a bitfield:
481
436
  // bit 0 (value 1) = isSelected → selection-highlight + force opaque
482
437
  // bit 1 (value 2) = isOverlay → color-override pass; preserve
483
438
  // baseColor.a (overlay pipeline has
484
439
  // src-alpha blending) AND skip the
485
- // glass-fresnel branch so low-alpha
486
- // ghost tints don't pick up the
487
- // near-white reflection tint meant
488
- // for real glass materials.
440
+ // specular term, so an override
441
+ // paints its colour, lit, and a
442
+ // low-alpha ghost tint does not
443
+ // pick up glass reflections.
489
444
  // Selected via the per-draw flag (flat path) OR the per-occurrence flag
490
445
  // (instanced path — vs_instanced reads it from the instance buffer).
491
446
  let isSelected = ((uniforms.flags.x & 1u) == 1u) || ((input.instSelected & 1u) == 1u);
@@ -495,7 +450,7 @@ export const mainShaderSource = `
495
450
  //
496
451
  // We override the material albedo with selection-blue and re-light
497
452
  // it with the SAME lightTerm used for unselected surfaces, then
498
- // discard the view-dependent (fresnel) term below. Two requirements
453
+ // skip the view-dependent (specular) term below. Two requirements
499
454
  // are in tension and this satisfies both:
500
455
  //
501
456
  // * No base-material bleed-through. The old fresnel-glow mix left
@@ -510,15 +465,19 @@ export const mainShaderSource = `
510
465
  // selection. Re-lighting keeps that per-face brightness step, so
511
466
  // creases read on the highlight exactly as they do unselected.
512
467
  //
513
- // The luminance of lightTerm is remapped by a multiplicative gain
514
- // (which preserves the per-face brightness RATIOS, so creases read
515
- // as strongly as on the unselected surface) calibrated so a sunlit
516
- // face hits full selection-blue, with a floor/ceiling clamp so
517
- // shadowed faces only dim and bright scenes never wash out.
468
+ // The luminance of the exposed irradiance is used as a multiplicative
469
+ // gain (which preserves the per-face brightness RATIOS, so creases
470
+ // read as strongly as on the unselected surface). The calibration
471
+ // puts a sunlit face at 1.0, i.e. full selection-blue, and the
472
+ // floor/ceiling clamp keeps shadowed faces only dimmed and bright
473
+ // scenes from washing out.
518
474
  if (isSelected) {
519
- let shadeLum = dot(lightTerm, vec3<f32>(0.299, 0.587, 0.114));
520
- let shade = clamp(shadeLum * 1.55, 0.45, 1.2);
521
- color = vec3<f32>(0.3, 0.6, 1.0) * shade;
475
+ let shadeLum = dot(irradiance, vec3<f32>(0.299, 0.587, 0.114));
476
+ let shade = clamp(shadeLum, 0.45, 1.2);
477
+ // selectionColor is already linear-light (set by Renderer.setOverlayTheme
478
+ // from the app theme, #5484) — no srgbToLinear here, unlike the constant
479
+ // it replaces.
480
+ color = selectionColor.rgb * shade;
522
481
  }
523
482
 
524
483
  // flags.x bit 5 (value 32) = EMPHASIZE overlay: render the colour
@@ -532,69 +491,66 @@ export const mainShaderSource = `
532
491
  color = baseColor * facet;
533
492
  }
534
493
 
535
- // Beautiful fresnel effect for transparent materials (glass)
536
- // Skip when selected — the glass shine and desaturation wash out the
537
- // blue highlight, making it appear white instead of blue.
538
- // Also force alpha to 1.0 for selected objects so the highlight is
539
- // fully opaque (the selection pipeline has no alpha blending).
540
- // Emphasized clash overlay paints a SOLID vivid fill (force opaque) so
541
- // it isn't blended down to a pale tint against the geometry beneath.
494
+ // Force alpha to 1.0 for selected objects so the highlight is fully
495
+ // opaque (the selection pipeline has no alpha blending). Emphasized
496
+ // clash overlay paints a SOLID vivid fill (force opaque) so it isn't
497
+ // blended down to a pale tint against the geometry beneath.
542
498
  var finalAlpha = select(input.color.a, 1.0, isSelected || emphasizedOverlay);
543
- if (finalAlpha < 0.99 && !isSelected && !isOverlay) {
544
- // Calculate view direction for fresnel
545
- let V = normalize(-input.worldPos);
546
- let NdotV = max(dot(N, V), 0.0);
547
-
548
- // Enhanced fresnel effect - stronger at edges (grazing angles)
549
- // Using Schlick's approximation for realistic glass reflection
550
- let fresnelPower = 1.5; // Higher = softer edge reflections
551
- let fresnel = pow(1.0 - NdotV, fresnelPower);
552
-
553
- // Glass reflection tint (sky/environment reflection at edges)
554
- let reflectionTint = vec3<f32>(0.92, 0.96, 1.0); // Cool sky reflection
555
- let reflectionStrength = fresnel * 0.6; // Strong edge reflections
556
-
557
- // Mix in reflection tint at edges
558
- color = mix(color, color * reflectionTint, reflectionStrength);
559
-
560
- // Add realistic glass shine - brighter at edges where light reflects
561
- let glassShine = fresnel * 0.12;
562
- color += glassShine;
563
-
564
- // Slight desaturation at edges (glass reflects environment, not just color)
565
- let edgeDesaturation = fresnel * 0.25;
566
- let gray = dot(color, vec3<f32>(0.299, 0.587, 0.114));
567
- color = mix(color, vec3<f32>(gray), edgeDesaturation);
568
-
569
- // Make glass more transparent (reduce opacity by 30%)
570
- finalAlpha = finalAlpha * 0.7;
499
+
500
+ // Specular (#5386; specular.wgsl.ts), after the diffuse above. Not
501
+ // on the selection highlight (it would wash the blue out) nor on a
502
+ // colour-override overlay. The sun lobe is scaled exactly like the
503
+ // diffuse sun term, and both terms like irradiance, so a preset's
504
+ // highlights and its diffuse light move together.
505
+ if (!isSelected && !isOverlay) {
506
+ // Glass is an authored translucent material (mesh-material.ts
507
+ // also gives it its smooth roughness). An X-Ray or compare fade
508
+ // only lowers the alpha and stays a fade. Instanced occurrences
509
+ // are never authored translucent: prepareInstancedRender routes
510
+ // those to the flat path, so the per-pass lane is ignored there.
511
+ let instancedPass = (uniforms.flags.x & 4u) != 0u;
512
+ let translucent = finalAlpha < 0.99;
513
+ let glass = translucent && uniforms.transmission.x > 0.5 && !instancedPass;
514
+ let metallic = clamp(uniforms.metallicRoughness.x, 0.0, 1.0);
515
+ let spec = surfaceSpecular(
516
+ N,
517
+ normalize(-input.eyePos),
518
+ baseColor,
519
+ metallic,
520
+ uniforms.metallicRoughness.y,
521
+ env.sunColor * (env.sunIntensity * sunShadow),
522
+ );
523
+ // What the lobe reflects is not there to diffuse; a metal has no
524
+ // diffuse at all.
525
+ let diffuse = color * (1.0 - spec.reflectance) * (1.0 - metallic);
526
+ let reflected = spec.light * (env.exposure * IRRADIANCE_CALIBRATION);
527
+ if (translucent) {
528
+ finalAlpha = finalAlpha * TRANSLUCENT_OPACITY_SCALE;
529
+ }
530
+ if (glass) {
531
+ // The transparent pipelines blend straight alpha:
532
+ // out = c * a + behind * (1 - a). A pane passes what is behind
533
+ // it except what its body absorbs and its surface reflects, and
534
+ // its reflection is not dimmed by the body's opacity, so solve
535
+ // for (c, a). The reflectance rising at grazing angles is what
536
+ // makes glass more opaque there; a bright sun glint raises the
537
+ // alpha further so it is not clipped to the body's opacity.
538
+ let body = finalAlpha;
539
+ let reflectance = dot(spec.reflectance, vec3<f32>(0.299, 0.587, 0.114));
540
+ let premultiplied = diffuse * body + reflected;
541
+ let peak = max(premultiplied.r, max(premultiplied.g, premultiplied.b));
542
+ finalAlpha = clamp(max(body + reflectance * (1.0 - body), peak), 0.0, 1.0);
543
+ color = premultiplied / max(finalAlpha, 0.0001);
544
+ } else {
545
+ color = diffuse + reflected;
546
+ }
571
547
  }
572
548
 
573
- // Exposure adjustment (historic default 0.85 darkens overall)
574
- color *= env.exposure;
575
-
576
- // Contrast enhancement
577
- color = (color - 0.5) * 1.15 + 0.5;
578
- color = max(color, vec3<f32>(0.0));
579
-
580
- // Saturation boost - stronger for colored surfaces, less for whites
581
- let gray = dot(color, vec3<f32>(0.299, 0.587, 0.114));
582
- // More saturation for colored surfaces. isWhiteish is derived from
583
- // the base material colour, so for a SELECTED object it would leak a
584
- // material dependence into the highlight (breaking the no-bleed-
585
- // through contract). The selection blue is a fully-saturated colour,
586
- // so force the colored-surface boost (1.4) when selected — keeping
587
- // the highlight identical regardless of the underlying material.
588
- let satBoost = select(mix(1.4, 1.1, isWhiteish), 1.4, isSelected);
589
- color = mix(vec3<f32>(gray), color, satBoost);
590
-
591
- // ACES filmic tone mapping
592
- let a = 2.51;
593
- let b = 0.03;
594
- let c = 2.43;
595
- let d = 0.59;
596
- let e = 0.14;
597
- color = clamp((color * (a * color + b)) / (color * (c * color + d) + e), vec3<f32>(0.0), vec3<f32>(1.0));
549
+ // Hue-preserving highlight roll-off (color-transfer.wgsl.ts). No
550
+ // contrast curve and no saturation boost: an authored colour lit at
551
+ // unit irradiance leaves here unchanged unless it is brighter than
552
+ // the roll-off threshold.
553
+ color = neutralCompress(color);
598
554
 
599
555
  // Subtle edge enhancement using screen-space derivatives.
600
556
  //
@@ -627,8 +583,7 @@ export const mainShaderSource = `
627
583
  color *= edgeDarken;
628
584
  }
629
585
 
630
- // Gamma correction
631
- color = pow(color, vec3<f32>(1.0 / 2.2));
586
+ color = linearToSrgb(clamp(color, vec3<f32>(0.0), vec3<f32>(1.0)));
632
587
 
633
588
  var out: FragmentOutput;
634
589
  out.color = vec4<f32>(color, finalAlpha);
@@ -1 +1 @@
1
- {"version":3,"file":"main.wgsl.js","sourceRoot":"","sources":["../../src/shaders/main.wgsl.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqnBzB,CAAC"}
1
+ {"version":3,"file":"main.wgsl.js","sourceRoot":"","sources":["../../src/shaders/main.wgsl.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;GAMG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;GAIG;AACH,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAEtC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAEpC,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;yCAmBS,sBAAsB;UACrD,iBAAiB;UACjB,WAAW;;;;;;;;;;;;;;;;;;;;;;8CAsByB,sBAAsB;iDACnB,yBAAyB;UAChE,iBAAiB;UACjB,YAAY;;UAEZ,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0fjB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Shared WGSL half of the renderer RTE contract.
3
+ *
4
+ * A pass owns its binding declarations, but imports this verbatim into its
5
+ * shader source and uses `rteWorldPosition` before projection. The layouts
6
+ * match `RelativeToEyeFrame.packUniforms` and `packRteOrigin` exactly: a
7
+ * translation-free `viewProj` per frame, then two vec4 drawable-camera delta
8
+ * lanes per draw. Origins are world/source f64 values on the CPU; `local` is
9
+ * the element-local f32 vertex already resident in a vertex buffer.
10
+ */
11
+ export declare const relativeToEyeWgsl = "\nstruct RteFrameUniform {\n // Camera translation is intentionally absent. This projects positions\n // returned by rteWorldPosition, which are already relative to the eye.\n viewProj: mat4x4<f32>,\n}\n\nstruct RteDrawableUniform {\n // CPU computes (drawable origin - camera origin) in f64 and splits it.\n // This data must be refreshed whenever the RTE camera frame changes.\n drawableDeltaHigh: vec4<f32>,\n drawableDeltaLow: vec4<f32>,\n}\n\nfn rteWorldPosition(\n local: vec3<f32>,\n drawable: RteDrawableUniform,\n) -> vec4<f32> {\n // Do not subtract a camera origin here: this delta was formed in CPU f64.\n let highDelta = drawable.drawableDeltaHigh.xyz;\n let lowDelta = drawable.drawableDeltaLow.xyz;\n // A drawable template can span kilometres. Keep local with high first;\n // The local-plus-(high-plus-low) association is not equivalent in f32.\n return vec4<f32>((local + highDelta) + lowDelta, 1.0);\n}\n";
12
+ //# sourceMappingURL=relative-to-eye.wgsl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relative-to-eye.wgsl.d.ts","sourceRoot":"","sources":["../../src/shaders/relative-to-eye.wgsl.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,+6BAyB7B,CAAC"}