@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
@@ -12,7 +12,8 @@
12
12
  * cascade's resolution of content with a one-texel skirt. A producer writes a cascade's tile at
13
13
  * {@link slot}, from the device; nothing here writes texels;
14
14
  * - {@link uniform}: the table a reader takes, {@link WIND_FIELD_STRUCT}: every cascade's window and
15
- * read record, finest first, and `v_far(t)`.
15
+ * read record, finest first, and `v_far(t)`;
16
+ * - {@link previous_uniform}: the table as the frame before read it, over the same atlas.
16
17
  *
17
18
  * **The producer's frame**, before any consumer encodes (at `FrameStart`, ahead of the scene's own
18
19
  * update):
@@ -25,12 +26,22 @@
25
26
  * and the scene's update ({@link update}) uploads the table once, if anything changed. Nothing here
26
27
  * allocates once the count is fixed: the setters write a retained copy of the table in place.
27
28
  *
29
+ * **One frame of history.** The field as the frame before read it stays readable beside this frame's:
30
+ * its table is {@link previous_uniform}, and its tiles are still in the atlas, because a cascade has
31
+ * two tiles and a producer writes this frame's into the one last frame's readers did not take
32
+ * ({@link publish_slot}). The scene context turns the frame over ({@link advance_frame}), once, before
33
+ * any producer writes. A reader that wants what the wind was a frame ago, a motion vector's, samples
34
+ * through the previous table (`chunk_wind_field_sample_previous`). In a frame where nothing was
35
+ * published and no setter ran, the two tables are equal, bit for bit. The history starts over, as a
36
+ * copy of this frame's field, whenever the cascades' count or resolution changes, which is also every
37
+ * time the atlas changes size: the previous table is always over the atlas as it is.
38
+ *
28
39
  * **A cascade reads as the far field until it has a record.** One that {@link set_cascades} adds
29
40
  * starts with a decay of 0, so whatever its tile holds — a freed slot's old texels, or nothing yet —
30
41
  * contributes nothing until the producer gives it a decay; a cascade created at the far field (as the
31
42
  * fluid creates them) is that exactly.
32
43
  *
33
- * **The atlas grows with the count and never shrinks**: more cascades allocate slots, which add
44
+ * **The atlas grows with the count and never shrinks**: more cascades allocate slots, two each, which add
34
45
  * layers to the texture (or widen it, past `maxTextureDimension3D`); fewer free them and keep the
35
46
  * texture. A new resolution is a new atlas. Either replaces the texture, so a consumer takes it per
36
47
  * frame ({@link bind}), as the frame graph does.
@@ -48,7 +59,8 @@ export class GPUSceneWind {
48
59
  */
49
60
  constructor(device: GPUDevice);
50
61
  /**
51
- * One tile per cascade, at {@link slot}. Replaced by a new resolution, and its texture by a grow.
62
+ * Two tiles per cascade: this frame's at {@link slot}, and the one a producer writes next. Replaced
63
+ * by a new resolution, and its texture by a grow.
52
64
  * @returns {GPUTileAtlas3D}
53
65
  */
54
66
  get atlas(): GPUTileAtlas3D;
@@ -57,17 +69,44 @@ export class GPUSceneWind {
57
69
  * @returns {GPUBuffer}
58
70
  */
59
71
  get uniform(): GPUBuffer;
72
+ /**
73
+ * The table as the frame before read it, {@link WIND_FIELD_STRUCT}, as the uniform
74
+ * `wind_field_previous`: it names tiles of {@link atlas}.
75
+ * @returns {GPUBuffer}
76
+ */
77
+ get previous_uniform(): GPUBuffer;
78
+ /**
79
+ * How many cascades the frame before read.
80
+ * @returns {number}
81
+ */
82
+ get previous_cascade_count(): number;
60
83
  /**
61
84
  * @returns {number}
62
85
  */
63
86
  get cascade_count(): number;
64
87
  /**
65
- * The atlas slot of a cascade's tile.
88
+ * The atlas slot of a cascade's tile: the one this frame's readers take.
66
89
  *
67
90
  * @param {number} index a cascade, finest first
68
91
  * @returns {number}
69
92
  */
70
93
  slot(index: number): number;
94
+ /**
95
+ * The atlas slot a producer writes a cascade's tile into this frame, which becomes the cascade's
96
+ * {@link slot}: the tile the frame before did not read, so that one stays as it was read. Asked
97
+ * again before the frame turns over ({@link advance_frame}), it is the same slot. A producer calls
98
+ * it for each cascade it publishes, before the table is uploaded; a cascade it does not publish
99
+ * keeps its tile, which both frames then read.
100
+ *
101
+ * @param {number} index a cascade, finest first
102
+ * @returns {number}
103
+ */
104
+ publish_slot(index: number): number;
105
+ /**
106
+ * Turn the frame over: the field as it stands, which is what the frame now ending read, becomes
107
+ * the previous one. Once a frame, before any producer writes.
108
+ */
109
+ advance_frame(): void;
71
110
  /**
72
111
  * The stack's shape: how many cascades, and the cells of each one's window, which is its tile's
73
112
  * content. Cascades past `count` are dropped and their slots freed; cascades it adds start with
@@ -105,7 +144,7 @@ export class GPUSceneWind {
105
144
  */
106
145
  set_far_velocity(velocity: ArrayLike<number>): void;
107
146
  /**
108
- * Upload the table when anything changed since the last upload; once a frame, after the producer
147
+ * Upload the tables that changed since their last upload; once a frame, after the producer
109
148
  * and before any consumer encodes. The tiles' texel origins and the atlas's size are taken here,
110
149
  * after every slot the frame allocated.
111
150
  */
@@ -117,6 +156,14 @@ export class GPUSceneWind {
117
156
  * @param {Object} bindings
118
157
  */
119
158
  bind(bindings: any): void;
159
+ /**
160
+ * Put the field and its history into a dispatch's bindings, under the names
161
+ * `wind_field_add_history_resources` declares: what {@link bind} puts, and
162
+ * `wind_field_previous`.
163
+ *
164
+ * @param {Object} bindings
165
+ */
166
+ bind_history(bindings: any): void;
120
167
  /**
121
168
  * Release the atlas and the table. Safe to call twice.
122
169
  */
@@ -1 +1 @@
1
- {"version":3,"file":"GPUSceneWind.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/GPUSceneWind.js"],"names":[],"mappings":"AA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH;IAqDI;;;;;OAKG;IACH,wDAJW,UAAU,MAAM,CAAC,YACjB,MAAM,GACJ,cAAc,CAoB1B;IAxCD;;OAEG;IACH,+BAWC;IA4BD;;;OAGG;IACH,4BAEC;IAED;;;OAGG;IACH,yBAEC;IAED;;OAEG;IACH,4BAEC;IAED;;;;;OAKG;IACH,YAHW,MAAM,GACJ,MAAM,CAOlB;IAED;;;;;;;;;OASG;IACH,oBAHW,MAAM,cACN,UAAU,MAAM,CAAC,QA4D3B;IAED;;;;;;;;OAQG;IACH,0BAJW,MAAM,UACN,UAAU,MAAM,CAAC,aACjB,MAAM,QAmBhB;IAED;;;;;;;OAOG;IACH,yBAHW,MAAM,SACN,MAAM,QAYhB;IAED;;;;OAIG;IACH,2BAFW,UAAU,MAAM,CAAC,QAY3B;IAED;;;;OAIG;IACH,eAiCC;IAiCD;;;;;OAKG;IACH,0BAGC;IAED;;OAEG;IACH,gBASC;;CACJ;+BAvZ8B,oCAAoC"}
1
+ {"version":3,"file":"GPUSceneWind.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/GPUSceneWind.js"],"names":[],"mappings":"AA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH;IA2FI;;;;;OAKG;IACH,wDAJW,UAAU,MAAM,CAAC,YACjB,MAAM,GACJ,cAAc,CAoB1B;IA9CD;;OAEG;IACH,+BAiBC;IA4BD;;;;OAIG;IACH,4BAEC;IAED;;;OAGG;IACH,yBAEC;IAED;;;;OAIG;IACH,kCAEC;IAED;;;OAGG;IACH,qCAEC;IAED;;OAEG;IACH,4BAEC;IAED;;;;;OAKG;IACH,YAHW,MAAM,GACJ,MAAM,CAOlB;IAED;;;;;;;;;OASG;IACH,oBAHW,MAAM,GACJ,MAAM,CAkBlB;IAED;;;OAGG;IACH,sBAgBC;IAED;;;;;;;;;OASG;IACH,oBAHW,MAAM,cACN,UAAU,MAAM,CAAC,QAmE3B;IAED;;;;;;;;OAQG;IACH,0BAJW,MAAM,UACN,UAAU,MAAM,CAAC,aACjB,MAAM,QAmBhB;IAED;;;;;;;OAOG;IACH,yBAHW,MAAM,SACN,MAAM,QAYhB;IAED;;;;OAIG;IACH,2BAFW,UAAU,MAAM,CAAC,QAY3B;IAED;;;;OAIG;IACH,eAmBC;IAiED;;;;;OAKG;IACH,0BAGC;IAED;;;;;;OAMG;IACH,kCAIC;IAED;;OAEG;IACH,gBAUC;;CACJ;+BAnjB8B,oCAAoC"}
@@ -39,7 +39,8 @@ const PLACEHOLDER_CONTENT = [1, 1, 1];
39
39
  * cascade's resolution of content with a one-texel skirt. A producer writes a cascade's tile at
40
40
  * {@link slot}, from the device; nothing here writes texels;
41
41
  * - {@link uniform}: the table a reader takes, {@link WIND_FIELD_STRUCT}: every cascade's window and
42
- * read record, finest first, and `v_far(t)`.
42
+ * read record, finest first, and `v_far(t)`;
43
+ * - {@link previous_uniform}: the table as the frame before read it, over the same atlas.
43
44
  *
44
45
  * **The producer's frame**, before any consumer encodes (at `FrameStart`, ahead of the scene's own
45
46
  * update):
@@ -52,12 +53,22 @@ const PLACEHOLDER_CONTENT = [1, 1, 1];
52
53
  * and the scene's update ({@link update}) uploads the table once, if anything changed. Nothing here
53
54
  * allocates once the count is fixed: the setters write a retained copy of the table in place.
54
55
  *
56
+ * **One frame of history.** The field as the frame before read it stays readable beside this frame's:
57
+ * its table is {@link previous_uniform}, and its tiles are still in the atlas, because a cascade has
58
+ * two tiles and a producer writes this frame's into the one last frame's readers did not take
59
+ * ({@link publish_slot}). The scene context turns the frame over ({@link advance_frame}), once, before
60
+ * any producer writes. A reader that wants what the wind was a frame ago, a motion vector's, samples
61
+ * through the previous table (`chunk_wind_field_sample_previous`). In a frame where nothing was
62
+ * published and no setter ran, the two tables are equal, bit for bit. The history starts over, as a
63
+ * copy of this frame's field, whenever the cascades' count or resolution changes, which is also every
64
+ * time the atlas changes size: the previous table is always over the atlas as it is.
65
+ *
55
66
  * **A cascade reads as the far field until it has a record.** One that {@link set_cascades} adds
56
67
  * starts with a decay of 0, so whatever its tile holds — a freed slot's old texels, or nothing yet —
57
68
  * contributes nothing until the producer gives it a decay; a cascade created at the far field (as the
58
69
  * fluid creates them) is that exactly.
59
70
  *
60
- * **The atlas grows with the count and never shrinks**: more cascades allocate slots, which add
71
+ * **The atlas grows with the count and never shrinks**: more cascades allocate slots, two each, which add
61
72
  * layers to the texture (or widen it, past `maxTextureDimension3D`); fewer free them and keep the
62
73
  * texture. A new resolution is a new atlas. Either replaces the texture, so a consumer takes it per
63
74
  * frame ({@link bind}), as the frame graph does.
@@ -72,6 +83,9 @@ export class GPUSceneWind {
72
83
  /** @type {GPUBuffer} */
73
84
  #uniform;
74
85
 
86
+ /** @type {GPUBuffer} */
87
+ #previous_uniform;
88
+
75
89
  /**
76
90
  * The table as the shader reads it, written in place by the setters.
77
91
  * @type {ArrayBuffer}
@@ -81,6 +95,13 @@ export class GPUSceneWind {
81
95
  #i32 = new Int32Array(this.#bytes);
82
96
  #u32 = new Uint32Array(this.#bytes);
83
97
 
98
+ /**
99
+ * The table as the frame before read it.
100
+ * @type {ArrayBuffer}
101
+ */
102
+ #previous_bytes = new ArrayBuffer(WIND_FIELD_STRUCT.size);
103
+ #previous_u32 = new Uint32Array(this.#previous_bytes);
104
+
84
105
  #count = 0;
85
106
 
86
107
  /**
@@ -89,6 +110,18 @@ export class GPUSceneWind {
89
110
  */
90
111
  #slots = new Uint32Array(WIND_FIELD_CASCADE_LIMIT);
91
112
 
113
+ /**
114
+ * The atlas slot of each cascade's other tile: the one a producer writes next.
115
+ * @type {Uint32Array}
116
+ */
117
+ #spare_slots = new Uint32Array(WIND_FIELD_CASCADE_LIMIT);
118
+
119
+ /**
120
+ * Whether each cascade's tile has changed places since the frame turned over.
121
+ * @type {Uint8Array}
122
+ */
123
+ #published = new Uint8Array(WIND_FIELD_CASCADE_LIMIT);
124
+
92
125
  /** @type {number[]} */
93
126
  #origin = [0, 0, 0];
94
127
 
@@ -97,6 +130,16 @@ export class GPUSceneWind {
97
130
  */
98
131
  #dirty = true;
99
132
 
133
+ /**
134
+ * Whether the previous table changed since it was last uploaded.
135
+ */
136
+ #previous_dirty = true;
137
+
138
+ /**
139
+ * Whether the history is to start over at the next upload, as a copy of the field then.
140
+ */
141
+ #history_lost = false;
142
+
100
143
  #destroyed = false;
101
144
 
102
145
  /**
@@ -113,6 +156,12 @@ export class GPUSceneWind {
113
156
  size: WIND_FIELD_STRUCT.size,
114
157
  usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
115
158
  });
159
+
160
+ this.#previous_uniform = device.createBuffer({
161
+ label: 'GPUSceneWind/previous table',
162
+ size: WIND_FIELD_STRUCT.size,
163
+ usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
164
+ });
116
165
  }
117
166
 
118
167
  /**
@@ -142,7 +191,8 @@ export class GPUSceneWind {
142
191
  }
143
192
 
144
193
  /**
145
- * One tile per cascade, at {@link slot}. Replaced by a new resolution, and its texture by a grow.
194
+ * Two tiles per cascade: this frame's at {@link slot}, and the one a producer writes next. Replaced
195
+ * by a new resolution, and its texture by a grow.
146
196
  * @returns {GPUTileAtlas3D}
147
197
  */
148
198
  get atlas() {
@@ -157,6 +207,23 @@ export class GPUSceneWind {
157
207
  return this.#uniform;
158
208
  }
159
209
 
210
+ /**
211
+ * The table as the frame before read it, {@link WIND_FIELD_STRUCT}, as the uniform
212
+ * `wind_field_previous`: it names tiles of {@link atlas}.
213
+ * @returns {GPUBuffer}
214
+ */
215
+ get previous_uniform() {
216
+ return this.#previous_uniform;
217
+ }
218
+
219
+ /**
220
+ * How many cascades the frame before read.
221
+ * @returns {number}
222
+ */
223
+ get previous_cascade_count() {
224
+ return this.#previous_u32[CASCADE_COUNT];
225
+ }
226
+
160
227
  /**
161
228
  * @returns {number}
162
229
  */
@@ -165,7 +232,7 @@ export class GPUSceneWind {
165
232
  }
166
233
 
167
234
  /**
168
- * The atlas slot of a cascade's tile.
235
+ * The atlas slot of a cascade's tile: the one this frame's readers take.
169
236
  *
170
237
  * @param {number} index a cascade, finest first
171
238
  * @returns {number}
@@ -177,6 +244,56 @@ export class GPUSceneWind {
177
244
  return this.#slots[index];
178
245
  }
179
246
 
247
+ /**
248
+ * The atlas slot a producer writes a cascade's tile into this frame, which becomes the cascade's
249
+ * {@link slot}: the tile the frame before did not read, so that one stays as it was read. Asked
250
+ * again before the frame turns over ({@link advance_frame}), it is the same slot. A producer calls
251
+ * it for each cascade it publishes, before the table is uploaded; a cascade it does not publish
252
+ * keeps its tile, which both frames then read.
253
+ *
254
+ * @param {number} index a cascade, finest first
255
+ * @returns {number}
256
+ */
257
+ publish_slot(index) {
258
+ assert.notOk(this.#destroyed, 'destroyed');
259
+ assert.isNonNegativeInteger(index, 'index');
260
+ assert.lessThan(index, this.#count, 'index');
261
+
262
+ if (this.#published[index] === 0) {
263
+ const slot = this.#spare_slots[index];
264
+
265
+ this.#spare_slots[index] = this.#slots[index];
266
+ this.#slots[index] = slot;
267
+
268
+ this.#published[index] = 1;
269
+ this.#dirty = true;
270
+ }
271
+
272
+ return this.#slots[index];
273
+ }
274
+
275
+ /**
276
+ * Turn the frame over: the field as it stands, which is what the frame now ending read, becomes
277
+ * the previous one. Once a frame, before any producer writes.
278
+ */
279
+ advance_frame() {
280
+ assert.notOk(this.#destroyed, 'destroyed');
281
+
282
+ this.#published.fill(0);
283
+
284
+ const from = this.#u32;
285
+ const to = this.#previous_u32;
286
+
287
+ for (let i = 0; i < from.length; i++) {
288
+ if (to[i] !== from[i]) {
289
+ to.set(from);
290
+ this.#previous_dirty = true;
291
+
292
+ break;
293
+ }
294
+ }
295
+ }
296
+
180
297
  /**
181
298
  * The stack's shape: how many cascades, and the cells of each one's window, which is its tile's
182
299
  * content. Cascades past `count` are dropped and their slots freed; cascades it adds start with
@@ -204,16 +321,22 @@ export class GPUSceneWind {
204
321
  if (count > 0 && (content[0] !== resolution[0] || content[1] !== resolution[1] || content[2] !== resolution[2])) {
205
322
  // a new tile shape: nothing of the old atlas carries over
206
323
  this.#atlas.destroy();
207
- this.#atlas = GPUSceneWind.#make_atlas(this.#device, resolution, count);
324
+ this.#atlas = GPUSceneWind.#make_atlas(this.#device, resolution, 2 * count);
208
325
  this.#count = 0;
209
326
  }
210
327
 
328
+ if (count !== this.#count) {
329
+ // the previous table would name tiles that are gone, or not yet written
330
+ this.#history_lost = true;
331
+ }
332
+
211
333
  const atlas = this.#atlas;
212
334
 
213
335
  while (this.#count < count) {
214
336
  const c = this.#count;
215
337
 
216
338
  this.#slots[c] = atlas.allocate();
339
+ this.#spare_slots[c] = atlas.allocate();
217
340
 
218
341
  const level = LEVELS + c * LEVEL_STRIDE;
219
342
 
@@ -231,6 +354,7 @@ export class GPUSceneWind {
231
354
  this.#count--;
232
355
 
233
356
  atlas.free(this.#slots[this.#count]);
357
+ atlas.free(this.#spare_slots[this.#count]);
234
358
  }
235
359
 
236
360
  const size = atlas.content_size;
@@ -313,17 +437,35 @@ export class GPUSceneWind {
313
437
  }
314
438
 
315
439
  /**
316
- * Upload the table when anything changed since the last upload; once a frame, after the producer
440
+ * Upload the tables that changed since their last upload; once a frame, after the producer
317
441
  * and before any consumer encodes. The tiles' texel origins and the atlas's size are taken here,
318
442
  * after every slot the frame allocated.
319
443
  */
320
444
  update() {
321
445
  assert.notOk(this.#destroyed, 'destroyed');
322
446
 
323
- if (!this.#dirty) {
324
- return;
447
+ if (this.#dirty) {
448
+ this.#upload();
449
+ }
450
+
451
+ if (this.#history_lost) {
452
+ this.#previous_u32.set(this.#u32);
453
+
454
+ this.#history_lost = false;
455
+ this.#previous_dirty = true;
456
+ }
457
+
458
+ if (this.#previous_dirty) {
459
+ this.#device.queue.writeBuffer(this.#previous_uniform, 0, this.#previous_bytes);
460
+
461
+ this.#previous_dirty = false;
325
462
  }
463
+ }
326
464
 
465
+ /**
466
+ * Finish the table and send it to the device.
467
+ */
468
+ #upload() {
327
469
  const atlas = this.#atlas;
328
470
  const origin = this.#origin;
329
471
  const f32 = this.#f32;
@@ -394,6 +536,19 @@ export class GPUSceneWind {
394
536
  bindings.wind_field_atlas = this.#atlas.texture;
395
537
  }
396
538
 
539
+ /**
540
+ * Put the field and its history into a dispatch's bindings, under the names
541
+ * `wind_field_add_history_resources` declares: what {@link bind} puts, and
542
+ * `wind_field_previous`.
543
+ *
544
+ * @param {Object} bindings
545
+ */
546
+ bind_history(bindings) {
547
+ this.bind(bindings);
548
+
549
+ bindings.wind_field_previous = this.#previous_uniform;
550
+ }
551
+
397
552
  /**
398
553
  * Release the atlas and the table. Safe to call twice.
399
554
  */
@@ -406,5 +561,6 @@ export class GPUSceneWind {
406
561
 
407
562
  this.#atlas.destroy();
408
563
  this.#uniform.destroy();
564
+ this.#previous_uniform.destroy();
409
565
  }
410
566
  }
@@ -6,7 +6,9 @@
6
6
  * uniform alternative is the scroll alone: with no departure from the far field anywhere, the flow
7
7
  * map has nothing to carry.
8
8
  *
9
- * A pass sets it from the field it binds, `scene.wind.cascade_count === 0`, the frame it binds it.
9
+ * A pass sets it from the field it binds, `scene.wind.cascade_count === 0`, the frame it binds it; a
10
+ * pass that also reads the field's history (`chunk_wind_field_sample_previous`) sets it only when
11
+ * `scene.wind.previous_cascade_count` is 0 too, since both reads are the one alternative.
10
12
  * `false`, the default, is the field read as it is, cascades or none, so a pass that never sets it
11
13
  * reads the wind exactly as it always did.
12
14
  *
@@ -1 +1 @@
1
- {"version":3,"file":"WIND_FIELD_UNIFORM.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/WIND_FIELD_UNIFORM.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,iCAFU,YAAY,CAEoD;6BAhB7C,oCAAoC"}
1
+ {"version":3,"file":"WIND_FIELD_UNIFORM.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/WIND_FIELD_UNIFORM.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,iCAFU,YAAY,CAEoD;6BAlB7C,oCAAoC"}
@@ -8,7 +8,9 @@ import { ShaderSwitch } from "../shader/compiler/ShaderSwitch.js";
8
8
  * uniform alternative is the scroll alone: with no departure from the far field anywhere, the flow
9
9
  * map has nothing to carry.
10
10
  *
11
- * A pass sets it from the field it binds, `scene.wind.cascade_count === 0`, the frame it binds it.
11
+ * A pass sets it from the field it binds, `scene.wind.cascade_count === 0`, the frame it binds it; a
12
+ * pass that also reads the field's history (`chunk_wind_field_sample_previous`) sets it only when
13
+ * `scene.wind.previous_cascade_count` is 0 too, since both reads are the one alternative.
12
14
  * `false`, the default, is the field read as it is, cascades or none, so a pass that never sets it
13
15
  * reads the wind exactly as it always did.
14
16
  *
@@ -4,7 +4,8 @@
4
4
  * number of cascades, none included.
5
5
  *
6
6
  * Reads `wind_field` ({@link WIND_FIELD_STRUCT}), `wind_field_atlas` and `wind_field_sampler`, as
7
- * {@link wind_field_add_resources} declares them.
7
+ * {@link wind_field_add_resources} declares them. `wind_field_sample_in(field, position_ws)` is the
8
+ * same read through any table over that atlas, the previous frame's for one.
8
9
  *
9
10
  * **The read:**
10
11
  * - the cascades' windows are walked finest first, each by `clipmap_level_select`, and the first holding
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_wind_field_sample_cascades.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/chunk_wind_field_sample_cascades.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,+CAFU,SAAS,CA4DjB;0BAnGwB,iCAAiC"}
1
+ {"version":3,"file":"chunk_wind_field_sample_cascades.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/chunk_wind_field_sample_cascades.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,+CAFU,SAAS,CAgEjB;0BAxGwB,iCAAiC"}
@@ -9,7 +9,8 @@ import { WIND_FIELD_STRUCT } from "./WIND_FIELD_STRUCT.js";
9
9
  * number of cascades, none included.
10
10
  *
11
11
  * Reads `wind_field` ({@link WIND_FIELD_STRUCT}), `wind_field_atlas` and `wind_field_sampler`, as
12
- * {@link wind_field_add_resources} declares them.
12
+ * {@link wind_field_add_resources} declares them. `wind_field_sample_in(field, position_ws)` is the
13
+ * same read through any table over that atlas, the previous frame's for one.
13
14
  *
14
15
  * **The read:**
15
16
  * - the cascades' windows are walked finest first, each by `clipmap_level_select`, and the first holding
@@ -46,26 +47,26 @@ export const chunk_wind_field_sample_cascades = CodeChunk.from(
46
47
  const WIND_FIELD_BAND_WIDTH: f32 = ${WIND_FIELD_BAND_WIDTH}.0;
47
48
 
48
49
  // cascade c's identity read at a world point its window holds
49
- fn wind_field_cascade_read(c: u32, position_ws: vec3<f32>) -> vec3<f32> {
50
- let level = wind_field.levels[c];
51
- let cascade = wind_field.cascades[c];
50
+ fn wind_field_cascade_read(field: ptr<uniform, ${WIND_FIELD_STRUCT.wgsl_ref}>, c: u32, position_ws: vec3<f32>) -> vec3<f32> {
51
+ let level = (*field).levels[c];
52
+ let cascade = (*field).cascades[c];
52
53
 
53
54
  // window-local position in the cascade's cells, which is a texel offset from the tile's content
54
55
  let local = position_ws / level.cell_size - vec3<f32>(level.corner);
55
- let uvw = (cascade.content_origin + local) * wind_field.inverse_atlas_size;
56
+ let uvw = (cascade.content_origin + local) * (*field).inverse_atlas_size;
56
57
 
57
58
  let deviation = textureSampleLevel(wind_field_atlas, wind_field_sampler, uvw, 0.0).xyz;
58
59
 
59
- return wind_field.far_velocity + deviation * cascade.decay;
60
+ return (*field).far_velocity + deviation * cascade.decay;
60
61
  }
61
62
 
62
- fn wind_field_sample(position_ws: vec3<f32>) -> vec3<f32> {
63
- let count = wind_field.cascade_count;
63
+ fn wind_field_sample_in(field: ptr<uniform, ${WIND_FIELD_STRUCT.wgsl_ref}>, position_ws: vec3<f32>) -> vec3<f32> {
64
+ let count = (*field).cascade_count;
64
65
 
65
66
  var selection = ClipmapSelection(CLIPMAP_LEVEL_NONE, 0.0);
66
67
 
67
68
  for (var i = 0u; i < min(count, ${WIND_FIELD_CASCADE_LIMIT}u); i++) {
68
- let weight = clipmap_level_select(wind_field.levels[i], position_ws, WIND_FIELD_BAND_WIDTH);
69
+ let weight = clipmap_level_select((*field).levels[i], position_ws, WIND_FIELD_BAND_WIDTH);
69
70
 
70
71
  if (weight >= 0.0) {
71
72
  selection = ClipmapSelection(i, weight);
@@ -74,10 +75,10 @@ fn wind_field_sample(position_ws: vec3<f32>) -> vec3<f32> {
74
75
  }
75
76
 
76
77
  if (selection.level == CLIPMAP_LEVEL_NONE) {
77
- return wind_field.far_velocity;
78
+ return (*field).far_velocity;
78
79
  }
79
80
 
80
- let inner = wind_field_cascade_read(selection.level, position_ws);
81
+ let inner = wind_field_cascade_read(field, selection.level, position_ws);
81
82
 
82
83
  if (selection.edge_weight <= 0.0) {
83
84
  return inner;
@@ -85,15 +86,19 @@ fn wind_field_sample(position_ws: vec3<f32>) -> vec3<f32> {
85
86
 
86
87
  let parent = selection.level + 1u;
87
88
 
88
- var outer = wind_field.far_velocity;
89
+ var outer = (*field).far_velocity;
89
90
 
90
91
  if (parent < count) {
91
- outer = wind_field_cascade_read(parent, position_ws);
92
+ outer = wind_field_cascade_read(field, parent, position_ws);
92
93
  }
93
94
 
94
95
  // mix's form, written so that equal reads blend to themselves exactly
95
96
  return inner + (outer - inner) * selection.edge_weight;
96
97
  }
98
+
99
+ fn wind_field_sample(position_ws: vec3<f32>) -> vec3<f32> {
100
+ return wind_field_sample_in(&wind_field, position_ws);
101
+ }
97
102
  `, [
98
103
  WIND_FIELD_STRUCT.declaration_chunk,
99
104
  chunk_clipmap_select_finest,
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The wind at a world point as the frame before read it, m/s: `wind_field_sample_previous(position_ws)`.
3
+ * It is `chunk_wind_field_sample`'s read through the previous table, so a consumer that samples the
4
+ * same point with both has what the wind there changed by over the frame: a motion vector's share of it.
5
+ *
6
+ * Reads `wind_field_previous` beside the bindings of `chunk_wind_field_sample`, as
7
+ * `wind_field_add_history_resources` declares them and `GPUSceneWind.bind_history` fills them.
8
+ *
9
+ * @type {CodeChunk}
10
+ */
11
+ export const chunk_wind_field_sample_previous: CodeChunk;
12
+ import { CodeChunk } from "../shader/compiler/CodeChunk.js";
13
+ //# sourceMappingURL=chunk_wind_field_sample_previous.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_wind_field_sample_previous.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/chunk_wind_field_sample_previous.js"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,+CAFU,SAAS,CAWjB;0BAtBwB,iCAAiC"}
@@ -0,0 +1,23 @@
1
+ import { CodeChunk } from "../shader/compiler/CodeChunk.js";
2
+ import { chunk_wind_field_sample } from "./chunk_wind_field_sample.js";
3
+
4
+ /**
5
+ * The wind at a world point as the frame before read it, m/s: `wind_field_sample_previous(position_ws)`.
6
+ * It is `chunk_wind_field_sample`'s read through the previous table, so a consumer that samples the
7
+ * same point with both has what the wind there changed by over the frame: a motion vector's share of it.
8
+ *
9
+ * Reads `wind_field_previous` beside the bindings of `chunk_wind_field_sample`, as
10
+ * `wind_field_add_history_resources` declares them and `GPUSceneWind.bind_history` fills them.
11
+ *
12
+ * @type {CodeChunk}
13
+ */
14
+ export const chunk_wind_field_sample_previous = CodeChunk.from(
15
+ //language=WGSL
16
+ `
17
+ fn wind_field_sample_previous(position_ws: vec3<f32>) -> vec3<f32> {
18
+ return wind_field_sample_in(&wind_field_previous, position_ws);
19
+ }
20
+ `, [
21
+ chunk_wind_field_sample,
22
+ ]
23
+ );
@@ -4,6 +4,7 @@
4
4
  * exactly, having found no window that holds the point.
5
5
  *
6
6
  * Reads `wind_field.far_velocity` and nothing else; the atlas and its sampler stay bound and unread.
7
+ * `wind_field_sample_in(field, position_ws)` is the same read of any table with no cascades.
7
8
  *
8
9
  * @type {CodeChunk}
9
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_wind_field_sample_uniform.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/chunk_wind_field_sample_uniform.js"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,8CAFU,SAAS,CAWjB;0BArBwB,iCAAiC"}
1
+ {"version":3,"file":"chunk_wind_field_sample_uniform.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/chunk_wind_field_sample_uniform.js"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,8CAFU,SAAS,CAejB;0BA1BwB,iCAAiC"}
@@ -7,14 +7,19 @@ import { WIND_FIELD_STRUCT } from "./WIND_FIELD_STRUCT.js";
7
7
  * exactly, having found no window that holds the point.
8
8
  *
9
9
  * Reads `wind_field.far_velocity` and nothing else; the atlas and its sampler stay bound and unread.
10
+ * `wind_field_sample_in(field, position_ws)` is the same read of any table with no cascades.
10
11
  *
11
12
  * @type {CodeChunk}
12
13
  */
13
14
  export const chunk_wind_field_sample_uniform = CodeChunk.from(
14
15
  //language=WGSL
15
16
  `
17
+ fn wind_field_sample_in(field: ptr<uniform, ${WIND_FIELD_STRUCT.wgsl_ref}>, position_ws: vec3<f32>) -> vec3<f32> {
18
+ return (*field).far_velocity;
19
+ }
20
+
16
21
  fn wind_field_sample(position_ws: vec3<f32>) -> vec3<f32> {
17
- return wind_field.far_velocity;
22
+ return wind_field_sample_in(&wind_field, position_ws);
18
23
  }
19
24
  `, [
20
25
  WIND_FIELD_STRUCT.declaration_chunk,
@@ -12,4 +12,15 @@
12
12
  * @returns {import("../shader/resource/ShaderResourceGroupDescriptor.js").ShaderResourceGroupDescriptor} group
13
13
  */
14
14
  export function wind_field_add_resources(group: import("../shader/resource/ShaderResourceGroupDescriptor.js").ShaderResourceGroupDescriptor): import("../shader/resource/ShaderResourceGroupDescriptor.js").ShaderResourceGroupDescriptor;
15
+ /**
16
+ * {@link wind_field_add_resources}, and the field as the frame before read it, for a consumer that
17
+ * samples both (`chunk_wind_field_sample_previous`): `wind_field_previous`, a second uniform
18
+ * {@link WIND_FIELD_STRUCT} over the same atlas. `GPUSceneWind.bind_history` fills them.
19
+ *
20
+ * Two uniforms, one texture, one sampler, and no storage buffer.
21
+ *
22
+ * @param {import("../shader/resource/ShaderResourceGroupDescriptor.js").ShaderResourceGroupDescriptor} group
23
+ * @returns {import("../shader/resource/ShaderResourceGroupDescriptor.js").ShaderResourceGroupDescriptor} group
24
+ */
25
+ export function wind_field_add_history_resources(group: import("../shader/resource/ShaderResourceGroupDescriptor.js").ShaderResourceGroupDescriptor): import("../shader/resource/ShaderResourceGroupDescriptor.js").ShaderResourceGroupDescriptor;
15
26
  //# sourceMappingURL=wind_field_add_resources.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wind_field_add_resources.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/wind_field_add_resources.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,gDAHW,OAAO,qDAAqD,EAAE,6BAA6B,GACzF,OAAO,qDAAqD,EAAE,6BAA6B,CAOvG"}
1
+ {"version":3,"file":"wind_field_add_resources.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/wind_field_add_resources.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,gDAHW,OAAO,qDAAqD,EAAE,6BAA6B,GACzF,OAAO,qDAAqD,EAAE,6BAA6B,CAOvG;AAED;;;;;;;;;GASG;AACH,wDAHW,OAAO,qDAAqD,EAAE,6BAA6B,GACzF,OAAO,qDAAqD,EAAE,6BAA6B,CAKvG"}