@woosh/meep-engine 3.64.1 → 3.67.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 (372) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/build/bundle-worker-image-decoder.js +1 -1
  3. package/build/bundle-worker-terrain.js +1 -1
  4. package/package.json +1 -1
  5. package/src/core/binary/BinaryBuffer.d.ts +5 -0
  6. package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
  7. package/src/core/binary/BinaryBuffer.js +39 -5
  8. package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.d.ts +65 -6
  9. package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.d.ts.map +1 -1
  10. package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.js +451 -101
  11. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts +4 -2
  12. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts.map +1 -1
  13. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.js +4 -2
  14. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.d.ts +8 -1
  15. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.d.ts.map +1 -1
  16. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.js +45 -10
  17. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.d.ts.map +1 -1
  18. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.js +237 -119
  19. package/src/engine/graphics/ecs/grass/GrassSpecies.d.ts +143 -0
  20. package/src/engine/graphics/ecs/grass/GrassSpecies.d.ts.map +1 -0
  21. package/src/engine/graphics/ecs/grass/GrassSpecies.js +189 -0
  22. package/src/engine/graphics/ecs/grass/GrassSurface.d.ts +25 -0
  23. package/src/engine/graphics/ecs/grass/GrassSurface.d.ts.map +1 -0
  24. package/src/engine/graphics/ecs/grass/GrassSurface.js +32 -0
  25. package/src/engine/graphics/ecs/grass/GroundCover.d.ts +68 -0
  26. package/src/engine/graphics/ecs/grass/GroundCover.d.ts.map +1 -0
  27. package/src/engine/graphics/ecs/grass/GroundCover.js +85 -0
  28. package/src/engine/graphics3/GrassSurfaceSystem.d.ts +153 -0
  29. package/src/engine/graphics3/GrassSurfaceSystem.d.ts.map +1 -0
  30. package/src/engine/graphics3/GrassSurfaceSystem.js +1076 -0
  31. package/src/engine/graphics3/GroundCoverSystem.d.ts +33 -0
  32. package/src/engine/graphics3/GroundCoverSystem.d.ts.map +1 -0
  33. package/src/engine/graphics3/GroundCoverSystem.js +58 -0
  34. package/src/engine/network/NetworkSession.d.ts.map +1 -1
  35. package/src/engine/network/NetworkSession.js +372 -110
  36. package/src/engine/network/orchestrator/NetworkPeer.d.ts.map +1 -1
  37. package/src/engine/network/orchestrator/NetworkPeer.js +6 -1
  38. package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
  39. package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +9 -2
  40. package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
  41. package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +325 -140
  42. package/src/engine/network/sim/SimActionExecutor.d.ts +4 -1
  43. package/src/engine/network/sim/SimActionExecutor.d.ts.map +1 -1
  44. package/src/engine/network/sim/SimActionExecutor.js +65 -9
  45. package/src/engine/network/state/PredictionHistory.d.ts.map +1 -1
  46. package/src/engine/network/state/PredictionHistory.js +6 -1
  47. package/src/engine/network/time/AdaptiveRenderDelay.d.ts +25 -14
  48. package/src/engine/network/time/AdaptiveRenderDelay.d.ts.map +1 -1
  49. package/src/engine/network/time/AdaptiveRenderDelay.js +38 -20
  50. package/src/engine/network/time/RenderPlayout.d.ts +23 -3
  51. package/src/engine/network/time/RenderPlayout.d.ts.map +1 -1
  52. package/src/engine/network/time/RenderPlayout.js +40 -4
  53. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  54. package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.d.ts +5 -1
  55. package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.d.ts.map +1 -1
  56. package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.js +27 -1
  57. package/src/format/lut/cube/CubeLut.d.ts +38 -0
  58. package/src/format/lut/cube/CubeLut.d.ts.map +1 -0
  59. package/src/format/lut/cube/CubeLut.js +23 -0
  60. package/src/format/lut/cube/cube_read.d.ts +23 -0
  61. package/src/format/lut/cube/cube_read.d.ts.map +1 -0
  62. package/src/format/lut/cube/cube_read.js +199 -0
  63. package/src/format/lut/cube/cube_write.d.ts +15 -0
  64. package/src/format/lut/cube/cube_write.d.ts.map +1 -0
  65. package/src/format/lut/cube/cube_write.js +90 -0
  66. package/src/shade/device/shader/ShaderModuleCompiler.d.ts +2 -0
  67. package/src/shade/device/shader/ShaderModuleCompiler.d.ts.map +1 -1
  68. package/src/shade/device/shader/ShaderModuleCompiler.js +25 -2
  69. package/src/shade/playground/grass_surfaces/index.html +75 -0
  70. package/src/shade/playground/grass_surfaces/main.d.ts +2 -0
  71. package/src/shade/playground/grass_surfaces/main.d.ts.map +1 -0
  72. package/src/shade/playground/grass_surfaces/main.js +593 -0
  73. package/src/shade/playground/grass_surfaces/read_grass_surfaces.d.ts +62 -0
  74. package/src/shade/playground/grass_surfaces/read_grass_surfaces.d.ts.map +1 -0
  75. package/src/shade/playground/grass_surfaces/read_grass_surfaces.js +188 -0
  76. package/src/shade/playground/probe_clipmap/README.md +1 -0
  77. package/src/shade/playground/probe_clipmap/index.html +5 -0
  78. package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
  79. package/src/shade/playground/probe_clipmap/main.js +7 -0
  80. package/src/shade/playground/probe_clipmap_box/README.md +5 -1
  81. package/src/shade/playground/probe_clipmap_box/index.html +12 -0
  82. package/src/shade/playground/probe_clipmap_box/main.d.ts.map +1 -1
  83. package/src/shade/playground/probe_clipmap_box/main.js +15 -0
  84. package/src/shade/playground/probe_clipmap_box/scene.d.ts +8 -1
  85. package/src/shade/playground/probe_clipmap_box/scene.d.ts.map +1 -1
  86. package/src/shade/playground/probe_clipmap_box/scene.js +74 -6
  87. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  88. package/src/shade/renderer/Renderer.js +59 -55
  89. package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts +73 -4
  90. package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts.map +1 -1
  91. package/src/shade/renderer/deferred/tonemap/ColorGrade.js +113 -7
  92. package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.d.ts +12 -0
  93. package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.d.ts.map +1 -0
  94. package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.js +12 -0
  95. package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts +15 -1
  96. package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts.map +1 -1
  97. package/src/shade/renderer/deferred/tonemap/ToneMapper.js +31 -3
  98. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts +25 -0
  99. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts.map +1 -0
  100. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.js +51 -0
  101. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts +2 -2
  102. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts.map +1 -1
  103. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.js +6 -3
  104. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts +3 -2
  105. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts.map +1 -1
  106. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.js +7 -3
  107. package/src/shade/renderer/extension/ViewTextures.d.ts +12 -5
  108. package/src/shade/renderer/extension/ViewTextures.d.ts.map +1 -1
  109. package/src/shade/renderer/extension/ViewTextures.js +19 -5
  110. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +3 -1
  111. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts.map +1 -1
  112. package/src/shade/renderer/fluid/GPUFluidCascadeStack.js +6 -1
  113. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -0
  114. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts.map +1 -1
  115. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.js +10 -0
  116. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +7 -1
  117. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
  118. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +46 -15
  119. package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.d.ts +3 -2
  120. package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.d.ts.map +1 -1
  121. package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.js +3 -2
  122. package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.d.ts +22 -0
  123. package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.d.ts.map +1 -0
  124. package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.js +247 -0
  125. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +50 -0
  126. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
  127. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +101 -0
  128. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +2 -1
  129. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
  130. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +2 -1
  131. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +8 -0
  132. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts.map +1 -1
  133. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js +12 -0
  134. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +12 -6
  135. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
  136. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +35 -29
  137. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_clipmap.d.ts.map +1 -1
  138. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_clipmap.js +4 -2
  139. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_material.d.ts.map +1 -1
  140. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_material.js +6 -4
  141. package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.d.ts.map +1 -1
  142. package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.js +2 -1
  143. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.d.ts +6 -5
  144. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.d.ts.map +1 -1
  145. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.js +15 -14
  146. package/src/shade/renderer/global_illumination/probe_clipmap/material/shader_brick_material_gather.d.ts.map +1 -1
  147. package/src/shade/renderer/global_illumination/probe_clipmap/material/shader_brick_material_gather.js +4 -2
  148. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +19 -2
  149. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts.map +1 -1
  150. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.js +128 -10
  151. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts +19 -1
  152. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts.map +1 -1
  153. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.js +27 -2
  154. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts +19 -11
  155. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts.map +1 -1
  156. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.js +35 -11
  157. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts.map +1 -1
  158. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.js +3 -1
  159. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.d.ts +40 -0
  160. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.d.ts.map +1 -0
  161. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.js +174 -0
  162. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_material.d.ts +4 -4
  163. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_material.js +10 -10
  164. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.d.ts +31 -0
  165. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.d.ts.map +1 -0
  166. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.js +54 -0
  167. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts +8 -4
  168. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts.map +1 -1
  169. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.js +10 -21
  170. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts +7 -2
  171. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts.map +1 -1
  172. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.js +33 -29
  173. package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.d.ts +28 -0
  174. package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.d.ts.map +1 -0
  175. package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.js +138 -0
  176. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts +13 -9
  177. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts.map +1 -1
  178. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.js +18 -11
  179. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +1 -1
  180. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.d.ts.map +1 -1
  181. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.js +4 -2
  182. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.d.ts.map +1 -1
  183. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.js +2 -3
  184. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts +5 -3
  185. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts.map +1 -1
  186. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.js +15 -30
  187. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js +1 -1
  188. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
  189. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +4 -2
  190. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts +11 -0
  191. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts.map +1 -1
  192. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.js +29 -2
  193. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.d.ts +40 -0
  194. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.d.ts.map +1 -0
  195. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.js +126 -0
  196. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.d.ts +36 -0
  197. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.d.ts.map +1 -0
  198. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.js +221 -0
  199. package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.d.ts +40 -0
  200. package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.d.ts.map +1 -0
  201. package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.js +86 -0
  202. package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts +135 -0
  203. package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts.map +1 -0
  204. package/src/shade/renderer/grass/blade/GPUGrassBlades.js +676 -0
  205. package/src/shade/renderer/grass/blade/GRASS_BLADE.d.ts +145 -0
  206. package/src/shade/renderer/grass/blade/GRASS_BLADE.d.ts.map +1 -0
  207. package/src/shade/renderer/grass/blade/GRASS_BLADE.js +179 -0
  208. package/src/shade/renderer/grass/blade/chunk_grass_blade.d.ts +63 -0
  209. package/src/shade/renderer/grass/blade/chunk_grass_blade.d.ts.map +1 -0
  210. package/src/shade/renderer/grass/blade/chunk_grass_blade.js +244 -0
  211. package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.d.ts +58 -0
  212. package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.d.ts.map +1 -0
  213. package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.js +174 -0
  214. package/src/shade/renderer/grass/blade/grass_blade_id_draw.d.ts +25 -0
  215. package/src/shade/renderer/grass/blade/grass_blade_id_draw.d.ts.map +1 -0
  216. package/src/shade/renderer/grass/blade/grass_blade_id_draw.js +133 -0
  217. package/src/shade/renderer/grass/blade/grass_blade_mechanics.d.ts +80 -0
  218. package/src/shade/renderer/grass/blade/grass_blade_mechanics.d.ts.map +1 -0
  219. package/src/shade/renderer/grass/blade/grass_blade_mechanics.js +92 -0
  220. package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts +29 -0
  221. package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts.map +1 -0
  222. package/src/shade/renderer/grass/blade/grass_blade_resolve.js +175 -0
  223. package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.d.ts +14 -0
  224. package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.d.ts.map +1 -0
  225. package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.js +45 -0
  226. package/src/shade/renderer/grass/blade/shader_grass_blade_expand.d.ts +61 -0
  227. package/src/shade/renderer/grass/blade/shader_grass_blade_expand.d.ts.map +1 -0
  228. package/src/shade/renderer/grass/blade/shader_grass_blade_expand.js +340 -0
  229. package/src/shade/renderer/grass/blade/shader_grass_cell_count.d.ts +46 -0
  230. package/src/shade/renderer/grass/blade/shader_grass_cell_count.d.ts.map +1 -0
  231. package/src/shade/renderer/grass/blade/shader_grass_cell_count.js +280 -0
  232. package/src/shade/renderer/grass/population/chunk_grass_population.d.ts +60 -0
  233. package/src/shade/renderer/grass/population/chunk_grass_population.d.ts.map +1 -0
  234. package/src/shade/renderer/grass/population/chunk_grass_population.js +171 -0
  235. package/src/shade/renderer/grass/press/GPUGrassPress.d.ts +99 -0
  236. package/src/shade/renderer/grass/press/GPUGrassPress.d.ts.map +1 -0
  237. package/src/shade/renderer/grass/press/GPUGrassPress.js +436 -0
  238. package/src/shade/renderer/grass/press/GRASS_PRESS.d.ts +179 -0
  239. package/src/shade/renderer/grass/press/GRASS_PRESS.d.ts.map +1 -0
  240. package/src/shade/renderer/grass/press/GRASS_PRESS.js +217 -0
  241. package/src/shade/renderer/grass/press/chunk_grass_press.d.ts +65 -0
  242. package/src/shade/renderer/grass/press/chunk_grass_press.d.ts.map +1 -0
  243. package/src/shade/renderer/grass/press/chunk_grass_press.js +296 -0
  244. package/src/shade/renderer/grass/press/shader_grass_press_mark.d.ts +31 -0
  245. package/src/shade/renderer/grass/press/shader_grass_press_mark.d.ts.map +1 -0
  246. package/src/shade/renderer/grass/press/shader_grass_press_mark.js +169 -0
  247. package/src/shade/renderer/grass/press/shader_grass_press_stamp.d.ts +27 -0
  248. package/src/shade/renderer/grass/press/shader_grass_press_stamp.d.ts.map +1 -0
  249. package/src/shade/renderer/grass/press/shader_grass_press_stamp.js +183 -0
  250. package/src/shade/renderer/grass/surface/GPUGrassSurfaces.d.ts +193 -0
  251. package/src/shade/renderer/grass/surface/GPUGrassSurfaces.d.ts.map +1 -0
  252. package/src/shade/renderer/grass/surface/GPUGrassSurfaces.js +1253 -0
  253. package/src/shade/renderer/grass/surface/GRASS_SURFACE.d.ts +211 -0
  254. package/src/shade/renderer/grass/surface/GRASS_SURFACE.d.ts.map +1 -0
  255. package/src/shade/renderer/grass/surface/GRASS_SURFACE.js +241 -0
  256. package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.d.ts +82 -0
  257. package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.d.ts.map +1 -0
  258. package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.js +111 -0
  259. package/src/shade/renderer/grass/surface/chunk_grass_column_cross.d.ts +39 -0
  260. package/src/shade/renderer/grass/surface/chunk_grass_column_cross.d.ts.map +1 -0
  261. package/src/shade/renderer/grass/surface/chunk_grass_column_cross.js +85 -0
  262. package/src/shade/renderer/grass/surface/chunk_grass_directory.d.ts +29 -0
  263. package/src/shade/renderer/grass/surface/chunk_grass_directory.d.ts.map +1 -0
  264. package/src/shade/renderer/grass/surface/chunk_grass_directory.js +112 -0
  265. package/src/shade/renderer/grass/surface/chunk_grass_slot.d.ts +27 -0
  266. package/src/shade/renderer/grass/surface/chunk_grass_slot.d.ts.map +1 -0
  267. package/src/shade/renderer/grass/surface/chunk_grass_slot.js +50 -0
  268. package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.d.ts +21 -0
  269. package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.d.ts.map +1 -0
  270. package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.js +41 -0
  271. package/src/shade/renderer/grass/surface/chunk_grass_surface_window.d.ts +32 -0
  272. package/src/shade/renderer/grass/surface/chunk_grass_surface_window.d.ts.map +1 -0
  273. package/src/shade/renderer/grass/surface/chunk_grass_surface_window.js +136 -0
  274. package/src/shade/renderer/grass/surface/chunk_grass_surfel.d.ts +37 -0
  275. package/src/shade/renderer/grass/surface/chunk_grass_surfel.d.ts.map +1 -0
  276. package/src/shade/renderer/grass/surface/chunk_grass_surfel.js +85 -0
  277. package/src/shade/renderer/grass/surface/chunk_grass_tile.d.ts +25 -0
  278. package/src/shade/renderer/grass/surface/chunk_grass_tile.d.ts.map +1 -0
  279. package/src/shade/renderer/grass/surface/chunk_grass_tile.js +52 -0
  280. package/src/shade/renderer/grass/surface/shader_grass_directory_fill.d.ts +23 -0
  281. package/src/shade/renderer/grass/surface/shader_grass_directory_fill.d.ts.map +1 -0
  282. package/src/shade/renderer/grass/surface/shader_grass_directory_fill.js +87 -0
  283. package/src/shade/renderer/grass/surface/shader_grass_surface_bake.d.ts +43 -0
  284. package/src/shade/renderer/grass/surface/shader_grass_surface_bake.d.ts.map +1 -0
  285. package/src/shade/renderer/grass/surface/shader_grass_surface_bake.js +265 -0
  286. package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.d.ts +13 -0
  287. package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.d.ts.map +1 -0
  288. package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.js +49 -0
  289. package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.d.ts +62 -0
  290. package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.d.ts.map +1 -0
  291. package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.js +162 -0
  292. package/src/shade/renderer/grass/surface/shader_grass_surface_retire.d.ts +40 -0
  293. package/src/shade/renderer/grass/surface/shader_grass_surface_retire.d.ts.map +1 -0
  294. package/src/shade/renderer/grass/surface/shader_grass_surface_retire.js +155 -0
  295. package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.d.ts +19 -0
  296. package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.d.ts.map +1 -0
  297. package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.js +58 -0
  298. package/src/shade/renderer/grass/surface/shader_grass_surface_want.d.ts +30 -0
  299. package/src/shade/renderer/grass/surface/shader_grass_surface_want.d.ts.map +1 -0
  300. package/src/shade/renderer/grass/surface/shader_grass_surface_want.js +251 -0
  301. package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.d.ts +21 -0
  302. package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.d.ts.map +1 -0
  303. package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.js +75 -0
  304. package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.d.ts +35 -9
  305. package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.d.ts.map +1 -1
  306. package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.js +81 -11
  307. package/src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.d.ts.map +1 -1
  308. package/src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.js +4 -1
  309. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts.map +1 -1
  310. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js +4 -23
  311. package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.d.ts +12 -0
  312. package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.d.ts.map +1 -0
  313. package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.js +29 -0
  314. package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.d.ts.map +1 -1
  315. package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.js +22 -0
  316. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  317. package/src/shade/renderer/scene/GPUSceneContext.js +3 -0
  318. package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.d.ts +27 -0
  319. package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.d.ts.map +1 -0
  320. package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.js +38 -0
  321. package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.d.ts +28 -0
  322. package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.d.ts.map +1 -0
  323. package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.js +58 -0
  324. package/src/shade/renderer/scene/SCENE_DATABASE_SPEC.d.ts.map +1 -1
  325. package/src/shade/renderer/scene/SCENE_DATABASE_SPEC.js +8 -0
  326. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts +6 -0
  327. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts.map +1 -1
  328. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.js +7 -0
  329. package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts +4 -4
  330. package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts.map +1 -1
  331. package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.js +86 -5
  332. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts +65 -0
  333. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts.map +1 -0
  334. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.js +136 -0
  335. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts +37 -0
  336. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts.map +1 -0
  337. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.js +148 -0
  338. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.d.ts +20 -0
  339. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.d.ts.map +1 -0
  340. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.js +169 -0
  341. package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.d.ts +18 -0
  342. package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.d.ts.map +1 -1
  343. package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.js +28 -0
  344. package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.d.ts +13 -0
  345. package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.d.ts.map +1 -0
  346. package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.js +22 -0
  347. package/src/shade/renderer/water/GPUWaterRenderer.d.ts.map +1 -1
  348. package/src/shade/renderer/water/GPUWaterRenderer.js +4 -0
  349. package/src/shade/renderer/wind/GPUSceneWind.d.ts +52 -5
  350. package/src/shade/renderer/wind/GPUSceneWind.d.ts.map +1 -1
  351. package/src/shade/renderer/wind/GPUSceneWind.js +164 -8
  352. package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.d.ts +3 -1
  353. package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.d.ts.map +1 -1
  354. package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.js +3 -1
  355. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts +2 -1
  356. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts.map +1 -1
  357. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.js +18 -13
  358. package/src/shade/renderer/wind/chunk_wind_field_sample_previous.d.ts +13 -0
  359. package/src/shade/renderer/wind/chunk_wind_field_sample_previous.d.ts.map +1 -0
  360. package/src/shade/renderer/wind/chunk_wind_field_sample_previous.js +23 -0
  361. package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.d.ts +1 -0
  362. package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.d.ts.map +1 -1
  363. package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.js +6 -1
  364. package/src/shade/renderer/wind/wind_field_add_resources.d.ts +11 -0
  365. package/src/shade/renderer/wind/wind_field_add_resources.d.ts.map +1 -1
  366. package/src/shade/renderer/wind/wind_field_add_resources.js +15 -0
  367. package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +1 -1
  368. package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
  369. package/src/shade/wgsl/emulator/WGSLLanguageCore.js +2 -0
  370. package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.d.ts +0 -11
  371. package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.d.ts.map +0 -1
  372. package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.js +0 -56
@@ -0,0 +1,136 @@
1
+ import { CodeChunk } from "../../../../compiler/CodeChunk.js";
2
+
3
+ /**
4
+ * Rec.709 photopic luminance weights: what the cones see of a linear Rec.709 colour.
5
+ * @type {ReadonlyArray<number>}
6
+ */
7
+ export const PURKINJE_REC709_PHOTOPIC = Object.freeze([0.2126, 0.7152, 0.0722]);
8
+
9
+ /**
10
+ * Rec.709 scotopic luminance weights: what the rods see of a linear Rec.709 colour. They sum to 1, so a grey has the
11
+ * same scotopic luminance as photopic.
12
+ * @type {ReadonlyArray<number>}
13
+ */
14
+ export const PURKINJE_REC709_SCOTOPIC = Object.freeze([0.0070, 0.5190, 0.4740]);
15
+
16
+ /**
17
+ * "Rod blue": the colour the scotopic signal is carried by. Artistic: (0.3, 0.5, 0.9) mimics the sensation of the
18
+ * rods' 507 nm peak.
19
+ * @type {ReadonlyArray<number>}
20
+ */
21
+ export const PURKINJE_NIGHT_TINT = Object.freeze([0.3, 0.5, 0.9]);
22
+
23
+ /**
24
+ * CIE 191's mesopic range, cd/m²: rods alone below the lower bound (scotopic), cones alone above the upper (photopic).
25
+ */
26
+ export const PURKINJE_MESOPIC_MIN_NITS = 0.005;
27
+ export const PURKINJE_MESOPIC_MAX_NITS = 5;
28
+
29
+ /**
30
+ * The least adaptation the share is read at, cd/m²: under it, the rods alone see, as they do at the bound itself.
31
+ */
32
+ const ADAPTATION_FLOOR_NITS = 1e-5;
33
+
34
+ /**
35
+ * How much of the eye's response is the rods', at an adaptation: 1 at and below {@link PURKINJE_MESOPIC_MIN_NITS}, 0 at
36
+ * and above {@link PURKINJE_MESOPIC_MAX_NITS}, linear in log luminance in between. The share `apply_purkinje_shift`
37
+ * blends by, for code that needs it on the CPU.
38
+ *
39
+ * @param {number} adaptation_luminance cd/m²
40
+ * @returns {number} 0 to 1
41
+ */
42
+ export function purkinje_rod_share(adaptation_luminance) {
43
+ const low = Math.log(PURKINJE_MESOPIC_MIN_NITS);
44
+ const high = Math.log(PURKINJE_MESOPIC_MAX_NITS);
45
+ const t = (Math.log(Math.max(adaptation_luminance, ADAPTATION_FLOOR_NITS)) - low) / (high - low);
46
+
47
+ return 1 - Math.min(1, Math.max(0, t));
48
+ }
49
+
50
+ /**
51
+ * @param {number} value
52
+ * @returns {string} as a WGSL float literal, with a point
53
+ */
54
+ function wgsl_float(value) {
55
+ const text = String(value);
56
+ return /[.e]/.test(text) ? text : `${text}.0`;
57
+ }
58
+
59
+ /**
60
+ * @param {ReadonlyArray<number>} v
61
+ * @returns {string}
62
+ */
63
+ function wgsl_vec3(v) {
64
+ return `vec3<f32>(${v.map(wgsl_float).join(", ")})`;
65
+ }
66
+
67
+ /**
68
+ * Purkinje shift.
69
+ * Human vision system shifts color perception away from red in night-time conditions.
70
+ *
71
+ * ```wgsl
72
+ * fn apply_purkinje_shift(color_rec709: vec3<f32>, adaptation_luminance: f32) -> vec3<f32>
73
+ * fn purkinje_rod_share(adaptation_luminance: f32) -> f32
74
+ * ```
75
+ *
76
+ * `color_rec709` is scene-linear Rec.709; `adaptation_luminance` is the luminance the eye is adapted to, cd/m². Above
77
+ * 5 cd/m² the colour is returned as it is; below 0.005 cd/m² it is the rod response alone, its scotopic luminance
78
+ * carried by a blue tint; in between the two blend linearly in log luminance, by `purkinje_rod_share`. The shift is
79
+ * linear in the colour, so it gives the same result ahead of the exposure as after it.
80
+ *
81
+ * The constants are the module's exports ({@link PURKINJE_REC709_SCOTOPIC} and the rest), and
82
+ * {@link purkinje_rod_share} is the share on the CPU.
83
+ *
84
+ * NOTE: this should go before the tonemapper.
85
+ *
86
+ * Notes on deriving it from the rod and cone responses: PURKINJE_PHYSICAL_DERIVATION_NOTES.md, beside this file.
87
+ *
88
+ * @see J. Patry, "Real-Time Samurai Cinema: Lighting, Atmosphere, and Tonemapping in Ghost of Tsushima", Advances in
89
+ * Real-Time Rendering in Games, SIGGRAPH 2021 — the primary reference.
90
+ * https://www.advances.realtimerendering.com/s2021/jpatry_advances2021/index.html
91
+ * @see A. G. Kirk, J. F. O'Brien, "Perceptually based tone mapping for low-light conditions", ACM TOG 30(4), 2011.
92
+ * https://www2.eecs.berkeley.edu/Pubs/TechRpts/2011/EECS-2011-91.pdf
93
+ * @see D. Cao, J. Pokorny, V. C. Smith, A. J. Zele, "Rod contributions to color perception: linear with rod
94
+ * contrast", Vision Research 48(26), 2008.
95
+ *
96
+ * @type {CodeChunk}
97
+ */
98
+ export const chunk_apply_purkinje_shift = CodeChunk.from(
99
+ //language=WGSL
100
+ `
101
+ const PURKINJE_REC709_PHOTOPIC = ${wgsl_vec3(PURKINJE_REC709_PHOTOPIC)}; // Day (Cones)
102
+ const PURKINJE_REC709_SCOTOPIC = ${wgsl_vec3(PURKINJE_REC709_SCOTOPIC)}; // Night (Rods) - Validated
103
+ const PURKINJE_NIGHT_TINT = ${wgsl_vec3(PURKINJE_NIGHT_TINT)};
104
+ const PURKINJE_MESOPIC_MIN_NITS = ${wgsl_float(PURKINJE_MESOPIC_MIN_NITS)}; // Rods dominate below this
105
+ const PURKINJE_MESOPIC_MAX_NITS = ${wgsl_float(PURKINJE_MESOPIC_MAX_NITS)}; // Cones dominate above this
106
+
107
+ // how much of the response is the rods', linear in log luminance across the mesopic range: a perceptually linear
108
+ // transition
109
+ fn purkinje_rod_share(adaptation_luminance: f32) -> f32 {
110
+ let logLum = log(max(adaptation_luminance, ${wgsl_float(ADAPTATION_FLOOR_NITS)}));
111
+
112
+ const logLow = log(PURKINJE_MESOPIC_MIN_NITS);
113
+ const logHigh = log(PURKINJE_MESOPIC_MAX_NITS);
114
+ const logDelta = logHigh - logLow;
115
+
116
+ return 1.0 - saturate( (logLum - logLow) / logDelta );
117
+ }
118
+
119
+ fn apply_purkinje_shift(
120
+ color_rec709: vec3<f32>,
121
+ adaptation_luminance: f32
122
+ ) -> vec3<f32>{
123
+ // 1. Calculate Rod Luminance (Night)
124
+ // Note: Red objects will have a near-zero Y_night, making them turn black.
125
+ // Blue objects will have a high Y_night, making them appear brighter.
126
+ let Y_night = dot(color_rec709, PURKINJE_REC709_SCOTOPIC);
127
+
128
+ // 2. Construct the Night Vision Image
129
+ // We treat the rod signal as a scalar intensity applied to our blue tint
130
+ let color_night = Y_night * PURKINJE_NIGHT_TINT;
131
+
132
+ // 3. Lerp from Day view to Night view, by the rods' share at the adaptation
133
+ return mix(color_rec709, color_night, purkinje_rod_share(adaptation_luminance));
134
+ }
135
+ `
136
+ );
@@ -0,0 +1,37 @@
1
+ /**
2
+ * What {@link chunk_ray_query_nearest_among}'s hook answers for an instance the ray passes by: the
3
+ * engine's one "no index" word, which no geometry reaches.
4
+ *
5
+ * @type {number}
6
+ */
7
+ export const RAY_QUERY_AMONG_PASS: number;
8
+ /**
9
+ * The nearest hit of a ray among the scene's instances the enclosing shader chooses, each traced as the
10
+ * geometry that shader names for it.
11
+ *
12
+ * ```wgsl
13
+ * fn ray_query_nearest_among(ray: Ray) -> RayHitInfo
14
+ * ```
15
+ *
16
+ * The walk over the scene's TLAS is `ray_query_nearest`'s. An instance the ray's reach meets is put to the
17
+ * hook before its geometry is entered, so an instance the hook passes by costs its box test and the hook,
18
+ * and none of its triangles.
19
+ *
20
+ * A hit holds the world distance in `t` (negative for a miss), the instance's `meshes` row in `instance`,
21
+ * the geometry that was traced in `geometry`, and `triangle` and `barycentrics` in that geometry.
22
+ *
23
+ * ## The seam: one function the enclosing shader defines
24
+ *
25
+ * - `fn ray_query_among_geometry(mesh: u32) -> u32` is asked about the instance at `meshes` row `mesh`,
26
+ * and answers with the geometry to trace for it, or `RAY_QUERY_AMONG_PASS` to pass it by. An instance
27
+ * traced as a geometry other than its own (a stand-in) is traced under the instance's own transform.
28
+ *
29
+ * The enclosing shader binds what `ray_query_nearest` reads: `tlas`, `scene_database` and the BLAS
30
+ * buffers. The ray's direction is unit length. The TLAS must hold a tree: an empty one
31
+ * (`tlas.root == BVH_NULL_NODE`) is the caller's to turn away.
32
+ *
33
+ * @type {CodeChunk}
34
+ */
35
+ export const chunk_ray_query_nearest_among: CodeChunk;
36
+ import { CodeChunk } from "../../../compiler/CodeChunk.js";
37
+ //# sourceMappingURL=chunk_ray_query_nearest_among.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_ray_query_nearest_among.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.js"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,mCAFU,MAAM,CAE+B;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,4CAFU,SAAS,CAsGjB;0BAjJwB,gCAAgC"}
@@ -0,0 +1,148 @@
1
+ import { UINT32_MAX } from "../../../../../../core/binary/UINT32_MAX.js";
2
+ import { TRANSFORMS_TABLE } from "../../../../scene/chunk_scene_database_access.js";
3
+ import { CodeChunk } from "../../../compiler/CodeChunk.js";
4
+ import { BVH_NULL_NODE_DEFINITION } from "../../bvh/BVH_NULL_NODE_DEFINITION.js";
5
+ import { BVH_TRAVERSAL_STACK_SIZE } from "../../bvh/BVH_TRAVERSAL_STACK_SIZE.js";
6
+ import { chunk_aabb3_intersects_ray } from "../aabb3/chunk_aabb3_intersects_ray.js";
7
+ import { chunk_mat4_inverse } from "../mat4/chunk_mat4_inverse.js";
8
+ import { chunk_ray_query_blas_nearest } from "./chunk_ray_query_blas_nearest.js";
9
+ import { chunk_ray_transform_m4 } from "./chunk_ray_transform_m4.js";
10
+ import { RAY_HIT_INFO } from "./RAY_HIT_INFO.js";
11
+ import { RAY_STRUCT } from "./RAY_STRUCT.js";
12
+
13
+ /**
14
+ * What {@link chunk_ray_query_nearest_among}'s hook answers for an instance the ray passes by: the
15
+ * engine's one "no index" word, which no geometry reaches.
16
+ *
17
+ * @type {number}
18
+ */
19
+ export const RAY_QUERY_AMONG_PASS = UINT32_MAX;
20
+
21
+ /**
22
+ * The nearest hit of a ray among the scene's instances the enclosing shader chooses, each traced as the
23
+ * geometry that shader names for it.
24
+ *
25
+ * ```wgsl
26
+ * fn ray_query_nearest_among(ray: Ray) -> RayHitInfo
27
+ * ```
28
+ *
29
+ * The walk over the scene's TLAS is `ray_query_nearest`'s. An instance the ray's reach meets is put to the
30
+ * hook before its geometry is entered, so an instance the hook passes by costs its box test and the hook,
31
+ * and none of its triangles.
32
+ *
33
+ * A hit holds the world distance in `t` (negative for a miss), the instance's `meshes` row in `instance`,
34
+ * the geometry that was traced in `geometry`, and `triangle` and `barycentrics` in that geometry.
35
+ *
36
+ * ## The seam: one function the enclosing shader defines
37
+ *
38
+ * - `fn ray_query_among_geometry(mesh: u32) -> u32` is asked about the instance at `meshes` row `mesh`,
39
+ * and answers with the geometry to trace for it, or `RAY_QUERY_AMONG_PASS` to pass it by. An instance
40
+ * traced as a geometry other than its own (a stand-in) is traced under the instance's own transform.
41
+ *
42
+ * The enclosing shader binds what `ray_query_nearest` reads: `tlas`, `scene_database` and the BLAS
43
+ * buffers. The ray's direction is unit length. The TLAS must hold a tree: an empty one
44
+ * (`tlas.root == BVH_NULL_NODE`) is the caller's to turn away.
45
+ *
46
+ * @type {CodeChunk}
47
+ */
48
+ export const chunk_ray_query_nearest_among = CodeChunk.from(
49
+ //language=WGSL
50
+ `
51
+ const RAY_QUERY_AMONG_PASS: u32 = ${RAY_QUERY_AMONG_PASS}u;
52
+
53
+ fn ray_query_nearest_among(
54
+ ray: ${RAY_STRUCT.wgsl_ref},
55
+ ) -> ${RAY_HIT_INFO.wgsl_ref} {
56
+ var stack = array<u32, ${BVH_TRAVERSAL_STACK_SIZE}>();
57
+
58
+ var node_index = tlas.root;
59
+ var pointer = 1u;
60
+
61
+ let direction_rcp = 1.0 / ray.direction;
62
+
63
+ var best_hit: ${RAY_HIT_INFO.wgsl_ref};
64
+ best_hit.t = -1.0;
65
+
66
+ var global_ray = ray;
67
+
68
+ for (; pointer > 0u && pointer <= ${BVH_TRAVERSAL_STACK_SIZE}u;) {
69
+
70
+ let node = tlas.nodes[node_index];
71
+
72
+ if (!aabb3_intersects_ray(node.bounds, global_ray.origin, direction_rcp, global_ray.tmax)) {
73
+ pointer--;
74
+ node_index = stack[pointer];
75
+
76
+ continue;
77
+ }
78
+
79
+ let child_1 = node.child_1;
80
+ let child_2 = node.child_2;
81
+
82
+ if (child_1 != BVH_NULL_NODE) {
83
+ // an inner node
84
+ node_index = child_1;
85
+
86
+ stack[pointer] = child_2;
87
+
88
+ pointer++;
89
+
90
+ continue;
91
+ }
92
+
93
+ pointer--;
94
+ node_index = stack[pointer];
95
+
96
+ // a leaf: child_2 is the instance's meshes row
97
+ let mesh_id = child_2;
98
+
99
+ let geometry_id = ray_query_among_geometry(mesh_id);
100
+
101
+ if (geometry_id == RAY_QUERY_AMONG_PASS) {
102
+ continue;
103
+ }
104
+
105
+ // a mesh row and its transforms row are the same row
106
+ let global = ${TRANSFORMS_TABLE.marshalling_method_read_field('global')}(&scene_database, mesh_id);
107
+
108
+ let local_ray = ray_transform_m4(global_ray, mat4_inverse(global));
109
+
110
+ let hit = ray_query_blas_nearest(local_ray, geometry_id, &stack, pointer);
111
+
112
+ if (hit.t < 0.0) {
113
+ continue;
114
+ }
115
+
116
+ let local_hit_position = local_ray.origin + local_ray.direction * hit.t;
117
+
118
+ let global_hit_position = global * vec4(local_hit_position, 1.0);
119
+
120
+ let reach = distance(global_ray.origin, global_hit_position.xyz / global_hit_position.w);
121
+
122
+ if (reach >= global_ray.tmax) {
123
+ continue;
124
+ }
125
+
126
+ global_ray.tmax = reach;
127
+
128
+ best_hit = hit;
129
+
130
+ best_hit.t = reach;
131
+ best_hit.instance = mesh_id;
132
+ best_hit.geometry = geometry_id;
133
+ }
134
+
135
+ return best_hit;
136
+ }
137
+ `,
138
+ [
139
+ RAY_STRUCT.declaration_chunk,
140
+ RAY_HIT_INFO.declaration_chunk,
141
+ BVH_NULL_NODE_DEFINITION,
142
+ chunk_ray_transform_m4,
143
+ chunk_aabb3_intersects_ray,
144
+ chunk_ray_query_blas_nearest,
145
+ chunk_mat4_inverse,
146
+ TRANSFORMS_TABLE.chunk_read_field('global'),
147
+ ]
148
+ );
@@ -0,0 +1,20 @@
1
+ /**
2
+ * `shape_record_line_span(kind, parameters, origin, direction) -> vec2<f32>`: the part of a line a core
3
+ * shape record holds, in the record's own local frame. The line is `origin + t · direction`,
4
+ * `direction` unit; the answer is the `t` it enters the shape at and the `t` it leaves at. A line that
5
+ * misses answers a span whose first is greater than its second. Every kind is convex, so the part is
6
+ * one span; a half-space's is open on one side, to `±F32_MAX`, and so may a hull's be.
7
+ *
8
+ * `kind` and `parameters` are as `shape_record_signed_distance` takes them, and the span is where that
9
+ * distance is at most zero along the line.
10
+ *
11
+ * ## Seam
12
+ *
13
+ * A hull's planes come through `shape_record_plane(index)`, which the enclosing shader defines (see
14
+ * `chunk_shape_record_signed_distance`); at most `SHAPE_RECORD_HULL_PLANE_LIMIT` of them are read.
15
+ *
16
+ * @type {CodeChunk}
17
+ */
18
+ export const chunk_shape_record_line_span: CodeChunk;
19
+ import { CodeChunk } from "../../compiler/CodeChunk.js";
20
+ //# sourceMappingURL=chunk_shape_record_line_span.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_shape_record_line_span.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AACH,2CAFU,SAAS,CAqJjB;0BAxKwB,6BAA6B"}
@@ -0,0 +1,169 @@
1
+ import { CodeChunk } from "../../compiler/CodeChunk.js";
2
+ import { F32_MAX_DEFINITION } from "../math/F32_MAX_DEFINITION.js";
3
+ import { chunk_shape_record_kind } from "./chunk_shape_record_kind.js";
4
+
5
+ /**
6
+ * `shape_record_line_span(kind, parameters, origin, direction) -> vec2<f32>`: the part of a line a core
7
+ * shape record holds, in the record's own local frame. The line is `origin + t · direction`,
8
+ * `direction` unit; the answer is the `t` it enters the shape at and the `t` it leaves at. A line that
9
+ * misses answers a span whose first is greater than its second. Every kind is convex, so the part is
10
+ * one span; a half-space's is open on one side, to `±F32_MAX`, and so may a hull's be.
11
+ *
12
+ * `kind` and `parameters` are as `shape_record_signed_distance` takes them, and the span is where that
13
+ * distance is at most zero along the line.
14
+ *
15
+ * ## Seam
16
+ *
17
+ * A hull's planes come through `shape_record_plane(index)`, which the enclosing shader defines (see
18
+ * `chunk_shape_record_signed_distance`); at most `SHAPE_RECORD_HULL_PLANE_LIMIT` of them are read.
19
+ *
20
+ * @type {CodeChunk}
21
+ */
22
+ export const chunk_shape_record_line_span = CodeChunk.from(
23
+ //language=WGSL
24
+ `
25
+ const SHAPE_RECORD_LINE_MISS = vec2<f32>(F32_MAX, -F32_MAX);
26
+
27
+ // two spans' common part
28
+ fn shape_record_span_meet(a: vec2<f32>, b: vec2<f32>) -> vec2<f32> {
29
+ return vec2<f32>(max(a.x, b.x), min(a.y, b.y));
30
+ }
31
+
32
+ // the least span that holds both of two spans, either of which may be a miss
33
+ fn shape_record_span_join(a: vec2<f32>, b: vec2<f32>) -> vec2<f32> {
34
+ if (a.x > a.y) {
35
+ return b;
36
+ }
37
+
38
+ if (b.x > b.y) {
39
+ return a;
40
+ }
41
+
42
+ return vec2<f32>(min(a.x, b.x), max(a.y, b.y));
43
+ }
44
+
45
+ // where o + t·d is at most half from zero, along one axis
46
+ fn shape_record_line_slab(o: f32, d: f32, half: f32) -> vec2<f32> {
47
+ if (d == 0.0) {
48
+ if (abs(o) <= half) {
49
+ return vec2<f32>(-F32_MAX, F32_MAX);
50
+ }
51
+
52
+ return SHAPE_RECORD_LINE_MISS;
53
+ }
54
+
55
+ let a = (-half - o) / d;
56
+ let b = (half - o) / d;
57
+
58
+ return vec2<f32>(min(a, b), max(a, b));
59
+ }
60
+
61
+ // where n·(o + t·d) is at most offset
62
+ fn shape_record_line_half_space(o: vec3<f32>, d: vec3<f32>, plane: vec4<f32>) -> vec2<f32> {
63
+ let slope = dot(plane.xyz, d);
64
+ let height = dot(plane.xyz, o) - plane.w;
65
+
66
+ if (slope == 0.0) {
67
+ if (height <= 0.0) {
68
+ return vec2<f32>(-F32_MAX, F32_MAX);
69
+ }
70
+
71
+ return SHAPE_RECORD_LINE_MISS;
72
+ }
73
+
74
+ let t = -height / slope;
75
+
76
+ if (slope > 0.0) {
77
+ return vec2<f32>(-F32_MAX, t);
78
+ }
79
+
80
+ return vec2<f32>(t, F32_MAX);
81
+ }
82
+
83
+ // where o + t·d is within radius of the origin, o and d of any dimension's worth: |d|² is a, o·d is b
84
+ fn shape_record_line_round(a: f32, b: f32, c: f32) -> vec2<f32> {
85
+ if (a == 0.0) {
86
+ if (c <= 0.0) {
87
+ return vec2<f32>(-F32_MAX, F32_MAX);
88
+ }
89
+
90
+ return SHAPE_RECORD_LINE_MISS;
91
+ }
92
+
93
+ let discriminant = b * b - a * c;
94
+
95
+ if (discriminant < 0.0) {
96
+ return SHAPE_RECORD_LINE_MISS;
97
+ }
98
+
99
+ let root = sqrt(discriminant);
100
+
101
+ return vec2<f32>((-b - root) / a, (-b + root) / a);
102
+ }
103
+
104
+ fn shape_record_line_sphere(o: vec3<f32>, d: vec3<f32>, radius: f32) -> vec2<f32> {
105
+ return shape_record_line_round(dot(d, d), dot(o, d), dot(o, o) - radius * radius);
106
+ }
107
+
108
+ // a cylinder about Y, of a radius and a height, centred on the origin
109
+ fn shape_record_line_cylinder(o: vec3<f32>, d: vec3<f32>, radius: f32, height: f32) -> vec2<f32> {
110
+ let around = shape_record_line_round(dot(d.xz, d.xz), dot(o.xz, d.xz), dot(o.xz, o.xz) - radius * radius);
111
+
112
+ return shape_record_span_meet(around, shape_record_line_slab(o.y, d.y, height * 0.5));
113
+ }
114
+
115
+ fn shape_record_line_span(kind: u32, parameters: vec4<f32>, origin: vec3<f32>, direction: vec3<f32>) -> vec2<f32> {
116
+ if (kind == SHAPE_RECORD_SPHERE) {
117
+ return shape_record_line_sphere(origin, direction, parameters.x);
118
+ }
119
+
120
+ if (kind == SHAPE_RECORD_CAPSULE) {
121
+ // a cylinder with a ball on each end: convex, so the line's part is the span over the three
122
+ let end = vec3<f32>(0.0, parameters.y * 0.5, 0.0);
123
+
124
+ var span = shape_record_line_cylinder(origin, direction, parameters.x, parameters.y);
125
+
126
+ span = shape_record_span_join(span, shape_record_line_sphere(origin - end, direction, parameters.x));
127
+ span = shape_record_span_join(span, shape_record_line_sphere(origin + end, direction, parameters.x));
128
+
129
+ return span;
130
+ }
131
+
132
+ if (kind == SHAPE_RECORD_BOX) {
133
+ var span = shape_record_line_slab(origin.x, direction.x, parameters.x);
134
+
135
+ span = shape_record_span_meet(span, shape_record_line_slab(origin.y, direction.y, parameters.y));
136
+ span = shape_record_span_meet(span, shape_record_line_slab(origin.z, direction.z, parameters.z));
137
+
138
+ return span;
139
+ }
140
+
141
+ if (kind == SHAPE_RECORD_CYLINDER) {
142
+ return shape_record_line_cylinder(origin, direction, parameters.x, parameters.y);
143
+ }
144
+
145
+ if (kind == SHAPE_RECORD_PLANE) {
146
+ return shape_record_line_half_space(origin, direction, parameters);
147
+ }
148
+
149
+ // SHAPE_RECORD_CONVEX_HULL: what every one of its planes leaves
150
+ let first = u32(parameters.x);
151
+ let count = u32(parameters.y);
152
+
153
+ var span = vec2<f32>(-F32_MAX, F32_MAX);
154
+
155
+ for (var i = 0u; i < SHAPE_RECORD_HULL_PLANE_LIMIT; i++) {
156
+ if (i >= count) {
157
+ break;
158
+ }
159
+
160
+ span = shape_record_span_meet(span, shape_record_line_half_space(origin, direction, shape_record_plane(first + i)));
161
+ }
162
+
163
+ return span;
164
+ }
165
+ `, [
166
+ chunk_shape_record_kind,
167
+ F32_MAX_DEFINITION,
168
+ ]
169
+ );
@@ -16,5 +16,23 @@
16
16
  * @type {CodeChunk}
17
17
  */
18
18
  export const chunk_tile_atlas_slot_origin: CodeChunk;
19
+ /**
20
+ * {@link chunk_tile_atlas_slot_origin} for a footprint of powers of two, given as shifts: what a reader
21
+ * on a hot path takes. `shift` is `tile_atlas_slot_shift(slots_x, slots_y)`, which the host passes in
22
+ * immediate data, so a slot is placed with masks and shifts alone, neither a texture query nor a
23
+ * divide in front of the fetch it addresses.
24
+ *
25
+ * Measured on the brick clipmap's trace (probe and camera rays, RTX 4090 and an RDNA2 iGPU,
26
+ * 2026-11-11), against the footprint from `textureDimensions` and `index_to_grid3d`: 6-7% faster on
27
+ * the 4090, 9.5-15% on the iGPU. The same shifts from a uniform measure the same.
28
+ *
29
+ * ```wgsl
30
+ * fn tile_atlas_slot_origin_shift(slot: u32, shift: u32, tile_size: vec3<u32>) -> vec3<u32>
31
+ * ```
32
+ *
33
+ * @see tile_atlas_slot_shift
34
+ * @type {CodeChunk}
35
+ */
36
+ export const chunk_tile_atlas_slot_origin_shift: CodeChunk;
19
37
  import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
20
38
  //# sourceMappingURL=chunk_tile_atlas_slot_origin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_tile_atlas_slot_origin.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,2CAFU,SAAS,CAWjB;0BA5BwB,oCAAoC"}
1
+ {"version":3,"file":"chunk_tile_atlas_slot_origin.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,2CAFU,SAAS,CAWjB;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,iDAFU,SAAS,CAWhB;0BAxDuB,oCAAoC"}
@@ -28,3 +28,31 @@ fn tile_atlas_slot_origin(slot: u32, slots: vec2<u32>, tile_size: vec3<u32>) ->
28
28
  chunk_index_to_grid3d,
29
29
  ]
30
30
  );
31
+
32
+ /**
33
+ * {@link chunk_tile_atlas_slot_origin} for a footprint of powers of two, given as shifts: what a reader
34
+ * on a hot path takes. `shift` is `tile_atlas_slot_shift(slots_x, slots_y)`, which the host passes in
35
+ * immediate data, so a slot is placed with masks and shifts alone, neither a texture query nor a
36
+ * divide in front of the fetch it addresses.
37
+ *
38
+ * Measured on the brick clipmap's trace (probe and camera rays, RTX 4090 and an RDNA2 iGPU,
39
+ * 2026-11-11), against the footprint from `textureDimensions` and `index_to_grid3d`: 6-7% faster on
40
+ * the 4090, 9.5-15% on the iGPU. The same shifts from a uniform measure the same.
41
+ *
42
+ * ```wgsl
43
+ * fn tile_atlas_slot_origin_shift(slot: u32, shift: u32, tile_size: vec3<u32>) -> vec3<u32>
44
+ * ```
45
+ *
46
+ * @see tile_atlas_slot_shift
47
+ * @type {CodeChunk}
48
+ */
49
+ export const chunk_tile_atlas_slot_origin_shift = CodeChunk.from(
50
+ //language=WGSL
51
+ `
52
+ fn tile_atlas_slot_origin_shift(slot: u32, shift: u32, tile_size: vec3<u32>) -> vec3<u32> {
53
+ let sx = shift & 0xffffu;
54
+ let sy = shift >> 16u;
55
+
56
+ return vec3<u32>(slot & ((1u << sx) - 1u), (slot >> sx) & ((1u << sy) - 1u), slot >> (sx + sy)) * tile_size;
57
+ }
58
+ `);
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A {@link GPUTileAtlas3D}'s footprint as `tile_atlas_slot_origin_shift` takes it: `log2 slots_x` in the
3
+ * low 16 bits, `log2 slots_y` in the high 16, one `u32` for a shader's immediate data.
4
+ *
5
+ * An atlas whose footprint starts at powers of two keeps them: a widen doubles a side, capped at a
6
+ * power of two of tiles for a power-of-two tile under a power-of-two `maxTextureDimension3D`.
7
+ *
8
+ * @param {number} slots_x tiles along x, a power of two
9
+ * @param {number} slots_y tiles along y, a power of two
10
+ * @returns {number}
11
+ */
12
+ export function tile_atlas_slot_shift(slots_x: number, slots_y: number): number;
13
+ //# sourceMappingURL=tile_atlas_slot_shift.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tile_atlas_slot_shift.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/atlas/tile_atlas_slot_shift.js"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,+CAJW,MAAM,WACN,MAAM,GACJ,MAAM,CASlB"}
@@ -0,0 +1,22 @@
1
+ import { assert } from "../../../../core/assert.js";
2
+ import { isPowerOfTwo } from "../../../../core/math/isPowerOfTwo.js";
3
+
4
+ /**
5
+ * A {@link GPUTileAtlas3D}'s footprint as `tile_atlas_slot_origin_shift` takes it: `log2 slots_x` in the
6
+ * low 16 bits, `log2 slots_y` in the high 16, one `u32` for a shader's immediate data.
7
+ *
8
+ * An atlas whose footprint starts at powers of two keeps them: a widen doubles a side, capped at a
9
+ * power of two of tiles for a power-of-two tile under a power-of-two `maxTextureDimension3D`.
10
+ *
11
+ * @param {number} slots_x tiles along x, a power of two
12
+ * @param {number} slots_y tiles along y, a power of two
13
+ * @returns {number}
14
+ */
15
+ export function tile_atlas_slot_shift(slots_x, slots_y) {
16
+ assert.isPositiveInteger(slots_x, 'slots_x');
17
+ assert.isPositiveInteger(slots_y, 'slots_y');
18
+ assert.ok(isPowerOfTwo(slots_x), `slots_x ${slots_x} must be a power of two`);
19
+ assert.ok(isPowerOfTwo(slots_y), `slots_y ${slots_y} must be a power of two`);
20
+
21
+ return (31 - Math.clz32(slots_x)) | ((31 - Math.clz32(slots_y)) << 16);
22
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"GPUWaterRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/water/GPUWaterRenderer.js"],"names":[],"mappings":"AAsBA,sFAAsF;AACtF;IACI,WAAa;IACb,mBAAe;IACf,yBAAqB;IACrB,aAAS;IACT,WAAa;IACb;;;;;;;;;;;MAE6B;IAmB7B;;;OAGG;IACH;;;;;MAA8F;IAC9F;;;OAGG;IACH,wBAAyD;IAMzD,oCAIC;IAED,8FAA8F;IAC9F,qCAgBC;IAED,gBASC;IAuDD;;;;;;;;;;;;;;;;;;MA2IC;IAQD;;;;;YAMC;IAED;;;;;;;;;;MAOC;IAED;;;;;;;;;;;;;;MAwBC;IAED,gGAAgG;IAChG,mEAYC;;CAyBJ;gCAzX+B,uCAAuC"}
1
+ {"version":3,"file":"GPUWaterRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/water/GPUWaterRenderer.js"],"names":[],"mappings":"AAsBA,sFAAsF;AACtF;IACI,WAAa;IACb,mBAAe;IACf,yBAAqB;IACrB,aAAS;IACT,WAAa;IACb;;;;;;;;;;;MAE6B;IAmB7B;;;OAGG;IACH;;;;;MAA8F;IAC9F;;;OAGG;IACH,wBAAyD;IAMzD,oCAIC;IAED,8FAA8F;IAC9F,qCAgBC;IAED,gBASC;IAuDD;;;;;;;;;;;;;;;;;;MA+IC;IAQD;;;;;YAMC;IAED;;;;;;;;;;MAOC;IAED;;;;;;;;;;;;;;MAwBC;IAED,gGAAgG;IAChG,mEAYC;;CAyBJ;gCA7X+B,uCAAuC"}
@@ -228,6 +228,10 @@ export class GPUWaterRenderer {
228
228
  let states = this.#prepared.get(graph);
229
229
  if (states === undefined) { states = new Map(); this.#prepared.set(graph, states); }
230
230
  states.set(camera, data);
231
+ // The optics pick the probes at each pixel of the interface, which the G-buffer holds no pixel of: the
232
+ // interface asks for them, by the normal the receivers stored and the optics turn to the eye.
233
+ probes.graph_want_surface({ graph, depth: data.interface_depth, normal: data.trace_metadata, normal_channel: 1,
234
+ two_sided: true, camera: view_ctx.camera.buffer, resolution });
231
235
  if (settings.debug_view !== 0) {
232
236
  let views = this.#inspection.get(graph);
233
237
  if (views === undefined) { views = new Map(); this.#inspection.set(graph, views); }