@woosh/meep-engine 3.42.0 → 3.44.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 (345) hide show
  1. package/editor/prototypeEditorShell.d.ts.map +1 -1
  2. package/editor/prototypeEditorShell.js +4 -2
  3. package/package.json +91 -96
  4. package/src/engine/Clock.d.ts +15 -0
  5. package/src/engine/Clock.d.ts.map +1 -1
  6. package/src/engine/Clock.js +29 -5
  7. package/src/engine/Engine.d.ts.map +1 -1
  8. package/src/engine/Engine.js +11 -19
  9. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.d.ts +57 -0
  10. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.d.ts.map +1 -0
  11. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.js +84 -0
  12. package/src/engine/graphics3/AnimationGraphSystem.d.ts +23 -13
  13. package/src/engine/graphics3/AnimationGraphSystem.d.ts.map +1 -1
  14. package/src/engine/graphics3/AnimationGraphSystem.js +61 -64
  15. package/src/engine/graphics3/AnimationSystem.d.ts +24 -15
  16. package/src/engine/graphics3/AnimationSystem.d.ts.map +1 -1
  17. package/src/engine/graphics3/AnimationSystem.js +67 -61
  18. package/src/engine/graphics3/MeshSkinSystem.d.ts +56 -0
  19. package/src/engine/graphics3/MeshSkinSystem.d.ts.map +1 -0
  20. package/src/engine/graphics3/MeshSkinSystem.js +317 -0
  21. package/src/engine/graphics3/MeshSystem.d.ts +15 -35
  22. package/src/engine/graphics3/MeshSystem.d.ts.map +1 -1
  23. package/src/engine/graphics3/MeshSystem.js +21 -298
  24. package/src/engine/graphics3/RowChains.d.ts +76 -0
  25. package/src/engine/graphics3/RowChains.d.ts.map +1 -0
  26. package/src/engine/graphics3/RowChains.js +347 -0
  27. package/src/engine/graphics3/ShadedGeometrySystem.d.ts +6 -0
  28. package/src/engine/graphics3/ShadedGeometrySystem.d.ts.map +1 -1
  29. package/src/engine/graphics3/ShadedGeometrySystem.js +329 -309
  30. package/src/engine/graphics3/animation/AnimationClips.d.ts +56 -0
  31. package/src/engine/graphics3/animation/AnimationClips.d.ts.map +1 -0
  32. package/src/engine/graphics3/animation/AnimationClips.js +79 -0
  33. package/src/engine/graphics3/animation/ClipListPlayer.d.ts +13 -14
  34. package/src/engine/graphics3/animation/ClipListPlayer.d.ts.map +1 -1
  35. package/src/engine/graphics3/animation/ClipListPlayer.js +262 -263
  36. package/src/engine/graphics3/animation/write_clip_playback.d.ts +3 -3
  37. package/src/engine/graphics3/animation/write_clip_playback.js +4 -4
  38. package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts +5 -0
  39. package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts.map +1 -1
  40. package/src/engine/graphics3/pose/query_entity_node_world_pose.js +80 -75
  41. package/src/engine/graphics3/prefab/PrefabInstance.d.ts +4 -24
  42. package/src/engine/graphics3/prefab/PrefabInstance.d.ts.map +1 -1
  43. package/src/engine/graphics3/prefab/PrefabInstance.js +60 -80
  44. package/src/engine/graphics3/prefab/prefab_instantiate.d.ts +16 -3
  45. package/src/engine/graphics3/prefab/prefab_instantiate.d.ts.map +1 -1
  46. package/src/engine/graphics3/prefab/prefab_instantiate.js +49 -12
  47. package/src/engine/graphics3/prefab/prefab_place.d.ts +31 -17
  48. package/src/engine/graphics3/prefab/prefab_place.d.ts.map +1 -1
  49. package/src/engine/graphics3/prefab/prefab_place.js +175 -130
  50. package/src/engine/graphics3/register_clips.d.ts +64 -0
  51. package/src/engine/graphics3/register_clips.d.ts.map +1 -0
  52. package/src/engine/graphics3/register_clips.js +114 -0
  53. package/src/engine/physics/cloth/MEASUREMENTS.md +795 -0
  54. package/src/engine/physics/cloth/PLAN.md +339 -9
  55. package/src/engine/physics/cloth/build/ClothProxy.d.ts +113 -61
  56. package/src/engine/physics/cloth/build/ClothProxy.d.ts.map +1 -1
  57. package/src/engine/physics/cloth/build/ClothProxy.js +142 -77
  58. package/src/engine/physics/cloth/build/cloth_bind_in_frame.d.ts +22 -0
  59. package/src/engine/physics/cloth/build/cloth_bind_in_frame.d.ts.map +1 -0
  60. package/src/engine/physics/cloth/build/cloth_bind_in_frame.js +75 -0
  61. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts +43 -30
  62. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts.map +1 -1
  63. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.js +357 -284
  64. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.d.ts +62 -0
  65. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.d.ts.map +1 -0
  66. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.js +280 -0
  67. package/src/engine/physics/cloth/collider/cloth_collider_sdf.d.ts +1 -1
  68. package/src/engine/physics/cloth/collider/cloth_collider_sdf.js +1 -1
  69. package/src/engine/physics/cloth/ecs/Cloth.d.ts +17 -9
  70. package/src/engine/physics/cloth/ecs/Cloth.d.ts.map +1 -1
  71. package/src/engine/physics/cloth/ecs/Cloth.js +220 -212
  72. package/src/engine/physics/cloth/ecs/ClothDynamicsFlags.js +6 -0
  73. package/src/engine/physics/cloth/ecs/ClothHold.d.ts +91 -0
  74. package/src/engine/physics/cloth/ecs/ClothHold.d.ts.map +1 -0
  75. package/src/engine/physics/cloth/ecs/ClothHold.js +103 -0
  76. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts +254 -48
  77. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts.map +1 -1
  78. package/src/engine/physics/cloth/ecs/ClothInstance.js +277 -47
  79. package/src/engine/physics/cloth/ecs/ClothPin.d.ts +73 -0
  80. package/src/engine/physics/cloth/ecs/ClothPin.d.ts.map +1 -0
  81. package/src/engine/physics/cloth/ecs/ClothPin.js +92 -0
  82. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.d.ts +36 -0
  83. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.d.ts.map +1 -0
  84. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.js +61 -0
  85. package/src/engine/physics/cloth/ecs/ClothRig.d.ts +23 -17
  86. package/src/engine/physics/cloth/ecs/ClothRig.d.ts.map +1 -1
  87. package/src/engine/physics/cloth/ecs/ClothRig.js +29 -27
  88. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts +12 -14
  89. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts.map +1 -1
  90. package/src/engine/physics/cloth/ecs/ClothSystem.js +20 -15
  91. package/src/engine/physics/cloth/ecs/ClothWorld.d.ts +57 -36
  92. package/src/engine/physics/cloth/ecs/ClothWorld.d.ts.map +1 -1
  93. package/src/engine/physics/cloth/ecs/ClothWorld.js +816 -179
  94. package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts +12 -13
  95. package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts.map +1 -1
  96. package/src/engine/physics/cloth/ecs/WorkerClothSystem.js +20 -14
  97. package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts +63 -11
  98. package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts.map +1 -1
  99. package/src/engine/physics/cloth/ecs/cloth_build_rows.js +321 -84
  100. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts +9 -7
  101. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts.map +1 -1
  102. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.js +9 -7
  103. package/src/engine/physics/cloth/ecs/cloth_gather_colliders.d.ts +3 -3
  104. package/src/engine/physics/cloth/ecs/cloth_gather_colliders.js +30 -30
  105. package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts +37 -0
  106. package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts.map +1 -0
  107. package/src/engine/physics/cloth/ecs/cloth_geodesic.js +142 -0
  108. package/src/engine/physics/cloth/ecs/cloth_holds.d.ts +97 -0
  109. package/src/engine/physics/cloth/ecs/cloth_holds.d.ts.map +1 -0
  110. package/src/engine/physics/cloth/ecs/cloth_holds.js +608 -0
  111. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts +2 -2
  112. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts.map +1 -1
  113. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.js +160 -9
  114. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts +17 -22
  115. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts.map +1 -1
  116. package/src/engine/physics/cloth/ecs/cloth_seed_rig.js +55 -117
  117. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts +21 -6
  118. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts.map +1 -1
  119. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.js +44 -15
  120. package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts +5 -0
  121. package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts.map +1 -1
  122. package/src/engine/physics/cloth/ecs/cloth_write_back.js +60 -16
  123. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.d.ts.map +1 -1
  124. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.js +65 -58
  125. package/src/engine/physics/cloth/playground/collide_main.js +1 -1
  126. package/src/engine/physics/cloth/playground/garment_build.d.ts.map +1 -1
  127. package/src/engine/physics/cloth/playground/garment_build.js +17 -5
  128. package/src/engine/physics/cloth/playground/garment_main.js +1 -1
  129. package/src/engine/physics/cloth/playground/rig_build.d.ts.map +1 -1
  130. package/src/engine/physics/cloth/playground/rig_build.js +302 -296
  131. package/src/engine/physics/cloth/solver/ClothState.d.ts +45 -7
  132. package/src/engine/physics/cloth/solver/ClothState.d.ts.map +1 -1
  133. package/src/engine/physics/cloth/solver/ClothState.js +63 -7
  134. package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts +6 -1
  135. package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts.map +1 -1
  136. package/src/engine/physics/cloth/solver/cloth_contact_find.js +7 -2
  137. package/src/engine/physics/cloth/solver/cloth_hold_line.d.ts +114 -0
  138. package/src/engine/physics/cloth/solver/cloth_hold_line.d.ts.map +1 -0
  139. package/src/engine/physics/cloth/solver/cloth_hold_line.js +362 -0
  140. package/src/engine/physics/cloth/solver/cloth_self_find.d.ts +6 -2
  141. package/src/engine/physics/cloth/solver/cloth_self_find.d.ts.map +1 -1
  142. package/src/engine/physics/cloth/solver/cloth_self_find.js +13 -13
  143. package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts +24 -12
  144. package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts.map +1 -1
  145. package/src/engine/physics/cloth/solver/cloth_solver_constants.js +24 -12
  146. package/src/engine/physics/cloth/solver/cloth_step.d.ts +16 -0
  147. package/src/engine/physics/cloth/solver/cloth_step.d.ts.map +1 -1
  148. package/src/engine/physics/cloth/solver/cloth_step.js +183 -20
  149. package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts +1 -0
  150. package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts.map +1 -1
  151. package/src/engine/physics/cloth/solver/cloth_step_instance.js +10 -3
  152. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.d.ts +1 -1
  153. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.d.ts.map +1 -1
  154. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.js +353 -346
  155. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts +7 -5
  156. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts.map +1 -1
  157. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.js +7 -5
  158. package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts +9 -9
  159. package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts.map +1 -1
  160. package/src/engine/physics/cloth/wind/cloth_sample_air.js +26 -26
  161. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  162. package/src/engine/simulation/Ticker.d.ts +13 -0
  163. package/src/engine/simulation/Ticker.d.ts.map +1 -1
  164. package/src/engine/simulation/Ticker.js +43 -8
  165. package/src/shade/RENDERER_CONTRACT.md +8 -2
  166. package/src/shade/playground/mesh_row_ceiling/main.js +2 -1
  167. package/src/shade/playground/skinned_blas_refit/main.d.ts.map +1 -1
  168. package/src/shade/playground/skinned_blas_refit/main.js +11 -19
  169. package/src/shade/playground/skinned_blas_refit/place_character.d.ts +6 -3
  170. package/src/shade/playground/skinned_blas_refit/place_character.d.ts.map +1 -1
  171. package/src/shade/playground/skinned_blas_refit/place_character.js +90 -90
  172. package/src/shade/playground/skinned_mesh_soup/main.d.ts.map +1 -1
  173. package/src/shade/playground/skinned_mesh_soup/main.js +502 -509
  174. package/src/shade/playground/texture_encode/README.md +129 -109
  175. package/src/shade/playground/texture_encode/main.js +1430 -1430
  176. package/src/shade/playground/vgeo_runtime/README.md +5 -4
  177. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  178. package/src/shade/renderer/Renderer.js +6 -5
  179. package/src/shade/renderer/animation/GPUAnimationManager.d.ts +45 -14
  180. package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
  181. package/src/shade/renderer/animation/GPUAnimationManager.js +316 -64
  182. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts +5 -0
  183. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
  184. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +11 -1
  185. package/src/shade/renderer/atmosphere/GPUSky.d.ts +12 -0
  186. package/src/shade/renderer/atmosphere/GPUSky.d.ts.map +1 -1
  187. package/src/shade/renderer/atmosphere/GPUSky.js +162 -147
  188. package/src/shade/renderer/geometry/BoxGeometry.d.ts +1 -11
  189. package/src/shade/renderer/geometry/BoxGeometry.d.ts.map +1 -1
  190. package/src/shade/renderer/geometry/BoxGeometry.js +6 -13
  191. package/src/shade/renderer/geometry/CapsuleGeometry.d.ts +19 -0
  192. package/src/shade/renderer/geometry/CapsuleGeometry.d.ts.map +1 -0
  193. package/src/shade/renderer/geometry/CapsuleGeometry.js +24 -0
  194. package/src/shade/renderer/geometry/ConeGeometry.d.ts +20 -0
  195. package/src/shade/renderer/geometry/ConeGeometry.d.ts.map +1 -0
  196. package/src/shade/renderer/geometry/ConeGeometry.js +33 -0
  197. package/src/shade/renderer/geometry/CylinderGeometry.d.ts +21 -0
  198. package/src/shade/renderer/geometry/CylinderGeometry.d.ts.map +1 -0
  199. package/src/shade/renderer/geometry/CylinderGeometry.js +35 -0
  200. package/src/shade/renderer/geometry/PlaneGeometry.d.ts +17 -0
  201. package/src/shade/renderer/geometry/PlaneGeometry.d.ts.map +1 -0
  202. package/src/shade/renderer/geometry/PlaneGeometry.js +22 -0
  203. package/src/shade/renderer/geometry/TorusGeometry.d.ts +18 -0
  204. package/src/shade/renderer/geometry/TorusGeometry.d.ts.map +1 -0
  205. package/src/shade/renderer/geometry/TorusGeometry.js +23 -0
  206. package/src/shade/renderer/geometry/UVSphereGeometry.d.ts +21 -0
  207. package/src/shade/renderer/geometry/UVSphereGeometry.d.ts.map +1 -0
  208. package/src/shade/renderer/geometry/UVSphereGeometry.js +34 -0
  209. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts +19 -0
  210. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts.map +1 -0
  211. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.js +205 -0
  212. package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts +21 -0
  213. package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts.map +1 -0
  214. package/src/shade/renderer/geometry/primitives/make_cone_geometry.js +36 -0
  215. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts +1 -1
  216. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts.map +1 -1
  217. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.js +44 -9
  218. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts +20 -0
  219. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts.map +1 -0
  220. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.js +190 -0
  221. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.d.ts.map +1 -1
  222. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.js +7 -2
  223. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts +26 -8
  224. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts.map +1 -1
  225. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js +56 -39
  226. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts +7 -0
  227. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts.map +1 -1
  228. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.js +46 -4
  229. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.d.ts.map +1 -1
  230. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.js +4 -2
  231. package/src/shade/renderer/gpu_primitive/sort/defs.d.ts +2 -2
  232. package/src/shade/renderer/gpu_primitive/sort/defs.js +79 -79
  233. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts +1 -1
  234. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts.map +1 -1
  235. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.js +7 -3
  236. package/src/shade/renderer/lightmap/bake/shader_lightmap_denoise_sh.d.ts.map +1 -1
  237. package/src/shade/renderer/lightmap/bake/shader_lightmap_denoise_sh.js +10 -3
  238. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  239. package/src/shade/renderer/particles/DESIGN.md +13 -9
  240. package/src/shade/renderer/particles/GPUParticleSystem.js +1 -1
  241. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts +4 -3
  242. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts.map +1 -1
  243. package/src/shade/renderer/particles/coherence/graph_particle_bucket.js +200 -194
  244. package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
  245. package/src/shade/renderer/particles/graph_particles.js +6 -2
  246. package/src/shade/renderer/particles/shaders/chunk_particle_lighting.d.ts +1 -1
  247. package/src/shade/renderer/particles/shaders/chunk_particle_lighting.js +1 -1
  248. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -1
  249. package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +334 -329
  250. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  251. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
  252. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +7 -2
  253. package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.d.ts.map +1 -1
  254. package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.js +16 -4
  255. package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts +3 -2
  256. package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts.map +1 -1
  257. package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.js +3 -2
  258. package/src/shade/renderer/scene/GPUSceneContext.d.ts +9 -1
  259. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  260. package/src/shade/renderer/scene/GPUSceneContext.js +23 -1
  261. package/src/shade/renderer/texture/COMPRESSED_TEXTURE_PLAN_2026_09_01.md +2444 -2345
  262. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts.map +1 -1
  263. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.js +312 -310
  264. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts +3 -3
  265. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts.map +1 -1
  266. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.js +383 -375
  267. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.d.ts.map +1 -1
  268. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.js +349 -346
  269. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts +58 -0
  270. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts.map +1 -0
  271. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.js +536 -0
  272. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts +21 -7
  273. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts.map +1 -1
  274. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js +291 -327
  275. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts +25 -0
  276. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts.map +1 -0
  277. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.js +99 -0
  278. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts +5 -3
  279. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts.map +1 -1
  280. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.js +47 -71
  281. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts +10 -0
  282. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts.map +1 -0
  283. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.js +50 -0
  284. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts +4 -5
  285. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts.map +1 -1
  286. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.js +7 -8
  287. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts +4 -1
  288. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
  289. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +74 -3
  290. package/src/shade/renderer/volumetrics/NOTES.md +1023 -957
  291. package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.d.ts +5 -4
  292. package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.d.ts.map +1 -1
  293. package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.js +5 -4
  294. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.d.ts +1 -1
  295. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.js +1 -1
  296. package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.d.ts +1 -1
  297. package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.js +1 -1
  298. package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts +41 -0
  299. package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts.map +1 -0
  300. package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.js +112 -0
  301. package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts +9 -23
  302. package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
  303. package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +18 -126
  304. package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts +22 -0
  305. package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts.map +1 -0
  306. package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.js +228 -0
  307. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
  308. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +0 -53
  309. package/src/shade/renderer/water/chunk_water_transport.d.ts.map +1 -1
  310. package/src/shade/renderer/water/chunk_water_transport.js +7 -5
  311. package/src/shade/renderer/water/medium/GPUWaterBodies.d.ts.map +1 -1
  312. package/src/shade/renderer/water/medium/GPUWaterBodies.js +8 -2
  313. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts +3 -2
  314. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts.map +1 -1
  315. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.js +3 -2
  316. package/src/shade/renderer/water/shader_water.d.ts.map +1 -1
  317. package/src/shade/renderer/water/shader_water.js +3 -1
  318. package/src/shade/renderer/water/surface/GPUWaterSurface.d.ts.map +1 -1
  319. package/src/shade/renderer/water/surface/GPUWaterSurface.js +3 -1
  320. package/src/shade/renderer/water/surface/chunk_water_surface_sample.d.ts +4 -3
  321. package/src/shade/renderer/water/surface/chunk_water_surface_sample.d.ts.map +1 -1
  322. package/src/shade/renderer/water/surface/chunk_water_surface_sample.js +17 -7
  323. package/src/shade/renderer/water/surface/graph_water_tessellation.d.ts.map +1 -1
  324. package/src/shade/renderer/water/surface/graph_water_tessellation.js +11 -4
  325. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
  326. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +93 -30
  327. package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts.map +1 -1
  328. package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.js +13 -5
  329. package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts +29 -8
  330. package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts.map +1 -1
  331. package/src/shade/renderer/water/surface/particles/chunk_water_particle.js +155 -30
  332. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts +6 -1
  333. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts.map +1 -1
  334. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.js +157 -39
  335. package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts +91 -21
  336. package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts.map +1 -1
  337. package/src/shade/renderer/water/surface/particles/shader_water_particles.js +442 -70
  338. package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +11 -3
  339. package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
  340. package/src/shade/wgsl/emulator/WGSLLanguageCore.js +3 -0
  341. package/src/shade/wgsl/validate_wgsl_source.d.ts.map +1 -1
  342. package/src/shade/wgsl/validate_wgsl_source.js +74 -3
  343. package/src/engine/graphics3/register_instance_animation.d.ts +0 -114
  344. package/src/engine/graphics3/register_instance_animation.d.ts.map +0 -1
  345. package/src/engine/graphics3/register_instance_animation.js +0 -201
@@ -8,17 +8,17 @@
8
8
  * step, the colliders that could touch it are queried out of the index and
9
9
  * rewritten into its frame.
10
10
  *
11
- * ## Both poses go into the *current* anchor frame
11
+ * ## Both poses go into the cloth's *current* frame
12
12
  *
13
13
  * A record carries where the collider was and where it is. Both are converted
14
- * using the anchor's pose **now**, not each with the anchor pose of its own
14
+ * using the frame's pose **now**, not each with the frame pose of its own
15
15
  * step, so what the sweep interpolates is the collider's motion *relative to
16
16
  * the cloth's frame*. That is the motion the particles actually see: the frame
17
17
  * change has already been applied to them by `move_local_frame`, scaled by
18
18
  * `ClothDynamics#inertia`, before the step begins.
19
19
  *
20
20
  * The alternative — converting each pose in its own frame — would make a
21
- * collider appear to move whenever the anchor did, so a character running past
21
+ * collider appear to move whenever the frame did, so a character running past
22
22
  * a static wall would sweep the wall through their own cape.
23
23
  *
24
24
  * ## The query box
@@ -47,17 +47,17 @@ import { CLOTH_COLLIDER_SLOTS } from "../solver/cloth_solver_constants.js";
47
47
  * step, the colliders that could touch it are queried out of the index and
48
48
  * rewritten into its frame.
49
49
  *
50
- * ## Both poses go into the *current* anchor frame
50
+ * ## Both poses go into the cloth's *current* frame
51
51
  *
52
52
  * A record carries where the collider was and where it is. Both are converted
53
- * using the anchor's pose **now**, not each with the anchor pose of its own
53
+ * using the frame's pose **now**, not each with the frame pose of its own
54
54
  * step, so what the sweep interpolates is the collider's motion *relative to
55
55
  * the cloth's frame*. That is the motion the particles actually see: the frame
56
56
  * change has already been applied to them by `move_local_frame`, scaled by
57
57
  * `ClothDynamics#inertia`, before the step begins.
58
58
  *
59
59
  * The alternative — converting each pose in its own frame — would make a
60
- * collider appear to move whenever the anchor did, so a character running past
60
+ * collider appear to move whenever the frame did, so a character running past
61
61
  * a static wall would sweep the wall through their own cape.
62
62
  *
63
63
  * ## The query box
@@ -193,20 +193,20 @@ function query_colliders(instance, index, reach) {
193
193
  return 0;
194
194
  }
195
195
 
196
- // The anchor pose the particles were carried into this step, not the live
196
+ // The frame pose the particles were carried into this step, not the live
197
197
  // component — those are the same value by the time this runs, and the
198
198
  // cached pair is the one `move_local_frame` used.
199
- const anchor_x = instance.anchor_translation[0];
200
- const anchor_y = instance.anchor_translation[1];
201
- const anchor_z = instance.anchor_translation[2];
199
+ const frame_x = instance.frame_translation[0];
200
+ const frame_y = instance.frame_translation[1];
201
+ const frame_z = instance.frame_translation[2];
202
202
 
203
- const anchor_rotation = instance.anchor_rotation;
203
+ const frame_rotation = instance.frame_rotation;
204
204
 
205
205
  const contact_reach = reach + state.contact_radius * (1 + CLOTH_CONTACT_MARGIN);
206
206
  const local_scale = Math.max(Math.abs(min_x), Math.abs(max_x))
207
207
  + Math.max(Math.abs(min_y), Math.abs(max_y))
208
208
  + Math.max(Math.abs(min_z), Math.abs(max_z)) + contact_reach;
209
- const world_scale = local_scale + Math.abs(anchor_x) + Math.abs(anchor_y) + Math.abs(anchor_z);
209
+ const world_scale = local_scale + Math.abs(frame_x) + Math.abs(frame_y) + Math.abs(frame_z);
210
210
  const margin = contact_reach + cloth_contact_rounding(local_scale, world_scale);
211
211
 
212
212
  min_x -= margin;
@@ -233,11 +233,11 @@ function query_colliders(instance, index, reach) {
233
233
  CORNER[1] = (corner & 2) === 0 ? min_y : max_y;
234
234
  CORNER[2] = (corner & 4) === 0 ? min_z : max_z;
235
235
 
236
- v3_quaternion_apply_array(CORNER, 0, CORNER, 0, anchor_rotation, 0);
236
+ v3_quaternion_apply_array(CORNER, 0, CORNER, 0, frame_rotation, 0);
237
237
 
238
- const x = CORNER[0] + anchor_x;
239
- const y = CORNER[1] + anchor_y;
240
- const z = CORNER[2] + anchor_z;
238
+ const x = CORNER[0] + frame_x;
239
+ const y = CORNER[1] + frame_y;
240
+ const z = CORNER[2] + frame_z;
241
241
 
242
242
  if (x < world_min_x) { world_min_x = x; }
243
243
  if (y < world_min_y) { world_min_y = y; }
@@ -339,8 +339,8 @@ export function cloth_gather_colliders(instance, index, reach) {
339
339
  * @private
340
340
  */
341
341
  function localise_record(table, record, source, handle, instance) {
342
- const anchor_translation = instance.anchor_translation;
343
- const anchor_rotation = instance.anchor_rotation;
342
+ const frame_translation = instance.frame_translation;
343
+ const frame_rotation = instance.frame_rotation;
344
344
  const from = handle * CCR_STRIDE;
345
345
  const to = record * CCR_STRIDE;
346
346
 
@@ -356,13 +356,13 @@ function localise_record(table, record, source, handle, instance) {
356
356
  localise(
357
357
  table, to + CCR_TX, to + CCR_QX,
358
358
  source, from + CCR_TX, from + CCR_QX,
359
- anchor_translation, anchor_rotation
359
+ frame_translation, frame_rotation
360
360
  );
361
361
 
362
362
  localise(
363
363
  table, to + CCR_PREV_TX, to + CCR_PREV_QX,
364
364
  source, from + CCR_PREV_TX, from + CCR_PREV_QX,
365
- anchor_translation, anchor_rotation
365
+ frame_translation, frame_rotation
366
366
  );
367
367
 
368
368
  cloth_collider_refit_bounds(table, record, CCR_STRIDE);
@@ -382,31 +382,31 @@ function localise_record(table, record, source, handle, instance) {
382
382
  * @param {Float32Array|Float64Array} source the world pose's record table
383
383
  * @param {number} source_translation_slot `[x, y, z]`
384
384
  * @param {number} source_rotation_slot `[x, y, z, w]`
385
- * @param {Float64Array} anchor_translation `[x, y, z]`
386
- * @param {Float64Array} anchor_rotation `[x, y, z, w]`
385
+ * @param {Float64Array} frame_translation `[x, y, z]`
386
+ * @param {Float64Array} frame_rotation `[x, y, z, w]`
387
387
  * @private
388
388
  */
389
389
  function localise(
390
390
  table, translation_slot, rotation_slot,
391
391
  source, source_translation_slot, source_rotation_slot,
392
- anchor_translation, anchor_rotation
392
+ frame_translation, frame_rotation
393
393
  ) {
394
- LOCAL_TRANSLATION[0] = source[source_translation_slot] - anchor_translation[0];
395
- LOCAL_TRANSLATION[1] = source[source_translation_slot + 1] - anchor_translation[1];
396
- LOCAL_TRANSLATION[2] = source[source_translation_slot + 2] - anchor_translation[2];
394
+ LOCAL_TRANSLATION[0] = source[source_translation_slot] - frame_translation[0];
395
+ LOCAL_TRANSLATION[1] = source[source_translation_slot + 1] - frame_translation[1];
396
+ LOCAL_TRANSLATION[2] = source[source_translation_slot + 2] - frame_translation[2];
397
397
 
398
- v3_quaternion_apply_inverse_array(LOCAL_TRANSLATION, 0, LOCAL_TRANSLATION, 0, anchor_rotation, 0);
398
+ v3_quaternion_apply_inverse_array(LOCAL_TRANSLATION, 0, LOCAL_TRANSLATION, 0, frame_rotation, 0);
399
399
 
400
400
  table[translation_slot] = LOCAL_TRANSLATION[0];
401
401
  table[translation_slot + 1] = LOCAL_TRANSLATION[1];
402
402
  table[translation_slot + 2] = LOCAL_TRANSLATION[2];
403
403
 
404
- ANCHOR_CONJUGATE[0] = -anchor_rotation[0];
405
- ANCHOR_CONJUGATE[1] = -anchor_rotation[1];
406
- ANCHOR_CONJUGATE[2] = -anchor_rotation[2];
407
- ANCHOR_CONJUGATE[3] = anchor_rotation[3];
404
+ FRAME_CONJUGATE[0] = -frame_rotation[0];
405
+ FRAME_CONJUGATE[1] = -frame_rotation[1];
406
+ FRAME_CONJUGATE[2] = -frame_rotation[2];
407
+ FRAME_CONJUGATE[3] = frame_rotation[3];
408
408
 
409
- quat3_multiply_array(LOCAL_ROTATION, 0, ANCHOR_CONJUGATE, 0, source, source_rotation_slot);
409
+ quat3_multiply_array(LOCAL_ROTATION, 0, FRAME_CONJUGATE, 0, source, source_rotation_slot);
410
410
 
411
411
  table[rotation_slot] = LOCAL_ROTATION[0];
412
412
  table[rotation_slot + 1] = LOCAL_ROTATION[1];
@@ -517,7 +517,7 @@ const LOCAL_ROTATION = new Float64Array(4);
517
517
  * @type {Float64Array}
518
518
  * @private
519
519
  */
520
- const ANCHOR_CONJUGATE = new Float64Array(4);
520
+ const FRAME_CONJUGATE = new Float64Array(4);
521
521
 
522
522
  /**
523
523
  * The world box {@link query_colliders} asks the index about, `[min_x, min_y, min_z, max_x, max_y,
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Edges incident on each node, CSR, from an edge list.
3
+ *
4
+ * @param {number} node_count
5
+ * @param {Int32Array} edge node pairs, 2 per edge
6
+ * @returns {{offset: Int32Array, edge: Int32Array}} `edge[offset[n] .. offset[n + 1]]` are the
7
+ * edges touching `n`
8
+ */
9
+ export function cloth_edge_incidence(node_count: number, edge: Int32Array): {
10
+ offset: Int32Array;
11
+ edge: Int32Array;
12
+ };
13
+ /**
14
+ * Distance from every node to the nearest of a set of source nodes, along the
15
+ * edges, and which source that is.
16
+ *
17
+ * A node marked in `blocked` can be reached but is never passed through. That is
18
+ * Chaos Cloth's rule for its long-range attachments (`ClothTetherData.cpp`):
19
+ * a path from one island of held particles does not run through another, because
20
+ * the far side of another island is that island's business.
21
+ *
22
+ * @param {Float64Array} out_distance per node; `Infinity` where no source reaches
23
+ * @param {Int32Array} out_nearest per node, the source it is nearest; `−1` where none reaches
24
+ * @param {number} node_count
25
+ * @param {Int32Array} edge node pairs, 2 per edge
26
+ * @param {Float64Array} edge_length rest length per edge
27
+ * @param {{offset: Int32Array, edge: Int32Array}} incidence from {@link cloth_edge_incidence}
28
+ * @param {Int32Array|number[]} source
29
+ * @param {number} source_count
30
+ * @param {Uint8Array|null} blocked per node, non-zero for a node no path may pass through;
31
+ * `null` for none
32
+ */
33
+ export function cloth_geodesic_field(out_distance: Float64Array, out_nearest: Int32Array, node_count: number, edge: Int32Array, edge_length: Float64Array, incidence: {
34
+ offset: Int32Array;
35
+ edge: Int32Array;
36
+ }, source: Int32Array | number[], source_count: number, blocked: Uint8Array | null): void;
37
+ //# sourceMappingURL=cloth_geodesic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloth_geodesic.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_geodesic.js"],"names":[],"mappings":"AAsCA;;;;;;;GAOG;AACH,iDALW,MAAM,QACN,UAAU,GACR;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAC,CAyBlD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mDAXW,YAAY,eACZ,UAAU,cACV,MAAM,QACN,UAAU,eACV,YAAY,aACZ;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAC,UACtC,UAAU,GAAC,MAAM,EAAE,gBACnB,MAAM,WACN,UAAU,GAAC,IAAI,QAsDzB"}
@@ -0,0 +1,142 @@
1
+ import { Uint32Heap } from "../../../../core/collection/heap/Uint32Heap.js";
2
+
3
+ /**
4
+ * # How far each particle is from a set of particles, along the fabric
5
+ *
6
+ * The tether row (§6, §7 P2) bounds a particle's distance from a held one by
7
+ * the length of fabric between them, so it needs that length: the shortest path
8
+ * through the cloth's stretch edges, each weighted by its rest length. A chain
9
+ * has one path and the answer is a sum; a sheet has many and the answer is
10
+ * Dijkstra's.
11
+ *
12
+ * A path along edges is never shorter than the surface geodesic it follows, and
13
+ * that is never shorter than the straight line, so in the rest pose a tether
14
+ * built from it is never taut. That is the property the tether needs; how much
15
+ * longer a grid path is than the true geodesic is how much slack the bound
16
+ * carries, and it is the price of a bound that costs nothing at runtime.
17
+ *
18
+ * ## In double, and label-correcting
19
+ *
20
+ * The distances are accumulated in `Float64` from `Float64` edge lengths. The
21
+ * open set is a {@link Uint32Heap}, whose scores are `Float32`, so two
22
+ * candidates closer together than a single-precision step can pop in the wrong
23
+ * order; a node is therefore never closed, and a shorter path arriving after it
24
+ * popped is relaxed through again. The answer is the exact shortest path
25
+ * whatever the heap's rounding, and on the graphs this sees the extra pops are
26
+ * a handful.
27
+ *
28
+ * @author Alex Goldring
29
+ * @copyright Company Named Limited (c) 2026
30
+ */
31
+
32
+ /**
33
+ * The open set. Module-level: a search runs start to finish synchronously, and
34
+ * it runs when a cloth is seeded or its held set changes, never per step.
35
+ * @type {Uint32Heap}
36
+ */
37
+ const OPEN = new Uint32Heap();
38
+
39
+ /**
40
+ * Edges incident on each node, CSR, from an edge list.
41
+ *
42
+ * @param {number} node_count
43
+ * @param {Int32Array} edge node pairs, 2 per edge
44
+ * @returns {{offset: Int32Array, edge: Int32Array}} `edge[offset[n] .. offset[n + 1]]` are the
45
+ * edges touching `n`
46
+ */
47
+ export function cloth_edge_incidence(node_count, edge) {
48
+ const edge_count = edge.length >> 1;
49
+
50
+ const offset = new Int32Array(node_count + 1);
51
+
52
+ for (let i = 0; i < edge_count * 2; i++) {
53
+ offset[edge[i] + 1]++;
54
+ }
55
+
56
+ for (let n = 0; n < node_count; n++) {
57
+ offset[n + 1] += offset[n];
58
+ }
59
+
60
+ const incident = new Int32Array(edge_count * 2);
61
+ const cursor = offset.slice(0, node_count);
62
+
63
+ for (let e = 0; e < edge_count; e++) {
64
+ incident[cursor[edge[e * 2]]++] = e;
65
+ incident[cursor[edge[e * 2 + 1]]++] = e;
66
+ }
67
+
68
+ return { offset, edge: incident };
69
+ }
70
+
71
+ /**
72
+ * Distance from every node to the nearest of a set of source nodes, along the
73
+ * edges, and which source that is.
74
+ *
75
+ * A node marked in `blocked` can be reached but is never passed through. That is
76
+ * Chaos Cloth's rule for its long-range attachments (`ClothTetherData.cpp`):
77
+ * a path from one island of held particles does not run through another, because
78
+ * the far side of another island is that island's business.
79
+ *
80
+ * @param {Float64Array} out_distance per node; `Infinity` where no source reaches
81
+ * @param {Int32Array} out_nearest per node, the source it is nearest; `−1` where none reaches
82
+ * @param {number} node_count
83
+ * @param {Int32Array} edge node pairs, 2 per edge
84
+ * @param {Float64Array} edge_length rest length per edge
85
+ * @param {{offset: Int32Array, edge: Int32Array}} incidence from {@link cloth_edge_incidence}
86
+ * @param {Int32Array|number[]} source
87
+ * @param {number} source_count
88
+ * @param {Uint8Array|null} blocked per node, non-zero for a node no path may pass through;
89
+ * `null` for none
90
+ */
91
+ export function cloth_geodesic_field(
92
+ out_distance, out_nearest,
93
+ node_count, edge, edge_length, incidence,
94
+ source, source_count,
95
+ blocked
96
+ ) {
97
+ out_distance.fill(Infinity, 0, node_count);
98
+ out_nearest.fill(-1, 0, node_count);
99
+
100
+ OPEN.clear();
101
+
102
+ for (let i = 0; i < source_count; i++) {
103
+ const s = source[i];
104
+
105
+ out_distance[s] = 0;
106
+ out_nearest[s] = s;
107
+
108
+ OPEN.insert(s, 0);
109
+ }
110
+
111
+ const offset = incidence.offset;
112
+ const incident = incidence.edge;
113
+
114
+ while (!OPEN.is_empty()) {
115
+ const u = OPEN.pop_min();
116
+
117
+ const d = out_distance[u];
118
+
119
+ if (d > 0 && blocked !== null && blocked[u] !== 0) {
120
+ // Reached, and that is where the path stops.
121
+ continue;
122
+ }
123
+
124
+ const nearest = out_nearest[u];
125
+
126
+ for (let k = offset[u]; k < offset[u + 1]; k++) {
127
+ const e = incident[k];
128
+
129
+ const a = edge[e * 2];
130
+ const v = a === u ? edge[e * 2 + 1] : a;
131
+
132
+ const candidate = d + edge_length[e];
133
+
134
+ if (candidate < out_distance[v]) {
135
+ out_distance[v] = candidate;
136
+ out_nearest[v] = nearest;
137
+
138
+ OPEN.insert(v, candidate);
139
+ }
140
+ }
141
+ }
142
+ }
@@ -0,0 +1,97 @@
1
+ /**
2
+ * # What holding a particle does to a cloth
3
+ *
4
+ * A {@link ClothPin} holds particles, and that one fact decides four things the
5
+ * rows depend on. This module is where they are decided, once per change in
6
+ * what is held ({@link cloth_apply_holds}) and once per step
7
+ * ({@link cloth_hold_step}):
8
+ *
9
+ * - **Who is kinematic.** A held particle has inverse mass zero and follows its
10
+ * holder: the solver carries it through the step towards
11
+ * `ClothState#kinematic_target`.
12
+ * - **What each free particle hangs from.** Its nearest held particle, along the
13
+ * fabric — one multi-source Dijkstra over the stretch edges, every held
14
+ * particle a source, so a path never runs through one held particle to reach
15
+ * another. Nothing held in reach means nothing to hang from.
16
+ * - **The tether and the slack**, §6's two leash rows, both measured from that
17
+ * particle (`ClothState#leash_source`), so that they follow it through the step
18
+ * rather than lag a step behind it. One tether per particle, to the nearest
19
+ * hold only: two hard tethers to two holders pulled apart are two bounds no
20
+ * position satisfies, and the fabric between them already says everything a
21
+ * second tether could.
22
+ * - **The animated pose**, which is the rest pose hung from that particle and
23
+ * turned by its holder — see `ClothInstance#animated_position`.
24
+ *
25
+ * A particle nothing held reaches gets a tether and a slack row of radius
26
+ * `Infinity`, which say nothing, and a cloth nothing holds is all such
27
+ * particles: there is no case here for it.
28
+ *
29
+ * ## The tether never pulls
30
+ *
31
+ * A hold that begins mid-run — a hand closing on a falling ribbon — begins
32
+ * wherever the fabric is, and a free configuration is routinely further from
33
+ * the new hold than the geodesic, because the fabric stretches and the tether
34
+ * only binds when something pulls. A tether switched on at its full tightness
35
+ * would snap the cloth onto the hold inside one step. So a tether's radius
36
+ * starts at the larger of `d_geo` and where the particle is, and each step comes
37
+ * down to wherever the particle has since come to, never below `d_geo`: it
38
+ * stops a particle going further than it has been since the hold began, and
39
+ * it never drags one in. A cloth seeded at rest is inside `d_geo` everywhere,
40
+ * so its tethers are `d_geo` from the first step, which is what they always
41
+ * were — and only a tether that began loose is looked at again, so a cloth
42
+ * whose holds have not changed pays nothing for it.
43
+ *
44
+ * @author Alex Goldring
45
+ * @copyright Company Named Limited (c) 2026
46
+ */
47
+ /**
48
+ * Take a hold's offsets: each of its particles relative to the holder, in the
49
+ * holder's own frame, from where the particle is now.
50
+ *
51
+ * Done in world terms, because the particles are in the frame they were last
52
+ * stepped in and the holder is where it is this step; the two meet in the
53
+ * world. The holder's turn is then measured from its pose in this step's frame,
54
+ * {@link ClothHold#pose}, so a hold begins unturned.
55
+ *
56
+ * @param {ClothInstance} instance
57
+ * @param {ClothHold} hold with {@link ClothHold#world} and {@link ClothHold#pose}
58
+ * this step's
59
+ * @param {Float64Array} frame_translation the frame the particle positions are in
60
+ * @param {Float64Array} frame_rotation
61
+ * @returns {void}
62
+ */
63
+ export function cloth_capture_hold(instance: ClothInstance, hold: ClothHold, frame_translation: Float64Array, frame_rotation: Float64Array): void;
64
+ /**
65
+ * Re-derive everything that depends on what is held: who is kinematic, what
66
+ * each free particle hangs from, the leash rows, and `reach`.
67
+ *
68
+ * Called once a seed and once per change in the set of holds — never per step.
69
+ * Writes into the instance's existing `ClothState`; nothing is re-built, so a
70
+ * worker that holds the buffer sees it on the next step without a second
71
+ * registration.
72
+ *
73
+ * @param {ClothInstance} instance
74
+ * @returns {void}
75
+ */
76
+ export function cloth_apply_holds(instance: ClothInstance): void;
77
+ /**
78
+ * Everything a hold changes per step: where each held particle is to be, the
79
+ * animated pose hung from them, the leash centres and the tethers' ratchet.
80
+ *
81
+ * Reads each hold's {@link ClothHold#pose} — the holder in this step's frame —
82
+ * and the particle positions as the frame carry left them.
83
+ *
84
+ * **Nothing is recomputed that cannot have changed.** Every quantity here
85
+ * except the ratchet is a function of the holds' poses in the frame, and a
86
+ * holder riding the frame — a rope's own top, a cape's shoulder in a cape riding
87
+ * that shoulder — has the same pose in it every step however the frame moves.
88
+ * So when no hold has moved in the frame since the last step, and nothing has
89
+ * rewritten the particles since ({@link ClothInstance#holds_dirty}), the
90
+ * targets, the animated pose and the leash offsets are left as they are: the
91
+ * question is a fact the step already has, not a kind of cloth.
92
+ *
93
+ * @param {ClothInstance} instance
94
+ * @returns {void}
95
+ */
96
+ export function cloth_hold_step(instance: ClothInstance): void;
97
+ //# sourceMappingURL=cloth_holds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloth_holds.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_holds.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,gGAJW,YAAY,kBACZ,YAAY,GACV,IAAI,CA6ChB;AAED;;;;;;;;;;;GAWG;AACH,4DAFa,IAAI,CA0KhB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,0DAFa,IAAI,CA2KhB"}