@woosh/meep-engine 3.61.2 → 3.61.3

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 (389) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/package.json +1 -1
  3. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  4. package/src/shade/playground/probe_clipmap/README.md +3 -4
  5. package/src/shade/playground/probe_clipmap/index.html +5 -13
  6. package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
  7. package/src/shade/playground/probe_clipmap/main.js +0 -5
  8. package/src/shade/playground/probe_clipmap_box/README.md +1 -1
  9. package/src/shade/playground/probe_clipmap_box/index.html +1 -1
  10. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  11. package/src/shade/renderer/Renderer.js +50 -11
  12. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  13. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  14. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
  15. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  16. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  17. package/src/shade/renderer/geometry/meshlet/meshlet_batch_colored.d.ts +10 -0
  18. package/src/shade/renderer/geometry/meshlet/meshlet_batch_colored.d.ts.map +1 -0
  19. package/src/shade/renderer/geometry/meshlet/meshlet_batch_colored.js +54 -0
  20. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +85 -36
  21. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
  22. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +813 -412
  23. package/src/shade/renderer/geometry/sdf/MESH_SDF.d.ts +7 -0
  24. package/src/shade/renderer/geometry/sdf/MESH_SDF.d.ts.map +1 -1
  25. package/src/shade/renderer/geometry/sdf/MESH_SDF.js +8 -0
  26. package/src/shade/renderer/geometry/sdf/MESH_SDF_BRICK_KEY.d.ts +14 -0
  27. package/src/shade/renderer/geometry/sdf/MESH_SDF_BRICK_KEY.d.ts.map +1 -0
  28. package/src/shade/renderer/geometry/sdf/MESH_SDF_BRICK_KEY.js +35 -0
  29. package/src/shade/renderer/geometry/sdf/MESH_SDF_STRUCT.d.ts.map +1 -1
  30. package/src/shade/renderer/geometry/sdf/MESH_SDF_STRUCT.js +0 -4
  31. package/src/shade/renderer/geometry/sdf/bake/MESH_SDF_BAKE.d.ts +55 -10
  32. package/src/shade/renderer/geometry/sdf/bake/MESH_SDF_BAKE.d.ts.map +1 -1
  33. package/src/shade/renderer/geometry/sdf/bake/MESH_SDF_BAKE.js +86 -16
  34. package/src/shade/renderer/geometry/sdf/bake/chunk_mesh_sdf_bake.d.ts +2 -2
  35. package/src/shade/renderer/geometry/sdf/bake/chunk_mesh_sdf_bake.d.ts.map +1 -1
  36. package/src/shade/renderer/geometry/sdf/bake/chunk_mesh_sdf_bake.js +28 -2
  37. package/src/shade/renderer/geometry/sdf/bake/chunk_mesh_sdf_contents.d.ts +54 -0
  38. package/src/shade/renderer/geometry/sdf/bake/chunk_mesh_sdf_contents.d.ts.map +1 -0
  39. package/src/shade/renderer/geometry/sdf/bake/chunk_mesh_sdf_contents.js +146 -0
  40. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_classify.d.ts +1 -1
  41. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_classify.d.ts.map +1 -1
  42. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_classify.js +2 -1
  43. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_content_rehash.d.ts +18 -0
  44. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_content_rehash.d.ts.map +1 -0
  45. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_content_rehash.js +66 -0
  46. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_count.d.ts +17 -0
  47. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_count.d.ts.map +1 -0
  48. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_count.js +66 -0
  49. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_evaluate.d.ts +5 -3
  50. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_evaluate.d.ts.map +1 -1
  51. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_evaluate.js +15 -14
  52. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_free.d.ts +2 -1
  53. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_free.d.ts.map +1 -1
  54. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_free.js +12 -3
  55. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_key.d.ts +21 -0
  56. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_key.d.ts.map +1 -0
  57. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_key.js +84 -0
  58. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_resolve.d.ts +53 -0
  59. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_resolve.d.ts.map +1 -0
  60. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_resolve.js +343 -0
  61. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_store.d.ts +3 -3
  62. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_store.d.ts.map +1 -1
  63. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_store.js +9 -5
  64. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_take.d.ts +2 -2
  65. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_take.d.ts.map +1 -1
  66. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_take.js +3 -2
  67. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_upload.d.ts +69 -0
  68. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_upload.d.ts.map +1 -0
  69. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_upload.js +294 -0
  70. package/src/shade/renderer/geometry/sdf/bundle/MODEL_CACHE_BUNDLE.d.ts +16 -0
  71. package/src/shade/renderer/geometry/sdf/bundle/MODEL_CACHE_BUNDLE.d.ts.map +1 -0
  72. package/src/shade/renderer/geometry/sdf/bundle/MODEL_CACHE_BUNDLE.js +36 -0
  73. package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.d.ts +126 -0
  74. package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.d.ts.map +1 -0
  75. package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.js +148 -0
  76. package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_read.d.ts +10 -0
  77. package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_read.d.ts.map +1 -0
  78. package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_read.js +140 -0
  79. package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_write.d.ts +8 -0
  80. package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_write.d.ts.map +1 -0
  81. package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_write.js +76 -0
  82. package/src/shade/renderer/geometry/sdf/chunk_mesh_sdf.d.ts +9 -0
  83. package/src/shade/renderer/geometry/sdf/chunk_mesh_sdf.d.ts.map +1 -1
  84. package/src/shade/renderer/geometry/sdf/chunk_mesh_sdf.js +23 -0
  85. package/src/shade/renderer/geometry/sdf/chunk_mesh_sdf_brick_key.d.ts +13 -0
  86. package/src/shade/renderer/geometry/sdf/chunk_mesh_sdf_brick_key.d.ts.map +1 -0
  87. package/src/shade/renderer/geometry/sdf/chunk_mesh_sdf_brick_key.js +23 -0
  88. package/src/shade/renderer/geometry/sdf/surface/GPUMeshSurfaceCaches.d.ts +262 -0
  89. package/src/shade/renderer/geometry/sdf/surface/GPUMeshSurfaceCaches.d.ts.map +1 -0
  90. package/src/shade/renderer/geometry/sdf/surface/GPUMeshSurfaceCaches.js +1819 -0
  91. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_BAKE.d.ts +118 -0
  92. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_BAKE.d.ts.map +1 -0
  93. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_BAKE.js +204 -0
  94. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_BLOCK.d.ts +66 -0
  95. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_BLOCK.d.ts.map +1 -0
  96. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_BLOCK.js +103 -0
  97. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_RESOURCES.d.ts +19 -0
  98. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_RESOURCES.d.ts.map +1 -0
  99. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_RESOURCES.js +23 -0
  100. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_STRUCT.d.ts +15 -0
  101. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_STRUCT.d.ts.map +1 -0
  102. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_STRUCT.js +70 -0
  103. package/src/shade/renderer/geometry/sdf/surface/SURFACE_MATERIAL.d.ts +13 -0
  104. package/src/shade/renderer/geometry/sdf/surface/SURFACE_MATERIAL.d.ts.map +1 -0
  105. package/src/shade/renderer/geometry/sdf/surface/SURFACE_MATERIAL.js +35 -0
  106. package/src/shade/renderer/geometry/sdf/surface/chunk_mesh_surface_block.d.ts +32 -0
  107. package/src/shade/renderer/geometry/sdf/surface/chunk_mesh_surface_block.d.ts.map +1 -0
  108. package/src/shade/renderer/geometry/sdf/surface/chunk_mesh_surface_block.js +111 -0
  109. package/src/shade/renderer/geometry/sdf/surface/chunk_mesh_surface_listed.d.ts +17 -0
  110. package/src/shade/renderer/geometry/sdf/surface/chunk_mesh_surface_listed.d.ts.map +1 -0
  111. package/src/shade/renderer/geometry/sdf/surface/chunk_mesh_surface_listed.js +49 -0
  112. package/src/shade/renderer/geometry/sdf/surface/chunk_mesh_surface_run_find.d.ts +13 -0
  113. package/src/shade/renderer/geometry/sdf/surface/chunk_mesh_surface_run_find.d.ts.map +1 -0
  114. package/src/shade/renderer/geometry/sdf/surface/chunk_mesh_surface_run_find.js +35 -0
  115. package/src/shade/renderer/geometry/sdf/surface/chunk_mesh_surface_sample.d.ts +24 -0
  116. package/src/shade/renderer/geometry/sdf/surface/chunk_mesh_surface_sample.d.ts.map +1 -0
  117. package/src/shade/renderer/geometry/sdf/surface/chunk_mesh_surface_sample.js +169 -0
  118. package/src/shade/renderer/geometry/sdf/surface/chunk_mesh_surface_texel_ray.d.ts +19 -0
  119. package/src/shade/renderer/geometry/sdf/surface/chunk_mesh_surface_texel_ray.d.ts.map +1 -0
  120. package/src/shade/renderer/geometry/sdf/surface/chunk_mesh_surface_texel_ray.js +49 -0
  121. package/src/shade/renderer/geometry/sdf/surface/chunk_surface_material_fit.d.ts +19 -0
  122. package/src/shade/renderer/geometry/sdf/surface/chunk_surface_material_fit.d.ts.map +1 -0
  123. package/src/shade/renderer/geometry/sdf/surface/chunk_surface_material_fit.js +67 -0
  124. package/src/shade/renderer/geometry/sdf/surface/chunk_surface_material_read.d.ts +78 -0
  125. package/src/shade/renderer/geometry/sdf/surface/chunk_surface_material_read.d.ts.map +1 -0
  126. package/src/shade/renderer/geometry/sdf/surface/chunk_surface_material_read.js +320 -0
  127. package/src/shade/renderer/geometry/sdf/surface/chunk_surface_material_store.d.ts +15 -0
  128. package/src/shade/renderer/geometry/sdf/surface/chunk_surface_material_store.d.ts.map +1 -0
  129. package/src/shade/renderer/geometry/sdf/surface/chunk_surface_material_store.js +48 -0
  130. package/src/shade/renderer/geometry/sdf/surface/mesh_surface_channels.d.ts +51 -0
  131. package/src/shade/renderer/geometry/sdf/surface/mesh_surface_channels.d.ts.map +1 -0
  132. package/src/shade/renderer/geometry/sdf/surface/mesh_surface_channels.js +109 -0
  133. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_command.d.ts +11 -0
  134. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_command.d.ts.map +1 -0
  135. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_command.js +51 -0
  136. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_encode.d.ts +26 -0
  137. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_encode.d.ts.map +1 -0
  138. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_encode.js +453 -0
  139. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_list.d.ts +12 -0
  140. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_list.d.ts.map +1 -0
  141. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_list.js +99 -0
  142. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_survey.d.ts +22 -0
  143. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_survey.d.ts.map +1 -0
  144. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_survey.js +140 -0
  145. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_trace.d.ts +32 -0
  146. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_trace.d.ts.map +1 -0
  147. package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_trace.js +261 -0
  148. package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.d.ts +2 -2
  149. package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.js +2 -2
  150. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts +6 -6
  151. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.js +7 -7
  152. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +15 -7
  153. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
  154. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +82 -17
  155. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts +26 -19
  156. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts.map +1 -1
  157. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.js +226 -148
  158. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +25 -52
  159. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
  160. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +29 -69
  161. package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_CLIPMAP.d.ts +19 -16
  162. package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_CLIPMAP.d.ts.map +1 -1
  163. package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_CLIPMAP.js +24 -21
  164. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +46 -22
  165. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts.map +1 -1
  166. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js +49 -36
  167. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.d.ts +3 -2
  168. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.d.ts.map +1 -1
  169. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.js +7 -6
  170. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +8 -22
  171. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
  172. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +15 -51
  173. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts +1 -6
  174. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts.map +1 -1
  175. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.js +6 -13
  176. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.d.ts.map +1 -1
  177. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.js +0 -2
  178. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.d.ts +4 -4
  179. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.d.ts.map +1 -1
  180. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.js +9 -34
  181. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.d.ts +4 -6
  182. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.d.ts.map +1 -1
  183. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.js +15 -39
  184. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_clear.d.ts +1 -1
  185. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_clear.js +1 -1
  186. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_store.d.ts +1 -2
  187. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_store.d.ts.map +1 -1
  188. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_store.js +2 -6
  189. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_take.d.ts +2 -2
  190. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_take.d.ts.map +1 -1
  191. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_take.js +5 -2
  192. package/src/shade/renderer/global_illumination/probe_clipmap/debug/ProbeClipmapDebugView.d.ts +5 -1
  193. package/src/shade/renderer/global_illumination/probe_clipmap/debug/ProbeClipmapDebugView.js +16 -2
  194. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_material.d.ts +45 -0
  195. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_material.d.ts.map +1 -0
  196. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_material.js +208 -0
  197. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_indirect.d.ts +24 -0
  198. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_indirect.d.ts.map +1 -0
  199. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_indirect.js +40 -0
  200. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_mesh_surfaces.d.ts +34 -0
  201. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_mesh_surfaces.d.ts.map +1 -0
  202. package/src/shade/renderer/global_illumination/probe_clipmap/debug/{graph_probe_clipmap_debug_mesh_cards.js → graph_probe_clipmap_debug_mesh_surfaces.js} +38 -57
  203. package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.d.ts +61 -0
  204. package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.d.ts.map +1 -0
  205. package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.js +193 -0
  206. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.d.ts +67 -0
  207. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.d.ts.map +1 -0
  208. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.js +142 -0
  209. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material_cell.d.ts +32 -0
  210. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material_cell.d.ts.map +1 -0
  211. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material_cell.js +70 -0
  212. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material_store.d.ts +30 -0
  213. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material_store.d.ts.map +1 -0
  214. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material_store.js +71 -0
  215. package/src/shade/renderer/global_illumination/probe_clipmap/material/shader_brick_material_gather.d.ts +26 -0
  216. package/src/shade/renderer/global_illumination/probe_clipmap/material/shader_brick_material_gather.d.ts.map +1 -0
  217. package/src/shade/renderer/global_illumination/probe_clipmap/material/shader_brick_material_gather.js +176 -0
  218. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +18 -9
  219. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts.map +1 -1
  220. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.js +63 -44
  221. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts +21 -1
  222. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts.map +1 -1
  223. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.js +24 -1
  224. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP_INDIRECT_LOBE.d.ts +10 -0
  225. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP_INDIRECT_LOBE.d.ts.map +1 -0
  226. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP_INDIRECT_LOBE.js +11 -0
  227. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapIndirectLobe.d.ts +11 -0
  228. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapIndirectLobe.d.ts.map +1 -0
  229. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapIndirectLobe.js +15 -0
  230. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts +44 -7
  231. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts.map +1 -1
  232. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.js +88 -11
  233. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_material.d.ts +43 -0
  234. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_material.d.ts.map +1 -0
  235. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_material.js +138 -0
  236. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_indirect_lobe.d.ts +21 -0
  237. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_indirect_lobe.d.ts.map +1 -0
  238. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_indirect_lobe.js +49 -0
  239. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.d.ts +2 -0
  240. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.d.ts.map +1 -1
  241. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.js +10 -4
  242. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_select.d.ts +22 -0
  243. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_select.d.ts.map +1 -0
  244. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_select.js +50 -0
  245. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts +4 -4
  246. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts.map +1 -1
  247. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.js +8 -8
  248. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_bounce.d.ts +3 -3
  249. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_bounce.js +5 -5
  250. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.d.ts +2 -0
  251. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.d.ts.map +1 -1
  252. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.js +5 -1
  253. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts +1 -1
  254. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +2 -2
  255. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.d.ts +7 -4
  256. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.d.ts.map +1 -1
  257. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js +30 -26
  258. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts +6 -5
  259. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
  260. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +22 -16
  261. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts.map +1 -1
  262. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.js +6 -2
  263. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.d.ts +2 -2
  264. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.js +6 -6
  265. package/src/shade/renderer/gpu_primitive/hash_table/chunk_generate_next_linear_congruential_index.d.ts +14 -0
  266. package/src/shade/renderer/gpu_primitive/hash_table/chunk_generate_next_linear_congruential_index.d.ts.map +1 -0
  267. package/src/shade/renderer/gpu_primitive/hash_table/chunk_generate_next_linear_congruential_index.js +22 -0
  268. package/src/shade/renderer/gpu_primitive/hash_table/chunk_hash_table_atomic.d.ts +37 -0
  269. package/src/shade/renderer/gpu_primitive/hash_table/chunk_hash_table_atomic.d.ts.map +1 -0
  270. package/src/shade/renderer/gpu_primitive/hash_table/chunk_hash_table_atomic.js +122 -0
  271. package/src/shade/renderer/gpu_primitive/hash_table/chunk_hash_table_get.d.ts.map +1 -1
  272. package/src/shade/renderer/gpu_primitive/hash_table/chunk_hash_table_get.js +1 -11
  273. package/src/shade/renderer/gpu_primitive/hash_table/cpu_build_hash_table.d.ts +8 -0
  274. package/src/shade/renderer/gpu_primitive/hash_table/cpu_build_hash_table.d.ts.map +1 -1
  275. package/src/shade/renderer/gpu_primitive/hash_table/cpu_build_hash_table.js +6 -4
  276. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  277. package/src/shade/renderer/material/resident/GPUResidentMaterialContext.d.ts +1 -1
  278. package/src/shade/renderer/material/resident/GPUResidentMaterialContext.d.ts.map +1 -1
  279. package/src/shade/renderer/material/resident/GPUResidentMaterialContext.js +2 -18
  280. package/src/shade/renderer/material/resident/NEUTRAL_SURFACE.d.ts +17 -0
  281. package/src/shade/renderer/material/resident/NEUTRAL_SURFACE.d.ts.map +1 -0
  282. package/src/shade/renderer/material/resident/NEUTRAL_SURFACE.js +16 -0
  283. package/src/shade/renderer/path_tracer/shader/INDIRECT_TEXTURE_FILTER.d.ts +1 -1
  284. package/src/shade/renderer/path_tracer/shader/INDIRECT_TEXTURE_FILTER.js +1 -1
  285. package/src/shade/renderer/path_tracer/shader/IndirectTextureFilter.js +1 -1
  286. package/src/shade/renderer/path_tracer/shader/chunk_beam_texture_level.d.ts +20 -0
  287. package/src/shade/renderer/path_tracer/shader/chunk_beam_texture_level.d.ts.map +1 -0
  288. package/src/shade/renderer/path_tracer/shader/chunk_beam_texture_level.js +65 -0
  289. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  290. package/src/shade/renderer/scene/GPUSceneContext.d.ts +1 -1
  291. package/src/shade/renderer/scene/GPUSceneContext.js +1 -1
  292. package/src/shade/renderer/shader/chunk/material/albedo_compress.d.ts +12 -0
  293. package/src/shade/renderer/shader/chunk/material/albedo_compress.d.ts.map +1 -0
  294. package/src/shade/renderer/shader/chunk/material/albedo_compress.js +26 -0
  295. package/src/shade/renderer/shader/chunk/material/chunk_albedo_compress.d.ts +16 -0
  296. package/src/shade/renderer/shader/chunk/material/chunk_albedo_compress.d.ts.map +1 -0
  297. package/src/shade/renderer/shader/chunk/material/chunk_albedo_compress.js +22 -0
  298. package/src/shade/renderer/shader/chunk/material/chunk_albedo_uncompress.d.ts +15 -0
  299. package/src/shade/renderer/shader/chunk/material/chunk_albedo_uncompress.d.ts.map +1 -0
  300. package/src/shade/renderer/shader/chunk/material/chunk_albedo_uncompress.js +23 -0
  301. package/src/shade/renderer/shader/chunk/material/chunk_metal_rough_compress.d.ts +16 -0
  302. package/src/shade/renderer/shader/chunk/material/chunk_metal_rough_compress.d.ts.map +1 -0
  303. package/src/shade/renderer/shader/chunk/material/chunk_metal_rough_compress.js +25 -0
  304. package/src/shade/renderer/shader/chunk/material/chunk_metal_rough_uncompress.d.ts +25 -0
  305. package/src/shade/renderer/shader/chunk/material/chunk_metal_rough_uncompress.d.ts.map +1 -0
  306. package/src/shade/renderer/shader/chunk/material/chunk_metal_rough_uncompress.js +36 -0
  307. package/src/shade/renderer/shader/chunk/material/metal_rough_compress.d.ts +11 -0
  308. package/src/shade/renderer/shader/chunk/material/metal_rough_compress.d.ts.map +1 -0
  309. package/src/shade/renderer/shader/chunk/material/metal_rough_compress.js +38 -0
  310. package/src/shade/renderer/shader/chunk/spherical_harmonics/pivot/chunk_sh2_color_pivot.d.ts +20 -0
  311. package/src/shade/renderer/shader/chunk/spherical_harmonics/pivot/chunk_sh2_color_pivot.d.ts.map +1 -0
  312. package/src/shade/renderer/shader/chunk/spherical_harmonics/pivot/chunk_sh2_color_pivot.js +35 -0
  313. package/src/shade/renderer/shader/chunk/spherical_harmonics/pivot/chunk_sh2_color_pivot_compress.d.ts +28 -0
  314. package/src/shade/renderer/shader/chunk/spherical_harmonics/pivot/chunk_sh2_color_pivot_compress.d.ts.map +1 -0
  315. package/src/shade/renderer/shader/chunk/spherical_harmonics/pivot/chunk_sh2_color_pivot_compress.js +79 -0
  316. package/src/shade/renderer/shader/chunk/spherical_harmonics/pivot/chunk_sh2_color_pivot_fit.d.ts +25 -0
  317. package/src/shade/renderer/shader/chunk/spherical_harmonics/pivot/chunk_sh2_color_pivot_fit.d.ts.map +1 -0
  318. package/src/shade/renderer/shader/chunk/spherical_harmonics/pivot/chunk_sh2_color_pivot_fit.js +89 -0
  319. package/src/shade/renderer/shader/chunk/spherical_harmonics/pivot/chunk_sh2_color_pivot_uncompress.d.ts +31 -0
  320. package/src/shade/renderer/shader/chunk/spherical_harmonics/pivot/chunk_sh2_color_pivot_uncompress.d.ts.map +1 -0
  321. package/src/shade/renderer/shader/chunk/spherical_harmonics/pivot/chunk_sh2_color_pivot_uncompress.js +66 -0
  322. package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_atomic_add.d.ts.map +1 -1
  323. package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_atomic_add.js +2 -0
  324. package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_atomic_load.d.ts +17 -0
  325. package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_atomic_load.d.ts.map +1 -0
  326. package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_atomic_load.js +34 -0
  327. package/src/shade/renderer/volumetrics/chunk_frustum_unit_box_coverage_multisample.d.ts +18 -0
  328. package/src/shade/renderer/volumetrics/chunk_frustum_unit_box_coverage_multisample.d.ts.map +1 -1
  329. package/src/shade/renderer/volumetrics/chunk_frustum_unit_box_coverage_multisample.js +31 -23
  330. package/src/shade/renderer/volumetrics/shader_volumetrics_build_participating_media.d.ts.map +1 -1
  331. package/src/shade/renderer/volumetrics/shader_volumetrics_build_participating_media.js +5 -6
  332. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
  333. package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
  334. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts +0 -213
  335. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts.map +0 -1
  336. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.js +0 -1468
  337. package/src/shade/renderer/geometry/sdf/cards/MESH_CARDS.d.ts +0 -82
  338. package/src/shade/renderer/geometry/sdf/cards/MESH_CARDS.d.ts.map +0 -1
  339. package/src/shade/renderer/geometry/sdf/cards/MESH_CARDS.js +0 -127
  340. package/src/shade/renderer/geometry/sdf/cards/MESH_CARD_RESOURCES.d.ts +0 -24
  341. package/src/shade/renderer/geometry/sdf/cards/MESH_CARD_RESOURCES.d.ts.map +0 -1
  342. package/src/shade/renderer/geometry/sdf/cards/MESH_CARD_RESOURCES.js +0 -29
  343. package/src/shade/renderer/geometry/sdf/cards/MESH_CARD_SET_STRUCT.d.ts +0 -12
  344. package/src/shade/renderer/geometry/sdf/cards/MESH_CARD_SET_STRUCT.d.ts.map +0 -1
  345. package/src/shade/renderer/geometry/sdf/cards/MESH_CARD_SET_STRUCT.js +0 -31
  346. package/src/shade/renderer/geometry/sdf/cards/MeshCardCaptureMode.d.ts +0 -11
  347. package/src/shade/renderer/geometry/sdf/cards/MeshCardCaptureMode.d.ts.map +0 -1
  348. package/src/shade/renderer/geometry/sdf/cards/MeshCardCaptureMode.js +0 -21
  349. package/src/shade/renderer/geometry/sdf/cards/chunk_mesh_card_surface.d.ts +0 -29
  350. package/src/shade/renderer/geometry/sdf/cards/chunk_mesh_card_surface.d.ts.map +0 -1
  351. package/src/shade/renderer/geometry/sdf/cards/chunk_mesh_card_surface.js +0 -179
  352. package/src/shade/renderer/geometry/sdf/cards/chunk_mesh_cards.d.ts +0 -17
  353. package/src/shade/renderer/geometry/sdf/cards/chunk_mesh_cards.d.ts.map +0 -1
  354. package/src/shade/renderer/geometry/sdf/cards/chunk_mesh_cards.js +0 -107
  355. package/src/shade/renderer/geometry/sdf/cards/mesh_cards_raster_pass_descriptor.d.ts +0 -65
  356. package/src/shade/renderer/geometry/sdf/cards/mesh_cards_raster_pass_descriptor.d.ts.map +0 -1
  357. package/src/shade/renderer/geometry/sdf/cards/mesh_cards_raster_pass_descriptor.js +0 -376
  358. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_capture.d.ts +0 -40
  359. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_capture.d.ts.map +0 -1
  360. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_capture.js +0 -301
  361. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_compact.d.ts +0 -19
  362. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_compact.d.ts.map +0 -1
  363. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_compact.js +0 -61
  364. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_histogram.d.ts +0 -18
  365. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_histogram.d.ts.map +0 -1
  366. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_histogram.js +0 -102
  367. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_log.d.ts +0 -15
  368. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_log.d.ts.map +0 -1
  369. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_log.js +0 -65
  370. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_merge.d.ts +0 -22
  371. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_merge.d.ts.map +0 -1
  372. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_merge.js +0 -136
  373. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_pages.d.ts +0 -20
  374. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_pages.d.ts.map +0 -1
  375. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_pages.js +0 -104
  376. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_args.d.ts +0 -20
  377. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_args.d.ts.map +0 -1
  378. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_args.js +0 -80
  379. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_scatter.d.ts +0 -18
  380. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_scatter.d.ts.map +0 -1
  381. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_scatter.js +0 -113
  382. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_split.d.ts +0 -30
  383. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_split.d.ts.map +0 -1
  384. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_split.js +0 -146
  385. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_mesh_cards.d.ts +0 -34
  386. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_mesh_cards.d.ts.map +0 -1
  387. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_surface.d.ts +0 -31
  388. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_surface.d.ts.map +0 -1
  389. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_surface.js +0 -82
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Bits of each of metalness and roughness in a `metal_rough_compress` code.
3
+ * @type {number}
4
+ */
5
+ export const METAL_ROUGH_CHANNEL_BITS: number;
6
+ /**
7
+ * Bits of a `metal_rough_compress` code: metalness, then roughness.
8
+ * @type {number}
9
+ */
10
+ export const METAL_ROUGH_CODE_BITS: number;
11
+ /**
12
+ * Metalness and roughness from the code `metal_rough_compress` wrote:
13
+ *
14
+ * ```wgsl
15
+ * fn metal_rough_uncompress(code: u32) -> vec2<f32> // (metalness, roughness), on [0, 1]
16
+ * ```
17
+ *
18
+ * The code's low {@link METAL_ROUGH_CHANNEL_BITS} bits are the metalness and the next as many the
19
+ * roughness, each unorm. Bits past {@link METAL_ROUGH_CODE_BITS} are ignored.
20
+ *
21
+ * @type {CodeChunk}
22
+ */
23
+ export const chunk_metal_rough_uncompress: CodeChunk;
24
+ import { CodeChunk } from "../../compiler/CodeChunk.js";
25
+ //# sourceMappingURL=chunk_metal_rough_uncompress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_metal_rough_uncompress.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/material/chunk_metal_rough_uncompress.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,uCAFU,MAAM,CAE0B;AAE1C;;;GAGG;AACH,oCAFU,MAAM,CAEkD;AAElE;;;;;;;;;;;GAWG;AACH,2CAFU,SAAS,CAWhB;0BAnCuB,6BAA6B"}
@@ -0,0 +1,36 @@
1
+ import { CodeChunk } from "../../compiler/CodeChunk.js";
2
+
3
+ /**
4
+ * Bits of each of metalness and roughness in a `metal_rough_compress` code.
5
+ * @type {number}
6
+ */
7
+ export const METAL_ROUGH_CHANNEL_BITS = 4;
8
+
9
+ /**
10
+ * Bits of a `metal_rough_compress` code: metalness, then roughness.
11
+ * @type {number}
12
+ */
13
+ export const METAL_ROUGH_CODE_BITS = 2 * METAL_ROUGH_CHANNEL_BITS;
14
+
15
+ /**
16
+ * Metalness and roughness from the code `metal_rough_compress` wrote:
17
+ *
18
+ * ```wgsl
19
+ * fn metal_rough_uncompress(code: u32) -> vec2<f32> // (metalness, roughness), on [0, 1]
20
+ * ```
21
+ *
22
+ * The code's low {@link METAL_ROUGH_CHANNEL_BITS} bits are the metalness and the next as many the
23
+ * roughness, each unorm. Bits past {@link METAL_ROUGH_CODE_BITS} are ignored.
24
+ *
25
+ * @type {CodeChunk}
26
+ */
27
+ export const chunk_metal_rough_uncompress = CodeChunk.from(
28
+ //language=WGSL
29
+ `
30
+ fn metal_rough_uncompress(code: u32) -> vec2<f32> {
31
+ return vec2<f32>(
32
+ f32(extractBits(code, 0u, ${METAL_ROUGH_CHANNEL_BITS}u)),
33
+ f32(extractBits(code, ${METAL_ROUGH_CHANNEL_BITS}u, ${METAL_ROUGH_CHANNEL_BITS}u))
34
+ ) / ${2 ** METAL_ROUGH_CHANNEL_BITS - 1}.0;
35
+ }
36
+ `);
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The code `metal_rough_compress` (`chunk_metal_rough_compress.js`) gives a metalness and roughness, on
3
+ * the host: each clamped to [0, 1], scaled to its steps in f32 and rounded half to even, as WGSL's
4
+ * `round` does.
5
+ *
6
+ * @param {number} metalness
7
+ * @param {number} roughness
8
+ * @returns {number} the code, {@link METAL_ROUGH_CHANNEL_BITS} bits each, metalness low
9
+ */
10
+ export function metal_rough_compress(metalness: number, roughness: number): number;
11
+ //# sourceMappingURL=metal_rough_compress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metal_rough_compress.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/material/metal_rough_compress.js"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,gDAJW,MAAM,aACN,MAAM,GACJ,MAAM,CAIlB"}
@@ -0,0 +1,38 @@
1
+ import { clamp01 } from "../../../../../core/math/clamp01.js";
2
+ import { METAL_ROUGH_CHANNEL_BITS } from "./chunk_metal_rough_uncompress.js";
3
+
4
+ const STEPS = 2 ** METAL_ROUGH_CHANNEL_BITS - 1;
5
+
6
+ /**
7
+ * The code `metal_rough_compress` (`chunk_metal_rough_compress.js`) gives a metalness and roughness, on
8
+ * the host: each clamped to [0, 1], scaled to its steps in f32 and rounded half to even, as WGSL's
9
+ * `round` does.
10
+ *
11
+ * @param {number} metalness
12
+ * @param {number} roughness
13
+ * @returns {number} the code, {@link METAL_ROUGH_CHANNEL_BITS} bits each, metalness low
14
+ */
15
+ export function metal_rough_compress(metalness, roughness) {
16
+ return step(metalness) | (step(roughness) << METAL_ROUGH_CHANNEL_BITS);
17
+ }
18
+
19
+ /**
20
+ * @param {number} v
21
+ * @returns {number}
22
+ */
23
+ function step(v) {
24
+ const scaled = Math.fround(Math.fround(clamp01(Math.fround(v))) * STEPS);
25
+ const floor = Math.floor(scaled);
26
+ const fraction = scaled - floor;
27
+
28
+ if (fraction > 0.5) {
29
+ return floor + 1;
30
+ }
31
+
32
+ if (fraction < 0.5) {
33
+ return floor;
34
+ }
35
+
36
+ // halfway: to the even one
37
+ return floor % 2 === 0 ? floor : floor + 1;
38
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * An RGB SH2 (L1) function of a unit normal written about a pivot normal, and its evaluation:
3
+ *
4
+ * ```wgsl
5
+ * struct Sh2ColorPivot { value: vec3<f32>, gradient: mat3x3<f32>, pivot: vec3<f32> }
6
+ * fn sh2_color_pivot_evaluate(f: Sh2ColorPivot, n: vec3<f32>) -> vec3<f32> // value + gradient · (n − pivot)
7
+ * ```
8
+ *
9
+ * Any L1 function on the sphere is affine in the normal, c₀ + c·n, so this is the same function space as
10
+ * band 0 and band 1 of SH. Writing it about a pivot near the normals it was fitted on puts a real value
11
+ * in `value`, the function at the pivot, where band 0 is the function's mean over the whole sphere. A
12
+ * one-sided fit's mean can lie far outside the range its values take on the fitted side.
13
+ *
14
+ * `gradient`'s column `a` is the RGB derivative along normal axis `a`.
15
+ *
16
+ * @type {CodeChunk}
17
+ */
18
+ export const chunk_sh2_color_pivot: CodeChunk;
19
+ import { CodeChunk } from "../../../compiler/CodeChunk.js";
20
+ //# sourceMappingURL=chunk_sh2_color_pivot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_sh2_color_pivot.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/shader/chunk/spherical_harmonics/pivot/chunk_sh2_color_pivot.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,oCAFU,SAAS,CAiBhB;0BAlCuB,gCAAgC"}
@@ -0,0 +1,35 @@
1
+ import { CodeChunk } from "../../../compiler/CodeChunk.js";
2
+
3
+ /**
4
+ * An RGB SH2 (L1) function of a unit normal written about a pivot normal, and its evaluation:
5
+ *
6
+ * ```wgsl
7
+ * struct Sh2ColorPivot { value: vec3<f32>, gradient: mat3x3<f32>, pivot: vec3<f32> }
8
+ * fn sh2_color_pivot_evaluate(f: Sh2ColorPivot, n: vec3<f32>) -> vec3<f32> // value + gradient · (n − pivot)
9
+ * ```
10
+ *
11
+ * Any L1 function on the sphere is affine in the normal, c₀ + c·n, so this is the same function space as
12
+ * band 0 and band 1 of SH. Writing it about a pivot near the normals it was fitted on puts a real value
13
+ * in `value`, the function at the pivot, where band 0 is the function's mean over the whole sphere. A
14
+ * one-sided fit's mean can lie far outside the range its values take on the fitted side.
15
+ *
16
+ * `gradient`'s column `a` is the RGB derivative along normal axis `a`.
17
+ *
18
+ * @type {CodeChunk}
19
+ */
20
+ export const chunk_sh2_color_pivot = CodeChunk.from(
21
+ //language=WGSL
22
+ `
23
+ struct Sh2ColorPivot {
24
+ /** the function at the pivot */
25
+ value: vec3<f32>,
26
+ /** a column an axis of the normal: the RGB change per unit of that axis */
27
+ gradient: mat3x3<f32>,
28
+ /** unit length */
29
+ pivot: vec3<f32>,
30
+ }
31
+
32
+ fn sh2_color_pivot_evaluate(f: Sh2ColorPivot, n: vec3<f32>) -> vec3<f32> {
33
+ return f.value + f.gradient * (n - f.pivot);
34
+ }
35
+ `);
@@ -0,0 +1,28 @@
1
+ /**
2
+ * An {@link chunk_sh2_color_pivot} function whose value at the pivot is in [0, 1] per channel, an
3
+ * albedo, in 128 bits, laid out as `sh2_color_pivot_uncompress` reads them:
4
+ *
5
+ * ```wgsl
6
+ * fn sh2_color_pivot_compress(f: Sh2ColorPivot) -> vec4<u32>
7
+ * ```
8
+ *
9
+ * - **The gradient** goes first: nine snorm8 codes over the least power of two at or above its largest
10
+ * component, so every code lies within ±127 and the largest one at or past 64.
11
+ * - **The pivot** goes next, octahedral, 12 bits a coordinate.
12
+ * - **The value** is then taken at the stored pivot, through the stored gradient: f(pivot′) =
13
+ * value + G′·(pivot′ − pivot). The function keeps its value at the given pivot up to the value's own
14
+ * code, whatever the pivot's quantization and however steep the gradient. The value is clamped to
15
+ * [0, 1] and stored as its square root, unorm8 a channel, which puts more codes in the dark, as
16
+ * `albedo_compress` stores an albedo.
17
+ *
18
+ * A code is never all zero: the exponent byte is at least 1, 1 for a zero gradient. A reader may take
19
+ * an all-zero `vec4<u32>` for no function at all.
20
+ *
21
+ * Nothing is deringed. A function fitted to one side of the sphere takes whatever values its other
22
+ * side gives, and a reader evaluates it near its pivot.
23
+ *
24
+ * @type {CodeChunk}
25
+ */
26
+ export const chunk_sh2_color_pivot_compress: CodeChunk;
27
+ import { CodeChunk } from "../../../compiler/CodeChunk.js";
28
+ //# sourceMappingURL=chunk_sh2_color_pivot_compress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_sh2_color_pivot_compress.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/shader/chunk/spherical_harmonics/pivot/chunk_sh2_color_pivot_compress.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,6CAFU,SAAS,CA6CZ;0BA9EmB,gCAAgC"}
@@ -0,0 +1,79 @@
1
+ import { CodeChunk } from "../../../compiler/CodeChunk.js";
2
+ import { chunk_uv_octahedral_unit_decode } from "../../geometry/octahedron/chunk_uv_octahedral_unit_decode.js";
3
+ import { chunk_uv_octahedral_unit_encode } from "../../geometry/octahedron/chunk_uv_octahedral_unit_encode.js";
4
+ import { chunk_sh2_color_pivot } from "./chunk_sh2_color_pivot.js";
5
+ import {
6
+ chunk_sh2_color_pivot_uncompress,
7
+ SH2_COLOR_PIVOT_EXPONENT_BIAS,
8
+ SH2_COLOR_PIVOT_OCTAHEDRAL_BITS
9
+ } from "./chunk_sh2_color_pivot_uncompress.js";
10
+
11
+ /**
12
+ * An {@link chunk_sh2_color_pivot} function whose value at the pivot is in [0, 1] per channel, an
13
+ * albedo, in 128 bits, laid out as `sh2_color_pivot_uncompress` reads them:
14
+ *
15
+ * ```wgsl
16
+ * fn sh2_color_pivot_compress(f: Sh2ColorPivot) -> vec4<u32>
17
+ * ```
18
+ *
19
+ * - **The gradient** goes first: nine snorm8 codes over the least power of two at or above its largest
20
+ * component, so every code lies within ±127 and the largest one at or past 64.
21
+ * - **The pivot** goes next, octahedral, 12 bits a coordinate.
22
+ * - **The value** is then taken at the stored pivot, through the stored gradient: f(pivot′) =
23
+ * value + G′·(pivot′ − pivot). The function keeps its value at the given pivot up to the value's own
24
+ * code, whatever the pivot's quantization and however steep the gradient. The value is clamped to
25
+ * [0, 1] and stored as its square root, unorm8 a channel, which puts more codes in the dark, as
26
+ * `albedo_compress` stores an albedo.
27
+ *
28
+ * A code is never all zero: the exponent byte is at least 1, 1 for a zero gradient. A reader may take
29
+ * an all-zero `vec4<u32>` for no function at all.
30
+ *
31
+ * Nothing is deringed. A function fitted to one side of the sphere takes whatever values its other
32
+ * side gives, and a reader evaluates it near its pivot.
33
+ *
34
+ * @type {CodeChunk}
35
+ */
36
+ export const chunk_sh2_color_pivot_compress = CodeChunk.from(
37
+ //language=WGSL
38
+ `
39
+ fn sh2_color_pivot_compress(f: Sh2ColorPivot) -> vec4<u32> {
40
+ let g = f.gradient;
41
+ let column_largest = max(max(abs(g[0]), abs(g[1])), abs(g[2]));
42
+ let largest = max(max(column_largest.x, column_largest.y), column_largest.z);
43
+
44
+ // ceil(log2) rounds a component just past a power of two up or down; pack4x8snorm clamps the one
45
+ // that lands a rounding past 1
46
+ let exponent = select(1i, clamp(i32(ceil(log2(largest))) + ${SH2_COLOR_PIVOT_EXPONENT_BIAS}i, 1i, 255i), largest > 0.0);
47
+ // the reciprocal is taken as its own power of two: 2^-127, the scale of byte 1, is subnormal
48
+ let inverse = exp2(f32(${SH2_COLOR_PIVOT_EXPONENT_BIAS}i - exponent));
49
+
50
+ let a = g[0] * inverse;
51
+ let b = g[1] * inverse;
52
+ let c = g[2] * inverse;
53
+
54
+ var code: vec4<u32>;
55
+
56
+ code.y = pack4x8snorm(vec4<f32>(a, b.x));
57
+ code.z = pack4x8snorm(vec4<f32>(b.yz, c.xy));
58
+ code.x = u32(exponent) << 24u;
59
+
60
+ let octahedral = vec2<u32>(round(saturate(uv_octahedral_unit_encode(f.pivot)) * ${2 ** SH2_COLOR_PIVOT_OCTAHEDRAL_BITS - 1}.0));
61
+ let pivot = uv_octahedral_unit_decode(vec2<f32>(octahedral) / ${2 ** SH2_COLOR_PIVOT_OCTAHEDRAL_BITS - 1}.0);
62
+
63
+ code.w = (pack4x8snorm(vec4<f32>(c.z, 0.0, 0.0, 0.0)) & 0xffu)
64
+ | (octahedral.x << 8u)
65
+ | (octahedral.y << ${8 + SH2_COLOR_PIVOT_OCTAHEDRAL_BITS}u);
66
+
67
+ // the value at the stored pivot, through the stored gradient
68
+ let value = f.value + sh2_color_pivot_uncompress_gradient(code) * (pivot - f.pivot);
69
+
70
+ code.x |= pack4x8unorm(vec4<f32>(sqrt(saturate(value)), 0.0));
71
+
72
+ return code;
73
+ }
74
+ `, [
75
+ chunk_sh2_color_pivot,
76
+ chunk_sh2_color_pivot_uncompress,
77
+ chunk_uv_octahedral_unit_encode,
78
+ chunk_uv_octahedral_unit_decode,
79
+ ]);
@@ -0,0 +1,25 @@
1
+ /**
2
+ * An {@link chunk_sh2_color_pivot} function fitted to weighted samples of it, a color at a unit normal
3
+ * each:
4
+ *
5
+ * ```wgsl
6
+ * fn sh2_color_pivot_fit_add(fit: ptr<function, Sh2ColorPivotFit>, weight: f32, normal: vec3<f32>, color: vec3<f32>)
7
+ * fn sh2_color_pivot_fit_solve(fit: Sh2ColorPivotFit, noise: f32) -> Sh2ColorPivot
8
+ * ```
9
+ *
10
+ * Weighted least squares, which written about the samples' mean normal n̄ is the regression of color on
11
+ * normal, G = Cov(color, n)·Cov(n)⁻¹, stored about n̄'s direction with its value there. `noise`, above
12
+ * 0, is the variance of the normals' error along an axis, which goes on Cov(n)'s diagonal: a spread no
13
+ * larger than that is the normals' noise, and a slope read from it would turn the colors' contrast into
14
+ * a gradient as steep as the noise is small.
15
+ *
16
+ * The sums are raw moments, so samples add in any order and a fit can be split and joined. Their
17
+ * cancellation in f32 is about 1e-7 of a unit normal's square: a noise under that is lost to it.
18
+ *
19
+ * A fit of no weight is the zero function about +z.
20
+ *
21
+ * @type {CodeChunk}
22
+ */
23
+ export const chunk_sh2_color_pivot_fit: CodeChunk;
24
+ import { CodeChunk } from "../../../compiler/CodeChunk.js";
25
+ //# sourceMappingURL=chunk_sh2_color_pivot_fit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_sh2_color_pivot_fit.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/shader/chunk/spherical_harmonics/pivot/chunk_sh2_color_pivot_fit.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wCAFU,SAAS,CAgEZ;0BAxFmB,gCAAgC"}
@@ -0,0 +1,89 @@
1
+ import { CodeChunk } from "../../../compiler/CodeChunk.js";
2
+ import { chunk_mat3_inverse } from "../../geometry/mat3/chunk_mat3_inverse.js";
3
+ import { chunk_sh2_color_pivot } from "./chunk_sh2_color_pivot.js";
4
+
5
+ /**
6
+ * An {@link chunk_sh2_color_pivot} function fitted to weighted samples of it, a color at a unit normal
7
+ * each:
8
+ *
9
+ * ```wgsl
10
+ * fn sh2_color_pivot_fit_add(fit: ptr<function, Sh2ColorPivotFit>, weight: f32, normal: vec3<f32>, color: vec3<f32>)
11
+ * fn sh2_color_pivot_fit_solve(fit: Sh2ColorPivotFit, noise: f32) -> Sh2ColorPivot
12
+ * ```
13
+ *
14
+ * Weighted least squares, which written about the samples' mean normal n̄ is the regression of color on
15
+ * normal, G = Cov(color, n)·Cov(n)⁻¹, stored about n̄'s direction with its value there. `noise`, above
16
+ * 0, is the variance of the normals' error along an axis, which goes on Cov(n)'s diagonal: a spread no
17
+ * larger than that is the normals' noise, and a slope read from it would turn the colors' contrast into
18
+ * a gradient as steep as the noise is small.
19
+ *
20
+ * The sums are raw moments, so samples add in any order and a fit can be split and joined. Their
21
+ * cancellation in f32 is about 1e-7 of a unit normal's square: a noise under that is lost to it.
22
+ *
23
+ * A fit of no weight is the zero function about +z.
24
+ *
25
+ * @type {CodeChunk}
26
+ */
27
+ export const chunk_sh2_color_pivot_fit = CodeChunk.from(
28
+ //language=WGSL
29
+ `
30
+ struct Sh2ColorPivotFit {
31
+ weight: f32,
32
+ /** the weighted sums of the samples' normals and colors */
33
+ normal: vec3<f32>,
34
+ color: vec3<f32>,
35
+ /** Σ w n nᵀ */
36
+ normal_normal: mat3x3<f32>,
37
+ /** Σ w c nᵀ: a column a normal axis, its RGB */
38
+ color_normal: mat3x3<f32>,
39
+ }
40
+
41
+ fn sh2_color_pivot_fit_add(fit: ptr<function, Sh2ColorPivotFit>, weight: f32, normal: vec3<f32>, color: vec3<f32>) {
42
+ let wn = weight * normal;
43
+ let wc = weight * color;
44
+
45
+ (*fit).weight += weight;
46
+ (*fit).normal += wn;
47
+ (*fit).color += wc;
48
+ (*fit).normal_normal += mat3x3<f32>(wn * normal.x, wn * normal.y, wn * normal.z);
49
+ (*fit).color_normal += mat3x3<f32>(wc * normal.x, wc * normal.y, wc * normal.z);
50
+ }
51
+
52
+ fn sh2_color_pivot_fit_solve(fit: Sh2ColorPivotFit, noise: f32) -> Sh2ColorPivot {
53
+ var out: Sh2ColorPivot;
54
+
55
+ out.pivot = vec3<f32>(0.0, 0.0, 1.0);
56
+
57
+ if (!(fit.weight > 0.0)) {
58
+ return out;
59
+ }
60
+
61
+ let inverse_weight = 1.0 / fit.weight;
62
+ let mean_normal = fit.normal * inverse_weight;
63
+ let mean_color = fit.color * inverse_weight;
64
+
65
+ // per unit weight, about the means; the noise on the normals' diagonal
66
+ let covariance = fit.normal_normal * inverse_weight
67
+ - mat3x3<f32>(mean_normal * mean_normal.x, mean_normal * mean_normal.y, mean_normal * mean_normal.z)
68
+ + mat3x3<f32>(vec3<f32>(noise, 0.0, 0.0), vec3<f32>(0.0, noise, 0.0), vec3<f32>(0.0, 0.0, noise));
69
+ let cross_covariance = fit.color_normal * inverse_weight
70
+ - mat3x3<f32>(mean_color * mean_normal.x, mean_color * mean_normal.y, mean_color * mean_normal.z);
71
+
72
+ let gradient = cross_covariance * mat3_inverse(covariance);
73
+ let reach = length(mean_normal);
74
+
75
+ // normals that cancel, as a thin wall's two faces do, leave no mean direction: then any unit normal
76
+ // is as good a pivot
77
+ if (reach > 0.0) {
78
+ out.pivot = mean_normal / reach;
79
+ }
80
+
81
+ out.gradient = gradient;
82
+ out.value = mean_color + gradient * (out.pivot - mean_normal);
83
+
84
+ return out;
85
+ }
86
+ `, [
87
+ chunk_sh2_color_pivot,
88
+ chunk_mat3_inverse,
89
+ ]);
@@ -0,0 +1,31 @@
1
+ /**
2
+ * What the gradient's exponent byte is offset by: the gradient's scale is 2^(e − bias).
3
+ * @type {number}
4
+ */
5
+ export const SH2_COLOR_PIVOT_EXPONENT_BIAS: number;
6
+ /**
7
+ * Bits of each of the pivot's two octahedral coordinates.
8
+ * @type {number}
9
+ */
10
+ export const SH2_COLOR_PIVOT_OCTAHEDRAL_BITS: number;
11
+ /**
12
+ * An {@link chunk_sh2_color_pivot} function from the 128 bits `sh2_color_pivot_compress` wrote:
13
+ *
14
+ * ```wgsl
15
+ * fn sh2_color_pivot_uncompress(code: vec4<u32>) -> Sh2ColorPivot
16
+ * fn sh2_color_pivot_uncompress_gradient(code: vec4<u32>) -> mat3x3<f32>
17
+ * ```
18
+ *
19
+ * The layout, a `vec4<u32>`:
20
+ * - `x`: the value at the pivot, its square root per channel as unorm8 in R, G, B; then the gradient's
21
+ * exponent byte e, never 0, its scale 2^(e − {@link SH2_COLOR_PIVOT_EXPONENT_BIAS}).
22
+ * - `y`, `z` and the low byte of `w`: nine snorm8 codes of the gradient over its scale, column by
23
+ * column: ∂/∂n_x as R, G, B, then ∂/∂n_y, then ∂/∂n_z.
24
+ * - `w` bits 8–31: the pivot, octahedral (`uv_octahedral_unit_encode`), {@link SH2_COLOR_PIVOT_OCTAHEDRAL_BITS}
25
+ * bits a coordinate, x then y.
26
+ *
27
+ * @type {CodeChunk}
28
+ */
29
+ export const chunk_sh2_color_pivot_uncompress: CodeChunk;
30
+ import { CodeChunk } from "../../../compiler/CodeChunk.js";
31
+ //# sourceMappingURL=chunk_sh2_color_pivot_uncompress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_sh2_color_pivot_uncompress.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/shader/chunk/spherical_harmonics/pivot/chunk_sh2_color_pivot_uncompress.js"],"names":[],"mappings":"AAIA;;;GAGG;AACH,4CAFU,MAAM,CAEiC;AAEjD;;;GAGG;AACH,8CAFU,MAAM,CAEkC;AAElD;;;;;;;;;;;;;;;;;GAiBG;AACH,+CAFU,SAAS,CAiCZ;0BAjEmB,gCAAgC"}
@@ -0,0 +1,66 @@
1
+ import { CodeChunk } from "../../../compiler/CodeChunk.js";
2
+ import { chunk_uv_octahedral_unit_decode } from "../../geometry/octahedron/chunk_uv_octahedral_unit_decode.js";
3
+ import { chunk_sh2_color_pivot } from "./chunk_sh2_color_pivot.js";
4
+
5
+ /**
6
+ * What the gradient's exponent byte is offset by: the gradient's scale is 2^(e − bias).
7
+ * @type {number}
8
+ */
9
+ export const SH2_COLOR_PIVOT_EXPONENT_BIAS = 128;
10
+
11
+ /**
12
+ * Bits of each of the pivot's two octahedral coordinates.
13
+ * @type {number}
14
+ */
15
+ export const SH2_COLOR_PIVOT_OCTAHEDRAL_BITS = 12;
16
+
17
+ /**
18
+ * An {@link chunk_sh2_color_pivot} function from the 128 bits `sh2_color_pivot_compress` wrote:
19
+ *
20
+ * ```wgsl
21
+ * fn sh2_color_pivot_uncompress(code: vec4<u32>) -> Sh2ColorPivot
22
+ * fn sh2_color_pivot_uncompress_gradient(code: vec4<u32>) -> mat3x3<f32>
23
+ * ```
24
+ *
25
+ * The layout, a `vec4<u32>`:
26
+ * - `x`: the value at the pivot, its square root per channel as unorm8 in R, G, B; then the gradient's
27
+ * exponent byte e, never 0, its scale 2^(e − {@link SH2_COLOR_PIVOT_EXPONENT_BIAS}).
28
+ * - `y`, `z` and the low byte of `w`: nine snorm8 codes of the gradient over its scale, column by
29
+ * column: ∂/∂n_x as R, G, B, then ∂/∂n_y, then ∂/∂n_z.
30
+ * - `w` bits 8–31: the pivot, octahedral (`uv_octahedral_unit_encode`), {@link SH2_COLOR_PIVOT_OCTAHEDRAL_BITS}
31
+ * bits a coordinate, x then y.
32
+ *
33
+ * @type {CodeChunk}
34
+ */
35
+ export const chunk_sh2_color_pivot_uncompress = CodeChunk.from(
36
+ //language=WGSL
37
+ `
38
+ fn sh2_color_pivot_uncompress_gradient(code: vec4<u32>) -> mat3x3<f32> {
39
+ let scale = exp2(f32(code.x >> 24u) - ${SH2_COLOR_PIVOT_EXPONENT_BIAS}.0);
40
+
41
+ let a = unpack4x8snorm(code.y) * scale;
42
+ let b = unpack4x8snorm(code.z) * scale;
43
+ let c = unpack4x8snorm(code.w & 0xffu).x * scale;
44
+
45
+ return mat3x3<f32>(a.xyz, vec3<f32>(a.w, b.xy), vec3<f32>(b.zw, c));
46
+ }
47
+
48
+ fn sh2_color_pivot_uncompress(code: vec4<u32>) -> Sh2ColorPivot {
49
+ var f: Sh2ColorPivot;
50
+
51
+ let root = unpack4x8unorm(code.x).rgb;
52
+ let octahedral = vec2<u32>(
53
+ extractBits(code.w, 8u, ${SH2_COLOR_PIVOT_OCTAHEDRAL_BITS}u),
54
+ extractBits(code.w, ${8 + SH2_COLOR_PIVOT_OCTAHEDRAL_BITS}u, ${SH2_COLOR_PIVOT_OCTAHEDRAL_BITS}u)
55
+ );
56
+
57
+ f.value = root * root;
58
+ f.gradient = sh2_color_pivot_uncompress_gradient(code);
59
+ f.pivot = uv_octahedral_unit_decode(vec2<f32>(octahedral) / ${2 ** SH2_COLOR_PIVOT_OCTAHEDRAL_BITS - 1}.0);
60
+
61
+ return f;
62
+ }
63
+ `, [
64
+ chunk_sh2_color_pivot,
65
+ chunk_uv_octahedral_unit_decode,
66
+ ]);
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_subgroup_atomic_add.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_atomic_add.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,wCAFU,SAAS,CAahB;0BAzBuB,6BAA6B"}
1
+ {"version":3,"file":"chunk_subgroup_atomic_add.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_atomic_add.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,wCAFU,SAAS,CAehB;0BA3BuB,6BAA6B"}
@@ -16,6 +16,8 @@ import { CodeChunk } from "../../compiler/CodeChunk.js";
16
16
  export const chunk_subgroup_atomic_add = CodeChunk.from(
17
17
  //language=WGSL
18
18
  `
19
+ // uniform in the subgroup by the caller's counter, which the analysis cannot see behind its returns
20
+ @diagnostic(off, subgroup_uniformity)
19
21
  fn subgroup_atomic_add_u32(counter: ptr<storage, atomic<u32>, read_write>, value: u32) {
20
22
  let total = subgroupAdd(value);
21
23
  let elected = subgroupElect();
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Load an atomic every lane of the subgroup reads alike, once a subgroup: its first active lane
3
+ * loads it, and the subgroup hands every lane what that lane read. Lanes that each load the same
4
+ * atomic serialize where `atomicLoad` is a read-modify-write, as it is on D3D12
5
+ * (`InterlockedOr(x, 0)`); one load a subgroup does not.
6
+ *
7
+ * `fn subgroup_atomic_load_u32(word: ptr<storage, atomic<u32>, read_write>) -> u32`
8
+ *
9
+ * Every lane of the subgroup calls it with the same `word`, from subgroup-uniform control flow: a
10
+ * lane passing another word reads the first lane's.
11
+ *
12
+ * @see chunk_subgroup_atomic_add for the writing twin
13
+ * @type {CodeChunk}
14
+ */
15
+ export const chunk_subgroup_atomic_load: CodeChunk;
16
+ import { CodeChunk } from "../../compiler/CodeChunk.js";
17
+ //# sourceMappingURL=chunk_subgroup_atomic_load.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_subgroup_atomic_load.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_atomic_load.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,yCAFU,SAAS,CAgBhB;0BA9BuB,6BAA6B"}
@@ -0,0 +1,34 @@
1
+ import { WebGPUExtensionType } from "../../../../descriptor/WebGPUExtensionType.js";
2
+ import { CodeChunk } from "../../compiler/CodeChunk.js";
3
+
4
+ /**
5
+ * Load an atomic every lane of the subgroup reads alike, once a subgroup: its first active lane
6
+ * loads it, and the subgroup hands every lane what that lane read. Lanes that each load the same
7
+ * atomic serialize where `atomicLoad` is a read-modify-write, as it is on D3D12
8
+ * (`InterlockedOr(x, 0)`); one load a subgroup does not.
9
+ *
10
+ * `fn subgroup_atomic_load_u32(word: ptr<storage, atomic<u32>, read_write>) -> u32`
11
+ *
12
+ * Every lane of the subgroup calls it with the same `word`, from subgroup-uniform control flow: a
13
+ * lane passing another word reads the first lane's.
14
+ *
15
+ * @see chunk_subgroup_atomic_add for the writing twin
16
+ * @type {CodeChunk}
17
+ */
18
+ export const chunk_subgroup_atomic_load = CodeChunk.from(
19
+ //language=WGSL
20
+ `
21
+ // uniform in the subgroup by the caller's word, which the analysis cannot see behind its returns
22
+ @diagnostic(off, subgroup_uniformity)
23
+ fn subgroup_atomic_load_u32(word: ptr<storage, atomic<u32>, read_write>) -> u32 {
24
+ var value = 0u;
25
+
26
+ if (subgroupElect()) {
27
+ value = atomicLoad(word);
28
+ }
29
+
30
+ return subgroupBroadcastFirst(value);
31
+ }
32
+ `);
33
+
34
+ chunk_subgroup_atomic_load.addExtension(WebGPUExtensionType.Subgroups);
@@ -1,3 +1,21 @@
1
+ /**
2
+ * The share of a frustum's volume inside the unit box [-0.5, 0.5]³, estimated along 4 rays from its near
3
+ * face to its far face: the mean of the fraction of each ray inside the box.
4
+ *
5
+ * The rays cross the face at points `4 · round` to `4 · round + 3` of the shuffled, Owen-scrambled Sobol
6
+ * sequence of `seed` (`sample_sobol_2d`), in the face's (u, v), u from the left plane to the right and v
7
+ * from the bottom to the top. Each call's 4 points are one per quarter of the face along either axis, and one
8
+ * per quadrant. The 2^m calls of an aligned run of rounds put one point in each dyadic cell of area
9
+ * 2^-(m+2). The points depend only on the seed and the round, and a ray is the planes' blend at its point:
10
+ * the same frustum's planes carried into another space by a rigid or uniformly scaled map, each plane
11
+ * renormalized, cast the same rays there.
12
+ *
13
+ * ```wgsl
14
+ * fn frustum_unit_box_coverage(frustum: array<vec4f, 6>, round: u32, seed: u32) -> f32 // frustum planes [LEFT, RIGHT, BOTTOM, TOP, NEAR, FAR]
15
+ * ```
16
+ *
17
+ * @type {CodeChunk}
18
+ */
1
19
  export const chunk_frustum_unit_box_coverage_multisample: CodeChunk;
2
20
  import { CodeChunk } from "../shader/compiler/CodeChunk.js";
3
21
  //# sourceMappingURL=chunk_frustum_unit_box_coverage_multisample.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_frustum_unit_box_coverage_multisample.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/volumetrics/chunk_frustum_unit_box_coverage_multisample.js"],"names":[],"mappings":"AAIA,oEAsDE;0BAxDwB,iCAAiC"}
1
+ {"version":3,"file":"chunk_frustum_unit_box_coverage_multisample.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/volumetrics/chunk_frustum_unit_box_coverage_multisample.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AACH,0DAFU,SAAS,CA8CjB;0BAhEwB,iCAAiC"}