@woosh/meep-engine 3.76.0 → 3.78.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 (265) hide show
  1. package/editor/particles/effect/ParticleReferenceSimulation.d.ts +11 -0
  2. package/editor/particles/effect/ParticleReferenceSimulation.d.ts.map +1 -1
  3. package/editor/particles/effect/ParticleReferenceSimulation.js +14 -0
  4. package/editor/view/particles/effect/ParticleGraphEditorView.js +1 -1
  5. package/package.json +3 -2
  6. package/src/engine/EngineHarness.d.ts +4 -6
  7. package/src/engine/EngineHarness.d.ts.map +1 -1
  8. package/src/engine/EngineHarness.js +11 -19
  9. package/src/engine/asset/loaders/GroomAssetLoader.d.ts +1 -1
  10. package/src/engine/asset/loaders/GroomAssetLoader.d.ts.map +1 -1
  11. package/src/engine/asset/loaders/GroomAssetLoader.js +16 -2
  12. package/src/engine/graphics/ecs/hair/Hair.d.ts +7 -0
  13. package/src/engine/graphics/ecs/hair/Hair.d.ts.map +1 -1
  14. package/src/engine/graphics/ecs/hair/Hair.js +9 -0
  15. package/src/engine/graphics/ecs/hair/HairDynamics.d.ts +63 -0
  16. package/src/engine/graphics/ecs/hair/HairDynamics.d.ts.map +1 -0
  17. package/src/engine/graphics/ecs/hair/HairDynamics.js +82 -0
  18. package/src/engine/graphics/hair/Groom.d.ts +45 -0
  19. package/src/engine/graphics/hair/Groom.d.ts.map +1 -1
  20. package/src/engine/graphics/hair/Groom.js +56 -0
  21. package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts +27 -1
  22. package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts.map +1 -1
  23. package/src/engine/graphics/hair/GroomSerializationAdapter.js +105 -32
  24. package/src/engine/graphics/hair/GroomSerializationUpgrader_0_1.d.ts +8 -0
  25. package/src/engine/graphics/hair/GroomSerializationUpgrader_0_1.d.ts.map +1 -0
  26. package/src/engine/graphics/hair/GroomSerializationUpgrader_0_1.js +31 -0
  27. package/src/engine/graphics/hair/groom_bind_to_mesh.d.ts +85 -0
  28. package/src/engine/graphics/hair/groom_bind_to_mesh.d.ts.map +1 -0
  29. package/src/engine/graphics/hair/groom_bind_to_mesh.js +216 -0
  30. package/src/engine/graphics/hair/groom_build_group.d.ts +7 -2
  31. package/src/engine/graphics/hair/groom_build_group.d.ts.map +1 -1
  32. package/src/engine/graphics/hair/groom_build_group.js +11 -2
  33. package/src/engine/graphics/hair/groom_build_guides.d.ts +43 -0
  34. package/src/engine/graphics/hair/groom_build_guides.d.ts.map +1 -0
  35. package/src/engine/graphics/hair/groom_build_guides.js +267 -0
  36. package/src/engine/graphics/hair/groom_root_spacing.d.ts +6 -4
  37. package/src/engine/graphics/hair/groom_root_spacing.d.ts.map +1 -1
  38. package/src/engine/graphics/hair/groom_root_spacing.js +199 -66
  39. package/src/engine/graphics3/HairColliderSystem.d.ts +59 -0
  40. package/src/engine/graphics3/HairColliderSystem.d.ts.map +1 -0
  41. package/src/engine/graphics3/HairColliderSystem.js +270 -0
  42. package/src/engine/graphics3/HairSystem.d.ts +21 -4
  43. package/src/engine/graphics3/HairSystem.d.ts.map +1 -1
  44. package/src/engine/graphics3/HairSystem.js +270 -4
  45. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  46. package/src/engine/sound/sopra/runtime/EventInstance.d.ts +0 -1
  47. package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -1
  48. package/src/engine/sound/sopra/runtime/EventInstance.js +0 -1
  49. package/src/shade/assets/textures/hair_scattering.bin +0 -0
  50. package/src/shade/playground/hair/main.js +27 -4
  51. package/src/shade/playground/hair_skinned/index.html +192 -0
  52. package/src/shade/playground/hair_skinned/main.d.ts +7 -0
  53. package/src/shade/playground/hair_skinned/main.d.ts.map +1 -0
  54. package/src/shade/playground/hair_skinned/main.js +481 -0
  55. package/src/shade/playground/hair_skinned/skinned_hair.d.ts +49 -0
  56. package/src/shade/playground/hair_skinned/skinned_hair.d.ts.map +1 -0
  57. package/src/shade/playground/hair_skinned/skinned_hair.js +362 -0
  58. package/src/shade/playground/sparks/README.md +36 -0
  59. package/src/shade/playground/sparks/index.html +145 -0
  60. package/src/shade/playground/sparks/main.d.ts +7 -0
  61. package/src/shade/playground/sparks/main.d.ts.map +1 -0
  62. package/src/shade/playground/sparks/main.js +312 -0
  63. package/src/shade/playground/sparks/sparks_effect.d.ts +72 -0
  64. package/src/shade/playground/sparks/sparks_effect.d.ts.map +1 -0
  65. package/src/shade/playground/sparks/sparks_effect.js +180 -0
  66. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  67. package/src/shade/renderer/Renderer.js +18 -3
  68. package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
  69. package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +1 -1
  70. package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
  71. package/src/shade/renderer/animation/GPUAnimationManager.d.ts +3 -2
  72. package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
  73. package/src/shade/renderer/animation/GPUAnimationManager.js +74 -3
  74. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts +13 -3
  75. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
  76. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +16 -5
  77. package/src/shade/renderer/animation/skinning/shader_meshlet_apply_skinning.js +8 -8
  78. package/src/shade/renderer/deferred/chunk_shade_direct_lights.js +2 -2
  79. package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts +4 -2
  80. package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts.map +1 -1
  81. package/src/shade/renderer/deferred/chunk_shade_directional_lights.js +7 -3
  82. package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.js +1 -1
  83. package/src/shade/renderer/extension/ShadowAtlas.d.ts +77 -0
  84. package/src/shade/renderer/extension/ShadowAtlas.d.ts.map +1 -0
  85. package/src/shade/renderer/extension/ShadowAtlas.js +135 -0
  86. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  87. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  88. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -7
  89. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  90. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  91. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +1 -1
  92. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts +37 -7
  93. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts.map +1 -1
  94. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.js +132 -8
  95. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +3 -1
  96. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
  97. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +6 -2
  98. package/src/shade/renderer/global_illumination/sharc/sharc_constants.d.ts +0 -18
  99. package/src/shade/renderer/global_illumination/sharc/sharc_constants.d.ts.map +1 -1
  100. package/src/shade/renderer/global_illumination/sharc/sharc_constants.js +1 -21
  101. package/src/shade/renderer/hair/GPUHairSystem.d.ts +121 -2
  102. package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -1
  103. package/src/shade/renderer/hair/GPUHairSystem.js +1187 -56
  104. package/src/shade/renderer/hair/HAIR.d.ts +22 -3
  105. package/src/shade/renderer/hair/HAIR.d.ts.map +1 -1
  106. package/src/shade/renderer/hair/HAIR.js +25 -4
  107. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.d.ts.map +1 -1
  108. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.js +33 -0
  109. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts +4 -0
  110. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts.map +1 -1
  111. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.js +24 -2
  112. package/src/shade/renderer/hair/HAIR_SIMULATION.d.ts +139 -0
  113. package/src/shade/renderer/hair/HAIR_SIMULATION.d.ts.map +1 -0
  114. package/src/shade/renderer/hair/HAIR_SIMULATION.js +160 -0
  115. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts +9 -2
  116. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts.map +1 -1
  117. package/src/shade/renderer/hair/chunk_hair_dual_scattering.js +40 -13
  118. package/src/shade/renderer/hair/chunk_hair_guide.d.ts +59 -0
  119. package/src/shade/renderer/hair/chunk_hair_guide.d.ts.map +1 -0
  120. package/src/shade/renderer/hair/chunk_hair_guide.js +179 -0
  121. package/src/shade/renderer/hair/chunk_hair_volume.d.ts +4 -3
  122. package/src/shade/renderer/hair/chunk_hair_volume.d.ts.map +1 -1
  123. package/src/shade/renderer/hair/chunk_hair_volume.js +21 -12
  124. package/src/shade/renderer/hair/hair_lighting.d.ts.map +1 -1
  125. package/src/shade/renderer/hair/hair_lighting.js +16 -7
  126. package/src/shade/renderer/hair/hair_scattering_lut.js +13 -13
  127. package/src/shade/renderer/hair/hair_shadow_draw.d.ts +32 -0
  128. package/src/shade/renderer/hair/hair_shadow_draw.d.ts.map +1 -0
  129. package/src/shade/renderer/hair/hair_shadow_draw.js +123 -0
  130. package/src/shade/renderer/hair/shader_hair_classes.d.ts +2 -1
  131. package/src/shade/renderer/hair/shader_hair_classes.d.ts.map +1 -1
  132. package/src/shade/renderer/hair/shader_hair_classes.js +6 -2
  133. package/src/shade/renderer/hair/shader_hair_cull.d.ts +8 -2
  134. package/src/shade/renderer/hair/shader_hair_cull.d.ts.map +1 -1
  135. package/src/shade/renderer/hair/shader_hair_cull.js +74 -17
  136. package/src/shade/renderer/hair/shader_hair_lod.d.ts +9 -3
  137. package/src/shade/renderer/hair/shader_hair_lod.d.ts.map +1 -1
  138. package/src/shade/renderer/hair/shader_hair_lod.js +125 -31
  139. package/src/shade/renderer/hair/shader_hair_roots.d.ts +36 -0
  140. package/src/shade/renderer/hair/shader_hair_roots.d.ts.map +1 -0
  141. package/src/shade/renderer/hair/shader_hair_roots.js +261 -0
  142. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts +44 -0
  143. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts.map +1 -0
  144. package/src/shade/renderer/hair/shader_hair_shadow_list.js +240 -0
  145. package/src/shade/renderer/hair/shader_hair_simulate.d.ts +55 -0
  146. package/src/shade/renderer/hair/shader_hair_simulate.d.ts.map +1 -0
  147. package/src/shade/renderer/hair/shader_hair_simulate.js +563 -0
  148. package/src/shade/renderer/hair/shader_hair_volume.d.ts +3 -3
  149. package/src/shade/renderer/hair/shader_hair_volume.d.ts.map +1 -1
  150. package/src/shade/renderer/hair/shader_hair_volume.js +4 -17
  151. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  152. package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts +8 -3
  153. package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts.map +1 -1
  154. package/src/shade/renderer/loader/usd/usd_groom_extension.js +58 -5
  155. package/src/shade/renderer/particles/GPUParticleSystem.d.ts +8 -0
  156. package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
  157. package/src/shade/renderer/particles/GPUParticleSystem.js +28 -0
  158. package/src/shade/renderer/particles/graph/ParticleNodeRegistry.d.ts.map +1 -1
  159. package/src/shade/renderer/particles/graph/ParticleNodeRegistry.js +22 -0
  160. package/src/shade/renderer/particles/graph/groups/particle_builtin_groups.d.ts.map +1 -1
  161. package/src/shade/renderer/particles/graph/groups/particle_builtin_groups.js +4 -0
  162. package/src/shade/renderer/particles/graph/groups/particle_groups_scene.d.ts +32 -0
  163. package/src/shade/renderer/particles/graph/groups/particle_groups_scene.d.ts.map +1 -0
  164. package/src/shade/renderer/particles/graph/groups/particle_groups_scene.js +80 -0
  165. package/src/shade/renderer/particles/graph/particle_node_parameters.d.ts.map +1 -1
  166. package/src/shade/renderer/particles/graph/particle_node_parameters.js +1 -0
  167. package/src/shade/renderer/particles/graph/particle_node_presentation.d.ts.map +1 -1
  168. package/src/shade/renderer/particles/graph/particle_node_presentation.js +12 -0
  169. package/src/shade/renderer/particles/graph_particles.d.ts +5 -1
  170. package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
  171. package/src/shade/renderer/particles/graph_particles.js +18 -3
  172. package/src/shade/renderer/particles/isa/InstructionStream.d.ts +25 -0
  173. package/src/shade/renderer/particles/isa/InstructionStream.d.ts.map +1 -1
  174. package/src/shade/renderer/particles/isa/InstructionStream.js +25 -0
  175. package/src/shade/renderer/particles/isa/ParticleVMISA.d.ts +9 -0
  176. package/src/shade/renderer/particles/isa/ParticleVMISA.d.ts.map +1 -1
  177. package/src/shade/renderer/particles/isa/ParticleVMISA.js +20 -0
  178. package/src/shade/renderer/particles/isa/particle_program_reads_scene_sdf.d.ts +9 -0
  179. package/src/shade/renderer/particles/isa/particle_program_reads_scene_sdf.d.ts.map +1 -0
  180. package/src/shade/renderer/particles/isa/particle_program_reads_scene_sdf.js +29 -0
  181. package/src/shade/renderer/particles/optimizer/particle_program_equivalence.d.ts +2 -1
  182. package/src/shade/renderer/particles/optimizer/particle_program_equivalence.d.ts.map +1 -1
  183. package/src/shade/renderer/particles/optimizer/particle_program_equivalence.js +27 -5
  184. package/src/shade/renderer/particles/optimizer/particle_program_fuzz.js +1 -1
  185. package/src/shade/renderer/particles/optimizer/particle_vm_semantics.d.ts.map +1 -1
  186. package/src/shade/renderer/particles/optimizer/particle_vm_semantics.js +5 -0
  187. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts +7 -0
  188. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts.map +1 -1
  189. package/src/shade/renderer/particles/runtime/EmitterRegistry.js +10 -0
  190. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts +5 -0
  191. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts.map +1 -1
  192. package/src/shade/renderer/particles/runtime/ParticleEmitter.js +5 -0
  193. package/src/shade/renderer/particles/runtime/ProgramHeap.d.ts +8 -0
  194. package/src/shade/renderer/particles/runtime/ProgramHeap.d.ts.map +1 -1
  195. package/src/shade/renderer/particles/runtime/ProgramHeap.js +25 -0
  196. package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts +1 -1
  197. package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts.map +1 -1
  198. package/src/shade/renderer/particles/shaders/shader_particle_emit.js +9 -3
  199. package/src/shade/renderer/particles/shaders/shader_particle_emit_wide.d.ts.map +1 -1
  200. package/src/shade/renderer/particles/shaders/shader_particle_emit_wide.js +4 -2
  201. package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts +2 -2
  202. package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts.map +1 -1
  203. package/src/shade/renderer/particles/shaders/shader_particle_simulate.js +10 -4
  204. package/src/shade/renderer/particles/shaders/shader_particle_simulate_wide.d.ts.map +1 -1
  205. package/src/shade/renderer/particles/shaders/shader_particle_simulate_wide.js +4 -2
  206. package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts +14 -1
  207. package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts.map +1 -1
  208. package/src/shade/renderer/particles/vm/ParticleVMReference.js +34 -1
  209. package/src/shade/renderer/particles/vm/chunk_particle_vm.d.ts.map +1 -1
  210. package/src/shade/renderer/particles/vm/chunk_particle_vm.js +10 -0
  211. package/src/shade/renderer/particles/vm/chunk_particle_vm_scene_sdf.d.ts +39 -0
  212. package/src/shade/renderer/particles/vm/chunk_particle_vm_scene_sdf.d.ts.map +1 -0
  213. package/src/shade/renderer/particles/vm/chunk_particle_vm_scene_sdf.js +90 -0
  214. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts +4 -1
  215. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -1
  216. package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +14 -2
  217. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts +1 -1
  218. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts.map +1 -1
  219. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.js +9 -3
  220. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.d.ts.map +1 -1
  221. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.js +4 -2
  222. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  223. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts +7 -4
  224. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts.map +1 -1
  225. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js +26 -16
  226. package/src/shade/renderer/rasterize/draw/chunk_meshlet_draw_vertex.d.ts +7 -4
  227. package/src/shade/renderer/rasterize/draw/chunk_meshlet_draw_vertex.d.ts.map +1 -1
  228. package/src/shade/renderer/rasterize/draw/chunk_meshlet_draw_vertex.js +66 -14
  229. package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.d.ts +20 -0
  230. package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.d.ts.map +1 -0
  231. package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.js +149 -0
  232. package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.d.ts +8 -0
  233. package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.d.ts.map +1 -1
  234. package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.js +100 -33
  235. package/src/shade/renderer/rasterize/native/rasterization_shader_resources.d.ts +11 -0
  236. package/src/shade/renderer/rasterize/native/rasterization_shader_resources.d.ts.map +1 -1
  237. package/src/shade/renderer/rasterize/native/rasterization_shader_resources.js +24 -11
  238. package/src/shade/renderer/scene/GPUSceneContext.d.ts +7 -0
  239. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  240. package/src/shade/renderer/scene/GPUSceneContext.js +18 -0
  241. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_normal.d.ts +13 -0
  242. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_normal.d.ts.map +1 -0
  243. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_normal.js +42 -0
  244. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_signed_distance_gradient.d.ts +20 -0
  245. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_signed_distance_gradient.d.ts.map +1 -0
  246. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_signed_distance_gradient.js +134 -0
  247. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts +15 -0
  248. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts.map +1 -1
  249. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +83 -5
  250. package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.d.ts +34 -0
  251. package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.d.ts.map +1 -0
  252. package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.js +106 -0
  253. package/src/shade/renderer/shadow/map/shader/chunk_shadow_cascade_caster_position.d.ts +16 -0
  254. package/src/shade/renderer/shadow/map/shader/chunk_shadow_cascade_caster_position.d.ts.map +1 -0
  255. package/src/shade/renderer/shadow/map/shader/chunk_shadow_cascade_caster_position.js +50 -0
  256. package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.d.ts +25 -0
  257. package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.d.ts.map +1 -0
  258. package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.js +42 -0
  259. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_directional_atlas_casters.d.ts +10 -0
  260. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_directional_atlas_casters.d.ts.map +1 -0
  261. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_directional_atlas_casters.js +22 -0
  262. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_directional_cascades.d.ts +1 -1
  263. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_directional_cascades.js +5 -5
  264. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
  265. package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
@@ -0,0 +1,362 @@
1
+ import { seededRandom } from "../../../core/math/random/seededRandom.js";
2
+ import { ShadedGeometry } from "../../../engine/graphics/ecs/mesh-v2/ShadedGeometry.js";
3
+ import { groom_bind_to_mesh, GROOM_BINDING_WORDS, groom_mesh_binder } from "../../../engine/graphics/hair/groom_bind_to_mesh.js";
4
+ import { Groom } from "../../../engine/graphics/hair/Groom.js";
5
+ import { groom_build_group } from "../../../engine/graphics/hair/groom_build_group.js";
6
+ import { HairDrawExtension, HairLightingExtension } from "../../../engine/graphics3/HairSystem.js";
7
+ import { geometry_build_from_meshlet_geometry } from "../../renderer/geometry/geometry_build_from_meshlet_geometry.js";
8
+ import { MESHLET_METADATA_STRUCT } from "../../renderer/geometry/meshlet/encoding/MESHLET_METADATA_STRUCT.js";
9
+ import { StandardAttributes } from "../../renderer/geometry/StandardAttributes.js";
10
+ import { GPUHairSystem, HairMaterial } from "../../renderer/hair/GPUHairSystem.js";
11
+ import { HAIR_ROOT_FRAME_VECTORS } from "../../renderer/hair/HAIR_SIMULATION.js";
12
+ import { row_of_entity } from "../../renderer/scene/rows/GPUSceneRows.js";
13
+
14
+ /**
15
+ * Short strands grown over the top quarter of a mesh at its bind pose (the head, the neck and the shoulders, where
16
+ * the skin deforms), area-weighted, along each face's normal, in the mesh's own space: a groom made on the mesh it is
17
+ * worn on. "Top" is along `up`, the world's up in the mesh's own space.
18
+ *
19
+ * @param {import("../../renderer/geometry/MeshletGeometry.js").MeshletGeometry} geometry
20
+ * @param {number} count
21
+ * @param {number[]} up unit, in the mesh's space
22
+ * @returns {Groom}
23
+ */
24
+ export function groom_on_mesh(geometry, count, up) {
25
+ const flat = geometry_build_from_meshlet_geometry(geometry);
26
+ const p = flat.getAttribute(StandardAttributes.Position).data;
27
+ const index = flat.index.data;
28
+
29
+ let low = Infinity, high = -Infinity;
30
+
31
+ const height_of = v => p[v] * up[0] + p[v + 1] * up[1] + p[v + 2] * up[2];
32
+
33
+ for (let v = 0; v < p.length; v += 3) {
34
+ low = Math.min(low, height_of(v));
35
+ high = Math.max(high, height_of(v));
36
+ }
37
+
38
+ const height = high - low;
39
+ const cut = high - 0.25 * height;
40
+
41
+ // the triangles above the cut, by area
42
+ const chosen = [];
43
+ const areas = [];
44
+
45
+ let total = 0;
46
+
47
+ for (let t = 0; t < index.length; t += 3) {
48
+ const a = index[t] * 3, b = index[t + 1] * 3, c = index[t + 2] * 3;
49
+
50
+ if ((height_of(a) + height_of(b) + height_of(c)) / 3 < cut) {
51
+ continue;
52
+ }
53
+
54
+ const ex = p[b] - p[a], ey = p[b + 1] - p[a + 1], ez = p[b + 2] - p[a + 2];
55
+ const fx = p[c] - p[a], fy = p[c + 1] - p[a + 1], fz = p[c + 2] - p[a + 2];
56
+ const area = 0.5 * Math.hypot(ey * fz - ez * fy, ez * fx - ex * fz, ex * fy - ey * fx);
57
+
58
+ if (area <= 0) {
59
+ continue;
60
+ }
61
+
62
+ chosen.push(t);
63
+ total += area;
64
+ areas.push(total);
65
+ }
66
+
67
+ const random = seededRandom(7);
68
+ const length = 0.02 * height;
69
+ const points = 9;
70
+ const positions = new Float64Array(count * points * 3);
71
+
72
+ for (let s = 0; s < count; s++) {
73
+ // a triangle by area, a point on it uniformly
74
+ const pick = random() * total;
75
+
76
+ let lo = 0, hi = areas.length - 1;
77
+
78
+ while (lo < hi) {
79
+ const mid = (lo + hi) >>> 1;
80
+
81
+ if (areas[mid] < pick) {
82
+ lo = mid + 1;
83
+ } else {
84
+ hi = mid;
85
+ }
86
+ }
87
+
88
+ const t = chosen[lo];
89
+ const a = index[t] * 3, b = index[t + 1] * 3, c = index[t + 2] * 3;
90
+
91
+ let u = random(), v = random();
92
+
93
+ if (u + v > 1) {
94
+ u = 1 - u;
95
+ v = 1 - v;
96
+ }
97
+
98
+ const w = 1 - u - v;
99
+
100
+ const ex = p[b] - p[a], ey = p[b + 1] - p[a + 1], ez = p[b + 2] - p[a + 2];
101
+ const fx = p[c] - p[a], fy = p[c + 1] - p[a + 1], fz = p[c + 2] - p[a + 2];
102
+
103
+ let nx = ey * fz - ez * fy, ny = ez * fx - ex * fz, nz = ex * fy - ey * fx;
104
+
105
+ const n = Math.hypot(nx, ny, nz);
106
+
107
+ nx /= n;
108
+ ny /= n;
109
+ nz /= n;
110
+
111
+ const rx = p[a] * w + p[b] * u + p[c] * v;
112
+ const ry = p[a + 1] * w + p[b + 1] * u + p[c + 1] * v;
113
+ const rz = p[a + 2] * w + p[b + 2] * u + p[c + 2] * v;
114
+
115
+ for (let i = 0; i < points; i++) {
116
+ const along = length * i / (points - 1);
117
+ // a little droop toward the bind pose's down, so the strands are not straight sticks
118
+ const droop = 0.3 * along * (i / (points - 1));
119
+ const at = (s * points + i) * 3;
120
+
121
+ positions[at] = rx + nx * along - droop * up[0];
122
+ positions[at + 1] = ry + ny * along - droop * up[1];
123
+ positions[at + 2] = rz + nz * along - droop * up[2];
124
+ }
125
+ }
126
+
127
+ const groom = new Groom();
128
+
129
+ groom.add(groom_build_group(
130
+ { positions, counts: new Uint32Array(count).fill(points), widths: null },
131
+ { name: "stubble", point_count: points, width: 6e-4 * height / 1.7 * 0.1, guide_tolerance: 0.004 * height }
132
+ ));
133
+
134
+ return groom;
135
+ }
136
+
137
+ /**
138
+ * A groom bound to a skinned mesh entity, drawn by a runtime of its own registered with the renderer.
139
+ *
140
+ * @param {import("../../renderer/Renderer.js").Renderer} renderer
141
+ * @param {import("../../renderer/scene/GPUSceneContext.js").GPUSceneContext} scene_context
142
+ * @param {import("../../../engine/ecs/EntityComponentDataset.js").EntityComponentDataset} dataset
143
+ * @param {number} entity the skinned mesh's
144
+ * @param {number} count strands
145
+ */
146
+ export async function setup_skinned_hair(renderer, scene_context, dataset, entity, count) {
147
+ const geometry = dataset.getComponent(entity, ShadedGeometry).geometry;
148
+
149
+ // the world's up in the mesh's own space: the transpose of its world matrix's turn takes +y there
150
+ const g = (await scene_context.scene_database.debug_table_read_element("transforms", row_of_entity(entity))).global;
151
+ const up = [g[1], g[5], g[9]];
152
+ const up_length = Math.hypot(up[0], up[1], up[2]);
153
+
154
+ const groom = groom_on_mesh(geometry, count, up.map(v => v / up_length));
155
+ const runtime = new GPUHairSystem(scene_context.graphics);
156
+
157
+ const material = new HairMaterial();
158
+
159
+ material.melanin = 0.6;
160
+ material.roughness = 0.35;
161
+
162
+ const context = runtime.add(groom, row_of_entity(entity), material);
163
+
164
+ const host = {
165
+ record_draw: frame => {
166
+ if (frame.view.scene === scene_context) {
167
+ runtime.graph_draw(frame);
168
+ }
169
+ },
170
+ record_light: frame => {
171
+ if (frame.view.scene === scene_context) {
172
+ runtime.graph_light(frame);
173
+ }
174
+ },
175
+ };
176
+
177
+ renderer.add_extension(new HairDrawExtension(host));
178
+ renderer.add_extension(new HairLightingExtension(host));
179
+
180
+ /**
181
+ * Before each frame: the mesh's meshlets as they are laid out now, and the clock.
182
+ *
183
+ * @param {number} seconds
184
+ */
185
+ const update = seconds => {
186
+ const clone = scene_context.skinning.clone_of(entity);
187
+ const metadata = clone ?? scene_context.geometries.get_metadata(geometry);
188
+
189
+ if (metadata !== undefined) {
190
+ runtime.set_binding(context, row_of_entity(entity), geometry, metadata.meshlets.metadata.offset);
191
+ }
192
+
193
+ runtime.step(seconds);
194
+ };
195
+
196
+ return { runtime, context, groom, geometry, entity, update };
197
+ }
198
+
199
+ /**
200
+ * @param {GPUDevice} device
201
+ * @param {GPUBuffer} buffer
202
+ * @param {number} offset bytes
203
+ * @param {number} size bytes
204
+ * @returns {Promise<ArrayBuffer>}
205
+ */
206
+ async function read_back(device, buffer, offset, size) {
207
+ const staging = device.createBuffer({ label: "hair/readback", size, usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ });
208
+ const encoder = device.createCommandEncoder();
209
+
210
+ encoder.copyBufferToBuffer(buffer, offset, staging, 0, size);
211
+ device.queue.submit([encoder.finish()]);
212
+
213
+ await staging.mapAsync(GPUMapMode.READ);
214
+
215
+ const copy = staging.getMappedRange().slice(0);
216
+
217
+ staging.unmap();
218
+ staging.destroy();
219
+
220
+ return copy;
221
+ }
222
+
223
+ /**
224
+ * The rows of a 3 x 3 rotation built as `hair_triangle_frame` builds it, from a triangle: the tangent along its first
225
+ * edge, the normal of its face, the bitangent the normal across the tangent; as columns T, B, N.
226
+ *
227
+ * @param {number[]} a
228
+ * @param {number[]} b
229
+ * @param {number[]} c
230
+ * @returns {number[][]} [T, B, N]
231
+ */
232
+ function triangle_frame(a, b, c) {
233
+ const e = [b[0] - a[0], b[1] - a[1], b[2] - a[2]];
234
+ const f = [c[0] - a[0], c[1] - a[1], c[2] - a[2]];
235
+ const el = Math.hypot(...e);
236
+ const t = e.map(v => v / el);
237
+ let n = [e[1] * f[2] - e[2] * f[1], e[2] * f[0] - e[0] * f[2], e[0] * f[1] - e[1] * f[0]];
238
+ const nl = Math.hypot(...n);
239
+
240
+ n = n.map(v => v / nl);
241
+
242
+ return [t, [n[1] * t[2] - n[2] * t[1], n[2] * t[0] - n[0] * t[2], n[0] * t[1] - n[1] * t[0]], n];
243
+ }
244
+
245
+ /**
246
+ * The gate, from what the device holds and nothing the hair passed it: the skinning context's own clone of the mesh,
247
+ * read back vertex by vertex, and the mesh's world matrix. For every strand, its tip carried by its root frame as the
248
+ * GPU wrote it, against its tip carried by a frame built here from its bound triangle where the clone is now; and its
249
+ * root's distance from that triangle's point, against its bind-pose distance. How far the skin moved from the bind
250
+ * pose is reported too, so a binding stuck at the bind pose cannot pass. Metres.
251
+ *
252
+ * @param {ReturnType<typeof setup_skinned_hair>} hair
253
+ * @param {import("../../renderer/scene/GPUSceneContext.js").GPUSceneContext} scene_context
254
+ * @returns {Promise<{strands: number, tip_max: number, root_excess_max: number, skin_moved_max: number, skin_moved_mean: number}>}
255
+ */
256
+ export async function verify_roots(hair, scene_context) {
257
+ const device = scene_context.graphics.device;
258
+ const { runtime, context, groom, geometry, entity } = hair;
259
+ const group = groom.groups[0];
260
+
261
+ await device.queue.onSubmittedWorkDone();
262
+
263
+ // the root frames as the GPU last wrote them
264
+ const roots = context.roots[0];
265
+ const frames = new Float32Array(await read_back(device, runtime.state_pool.buffer, roots.offset * 16, group.strand_count * HAIR_ROOT_FRAME_VECTORS * 16));
266
+
267
+ // the mesh where it is now: its world matrix, and its clone's meshlets where the skinning context says they are
268
+ const node = await scene_context.scene_database.debug_table_read_element("transforms", row_of_entity(entity));
269
+ const g = node.global;
270
+
271
+ const clone = scene_context.skinning.clone_of(entity);
272
+ const base = clone.meshlets.metadata.offset;
273
+
274
+ const meshlets = scene_context.geometries.meshlets;
275
+ const stride = MESHLET_METADATA_STRUCT.aligned_size;
276
+ const count = geometry.meshlets.count;
277
+ const headers = new DataView(await read_back(device, meshlets.buffer_metadata, base * stride, count * stride));
278
+
279
+ const ADDRESS = MESHLET_METADATA_STRUCT.get("address").offset;
280
+ const PRIMITIVES = MESHLET_METADATA_STRUCT.get("primitive_count").offset;
281
+ const VERTICES = MESHLET_METADATA_STRUCT.get("vertex_count").offset;
282
+
283
+ let low = Infinity, high = 0;
284
+
285
+ for (let m = 0; m < count; m++) {
286
+ const address = headers.getUint32(m * stride + ADDRESS, true);
287
+ const position = address + ((headers.getUint32(m * stride + PRIMITIVES, true) * 3 + 3) >> 2);
288
+
289
+ low = Math.min(low, address);
290
+ high = Math.max(high, position + headers.getUint32(m * stride + VERTICES, true) * 3);
291
+ }
292
+
293
+ const data = new Uint32Array(await read_back(device, meshlets.buffer_data, low * 4, (high - low) * 4));
294
+ const data_f32 = new Float32Array(data.buffer);
295
+
296
+ const binding = groom_bind_to_mesh(group, groom_mesh_binder(geometry));
297
+ const binding_f32 = new Float32Array(binding.buffer);
298
+
299
+ const root = [0, 0, 0];
300
+ const tip = [0, 0, 0];
301
+ const world = p => [0, 1, 2].map(i => g[i] * p[0] + g[4 + i] * p[1] + g[8 + i] * p[2] + g[12 + i]);
302
+ const by_frame = (f, p) => [0, 1, 2].map(r => frames[f + r * 4] * p[0] + frames[f + r * 4 + 1] * p[1] + frames[f + r * 4 + 2] * p[2] + frames[f + r * 4 + 3]);
303
+
304
+ let tip_max = 0, root_excess_max = 0, moved_max = 0, moved_sum = 0;
305
+
306
+ for (let s = 0; s < group.strand_count; s++) {
307
+ const at = s * GROOM_BINDING_WORDS;
308
+ const m = binding[at] >>> 8;
309
+ const t = binding[at] & 0xFF;
310
+
311
+ const row = m * stride;
312
+ const address = headers.getUint32(row + ADDRESS, true) - low;
313
+ const position = address + ((headers.getUint32(row + PRIMITIVES, true) * 3 + 3) >> 2);
314
+
315
+ const vertex = k => {
316
+ const byte = t * 3 + k;
317
+ const v = (data[address + (byte >> 2)] >>> ((byte & 3) * 8)) & 0xFF;
318
+ const w = position + v * 3;
319
+
320
+ return [data_f32[w], data_f32[w + 1], data_f32[w + 2]];
321
+ };
322
+
323
+ const a = vertex(0), b = vertex(1), c = vertex(2);
324
+ const wa = binding_f32[at + 1], wb = binding_f32[at + 2], wc = 1 - wa - wb;
325
+ const q = [0, 1, 2].map(i => a[i] * wa + b[i] * wb + c[i] * wc);
326
+
327
+ // the frame now, built here: turn = [T B N]_now [T B N]_rest^T, in the mesh's space
328
+ const [tn, bn, nn] = triangle_frame(a, b, c);
329
+ const rest = [[binding_f32[at + 4], binding_f32[at + 5], binding_f32[at + 6]], [binding_f32[at + 8], binding_f32[at + 9], binding_f32[at + 10]], [binding_f32[at + 12], binding_f32[at + 13], binding_f32[at + 14]]];
330
+ const rest_origin = [binding_f32[at + 7], binding_f32[at + 11], binding_f32[at + 15]];
331
+ const carry = p => {
332
+ const d = [p[0] - rest_origin[0], p[1] - rest_origin[1], p[2] - rest_origin[2]];
333
+ const local = rest.map(axis => axis[0] * d[0] + axis[1] * d[1] + axis[2] * d[2]);
334
+
335
+ return world([0, 1, 2].map(i => q[i] + tn[i] * local[0] + bn[i] * local[1] + nn[i] * local[2]));
336
+ };
337
+
338
+ group.read_point(root, 0, s, 0);
339
+ group.read_point(tip, 0, s, group.point_count - 1);
340
+
341
+ const f = s * HAIR_ROOT_FRAME_VECTORS * 4;
342
+
343
+ const tip_gpu = by_frame(f, tip);
344
+ const tip_here = carry(tip);
345
+
346
+ tip_max = Math.max(tip_max, Math.hypot(tip_gpu[0] - tip_here[0], tip_gpu[1] - tip_here[1], tip_gpu[2] - tip_here[2]));
347
+
348
+ const root_gpu = by_frame(f, root);
349
+ const surface = world(q);
350
+
351
+ root_excess_max = Math.max(root_excess_max, Math.hypot(root_gpu[0] - surface[0], root_gpu[1] - surface[1], root_gpu[2] - surface[2]) - binding_f32[at + 3] * Math.hypot(g[0], g[1], g[2]));
352
+
353
+ // how far the skin under the root moved from where it stood at the bind pose, under the same matrix
354
+ const bind = world(rest_origin);
355
+ const moved = Math.hypot(surface[0] - bind[0], surface[1] - bind[1], surface[2] - bind[2]);
356
+
357
+ moved_max = Math.max(moved_max, moved);
358
+ moved_sum += moved;
359
+ }
360
+
361
+ return { strands: group.strand_count, tip_max, root_excess_max, skin_moved_max: moved_max, skin_moved_mean: moved_sum / group.strand_count };
362
+ }
@@ -0,0 +1,36 @@
1
+ # Sparks
2
+
3
+ Three fountains of sparks in Sponza's court, landing on it: the particle node library's `collide` group over the
4
+ scene's distance field (`src/shade/renderer/particles/DESIGN.md`, the VM's `SAMPLE_SCENE_SDF`). The effect is
5
+ `sparks_effect.js`: thrown up, falling under gravity, and through `collide` when it is on.
6
+
7
+ ## Running it
8
+
9
+ ```bash
10
+ npm install
11
+ npm run dev
12
+ ```
13
+
14
+ then open <http://localhost:5173/src/shade/playground/sparks/index.html>.
15
+
16
+ The scene comes from `test_assets/Sponza/glTF/Sponza.gltf`, which is gitignored; `test_assets/README.md` has the
17
+ two lines that put it there. Another scene loads with `?scene=/some/other/scene.gltf`.
18
+
19
+ ## The controls
20
+
21
+ | control | what it does |
22
+ |---|---|
23
+ | Collide (C) | the sparks collide with the scene, or fall through it; the fountains move between the two effects with their sparks in flight |
24
+ | Restitution | how much of an impact a spark keeps: 0 lands dead, 1 bounces back as fast as it came |
25
+ | Friction | Coulomb's coefficient against each impact: how quickly a spark sliding on a surface comes to rest; with restitution above 0 a spark lying on the floor still hops by restitution of each step's fall |
26
+ | Spawn rate | sparks a second from each fountain |
27
+
28
+ Restitution and friction are emitter fields: the sliders write each fountain's own values, and the program is not
29
+ compiled again.
30
+
31
+ Drag to orbit, wheel to zoom, WASD to move. The stats line reads the frame time, the sparks alive, the mesh SDF
32
+ bake's progress — a mesh whose field is not baked yet is not in the scene's field, and sparks pass through it —
33
+ and whether the particle system holds the scene's field, which it does while an effect it runs reads it.
34
+
35
+ The field is finest around the camera. A spark that moves further in one step than its radius and a surface's
36
+ shell passes through that surface, which is why the page moves the sparks by at most 50 ms a frame.
@@ -0,0 +1,145 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>meep — sparks</title>
6
+ <style>
7
+ :root {
8
+ color-scheme: dark;
9
+ --panel: rgba(20, 22, 26, 0.88);
10
+ --line: #2b3038;
11
+ --text: #d6dae0;
12
+ --muted: #8b939f;
13
+ --pass: #55c46a;
14
+ --fail: #ff6b6b;
15
+ --warn: #e5b54a;
16
+ }
17
+
18
+ * { box-sizing: border-box; }
19
+
20
+ html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0f12; }
21
+
22
+ /* body carries tabindex so the camera controller's keyboard device has something focusable
23
+ to listen on; the focus ring around the whole viewport is not wanted */
24
+ body:focus { outline: none; }
25
+
26
+ #view { display: block; width: 100vw; height: 100vh; }
27
+
28
+ #panel {
29
+ position: fixed;
30
+ top: 12px;
31
+ left: 12px;
32
+ width: 320px;
33
+ padding: 12px 14px;
34
+ background: var(--panel);
35
+ border: 1px solid var(--line);
36
+ border-radius: 8px;
37
+ backdrop-filter: blur(6px);
38
+ color: var(--text);
39
+ font: 13px/1.5 system-ui, -apple-system, Segoe UI, sans-serif;
40
+ }
41
+
42
+ #panel h1 { font-size: 13px; font-weight: 600; margin: 0 0 8px; }
43
+
44
+ label { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }
45
+ label input[type="checkbox"] { margin: 0; }
46
+ label .hint { color: var(--muted); font-size: 11.5px; }
47
+ label > span:first-child { flex: 0 0 96px; }
48
+
49
+ select, input[type="number"] {
50
+ flex: 1 1 auto;
51
+ min-width: 0;
52
+ font: 12px system-ui, -apple-system, Segoe UI, sans-serif;
53
+ padding: 3px 6px;
54
+ border-radius: 5px;
55
+ border: 1px solid var(--line);
56
+ background: #14161a;
57
+ color: var(--text);
58
+ }
59
+
60
+ input[type="range"] { flex: 1 1 auto; min-width: 0; }
61
+
62
+ output { flex: 0 0 34px; text-align: right; color: var(--muted); font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; }
63
+
64
+ hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
65
+
66
+ #status { font-size: 12px; color: var(--muted); word-break: break-word; }
67
+ #status.pass { color: var(--pass); }
68
+ #status.fail { color: var(--fail); }
69
+ #status.warn { color: var(--warn); }
70
+
71
+ #stats {
72
+ margin-top: 6px;
73
+ font: 12px ui-monospace, SFMono-Regular, Consolas, monospace;
74
+ color: var(--text);
75
+ white-space: pre;
76
+ }
77
+
78
+ p.note { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); }
79
+ </style>
80
+ </head>
81
+ <body tabindex="0">
82
+
83
+ <canvas id="view"></canvas>
84
+
85
+ <div id="panel">
86
+ <h1>Sparks against the scene</h1>
87
+
88
+ <label>
89
+ <input type="checkbox" id="collide" checked>
90
+ <span>Collide <span class="hint">— against the scene's distance field; C flips it</span></span>
91
+ </label>
92
+
93
+ <label>
94
+ <span>Restitution</span>
95
+ <input type="range" id="restitution" min="0" max="1" step="0.05" value="0.35">
96
+ <output id="restitution_value"></output>
97
+ </label>
98
+
99
+ <label>
100
+ <span>Friction</span>
101
+ <input type="range" id="friction" min="0" max="2" step="0.05" value="0.5">
102
+ <output id="friction_value"></output>
103
+ </label>
104
+
105
+ <label>
106
+ <span>Spawn rate</span>
107
+ <select id="spawn_rate">
108
+ <option value="250">250 a second a fountain</option>
109
+ <option value="1000" selected>1,000 a second a fountain</option>
110
+ <option value="4000">4,000 a second a fountain</option>
111
+ </select>
112
+ </label>
113
+
114
+ <hr>
115
+
116
+ <div id="status"></div>
117
+ <div id="stats"></div>
118
+
119
+ <p class="note">
120
+ Three fountains of sparks in Sponza's court. With Collide on they land on the floor, the steps and
121
+ the columns, bounce by the restitution and slide to rest by the friction; off, they fall through
122
+ everything. The distance field fills as the meshes' fields bake: until a mesh's is in, sparks pass
123
+ through it.
124
+ </p>
125
+ <p class="note">
126
+ Drag to orbit, wheel to zoom, WASD to move. The field is finest around the camera, and a spark
127
+ that moves further in a step than its radius and a surface's shell passes through it.
128
+ </p>
129
+ </div>
130
+
131
+ <script type="module">
132
+ import { start } from './main.js';
133
+
134
+ start().catch(error => {
135
+ const status = document.getElementById('status');
136
+
137
+ status.className = 'fail';
138
+ status.textContent = String(error?.message ?? error);
139
+
140
+ console.error(error);
141
+ });
142
+ </script>
143
+
144
+ </body>
145
+ </html>
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Stand the page up. Called by the page rather than run on import.
3
+ *
4
+ * @returns {Promise<void>}
5
+ */
6
+ export function start(): Promise<void>;
7
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../../src/shade/playground/sparks/main.js"],"names":[],"mappings":"AAyEA;;;;GAIG;AACH,yBAFa,QAAQ,IAAI,CAAC,CA2OzB"}