@woosh/meep-engine 3.74.0 → 3.76.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 (363) hide show
  1. package/CHANGELOG.md +20 -19
  2. package/package.json +1 -1
  3. package/src/core/geom/2d/hilbert/v2_hilbert_encode.d.ts +11 -0
  4. package/src/core/geom/2d/hilbert/v2_hilbert_encode.d.ts.map +1 -0
  5. package/src/core/geom/2d/hilbert/v2_hilbert_encode.js +46 -0
  6. package/src/engine/asset/GameAssetType.d.ts +1 -0
  7. package/src/engine/asset/GameAssetType.js +5 -1
  8. package/src/engine/asset/loaders/GroomAssetLoader.d.ts +33 -0
  9. package/src/engine/asset/loaders/GroomAssetLoader.d.ts.map +1 -0
  10. package/src/engine/asset/loaders/GroomAssetLoader.js +99 -0
  11. package/src/engine/graphics/ecs/hair/Hair.d.ts +47 -0
  12. package/src/engine/graphics/ecs/hair/Hair.d.ts.map +1 -0
  13. package/src/engine/graphics/ecs/hair/Hair.js +61 -0
  14. package/src/engine/graphics/hair/Groom.d.ts +130 -0
  15. package/src/engine/graphics/hair/Groom.d.ts.map +1 -0
  16. package/src/engine/graphics/hair/Groom.js +193 -0
  17. package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts +24 -0
  18. package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts.map +1 -0
  19. package/src/engine/graphics/hair/GroomSerializationAdapter.js +77 -0
  20. package/src/engine/graphics/hair/groom_build_group.d.ts +85 -0
  21. package/src/engine/graphics/hair/groom_build_group.d.ts.map +1 -0
  22. package/src/engine/graphics/hair/groom_build_group.js +487 -0
  23. package/src/engine/graphics/hair/groom_generate_scalp.d.ts +29 -0
  24. package/src/engine/graphics/hair/groom_generate_scalp.d.ts.map +1 -0
  25. package/src/engine/graphics/hair/groom_generate_scalp.js +184 -0
  26. package/src/engine/graphics/hair/groom_rank_order.d.ts +15 -0
  27. package/src/engine/graphics/hair/groom_rank_order.d.ts.map +1 -0
  28. package/src/engine/graphics/hair/groom_rank_order.js +53 -0
  29. package/src/engine/graphics/hair/groom_root_spacing.d.ts +12 -0
  30. package/src/engine/graphics/hair/groom_root_spacing.d.ts.map +1 -0
  31. package/src/engine/graphics/hair/groom_root_spacing.js +120 -0
  32. package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts +6 -0
  33. package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts.map +1 -1
  34. package/src/engine/graphics/render/frame_graph/FrameGraph.js +9 -0
  35. package/src/engine/graphics3/GPUAcousticSystem.d.ts +29 -32
  36. package/src/engine/graphics3/GPUAcousticSystem.d.ts.map +1 -1
  37. package/src/engine/graphics3/GPUAcousticSystem.js +87 -162
  38. package/src/engine/graphics3/HairSystem.d.ts +102 -0
  39. package/src/engine/graphics3/HairSystem.d.ts.map +1 -0
  40. package/src/engine/graphics3/HairSystem.js +456 -0
  41. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  42. package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts.map +1 -1
  43. package/src/engine/sound/ecs/audio/AudioEmitterSystem.js +35 -17
  44. package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts.map +1 -1
  45. package/src/engine/sound/ecs/audio/LiveEmitterSet.js +2 -3
  46. package/src/engine/sound/simulation/AcousticSimulator.d.ts +7 -0
  47. package/src/engine/sound/simulation/AcousticSimulator.d.ts.map +1 -1
  48. package/src/engine/sound/simulation/AcousticSimulator.js +27 -0
  49. package/src/engine/sound/simulation/README.md +121 -107
  50. package/src/engine/sound/sopra/README.md +8 -3
  51. package/src/engine/sound/sopra/definition/effect/AcousticReverbEffect.d.ts +2 -2
  52. package/src/engine/sound/sopra/definition/effect/AcousticReverbEffect.d.ts.map +1 -1
  53. package/src/engine/sound/sopra/definition/effect/AcousticReverbEffect.js +4 -3
  54. package/src/engine/sound/sopra/runtime/AcousticReverbConvolution.d.ts +118 -0
  55. package/src/engine/sound/sopra/runtime/AcousticReverbConvolution.d.ts.map +1 -0
  56. package/src/engine/sound/sopra/runtime/AcousticReverbConvolution.js +472 -0
  57. package/src/engine/sound/sopra/runtime/AcousticReverbLines.d.ts +166 -0
  58. package/src/engine/sound/sopra/runtime/AcousticReverbLines.d.ts.map +1 -0
  59. package/src/engine/sound/sopra/runtime/AcousticReverbLines.js +447 -0
  60. package/src/engine/sound/sopra/runtime/AcousticReverbNetwork.d.ts +69 -113
  61. package/src/engine/sound/sopra/runtime/AcousticReverbNetwork.d.ts.map +1 -1
  62. package/src/engine/sound/sopra/runtime/AcousticReverbNetwork.js +143 -491
  63. package/src/engine/sound/sopra/runtime/AcousticSpeakers.d.ts +102 -0
  64. package/src/engine/sound/sopra/runtime/AcousticSpeakers.d.ts.map +1 -0
  65. package/src/engine/sound/sopra/runtime/AcousticSpeakers.js +232 -0
  66. package/src/engine/sound/sopra/runtime/BusGraph.d.ts +17 -3
  67. package/src/engine/sound/sopra/runtime/BusGraph.d.ts.map +1 -1
  68. package/src/engine/sound/sopra/runtime/BusGraph.js +55 -5
  69. package/src/engine/sound/sopra/runtime/EventInstance.d.ts +8 -6
  70. package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -1
  71. package/src/engine/sound/sopra/runtime/EventInstance.js +113 -105
  72. package/src/engine/sound/sopra/runtime/acoustic_reverb_decay.d.ts +13 -0
  73. package/src/engine/sound/sopra/runtime/acoustic_reverb_decay.d.ts.map +1 -0
  74. package/src/engine/sound/sopra/runtime/acoustic_reverb_decay.js +15 -0
  75. package/src/generation/grid/generation/discrete/GridTaskConnectRooms.d.ts.map +1 -1
  76. package/src/generation/grid/generation/discrete/GridTaskConnectRooms.js +4 -6
  77. package/src/shade/assets/textures/hair_scattering.bin +0 -0
  78. package/src/shade/device/pipeline/PipelineEnquiry.d.ts +11 -0
  79. package/src/shade/device/pipeline/PipelineEnquiry.d.ts.map +1 -1
  80. package/src/shade/device/pipeline/PipelineEnquiry.js +13 -0
  81. package/src/shade/playground/hair/index.html +50 -0
  82. package/src/shade/playground/hair/main.d.ts +2 -0
  83. package/src/shade/playground/hair/main.d.ts.map +1 -0
  84. package/src/shade/playground/hair/main.js +274 -0
  85. package/src/shade/playground/screen_probes/README.md +54 -0
  86. package/src/shade/playground/screen_probes/index.html +271 -0
  87. package/src/shade/playground/screen_probes/main.d.ts +8 -0
  88. package/src/shade/playground/screen_probes/main.d.ts.map +1 -0
  89. package/src/shade/playground/screen_probes/main.js +527 -0
  90. package/src/shade/playground/skinned_blas_refit/diff_traced_against_rasterized.d.ts.map +1 -1
  91. package/src/shade/playground/skinned_blas_refit/diff_traced_against_rasterized.js +4 -5
  92. package/src/shade/playground/skinned_blas_refit/main.d.ts.map +1 -1
  93. package/src/shade/playground/skinned_blas_refit/main.js +6 -12
  94. package/src/shade/playground/skinned_mesh_soup/main.d.ts.map +1 -1
  95. package/src/shade/playground/skinned_mesh_soup/main.js +1 -2
  96. package/src/shade/playground/vgeo_scene/README.md +12 -2
  97. package/src/shade/playground/vgeo_scene/main.js +1 -1
  98. package/src/shade/playground/volumetrics_froxel/README.md +191 -191
  99. package/src/shade/playground/volumetrics_froxel/measure.d.ts +3 -3
  100. package/src/shade/playground/volumetrics_froxel/measure.d.ts.map +1 -1
  101. package/src/shade/playground/volumetrics_froxel/measure.js +11 -13
  102. package/src/shade/playground/vsm/main.d.ts.map +1 -1
  103. package/src/shade/playground/vsm/main.js +5 -6
  104. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  105. package/src/shade/renderer/Renderer.js +85 -16
  106. package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.d.ts +6 -0
  107. package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.d.ts.map +1 -1
  108. package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.js +10 -0
  109. package/src/shade/renderer/acoustics/ACOUSTIC_LISTENER_RESOURCES.d.ts +28 -0
  110. package/src/shade/renderer/acoustics/ACOUSTIC_LISTENER_RESOURCES.d.ts.map +1 -0
  111. package/src/shade/renderer/acoustics/ACOUSTIC_LISTENER_RESOURCES.js +42 -0
  112. package/src/shade/renderer/acoustics/ACOUSTIC_PROBE_DATABASE_SPEC.d.ts +58 -0
  113. package/src/shade/renderer/acoustics/ACOUSTIC_PROBE_DATABASE_SPEC.d.ts.map +1 -0
  114. package/src/shade/renderer/acoustics/ACOUSTIC_PROBE_DATABASE_SPEC.js +108 -0
  115. package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
  116. package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +161 -0
  117. package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts.map +1 -0
  118. package/src/shade/renderer/acoustics/GPUAcousticProbes.js +760 -0
  119. package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
  120. package/src/shade/renderer/acoustics/acoustic_listener_order.d.ts +12 -0
  121. package/src/shade/renderer/acoustics/acoustic_listener_order.d.ts.map +1 -0
  122. package/src/shade/renderer/acoustics/acoustic_listener_order.js +56 -0
  123. package/src/shade/renderer/acoustics/chunk_acoustic_direct.d.ts.map +1 -1
  124. package/src/shade/renderer/acoustics/chunk_acoustic_direct.js +5 -0
  125. package/src/shade/renderer/acoustics/chunk_acoustic_direct_cone.d.ts +57 -0
  126. package/src/shade/renderer/acoustics/chunk_acoustic_direct_cone.d.ts.map +1 -0
  127. package/src/shade/renderer/acoustics/chunk_acoustic_direct_cone.js +314 -0
  128. package/src/shade/renderer/acoustics/chunk_acoustic_finite.d.ts +15 -0
  129. package/src/shade/renderer/acoustics/chunk_acoustic_finite.d.ts.map +1 -0
  130. package/src/shade/renderer/acoustics/chunk_acoustic_finite.js +21 -0
  131. package/src/shade/renderer/acoustics/chunk_acoustic_gather.js +1 -1
  132. package/src/shade/renderer/acoustics/chunk_acoustic_lean.d.ts +27 -0
  133. package/src/shade/renderer/acoustics/chunk_acoustic_lean.d.ts.map +1 -0
  134. package/src/shade/renderer/acoustics/chunk_acoustic_lean.js +42 -0
  135. package/src/shade/renderer/acoustics/chunk_acoustic_listener.d.ts +80 -0
  136. package/src/shade/renderer/acoustics/chunk_acoustic_listener.d.ts.map +1 -0
  137. package/src/shade/renderer/acoustics/chunk_acoustic_listener.js +274 -0
  138. package/src/shade/renderer/acoustics/chunk_acoustic_partials.d.ts +2 -2
  139. package/src/shade/renderer/acoustics/chunk_acoustic_partials.js +2 -2
  140. package/src/shade/renderer/acoustics/chunk_acoustic_phonon.d.ts +7 -0
  141. package/src/shade/renderer/acoustics/chunk_acoustic_phonon.d.ts.map +1 -1
  142. package/src/shade/renderer/acoustics/chunk_acoustic_phonon.js +24 -1
  143. package/src/shade/renderer/acoustics/chunk_acoustic_resample.js +1 -1
  144. package/src/shade/renderer/acoustics/chunk_acoustic_reservoir.js +1 -1
  145. package/src/shade/renderer/acoustics/chunk_acoustic_through.d.ts +43 -0
  146. package/src/shade/renderer/acoustics/chunk_acoustic_through.d.ts.map +1 -0
  147. package/src/shade/renderer/acoustics/chunk_acoustic_through.js +153 -0
  148. package/src/shade/renderer/acoustics/chunk_acoustic_trace.d.ts +3 -1
  149. package/src/shade/renderer/acoustics/chunk_acoustic_trace.d.ts.map +1 -1
  150. package/src/shade/renderer/acoustics/chunk_acoustic_trace.js +10 -1
  151. package/src/shade/renderer/acoustics/shader_acoustic_combine.d.ts +7 -3
  152. package/src/shade/renderer/acoustics/shader_acoustic_combine.d.ts.map +1 -1
  153. package/src/shade/renderer/acoustics/shader_acoustic_combine.js +22 -6
  154. package/src/shade/renderer/acoustics/shader_acoustic_coupling.d.ts +14 -0
  155. package/src/shade/renderer/acoustics/shader_acoustic_coupling.d.ts.map +1 -0
  156. package/src/shade/renderer/acoustics/shader_acoustic_coupling.js +102 -0
  157. package/src/shade/renderer/acoustics/shader_acoustic_listener.d.ts +12 -0
  158. package/src/shade/renderer/acoustics/shader_acoustic_listener.d.ts.map +1 -0
  159. package/src/shade/renderer/acoustics/shader_acoustic_listener.js +80 -0
  160. package/src/shade/renderer/acoustics/shader_acoustic_receive.d.ts.map +1 -1
  161. package/src/shade/renderer/acoustics/shader_acoustic_receive.js +27 -6
  162. package/src/shade/renderer/acoustics/shader_acoustic_room.d.ts +11 -0
  163. package/src/shade/renderer/acoustics/shader_acoustic_room.d.ts.map +1 -0
  164. package/src/shade/renderer/acoustics/shader_acoustic_room.js +111 -0
  165. package/src/shade/renderer/acoustics/shader_acoustic_source.d.ts +18 -0
  166. package/src/shade/renderer/acoustics/shader_acoustic_source.d.ts.map +1 -0
  167. package/src/shade/renderer/acoustics/shader_acoustic_source.js +130 -0
  168. package/src/shade/renderer/deferred/chunk_read_gBuffer_material.d.ts.map +1 -1
  169. package/src/shade/renderer/deferred/chunk_read_gBuffer_material.js +3 -1
  170. package/src/shade/renderer/deferred/chunk_shade_direct_lights.d.ts +23 -0
  171. package/src/shade/renderer/deferred/chunk_shade_direct_lights.d.ts.map +1 -0
  172. package/src/shade/renderer/deferred/chunk_shade_direct_lights.js +111 -0
  173. package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts +17 -6
  174. package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts.map +1 -1
  175. package/src/shade/renderer/deferred/chunk_shade_directional_lights.js +26 -21
  176. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.d.ts +12 -22
  177. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.d.ts.map +1 -1
  178. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.js +20 -100
  179. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct_restir.d.ts.map +1 -1
  180. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct_restir.js +6 -4
  181. package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.d.ts +15 -0
  182. package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.d.ts.map +1 -0
  183. package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.js +47 -0
  184. package/src/shade/renderer/extension/ViewLighting.d.ts +101 -0
  185. package/src/shade/renderer/extension/ViewLighting.d.ts.map +1 -0
  186. package/src/shade/renderer/extension/ViewLighting.js +168 -0
  187. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  188. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  189. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -7
  190. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  191. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  192. package/src/shade/renderer/geometry/virtual/build/level/VGeoFrontier.d.ts +2 -2
  193. package/src/shade/renderer/geometry/virtual/build/level/VGeoFrontier.js +2 -2
  194. package/src/shade/renderer/geometry/virtual/build/level/VGeoLevelOptions.d.ts +5 -2
  195. package/src/shade/renderer/geometry/virtual/build/level/VGeoLevelOptions.d.ts.map +1 -1
  196. package/src/shade/renderer/geometry/virtual/build/level/VGeoLevelOptions.js +5 -2
  197. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.d.ts +9 -2
  198. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.d.ts.map +1 -1
  199. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.js +48 -12
  200. package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.d.ts +0 -22
  201. package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.d.ts.map +1 -1
  202. package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.js +0 -42
  203. package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.d.ts +2 -18
  204. package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.d.ts.map +1 -1
  205. package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.js +2 -19
  206. package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_worker_serve.d.ts.map +1 -1
  207. package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_worker_serve.js +0 -1
  208. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts +5 -4
  209. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts.map +1 -1
  210. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.js +3 -1
  211. package/src/shade/renderer/geometry/virtual/runtime/VGeoFeedbackLoop.d.ts.map +1 -1
  212. package/src/shade/renderer/geometry/virtual/runtime/VGeoFeedbackLoop.js +3 -1
  213. package/src/shade/renderer/geometry/virtual/runtime/VGeoPageFetcher.d.ts.map +1 -1
  214. package/src/shade/renderer/geometry/virtual/runtime/VGeoPageFetcher.js +0 -1
  215. package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.d.ts +60 -14
  216. package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.d.ts.map +1 -1
  217. package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.js +75 -39
  218. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_indirect_lighting.d.ts.map +1 -1
  219. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_indirect_lighting.js +3 -1
  220. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +1 -1
  221. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts +0 -9
  222. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts.map +1 -1
  223. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.js +45 -17
  224. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +7 -3
  225. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
  226. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +43 -7
  227. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.d.ts.map +1 -1
  228. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.js +3 -1
  229. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts +15 -7
  230. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts.map +1 -1
  231. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js +40 -9
  232. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts +23 -0
  233. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts.map +1 -1
  234. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.js +26 -0
  235. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts +1 -0
  236. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.js +6 -0
  237. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts +13 -1
  238. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts.map +1 -1
  239. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.js +23 -1
  240. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts.map +1 -1
  241. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.js +2 -0
  242. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts +29 -0
  243. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts.map +1 -0
  244. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.js +102 -0
  245. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts +8 -1
  246. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts.map +1 -1
  247. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.js +27 -1
  248. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts +4 -1
  249. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts.map +1 -1
  250. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.js +4 -1
  251. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts +11 -5
  252. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts.map +1 -1
  253. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.js +28 -10
  254. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts +36 -2
  255. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts.map +1 -1
  256. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.js +149 -4
  257. package/src/shade/renderer/global_illumination/shader_resolve_indirect_lighting.d.ts.map +1 -1
  258. package/src/shade/renderer/global_illumination/shader_resolve_indirect_lighting.js +3 -1
  259. package/src/shade/renderer/hair/GPUHairSystem.d.ts +159 -0
  260. package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -0
  261. package/src/shade/renderer/hair/GPUHairSystem.js +1132 -0
  262. package/src/shade/renderer/hair/HAIR.d.ts +102 -0
  263. package/src/shade/renderer/hair/HAIR.d.ts.map +1 -0
  264. package/src/shade/renderer/hair/HAIR.js +115 -0
  265. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.d.ts +17 -0
  266. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.d.ts.map +1 -0
  267. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.js +71 -0
  268. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts +11 -0
  269. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts.map +1 -0
  270. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.js +48 -0
  271. package/src/shade/renderer/hair/HairFrame.d.ts +41 -0
  272. package/src/shade/renderer/hair/HairFrame.d.ts.map +1 -0
  273. package/src/shade/renderer/hair/HairFrame.js +76 -0
  274. package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts +42 -0
  275. package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts.map +1 -0
  276. package/src/shade/renderer/hair/chunk_hair_bsdf.js +170 -0
  277. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts +30 -0
  278. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts.map +1 -0
  279. package/src/shade/renderer/hair/chunk_hair_dual_scattering.js +131 -0
  280. package/src/shade/renderer/hair/chunk_hair_pixel.d.ts +32 -0
  281. package/src/shade/renderer/hair/chunk_hair_pixel.d.ts.map +1 -0
  282. package/src/shade/renderer/hair/chunk_hair_pixel.js +116 -0
  283. package/src/shade/renderer/hair/chunk_hair_strand.d.ts +40 -0
  284. package/src/shade/renderer/hair/chunk_hair_strand.d.ts.map +1 -0
  285. package/src/shade/renderer/hair/chunk_hair_strand.js +85 -0
  286. package/src/shade/renderer/hair/chunk_hair_volume.d.ts +31 -0
  287. package/src/shade/renderer/hair/chunk_hair_volume.d.ts.map +1 -0
  288. package/src/shade/renderer/hair/chunk_hair_volume.js +106 -0
  289. package/src/shade/renderer/hair/hair_id_draw.d.ts +24 -0
  290. package/src/shade/renderer/hair/hair_id_draw.d.ts.map +1 -0
  291. package/src/shade/renderer/hair/hair_id_draw.js +135 -0
  292. package/src/shade/renderer/hair/hair_lighting.d.ts +53 -0
  293. package/src/shade/renderer/hair/hair_lighting.d.ts.map +1 -0
  294. package/src/shade/renderer/hair/hair_lighting.js +270 -0
  295. package/src/shade/renderer/hair/hair_scattering_lut.d.ts +75 -0
  296. package/src/shade/renderer/hair/hair_scattering_lut.d.ts.map +1 -0
  297. package/src/shade/renderer/hair/hair_scattering_lut.js +271 -0
  298. package/src/shade/renderer/hair/hair_stamp.d.ts +33 -0
  299. package/src/shade/renderer/hair/hair_stamp.d.ts.map +1 -0
  300. package/src/shade/renderer/hair/hair_stamp.js +175 -0
  301. package/src/shade/renderer/hair/shader_hair_classes.d.ts +21 -0
  302. package/src/shade/renderer/hair/shader_hair_classes.d.ts.map +1 -0
  303. package/src/shade/renderer/hair/shader_hair_classes.js +86 -0
  304. package/src/shade/renderer/hair/shader_hair_cull.d.ts +31 -0
  305. package/src/shade/renderer/hair/shader_hair_cull.d.ts.map +1 -0
  306. package/src/shade/renderer/hair/shader_hair_cull.js +194 -0
  307. package/src/shade/renderer/hair/shader_hair_lod.d.ts +33 -0
  308. package/src/shade/renderer/hair/shader_hair_lod.d.ts.map +1 -0
  309. package/src/shade/renderer/hair/shader_hair_lod.js +268 -0
  310. package/src/shade/renderer/hair/shader_hair_volume.d.ts +28 -0
  311. package/src/shade/renderer/hair/shader_hair_volume.d.ts.map +1 -0
  312. package/src/shade/renderer/hair/shader_hair_volume.js +167 -0
  313. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  314. package/src/shade/renderer/loader/usd/usd_build_scene.d.ts +31 -0
  315. package/src/shade/renderer/loader/usd/usd_build_scene.d.ts.map +1 -1
  316. package/src/shade/renderer/loader/usd/usd_build_scene.js +36 -21
  317. package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts +60 -0
  318. package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts.map +1 -0
  319. package/src/shade/renderer/loader/usd/usd_groom_extension.js +417 -0
  320. package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.d.ts.map +1 -1
  321. package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.js +4 -1
  322. package/src/shade/renderer/path_tracer/shader/chunk_shading_closure_from_material_data.d.ts.map +1 -1
  323. package/src/shade/renderer/path_tracer/shader/chunk_shading_closure_from_material_data.js +3 -1
  324. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  325. package/src/shade/renderer/postprocess/ssr/SSR.d.ts +4 -1
  326. package/src/shade/renderer/postprocess/ssr/SSR.d.ts.map +1 -1
  327. package/src/shade/renderer/postprocess/ssr/SSR.js +9 -0
  328. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.d.ts +16 -1
  329. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.d.ts.map +1 -1
  330. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.js +47 -3
  331. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader.d.ts.map +1 -1
  332. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader.js +5 -3
  333. package/src/shade/renderer/postprocess/ssr/ssr_combine_shader.d.ts.map +1 -1
  334. package/src/shade/renderer/postprocess/ssr/ssr_combine_shader.js +6 -5
  335. package/src/shade/renderer/rasterize/forward/chunk_forward_shade_standard_fragment.d.ts.map +1 -1
  336. package/src/shade/renderer/rasterize/forward/chunk_forward_shade_standard_fragment.js +5 -2
  337. package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.d.ts.map +1 -1
  338. package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.js +5 -0
  339. package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.d.ts.map +1 -1
  340. package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.js +4 -1
  341. package/src/shade/renderer/rasterize/native/oit/oit_resolve_fragment_body.d.ts.map +1 -1
  342. package/src/shade/renderer/rasterize/native/oit/oit_resolve_fragment_body.js +5 -1
  343. package/src/shade/renderer/rasterize/native/oit/shader_oit_generate_moments.d.ts.map +1 -1
  344. package/src/shade/renderer/rasterize/native/oit/shader_oit_generate_moments.js +7 -4
  345. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts +13 -8
  346. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts.map +1 -1
  347. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.js +18 -14
  348. package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.d.ts +3 -2
  349. package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.d.ts.map +1 -1
  350. package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.js +12 -4
  351. package/src/shade/renderer/shader/chunk/material/MATERIAL_SHADING_INFO_STRUCT.d.ts.map +1 -1
  352. package/src/shade/renderer/shader/chunk/material/MATERIAL_SHADING_INFO_STRUCT.js +1 -0
  353. package/src/shade/renderer/shader/chunk/material/chunk_compute_indirect_specular.js +1 -1
  354. package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.d.ts +16 -0
  355. package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.d.ts.map +1 -0
  356. package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.js +25 -0
  357. package/src/shade/renderer/shader/chunk/material/chunk_re_direct_multiscatter.js +2 -2
  358. package/src/shade/renderer/shader/compiler/ShaderSwitch.d.ts +1 -1
  359. package/src/shade/renderer/shader/compiler/ShaderSwitchSet.d.ts +1 -1
  360. package/src/shade/renderer/shader/resource/ShaderResourceDescriptor.d.ts +1 -1
  361. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.d.ts +2 -2
  362. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.js +2 -2
  363. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -19,30 +19,31 @@
19
19
  ### Sound: acoustics traced on the GPU, live, through the world the GI traces
20
20
 
21
21
  - **Added:** `GPUAcousticSystem` (`engine/graphics3/`): the acoustic simulation's propagation, traced through the
22
- scene's brick clipmap every frame with nothing baked. The listener emits phonons, which fly from bounce to bounce by
23
- one cosine lobe tilted toward the mirror direction by the surface's scattering (`acoustic_lobe`). Each live
24
- acoustic source traces its direct path through walls at a fixed pattern of 32 points and gathers the phonons' paths
25
- to it. A source hears its direct sound through what the walls let through, its early reflections from where they
26
- arrive, and its reverberation with a decay that follows the room. A listener-centred lattice of receivers answers a
27
- newborn sound until its own first result lands. Kernels and tables in `shade/renderer/acoustics/`.
28
- - **Added:** nothing of the acoustics is averaged over time. Every stored path is joined to the listener where it is
29
- now (`acoustic_reconnect`). A gather lane weighs 64 phonons by what each would bring with nothing in the way and
30
- traces one drawn in proportion (`acoustic_pick`), and keeps a path from frame to frame, traced again each frame
31
- where the listener and the source are (`acoustic_reservoir_lane`). A source takes one to 16 workgroups of lanes: every
32
- live source has one, and 16 more a frame (`ACOUSTIC_PARTS_BUDGET`) are shared by unoccluded loudness
33
- (`EventInstance#currentGain` squared) times the measured spread of each source's estimate
34
- (`acoustic_allocate_parts`, `GPUAcoustics#set_importance`). On the listening page a lone source's reflected levels
35
- move by 0.1 to 0.35 dB rms from frame to frame.
36
- - **Added:** acoustic results reach Web Audio about 5 ms after the frame's listener pose, on a 4090 and on an
37
- integrated GPU alike. The receivers are submitted ahead of the frame's rendering (`FrameContext#early_graph`, a graph
22
+ scene's brick clipmap with nothing baked (`GPUAcousticProbes`, kernels in `shade/renderer/acoustics/`). One probe at
23
+ the listener: 2,048 fixed rays to their first hits each frame, whose surface, volume and absorption give the room's
24
+ mean free path, Eyring's decay per band and its lean. Each heard acoustic source marches its direct path as one cone
25
+ over its disk, the share each occluder leaves open and the walls' transmission of the rest (within 0.05 of the
26
+ geometry across an edge or a floor, read from the field's own distance), and one path from each of the listener's hits,
27
+ its first-order reflections at the listener, the orders after as the room's absorption and the air have them: its
28
+ reverberant energy, through whatever doorway it has to pass, and through walls darkened as their transmission is per
29
+ band. Paths through walls are read from both ends, their cost the same however many walls stand between. Every ray is
30
+ the same every frame, so a still scene reads the same. A source out of hearing is not traced. About 0.31 ms of an AMD
31
+ iGPU with one source, 64 ms with 1,024.
32
+ - **Added:** the path-traced acoustics it was first built on are kept in the tree, unwired: the phonon ring the listener
33
+ emits, gather lanes with reservoirs and a shared ray budget (`GPUAcoustics`), and the lattice. What was measured on
34
+ them and why they were set aside: `simulation/PATH_TRACED_RESEARCH.md`.
35
+ - **Added:** acoustic results reach Web Audio as soon as the device has produced them, not at the next frame. The
36
+ acoustics are submitted ahead of the frame's rendering (`FrameContext#early_graph`, a graph
38
37
  the renderer submits on its own when `FrameStart` ends; `FrameGraph#pass_count`), `GPUDatabaseReadback` starts a
39
38
  batch's mapping at the submit of the frame that recorded it (was the next apply point) and takes an `on_landed`
40
39
  callback, and results are applied when the mapping lands (`AcousticSimulator#refresh`).
41
40
  - **Added:** the listening page, `src/shade/playground/acoustics/`: a hall, a corridor, a soft room and open ground
42
41
  with one source, to walk and hear the acoustics and to read each frame's direct, early and late levels.
43
- - **Added:** `AcousticReverbEffect`, a bus insert: one feedback delay network whose decay per band follows the
44
- acoustic instances that send to it, retuned every frame, and whose output is corrected from a gain model of what its
45
- tail holds, so leaving a room is heard at the new level at once. An acoustic instance sends to the nearest bus above
42
+ - **Added:** `AcousticReverbEffect`, a bus insert: a convolution with a decaying noise whose decay per band follows
43
+ the acoustic instances that send to it (`AcousticReverbConvolution`: Linkwitz–Riley bands, a new decay warmed in a
44
+ second convolver until its tail has built, then crossed over to), and whose output is corrected from a gain model
45
+ of what its tail holds, so leaving a room is heard at the new level at once. `AcousticReverbNetwork` takes its tank:
46
+ the convolution, or `AcousticReverbLines`, the feedback delay network it was first built with. An acoustic instance sends to the nearest bus above
46
47
  its own that has one; with none, its early taps carry all of its early energy.
47
48
  - **Added:** `GPUSceneContext#brick_clipmap` (`GPUSceneBrickClipmap`): the brick clipmap as a scene service that
48
49
  any reader holds, built under any lighting mode while held. The probe clipmap GI holds it.
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "Advanced 3D game engine",
7
7
  "type": "module",
8
8
  "author": "Alexander Goldring",
9
- "version": "3.74.0",
9
+ "version": "3.76.0",
10
10
  "exports": {
11
11
  "./build/*": "./build/*",
12
12
  "./src/*": "./src/*",
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Index of a cell along the 2-D Hilbert curve through a `2^order × 2^order` grid: cells next along the curve are
3
+ * neighbours on the grid, and every run of the curve covers a compact block of it.
4
+ *
5
+ * @param {number} x integer in `[0, 2^order)`
6
+ * @param {number} y integer in `[0, 2^order)`
7
+ * @param {number} order bits per axis, at most 15
8
+ * @returns {number} integer in `[0, 4^order)`
9
+ */
10
+ export function v2_hilbert_encode(x: number, y: number, order: number): number;
11
+ //# sourceMappingURL=v2_hilbert_encode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2_hilbert_encode.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/hilbert/v2_hilbert_encode.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,qCALW,MAAM,KACN,MAAM,SACN,MAAM,GACJ,MAAM,CAoClB"}
@@ -0,0 +1,46 @@
1
+ import { assert } from "../../../assert.js";
2
+
3
+ /**
4
+ * Index of a cell along the 2-D Hilbert curve through a `2^order × 2^order` grid: cells next along the curve are
5
+ * neighbours on the grid, and every run of the curve covers a compact block of it.
6
+ *
7
+ * @param {number} x integer in `[0, 2^order)`
8
+ * @param {number} y integer in `[0, 2^order)`
9
+ * @param {number} order bits per axis, at most 15
10
+ * @returns {number} integer in `[0, 4^order)`
11
+ */
12
+ export function v2_hilbert_encode(x, y, order) {
13
+ assert.isNonNegativeInteger(order, 'order');
14
+ assert.lessThanOrEqual(order, 15, 'order');
15
+ assert.isNonNegativeInteger(x, 'x');
16
+ assert.isNonNegativeInteger(y, 'y');
17
+
18
+ const n = 1 << order;
19
+
20
+ assert.lessThan(x, n, 'x');
21
+ assert.lessThan(y, n, 'y');
22
+
23
+ let d = 0;
24
+
25
+ for (let s = n >> 1; s > 0; s >>= 1) {
26
+ const rx = (x & s) > 0 ? 1 : 0;
27
+ const ry = (y & s) > 0 ? 1 : 0;
28
+
29
+ d += s * s * ((3 * rx) ^ ry);
30
+
31
+ // turn the quadrant so the curve within it runs the same way as at the top level
32
+ if (ry === 0) {
33
+ if (rx === 1) {
34
+ x = s - 1 - (x & (s - 1));
35
+ y = s - 1 - (y & (s - 1));
36
+ }
37
+
38
+ const t = x;
39
+
40
+ x = y;
41
+ y = t;
42
+ }
43
+ }
44
+
45
+ return d;
46
+ }
@@ -18,5 +18,6 @@ export namespace GameAssetType {
18
18
  let JavaScript: string;
19
19
  let Sound: string;
20
20
  let Font: string;
21
+ let Groom: string;
21
22
  }
22
23
  //# sourceMappingURL=GameAssetType.d.ts.map
@@ -29,5 +29,9 @@ export const GameAssetType = {
29
29
  AnimationGraph: 'x-meep/animation-graph',
30
30
  JavaScript: "text/javascript",
31
31
  Sound: 'audio',
32
- Font: 'font/opentype'
32
+ Font: 'font/opentype',
33
+ /**
34
+ * Strand hair at rest (`Groom`): a groom file, or a USD file whose BasisCurves prims are its groups.
35
+ */
36
+ Groom: 'x-meep/groom'
33
37
  };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * A {@link Groom} as a file: {@link GROOM_FILE_MAGIC}, the format's version (u32), then the groom
3
+ * ({@link GroomSerializationAdapter}).
4
+ *
5
+ * @param {Groom} groom
6
+ * @returns {ArrayBuffer}
7
+ */
8
+ export function groom_to_file(groom: Groom): ArrayBuffer;
9
+ /**
10
+ * The groom a file holds, as {@link groom_to_file} wrote it.
11
+ *
12
+ * @param {ArrayBuffer} data
13
+ * @returns {Groom}
14
+ */
15
+ export function groom_from_file(data: ArrayBuffer): Groom;
16
+ /**
17
+ * The four bytes a groom file opens with, "MGRM", read as a little-endian u32.
18
+ * @type {number}
19
+ */
20
+ export const GROOM_FILE_MAGIC: number;
21
+ /**
22
+ * Loads a {@link Groom} ({@link GameAssetType.Groom}): a groom file, or a USD file whose BasisCurves prims become its
23
+ * groups (`load_groom_usd`), told apart by the file's first bytes. The asset hands out the one groom, so every entity
24
+ * that wears it shares it.
25
+ */
26
+ export class GroomAssetLoader extends AssetLoader<any, any> {
27
+ constructor();
28
+ load(scope: any, path: any, success: any, failure: any, progress: any): Promise<Asset<Groom>>;
29
+ }
30
+ import { Groom } from "../../graphics/hair/Groom.js";
31
+ import { AssetLoader } from "./AssetLoader.js";
32
+ import { Asset } from "../Asset.js";
33
+ //# sourceMappingURL=GroomAssetLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GroomAssetLoader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/asset/loaders/GroomAssetLoader.js"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,qCAHW,KAAK,GACH,WAAW,CAcvB;AAED;;;;;GAKG;AACH,sCAHW,WAAW,GACT,KAAK,CAiBjB;AAhDD;;;GAGG;AACH,+BAFU,MAAM,CAE2B;AA8C3C;;;;GAIG;AACH;;IAaI,8FAmBC;CACJ;sBA/FqB,8BAA8B;4BAKxB,kBAAkB;sBAHxB,aAAa"}
@@ -0,0 +1,99 @@
1
+ import { assert } from "../../../core/assert.js";
2
+ import { BinaryBuffer } from "../../../core/binary/BinaryBuffer.js";
3
+ import { load_groom_usd } from "../../../shade/renderer/loader/usd/usd_groom_extension.js";
4
+ import { Groom } from "../../graphics/hair/Groom.js";
5
+ import { GroomSerializationAdapter } from "../../graphics/hair/GroomSerializationAdapter.js";
6
+ import { Asset } from "../Asset.js";
7
+ import { GameAssetType } from "../GameAssetType.js";
8
+ import { ArrayBufferLoader } from "./ArrayBufferLoader.js";
9
+ import { AssetLoader } from "./AssetLoader.js";
10
+
11
+ /**
12
+ * The four bytes a groom file opens with, "MGRM", read as a little-endian u32.
13
+ * @type {number}
14
+ */
15
+ export const GROOM_FILE_MAGIC = 0x4D52474D;
16
+
17
+ /**
18
+ * A {@link Groom} as a file: {@link GROOM_FILE_MAGIC}, the format's version (u32), then the groom
19
+ * ({@link GroomSerializationAdapter}).
20
+ *
21
+ * @param {Groom} groom
22
+ * @returns {ArrayBuffer}
23
+ */
24
+ export function groom_to_file(groom) {
25
+ const adapter = new GroomSerializationAdapter();
26
+ const buffer = new BinaryBuffer();
27
+
28
+ buffer.writeUint32(GROOM_FILE_MAGIC);
29
+ buffer.writeUint32(adapter.version);
30
+
31
+ adapter.serialize(buffer, groom);
32
+
33
+ buffer.trim();
34
+
35
+ return buffer.data;
36
+ }
37
+
38
+ /**
39
+ * The groom a file holds, as {@link groom_to_file} wrote it.
40
+ *
41
+ * @param {ArrayBuffer} data
42
+ * @returns {Groom}
43
+ */
44
+ export function groom_from_file(data) {
45
+ const adapter = new GroomSerializationAdapter();
46
+ const buffer = BinaryBuffer.fromArrayBuffer(data);
47
+
48
+ assert.equal(buffer.readUint32(), GROOM_FILE_MAGIC, 'not a groom file');
49
+
50
+ const version = buffer.readUint32();
51
+
52
+ assert.lessThanOrEqual(version, adapter.version, `a groom file of version ${version}, newer than this engine reads`);
53
+
54
+ const groom = new Groom();
55
+
56
+ adapter.deserialize(buffer, groom);
57
+
58
+ return groom;
59
+ }
60
+
61
+ /**
62
+ * Loads a {@link Groom} ({@link GameAssetType.Groom}): a groom file, or a USD file whose BasisCurves prims become its
63
+ * groups (`load_groom_usd`), told apart by the file's first bytes. The asset hands out the one groom, so every entity
64
+ * that wears it shares it.
65
+ */
66
+ export class GroomAssetLoader extends AssetLoader {
67
+ /**
68
+ * @param {import("../AssetManager.js").AssetManager} assetManager
69
+ * @param {*} context
70
+ */
71
+ async link(assetManager, context) {
72
+ if (assetManager.getLoaderByType(GameAssetType.ArrayBuffer) === undefined) {
73
+ await assetManager.registerLoader(GameAssetType.ArrayBuffer, new ArrayBufferLoader());
74
+ }
75
+
76
+ await super.link(assetManager, context);
77
+ }
78
+
79
+ async load(scope, path, success, failure, progress) {
80
+ try {
81
+ const bytes = await this.assetManager.promise(path, GameAssetType.ArrayBuffer, { scope, progress });
82
+
83
+ /** @type {ArrayBuffer} */
84
+ const data = bytes.create();
85
+
86
+ const is_groom = data.byteLength >= 4 && new DataView(data).getUint32(0, true) === GROOM_FILE_MAGIC;
87
+
88
+ const groom = is_groom ? groom_from_file(data) : await load_groom_usd(data, { fileName: path });
89
+
90
+ const asset = new Asset(() => groom, data.byteLength);
91
+
92
+ success(asset);
93
+
94
+ return asset;
95
+ } catch (e) {
96
+ failure(e);
97
+ }
98
+ }
99
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Strand hair worn by an entity: a {@link Groom}, carried by the entity's transform, and the colour of its fibres.
3
+ * For a head of hair, attach the entity to the head's bone; the skull is rigid.
4
+ *
5
+ * The component is the hair's description; its strands are drawn where {@link HairSystem} draws them, on the GPU.
6
+ * A game writes these fields and the system picks the change up.
7
+ *
8
+ * The colour is physical: how much melanin a fibre holds, how much of that is the red pheomelanin, and a dye over
9
+ * both. Each strand of the groom moves the melanin by its own variation.
10
+ */
11
+ export class Hair {
12
+ /**
13
+ * @type {import("../../hair/Groom.js").Groom|null}
14
+ */
15
+ groom: import("../../hair/Groom.js").Groom | null;
16
+ /**
17
+ * Melanin in a fibre, from none (white) to 1 (black).
18
+ * @type {number}
19
+ */
20
+ melanin: number;
21
+ /**
22
+ * The share of the melanin that is pheomelanin, from none (brown to black) to all of it (red).
23
+ * @type {number}
24
+ */
25
+ redness: number;
26
+ /**
27
+ * A dye's colour, linear; white is no dye.
28
+ * @readonly
29
+ * @type {Color}
30
+ */
31
+ readonly dye: Color;
32
+ /**
33
+ * How rough a fibre's surface is along its length, from 0 to 1: how wide its highlights spread.
34
+ * @type {number}
35
+ */
36
+ roughness: number;
37
+ /**
38
+ * @param {Hair} other
39
+ * @returns {boolean}
40
+ */
41
+ equals(other: Hair): boolean;
42
+ }
43
+ export namespace Hair {
44
+ let typeName: string;
45
+ }
46
+ import { Color } from "../../../../core/color/Color.js";
47
+ //# sourceMappingURL=Hair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Hair.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/hair/Hair.js"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH;IACI;;OAEG;IACH,OAFU,OAAO,qBAAqB,EAAE,KAAK,GAAC,IAAI,CAErC;IAEb;;;OAGG;IACH,SAFU,MAAM,CAEF;IAEd;;;OAGG;IACH,SAFU,MAAM,CAEJ;IAEZ;;;;OAIG;IACH,cAFU,KAAK,CAEa;IAE5B;;;OAGG;IACH,WAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,cAHW,IAAI,GACF,OAAO,CAQnB;CACJ;;kBAIS,MAAM;;sBA1DM,iCAAiC"}
@@ -0,0 +1,61 @@
1
+ import { Color } from "../../../../core/color/Color.js";
2
+
3
+ /**
4
+ * Strand hair worn by an entity: a {@link Groom}, carried by the entity's transform, and the colour of its fibres.
5
+ * For a head of hair, attach the entity to the head's bone; the skull is rigid.
6
+ *
7
+ * The component is the hair's description; its strands are drawn where {@link HairSystem} draws them, on the GPU.
8
+ * A game writes these fields and the system picks the change up.
9
+ *
10
+ * The colour is physical: how much melanin a fibre holds, how much of that is the red pheomelanin, and a dye over
11
+ * both. Each strand of the groom moves the melanin by its own variation.
12
+ */
13
+ export class Hair {
14
+ /**
15
+ * @type {import("../../hair/Groom.js").Groom|null}
16
+ */
17
+ groom = null;
18
+
19
+ /**
20
+ * Melanin in a fibre, from none (white) to 1 (black).
21
+ * @type {number}
22
+ */
23
+ melanin = 0.5;
24
+
25
+ /**
26
+ * The share of the melanin that is pheomelanin, from none (brown to black) to all of it (red).
27
+ * @type {number}
28
+ */
29
+ redness = 0;
30
+
31
+ /**
32
+ * A dye's colour, linear; white is no dye.
33
+ * @readonly
34
+ * @type {Color}
35
+ */
36
+ dye = new Color(1, 1, 1, 1);
37
+
38
+ /**
39
+ * How rough a fibre's surface is along its length, from 0 to 1: how wide its highlights spread.
40
+ * @type {number}
41
+ */
42
+ roughness = 0.3;
43
+
44
+ /**
45
+ * @param {Hair} other
46
+ * @returns {boolean}
47
+ */
48
+ equals(other) {
49
+ return this.groom === other.groom
50
+ && this.melanin === other.melanin
51
+ && this.redness === other.redness
52
+ && this.dye.equals(other.dye)
53
+ && this.roughness === other.roughness;
54
+ }
55
+ }
56
+
57
+ /**
58
+ * @readonly
59
+ * @type {string}
60
+ */
61
+ Hair.typeName = "Hair";
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Words of one rest point in {@link GroomGroup#points}: `x | y << 16`, then `z | width << 16`, the top
3
+ * byte of the second word spare.
4
+ * @type {number}
5
+ */
6
+ export const GROOM_POINT_WORDS: number;
7
+ /**
8
+ * Steps a rest point's coordinate takes across its group's bounds: 16 bits, 6 µm over 40 cm.
9
+ * @type {number}
10
+ */
11
+ export const GROOM_POINT_COORDINATE_STEPS: number;
12
+ /**
13
+ * Steps a rest point's width takes from zero to its group's {@link GroomGroup#width_max}: 8 bits.
14
+ * @type {number}
15
+ */
16
+ export const GROOM_POINT_WIDTH_STEPS: number;
17
+ /**
18
+ * The most points a strand of a group has: `2^7 + 1`.
19
+ * @type {number}
20
+ */
21
+ export const GROOM_POINT_COUNT_MAX: number;
22
+ /**
23
+ * Strands of hair that share a point count, as they are at rest: a scalp, the brows, the lashes, a beard.
24
+ *
25
+ * Every strand has {@link point_count} points, `2^k + 1` of them, spaced evenly along its own arc length from
26
+ * the root (its first point) to the tip. The strands are stored in **rank order**: any first `n` of them are a
27
+ * well-spread subset of the group, so drawing a prefix thins the group evenly (`groom_rank_order`).
28
+ *
29
+ * Points are quantized inside the group's {@link bounds} (`GROOM_POINT_WORDS` a point); a point's width is
30
+ * a share of {@link width_max}.
31
+ */
32
+ export class GroomGroup {
33
+ /**
34
+ * @type {string}
35
+ */
36
+ name: string;
37
+ /**
38
+ * Points a strand has, `2^k + 1`, between 2 and {@link GROOM_POINT_COUNT_MAX}.
39
+ * @type {number}
40
+ */
41
+ point_count: number;
42
+ /**
43
+ * @type {number}
44
+ */
45
+ strand_count: number;
46
+ /**
47
+ * The box the points are quantized in: min x, y, z, then max x, y, z, in metres.
48
+ * @type {Float32Array}
49
+ */
50
+ bounds: Float32Array;
51
+ /**
52
+ * The widest a point is, metres.
53
+ * @type {number}
54
+ */
55
+ width_max: number;
56
+ /**
57
+ * The mean width of the group's points, metres: the width the level of detail keeps the group's area
58
+ * by.
59
+ * @type {number}
60
+ */
61
+ width_mean: number;
62
+ /**
63
+ * How far apart the strands grow: the median distance from a root to the nearest other, metres
64
+ * (`groom_root_spacing`). Derived from the roots; not stored.
65
+ * @type {number}
66
+ */
67
+ root_spacing: number;
68
+ /**
69
+ * Rest points, strand after strand in rank order, root first: {@link GROOM_POINT_WORDS} words a point.
70
+ * @type {Uint32Array}
71
+ */
72
+ points: Uint32Array;
73
+ /**
74
+ * A strand's own variation of the colour its groom is given, a strand a byte in rank order: 0 is the
75
+ * least melanin the variation takes, 255 the most, 128 none.
76
+ * @type {Uint8Array}
77
+ */
78
+ variation: Uint8Array;
79
+ /**
80
+ * The largest chord error over the group's strands when only every `2^j`-th point is kept, by `j`, in
81
+ * metres: the distance from a dropped point to the chord between the kept points either side of it.
82
+ * Entry 0 is zero; there are `k + 1` entries for `2^k + 1` points.
83
+ * @type {Float32Array}
84
+ */
85
+ decimation: Float32Array;
86
+ /**
87
+ * @returns {number} entries of the decimation table: `k + 1` for the group's `2^k + 1` points
88
+ */
89
+ get level_count(): number;
90
+ /**
91
+ * Where a rest point is, in metres.
92
+ *
93
+ * @param {number[]|Float32Array|Float64Array} out
94
+ * @param {number} out_offset
95
+ * @param {number} strand rank of the strand
96
+ * @param {number} point index along the strand, from its root
97
+ */
98
+ read_point(out: number[] | Float32Array | Float64Array, out_offset: number, strand: number, point: number): void;
99
+ /**
100
+ * How wide a rest point is, in metres.
101
+ *
102
+ * @param {number} strand rank of the strand
103
+ * @param {number} point index along the strand, from its root
104
+ * @returns {number}
105
+ */
106
+ read_width(strand: number, point: number): number;
107
+ }
108
+ /**
109
+ * A head's hair, or a beast's fur, at rest: its {@link GroomGroup}s. An asset, shared by every entity that wears
110
+ * it; nothing in it changes once it is built.
111
+ */
112
+ export class Groom {
113
+ /**
114
+ * @type {GroomGroup[]}
115
+ */
116
+ groups: GroomGroup[];
117
+ /**
118
+ * @returns {number} strands across every group
119
+ */
120
+ get strand_count(): number;
121
+ /**
122
+ * @returns {number} points across every group
123
+ */
124
+ get point_count(): number;
125
+ /**
126
+ * @param {GroomGroup} group
127
+ */
128
+ add(group: GroomGroup): void;
129
+ }
130
+ //# sourceMappingURL=Groom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Groom.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/hair/Groom.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,gCAFU,MAAM,CAEmB;AAEnC;;;GAGG;AACH,2CAFU,MAAM,CAEmC;AAEnD;;;GAGG;AACH,sCAFU,MAAM,CAE4B;AAE5C;;;GAGG;AACH,oCAFU,MAAM,CAEyB;AAEzC;;;;;;;;;GASG;AACH;IACI;;OAEG;IACH,MAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,aAFU,MAAM,CAEA;IAEhB;;OAEG;IACH,cAFU,MAAM,CAEC;IAEjB;;;OAGG;IACH,QAFU,YAAY,CAEO;IAE7B;;;OAGG;IACH,WAFU,MAAM,CAEF;IAEd;;;;OAIG;IACH,YAFU,MAAM,CAED;IAEf;;;;OAIG;IACH,cAFU,MAAM,CAEC;IAEjB;;;OAGG;IACH,QAFU,WAAW,CAEO;IAE5B;;;;OAIG;IACH,WAFU,UAAU,CAEU;IAE9B;;;;;OAKG;IACH,YAFU,YAAY,CAEW;IAEjC;;OAEG;IACH,0BAEC;IAED;;;;;;;OAOG;IACH,gBALW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,cAClC,MAAM,UACN,MAAM,SACN,MAAM,QAehB;IAED;;;;;;OAMG;IACH,mBAJW,MAAM,SACN,MAAM,GACJ,MAAM,CAMlB;CACJ;AAED;;;GAGG;AACH;IACI;;OAEG;IACH,QAFU,UAAU,EAAE,CAEV;IAEZ;;OAEG;IACH,2BAQC;IAED;;OAEG;IACH,0BAUC;IAED;;OAEG;IACH,WAFW,UAAU,QAOpB;CACJ"}