@woosh/meep-engine 3.43.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 (287) hide show
  1. package/editor/prototypeEditorShell.d.ts.map +1 -1
  2. package/editor/prototypeEditorShell.js +4 -2
  3. package/package.json +1 -1
  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/renderer/animation/GPUAnimationManager.d.ts +45 -14
  177. package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
  178. package/src/shade/renderer/animation/GPUAnimationManager.js +316 -64
  179. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts +5 -0
  180. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
  181. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +11 -1
  182. package/src/shade/renderer/geometry/BoxGeometry.d.ts +1 -11
  183. package/src/shade/renderer/geometry/BoxGeometry.d.ts.map +1 -1
  184. package/src/shade/renderer/geometry/BoxGeometry.js +6 -13
  185. package/src/shade/renderer/geometry/CapsuleGeometry.d.ts +19 -0
  186. package/src/shade/renderer/geometry/CapsuleGeometry.d.ts.map +1 -0
  187. package/src/shade/renderer/geometry/CapsuleGeometry.js +24 -0
  188. package/src/shade/renderer/geometry/ConeGeometry.d.ts +20 -0
  189. package/src/shade/renderer/geometry/ConeGeometry.d.ts.map +1 -0
  190. package/src/shade/renderer/geometry/ConeGeometry.js +33 -0
  191. package/src/shade/renderer/geometry/CylinderGeometry.d.ts +21 -0
  192. package/src/shade/renderer/geometry/CylinderGeometry.d.ts.map +1 -0
  193. package/src/shade/renderer/geometry/CylinderGeometry.js +35 -0
  194. package/src/shade/renderer/geometry/PlaneGeometry.d.ts +17 -0
  195. package/src/shade/renderer/geometry/PlaneGeometry.d.ts.map +1 -0
  196. package/src/shade/renderer/geometry/PlaneGeometry.js +22 -0
  197. package/src/shade/renderer/geometry/TorusGeometry.d.ts +18 -0
  198. package/src/shade/renderer/geometry/TorusGeometry.d.ts.map +1 -0
  199. package/src/shade/renderer/geometry/TorusGeometry.js +23 -0
  200. package/src/shade/renderer/geometry/UVSphereGeometry.d.ts +21 -0
  201. package/src/shade/renderer/geometry/UVSphereGeometry.d.ts.map +1 -0
  202. package/src/shade/renderer/geometry/UVSphereGeometry.js +34 -0
  203. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts +19 -0
  204. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts.map +1 -0
  205. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.js +205 -0
  206. package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts +21 -0
  207. package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts.map +1 -0
  208. package/src/shade/renderer/geometry/primitives/make_cone_geometry.js +36 -0
  209. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts +1 -1
  210. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts.map +1 -1
  211. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.js +44 -9
  212. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts +20 -0
  213. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts.map +1 -0
  214. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.js +190 -0
  215. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.d.ts.map +1 -1
  216. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.js +7 -2
  217. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts +26 -8
  218. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts.map +1 -1
  219. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js +56 -39
  220. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts +7 -0
  221. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts.map +1 -1
  222. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.js +46 -4
  223. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.d.ts.map +1 -1
  224. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.js +4 -2
  225. package/src/shade/renderer/gpu_primitive/sort/defs.d.ts +2 -2
  226. package/src/shade/renderer/gpu_primitive/sort/defs.js +79 -79
  227. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts +1 -1
  228. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts.map +1 -1
  229. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.js +7 -3
  230. package/src/shade/renderer/particles/GPUParticleSystem.js +1 -1
  231. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts +4 -3
  232. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts.map +1 -1
  233. package/src/shade/renderer/particles/coherence/graph_particle_bucket.js +200 -194
  234. package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
  235. package/src/shade/renderer/particles/graph_particles.js +6 -2
  236. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -1
  237. package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +334 -329
  238. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
  239. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +7 -2
  240. package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.d.ts.map +1 -1
  241. package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.js +16 -4
  242. package/src/shade/renderer/texture/COMPRESSED_TEXTURE_PLAN_2026_09_01.md +2444 -2345
  243. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts.map +1 -1
  244. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.js +312 -310
  245. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts +3 -3
  246. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts.map +1 -1
  247. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.js +383 -375
  248. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.d.ts.map +1 -1
  249. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.js +349 -346
  250. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts +58 -0
  251. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts.map +1 -0
  252. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.js +536 -0
  253. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts +21 -7
  254. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts.map +1 -1
  255. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js +291 -327
  256. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts +25 -0
  257. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts.map +1 -0
  258. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.js +99 -0
  259. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts +5 -3
  260. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts.map +1 -1
  261. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.js +47 -71
  262. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts +10 -0
  263. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts.map +1 -0
  264. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.js +50 -0
  265. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts +4 -5
  266. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts.map +1 -1
  267. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.js +7 -8
  268. package/src/shade/renderer/water/chunk_water_transport.d.ts.map +1 -1
  269. package/src/shade/renderer/water/chunk_water_transport.js +7 -5
  270. package/src/shade/renderer/water/medium/GPUWaterBodies.d.ts.map +1 -1
  271. package/src/shade/renderer/water/medium/GPUWaterBodies.js +8 -2
  272. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts +3 -2
  273. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts.map +1 -1
  274. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.js +3 -2
  275. package/src/shade/renderer/water/shader_water.d.ts.map +1 -1
  276. package/src/shade/renderer/water/shader_water.js +3 -1
  277. package/src/shade/renderer/water/surface/GPUWaterSurface.d.ts.map +1 -1
  278. package/src/shade/renderer/water/surface/GPUWaterSurface.js +3 -1
  279. package/src/shade/renderer/water/surface/graph_water_tessellation.d.ts.map +1 -1
  280. package/src/shade/renderer/water/surface/graph_water_tessellation.js +11 -4
  281. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
  282. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +37 -20
  283. package/src/shade/wgsl/validate_wgsl_source.d.ts.map +1 -1
  284. package/src/shade/wgsl/validate_wgsl_source.js +74 -3
  285. package/src/engine/graphics3/register_instance_animation.d.ts +0 -114
  286. package/src/engine/graphics3/register_instance_animation.d.ts.map +0 -1
  287. package/src/engine/graphics3/register_instance_animation.js +0 -201
@@ -1,6 +1,7 @@
1
1
  import { quat3_multiply_array } from "../../../../core/geom/3d/quaternion/quat3_multiply.js";
2
2
  import { quat3_nlerp_array } from "../../../../core/geom/3d/quaternion/quat3_nlerp.js";
3
3
  import { quat3_shortest_arc_array } from "../../../../core/geom/3d/quaternion/quat3_shortest_arc.js";
4
+ import { v3_quaternion_apply_array } from "../../../../core/geom/vec3/v3_quaternion_apply.js";
4
5
 
5
6
  /**
6
7
  * # From particles to a pose — the half of the write-back that is arithmetic
@@ -34,6 +35,19 @@ import { quat3_shortest_arc_array } from "../../../../core/geom/3d/quaternion/qu
34
35
  * every link points at its child and a two-link chain reads as a hinge with a
35
36
  * corner in it.
36
37
  *
38
+ * ## A node on a surface turns with the surface
39
+ *
40
+ * A sheet's joints have no chain to swing along — a generated skin hangs every
41
+ * one of them off the frame — and what a joint's orientation is *for* there is
42
+ * the normal it turns its vertex's normal by. So a node with triangles around
43
+ * it takes the rotation that carries its animated surface onto its simulated
44
+ * one: a swing taking the area-weighted normal of its triangles onto the
45
+ * normal they have now, then a twist about that normal taking one fixed
46
+ * neighbour's direction onto where it is now. Both are shortest arcs, so there
47
+ * is no basis to orthonormalise and nothing new in `core`; M3's joint-budget
48
+ * fixture fits the same two directions. A surface that has collapsed to a line
49
+ * at the node keeps whichever half still has a direction.
50
+ *
37
51
  * @author Alex Goldring
38
52
  * @copyright Company Named Limited (c) 2026
39
53
  */
@@ -44,7 +58,7 @@ import { quat3_shortest_arc_array } from "../../../../core/geom/3d/quaternion/qu
44
58
  * @type {Float64Array}
45
59
  * @private
46
60
  */
47
- const SWING = new Float64Array(12);
61
+ const SWING = new Float64Array(16);
48
62
 
49
63
  /** Where the parent-driven swing sits in {@link SWING}. @private */
50
64
  const SWING_PARENT = 0;
@@ -52,6 +66,8 @@ const SWING_PARENT = 0;
52
66
  const SWING_CHILD = 4;
53
67
  /** Where the blended swing sits. @private */
54
68
  const SWING_OUT = 8;
69
+ /** Where a surface's twist sits. @private */
70
+ const SWING_TWIST = 12;
55
71
 
56
72
  /**
57
73
  * @type {Float64Array}
@@ -64,8 +80,8 @@ const DIRECTION = new Float64Array(12);
64
80
  *
65
81
  * Both are in the **cloth's own frame**: the position is the particle lerped
66
82
  * towards its animated one by `Cloth#blend`, and the rotation is the swing
67
- * composed onto the animated orientation. Node 0 — the anchor — is the origin of
68
- * that frame, so its rotation is the identity rather than anything read off it.
83
+ * composed onto the animated orientation. A root of the seeder's tree has no
84
+ * link above it and takes its children's swing alone.
69
85
  *
70
86
  * @param {ClothInstance} instance
71
87
  * @returns {void}
@@ -103,13 +119,23 @@ export function cloth_reconstruct_pose(instance) {
103
119
 
104
120
  const reconstructed = instance.blended_rotation;
105
121
 
106
- reconstructed[0] = 0;
107
- reconstructed[1] = 0;
108
- reconstructed[2] = 0;
109
- reconstructed[3] = 1;
122
+ const surface_offset = instance.surface_offset;
123
+
124
+ for (let node = 0; node < node_count; node++) {
125
+ if (surface_offset !== null && surface_offset[node + 1] > surface_offset[node]) {
126
+ surface_turn(instance, node, SWING_OUT);
127
+
128
+ quat3_multiply_array(reconstructed, node * 4, SWING, SWING_OUT, rotation, node * 4);
129
+
130
+ continue;
131
+ }
132
+
133
+ const has_parent_swing = parent[node] >= 0 && link_swing(instance, parent[node], node, SWING_PARENT);
134
+
135
+ if (!has_parent_swing) {
136
+ identity(SWING_PARENT);
137
+ }
110
138
 
111
- for (let node = 1; node < node_count; node++) {
112
- const has_parent_swing = link_swing(instance, parent[node], node, SWING_PARENT);
113
139
  const has_child_swing = children_swing(instance, node, SWING_CHILD);
114
140
 
115
141
  let swing = SWING_OUT;
@@ -133,6 +159,131 @@ export function cloth_reconstruct_pose(instance) {
133
159
  }
134
160
  }
135
161
 
162
+ /**
163
+ * The turn that carries a node's animated surface onto its simulated one, into
164
+ * `SWING` at `out` — see the module docblock.
165
+ *
166
+ * @param {ClothInstance} instance
167
+ * @param {number} node with triangles around it
168
+ * @param {number} out
169
+ * @private
170
+ */
171
+ function surface_turn(instance, node, out) {
172
+ const animated = instance.animated_position;
173
+ const blended = instance.blended_position;
174
+
175
+ surface_normal(DIRECTION, 0, instance, animated, node);
176
+ surface_normal(DIRECTION, 3, instance, blended, node);
177
+
178
+ const has_normal = unit(DIRECTION, 0) && unit(DIRECTION, 3);
179
+
180
+ // the swing: normal onto normal
181
+ if (has_normal) {
182
+ quat3_shortest_arc_array(SWING, out, DIRECTION, 0, DIRECTION, 3);
183
+ } else {
184
+ identity(out);
185
+ }
186
+
187
+ const neighbour = instance.surface_neighbour[node];
188
+
189
+ const a = node * 3;
190
+ const b = neighbour * 3;
191
+
192
+ // the neighbour's animated direction, swung; and its simulated one
193
+ TANGENT[0] = animated[b] - animated[a];
194
+ TANGENT[1] = animated[b + 1] - animated[a + 1];
195
+ TANGENT[2] = animated[b + 2] - animated[a + 2];
196
+
197
+ v3_quaternion_apply_array(DIRECTION, 6, TANGENT, 0, SWING, out);
198
+
199
+ DIRECTION[9] = blended[b] - blended[a];
200
+ DIRECTION[10] = blended[b + 1] - blended[a + 1];
201
+ DIRECTION[11] = blended[b + 2] - blended[a + 2];
202
+
203
+ if (has_normal) {
204
+ // both into the plane the normal leaves them, so the arc between them
205
+ // turns about the normal and nothing else
206
+ reject(DIRECTION, 6, DIRECTION, 3);
207
+ reject(DIRECTION, 9, DIRECTION, 3);
208
+ }
209
+
210
+ if (!unit(DIRECTION, 6) || !unit(DIRECTION, 9)) {
211
+ return;
212
+ }
213
+
214
+ // the twist, then the swing it follows
215
+ quat3_shortest_arc_array(SWING, SWING_TWIST, DIRECTION, 6, DIRECTION, 9);
216
+
217
+ quat3_multiply_array(SWING, out, SWING, SWING_TWIST, SWING, out);
218
+ }
219
+
220
+ /**
221
+ * The area-weighted normal of the triangles around a node, unnormalised, into
222
+ * `out` at `offset`.
223
+ *
224
+ * @param {Float64Array} out
225
+ * @param {number} offset
226
+ * @param {ClothInstance} instance
227
+ * @param {Float64Array} position 3 per node
228
+ * @param {number} node
229
+ * @private
230
+ */
231
+ function surface_normal(out, offset, instance, position, node) {
232
+ const triangle = instance.triangle;
233
+ const surface = instance.surface_triangle;
234
+
235
+ let nx = 0, ny = 0, nz = 0;
236
+
237
+ for (let k = instance.surface_offset[node]; k < instance.surface_offset[node + 1]; k++) {
238
+ const t = surface[k] * 3;
239
+
240
+ const a = triangle[t] * 3;
241
+ const b = triangle[t + 1] * 3;
242
+ const c = triangle[t + 2] * 3;
243
+
244
+ const ux = position[b] - position[a];
245
+ const uy = position[b + 1] - position[a + 1];
246
+ const uz = position[b + 2] - position[a + 2];
247
+
248
+ const vx = position[c] - position[a];
249
+ const vy = position[c + 1] - position[a + 1];
250
+ const vz = position[c + 2] - position[a + 2];
251
+
252
+ // twice the area, along the normal: the weighting is the cross product's own length
253
+ nx += uy * vz - uz * vy;
254
+ ny += uz * vx - ux * vz;
255
+ nz += ux * vy - uy * vx;
256
+ }
257
+
258
+ out[offset] = nx;
259
+ out[offset + 1] = ny;
260
+ out[offset + 2] = nz;
261
+ }
262
+
263
+ /**
264
+ * Remove from the vector at `offset` its part along the unit vector at
265
+ * `normal_offset`.
266
+ *
267
+ * @param {Float64Array} v
268
+ * @param {number} offset
269
+ * @param {Float64Array} n
270
+ * @param {number} normal_offset
271
+ * @private
272
+ */
273
+ function reject(v, offset, n, normal_offset) {
274
+ const d = v[offset] * n[normal_offset] + v[offset + 1] * n[normal_offset + 1] + v[offset + 2] * n[normal_offset + 2];
275
+
276
+ v[offset] -= d * n[normal_offset];
277
+ v[offset + 1] -= d * n[normal_offset + 1];
278
+ v[offset + 2] -= d * n[normal_offset + 2];
279
+ }
280
+
281
+ /**
282
+ * @type {Float64Array}
283
+ * @private
284
+ */
285
+ const TANGENT = new Float64Array(3);
286
+
136
287
  /**
137
288
  * Swing of the link from `from` to `to`, into `SWING` at `out`.
138
289
  *
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * # Seeding a cloth from a skinned model's joints — §11.2
3
3
  *
4
- * One particle per joint the proxy names, with the anchor as the fixed set, and
5
- * everything after that is `cloth_build_rows.js` — the same rows, the same
6
- * geodesics, the same leashes the entity path gets. §11 says "the solver is
4
+ * One particle per joint the proxy names — the garment's own and the bones it
5
+ * hangs from — and everything after that is `cloth_build_rows.js`: the same
6
+ * rows, the same leashes the entity path gets. §11 says "the solver is
7
7
  * identical either way; only seeding and write-back differ", and this file plus
8
8
  * `cloth_write_back_rig.js` is the whole of the difference.
9
9
  *
@@ -16,28 +16,23 @@
16
16
  * after the CPU's flush and whatever any bit says. The bit states that, and
17
17
  * stops the flush from racing it; it does not stop the clip.
18
18
  *
19
- * So the seed **holds** every joint it drives (`gpu_authority_hold`): the bit
20
- * clears, the animation manager mutes every binding that names the joint, and
21
- * the row is what the write-back wrote. A clip that binds a held joint later
22
- * binds muted, and one that leaves it leaves cloth's offset alone. Ending the
23
- * hold grants nothing; a clip still bound takes the joint back. So a cape
24
- * simulates under a clip that keys its bones too — exporters often bake every
25
- * bone — and the exact evaluation (`t64_evaluate_world`) answers a held joint
26
- * with cloth's offset, as the GPU shows it.
19
+ * So the seed **holds** every garment joint it drives (`gpu_authority_hold`):
20
+ * the bit clears, the animation manager mutes every binding that names the
21
+ * joint, and the row is what the write-back wrote. A clip that binds a held
22
+ * joint later binds muted, and one that leaves it leaves cloth's offset alone.
23
+ * Ending the hold grants nothing; a clip still bound takes the joint back. So a
24
+ * cape simulates under a clip that keys its bones too — exporters often bake
25
+ * every bone — and the exact evaluation (`t64_evaluate_world`) answers a held
26
+ * joint with cloth's offset, as the GPU shows it.
27
27
  *
28
- * ## The animated pose is constant, exactly as it is for a rope
28
+ * The bones the garment hangs from are not held: they are the character's, and
29
+ * cloth only reads them — each step, exactly, for the write-back to express the
30
+ * garment's roots against (`ClothInstance#boundary_pose`).
29
31
  *
30
- * §11.1 says a subtree's authored pose is rigid relative to its anchor, so in
31
- * the anchor's own frame it does not move, and then says "a subtree whose links
32
- * are themselves animated is not an M1 case — that is the rig path, where the
33
- * animated pose comes from the skeleton and is live".
32
+ * ## The rest pose is the proxy's
34
33
  *
35
- * For a **rigged** garment it is not live either, and the reason is the
36
- * hold above: cloth owns those joints, so nothing else poses them,
37
- * so their authored pose is the proxy's baked bind pose — constant in the
38
- * anchor's frame, exactly as a rope's is. What moves is the anchor, and the
39
- * anchor is a joint of the character's own animated skeleton, whose pose the
40
- * system evaluates exactly (`t64_evaluate_world`).
34
+ * Baked at build in the frame joint's bind pose, so a re-seed of a live garment
35
+ * reads the authored shape rather than the shape the solver left behind.
41
36
  *
42
37
  * @author Alex Goldring
43
38
  * @copyright Company Named Limited (c) 2026
@@ -1 +1 @@
1
- {"version":3,"file":"cloth_seed_rig.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_seed_rig.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH;;;;;;;;GAQG;AACH,mFAJW,MAAM,EAAE,mCAER,MAAM,QAqFhB;AAoED;;;;;;;;;;;;;;;;GAgBG;AACH,yFAFa,IAAI,CAoBhB"}
1
+ {"version":3,"file":"cloth_seed_rig.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_seed_rig.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;;;;;;GAQG;AACH,mFAJW,MAAM,EAAE,mCAER,MAAM,QAkGhB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,yFAFa,IAAI,CAoBhB"}
@@ -1,18 +1,16 @@
1
1
  import { assert } from "../../../../core/assert.js";
2
- import { quat3_multiply } from "../../../../core/geom/3d/quaternion/quat3_multiply.js";
3
- import { v3_quaternion_apply } from "../../../../core/geom/vec3/v3_quaternion_apply.js";
4
2
  import { GPUStateAuthorityFlags } from "../../../ecs/gpu/GPUStateAuthorityFlags.js";
5
3
  import { gpu_authority_hold } from "../../../ecs/gpu/gpu_authority_hold.js";
6
4
  import { gpu_authority_unhold } from "../../../ecs/gpu/gpu_authority_unhold.js";
7
5
  import { TransformAttachment } from "../../../ecs/transform-attachment/TransformAttachment.js";
8
- import { cloth_build_children, cloth_build_rows } from "./cloth_build_rows.js";
6
+ import { cloth_build_children, cloth_build_rows, cloth_build_surface } from "./cloth_build_rows.js";
9
7
 
10
8
  /**
11
9
  * # Seeding a cloth from a skinned model's joints — §11.2
12
10
  *
13
- * One particle per joint the proxy names, with the anchor as the fixed set, and
14
- * everything after that is `cloth_build_rows.js` — the same rows, the same
15
- * geodesics, the same leashes the entity path gets. §11 says "the solver is
11
+ * One particle per joint the proxy names — the garment's own and the bones it
12
+ * hangs from — and everything after that is `cloth_build_rows.js`: the same
13
+ * rows, the same leashes the entity path gets. §11 says "the solver is
16
14
  * identical either way; only seeding and write-back differ", and this file plus
17
15
  * `cloth_write_back_rig.js` is the whole of the difference.
18
16
  *
@@ -25,28 +23,23 @@ import { cloth_build_children, cloth_build_rows } from "./cloth_build_rows.js";
25
23
  * after the CPU's flush and whatever any bit says. The bit states that, and
26
24
  * stops the flush from racing it; it does not stop the clip.
27
25
  *
28
- * So the seed **holds** every joint it drives (`gpu_authority_hold`): the bit
29
- * clears, the animation manager mutes every binding that names the joint, and
30
- * the row is what the write-back wrote. A clip that binds a held joint later
31
- * binds muted, and one that leaves it leaves cloth's offset alone. Ending the
32
- * hold grants nothing; a clip still bound takes the joint back. So a cape
33
- * simulates under a clip that keys its bones too — exporters often bake every
34
- * bone — and the exact evaluation (`t64_evaluate_world`) answers a held joint
35
- * with cloth's offset, as the GPU shows it.
26
+ * So the seed **holds** every garment joint it drives (`gpu_authority_hold`):
27
+ * the bit clears, the animation manager mutes every binding that names the
28
+ * joint, and the row is what the write-back wrote. A clip that binds a held
29
+ * joint later binds muted, and one that leaves it leaves cloth's offset alone.
30
+ * Ending the hold grants nothing; a clip still bound takes the joint back. So a
31
+ * cape simulates under a clip that keys its bones too — exporters often bake
32
+ * every bone — and the exact evaluation (`t64_evaluate_world`) answers a held
33
+ * joint with cloth's offset, as the GPU shows it.
36
34
  *
37
- * ## The animated pose is constant, exactly as it is for a rope
35
+ * The bones the garment hangs from are not held: they are the character's, and
36
+ * cloth only reads them — each step, exactly, for the write-back to express the
37
+ * garment's roots against (`ClothInstance#boundary_pose`).
38
38
  *
39
- * §11.1 says a subtree's authored pose is rigid relative to its anchor, so in
40
- * the anchor's own frame it does not move, and then says "a subtree whose links
41
- * are themselves animated is not an M1 case — that is the rig path, where the
42
- * animated pose comes from the skeleton and is live".
39
+ * ## The rest pose is the proxy's
43
40
  *
44
- * For a **rigged** garment it is not live either, and the reason is the
45
- * hold above: cloth owns those joints, so nothing else poses them,
46
- * so their authored pose is the proxy's baked bind pose — constant in the
47
- * anchor's frame, exactly as a rope's is. What moves is the anchor, and the
48
- * anchor is a joint of the character's own animated skeleton, whose pose the
49
- * system evaluates exactly (`t64_evaluate_world`).
41
+ * Baked at build in the frame joint's bind pose, so a re-seed of a live garment
42
+ * reads the authored shape rather than the shape the solver left behind.
50
43
  *
51
44
  * @author Alex Goldring
52
45
  * @copyright Company Named Limited (c) 2026
@@ -68,50 +61,43 @@ export function cloth_seed_rig(instance, proxy, joints, ecd, dt) {
68
61
  // instance, gives the last seeding's holds back first.
69
62
  assert.equal(instance.held_joints, null, 'a rig seeds over a rig that still holds its joints; ClothWorld#reseed gives them back first');
70
63
 
71
- const joint_count = proxy.joint_count;
72
-
73
- // Node 0 is the anchor, exactly as it is for the entity path: the fixed
74
- // set, the origin of the local frame, and `d_geo = 0`.
75
- const node_count = joint_count + 1;
64
+ const node_count = proxy.particle_count;
76
65
 
77
66
  instance.node_count = node_count;
67
+ instance.node_parent = Int32Array.from(proxy.parent);
68
+ instance.node_output = Uint8Array.from(proxy.output);
78
69
 
79
- const node_parent = new Int32Array(node_count);
80
-
81
- node_parent[0] = -1;
70
+ instance.frame_entity = joints[proxy.frame];
82
71
 
83
- for (let i = 0; i < joint_count; i++) {
84
- node_parent[i + 1] = proxy.joint_parent[i] + 1;
85
- }
86
-
87
- instance.node_parent = node_parent;
72
+ assert.defined(instance.frame_entity, `frame joint ${proxy.frame} of the skin`);
88
73
 
89
74
  const node_joint = new Int32Array(node_count);
90
-
91
- node_joint[0] = joints[proxy.anchor];
92
-
93
75
  const node_attachment = new Array(node_count);
94
76
 
95
- node_attachment[0] = null;
96
-
97
77
  // What this seeding holds, so that giving it back is possible. A hold that
98
78
  // nothing ends is half a transaction, and the half that is missing is the
99
79
  // one that runs when the garment is removed.
100
80
  const held = [];
101
81
 
102
- for (let i = 0; i < joint_count; i++) {
103
- const joint = joints[proxy.joint[i]];
82
+ for (let node = 0; node < node_count; node++) {
83
+ const joint = joints[proxy.joint[node]];
84
+
85
+ assert.defined(joint, `joint ${proxy.joint[node]} of the skin`);
86
+ assert.ok(ecd.entityExists(joint), `joint ${proxy.joint[node]} of the skin, entity ${joint}, does not exist`);
104
87
 
105
- assert.defined(joint, `joint ${proxy.joint[i]} of the skin`);
106
- assert.ok(ecd.entityExists(joint), `joint ${proxy.joint[i]} of the skin, entity ${joint}, does not exist`);
88
+ node_joint[node] = joint;
107
89
 
108
- node_joint[i + 1] = joint;
90
+ if (proxy.output[node] === 0) {
91
+ node_attachment[node] = null;
92
+
93
+ continue;
94
+ }
109
95
 
110
96
  const attachment = ecd.getComponent(joint, TransformAttachment);
111
97
 
112
98
  assert.defined(attachment, `joint entity ${joint} carries no TransformAttachment to write`);
113
99
 
114
- node_attachment[i + 1] = attachment;
100
+ node_attachment[node] = attachment;
115
101
 
116
102
  // See the module docblock. Every joint, whether or not a clip drives it now: one may bind
117
103
  // it later, and the hold is what it finds there.
@@ -135,81 +121,35 @@ export function cloth_seed_rig(instance, proxy, joints, ecd, dt) {
135
121
  instance.pruned_transform = [];
136
122
  instance.pruned_attachment = [];
137
123
 
138
- cloth_build_children(instance);
139
-
140
- read_bind_pose(instance, proxy);
141
-
142
- instance.dynamics_seen.copy(instance.cloth.dynamics);
143
-
144
- cloth_build_rows(instance, dt);
145
-
146
- instance.seeded = true;
147
- }
148
-
149
- /**
150
- * The proxy's bind pose, composed: local offsets per node and the position and
151
- * rotation of every node in the anchor's frame.
152
- *
153
- * @param {ClothInstance} instance
154
- * @param {ClothProxy} proxy
155
- */
156
- function read_bind_pose(instance, proxy) {
157
- const node_count = instance.node_count;
158
-
159
- const local_position = new Float32Array(node_count * 3);
160
- const local_rotation = new Float32Array(node_count * 4);
161
-
162
- const position = new Float32Array(node_count * 3);
163
- const rotation = new Float32Array(node_count * 4);
164
-
165
- // The anchor is the origin of the frame it anchors.
166
- local_rotation[3] = 1;
167
- rotation[3] = 1;
124
+ // Read from the proxy, so a re-seed is as authored; and the frame joint, if
125
+ // the garment hangs from it, is the identity in its own frame from the first
126
+ // step, the rest are evaluated every step.
127
+ instance.rest_position = Float32Array.from(proxy.rest_position);
128
+ instance.rest_rotation = Float32Array.from(proxy.rest_rotation);
168
129
 
169
- const parent = instance.node_parent;
130
+ instance.rest_local_position = null;
131
+ instance.rest_local_rotation = null;
170
132
 
171
- for (let node = 1; node < node_count; node++) {
172
- const joint = node - 1;
133
+ instance.boundary_pose = new Float64Array(node_count * 7);
173
134
 
174
- local_position[node * 3] = proxy.rest_position[joint * 3];
175
- local_position[node * 3 + 1] = proxy.rest_position[joint * 3 + 1];
176
- local_position[node * 3 + 2] = proxy.rest_position[joint * 3 + 2];
177
-
178
- local_rotation[node * 4] = proxy.rest_rotation[joint * 4];
179
- local_rotation[node * 4 + 1] = proxy.rest_rotation[joint * 4 + 1];
180
- local_rotation[node * 4 + 2] = proxy.rest_rotation[joint * 4 + 2];
181
- local_rotation[node * 4 + 3] = proxy.rest_rotation[joint * 4 + 3];
182
-
183
- const p = parent[node];
135
+ for (let node = 0; node < node_count; node++) {
136
+ instance.boundary_pose[node * 7 + 6] = 1;
137
+ }
184
138
 
185
- const pqx = rotation[p * 4];
186
- const pqy = rotation[p * 4 + 1];
187
- const pqz = rotation[p * 4 + 2];
188
- const pqw = rotation[p * 4 + 3];
139
+ cloth_build_children(instance);
189
140
 
190
- v3_quaternion_apply(
191
- COMPOSE, 0,
192
- local_position[node * 3], local_position[node * 3 + 1], local_position[node * 3 + 2],
193
- pqx, pqy, pqz, pqw
194
- );
141
+ instance.edge = Int32Array.from(proxy.edge);
142
+ instance.skip = Int32Array.from(proxy.skip);
143
+ instance.hinge = Int32Array.from(proxy.hinge);
144
+ instance.triangle = Int32Array.from(proxy.triangle);
195
145
 
196
- position[node * 3] = position[p * 3] + COMPOSE[0];
197
- position[node * 3 + 1] = position[p * 3 + 1] + COMPOSE[1];
198
- position[node * 3 + 2] = position[p * 3 + 2] + COMPOSE[2];
146
+ cloth_build_surface(instance);
199
147
 
200
- quat3_multiply(
201
- rotation, node * 4,
202
- pqx, pqy, pqz, pqw,
203
- local_rotation[node * 4], local_rotation[node * 4 + 1],
204
- local_rotation[node * 4 + 2], local_rotation[node * 4 + 3]
205
- );
206
- }
148
+ instance.dynamics_seen.copy(instance.cloth.dynamics);
207
149
 
208
- instance.rest_local_position = local_position;
209
- instance.rest_local_rotation = local_rotation;
150
+ cloth_build_rows(instance, dt);
210
151
 
211
- instance.animated_position = position;
212
- instance.animated_rotation = rotation;
152
+ instance.seeded = true;
213
153
  }
214
154
 
215
155
  /**
@@ -248,5 +188,3 @@ export function cloth_release_rig(instance, ecd) {
248
188
 
249
189
  instance.held_joints = null;
250
190
  }
251
-
252
- const COMPOSE = new Float64Array(3);
@@ -2,12 +2,27 @@
2
2
  * # Seeding a cloth from an entity subtree — §11.1
3
3
  *
4
4
  * One particle per entity in the transform subtree of the entity the
5
- * {@link Cloth} is on, walked breadth-first through
6
- * `TransformAttachmentSystem#findChildrenOf`, stopping at a nested `Cloth` or a
7
- * {@link ClothExclude}. Stretch rows along the parent-child links, a bending
8
- * model along each chain, and the anchor itself as the fixed set — so `d_geo`
9
- * is distance along the chain from the anchor and every derived quantity in
10
- * §3.4 works unchanged.
5
+ * {@link Cloth} is on — that entity included, as node 0 — walked breadth-first
6
+ * through `TransformAttachmentSystem#findChildrenOf`, stopping at a nested
7
+ * `Cloth` or a {@link ClothExclude}. Stretch rows along the parent-child links
8
+ * and a bending model along each chain.
9
+ *
10
+ * **Node 0 is the cloth's frame and nothing holds it.** It is a particle like
11
+ * any other — links run from it, a {@link ClothPin} can hold it — but its
12
+ * entity is the frame, which cloth reads and never writes, so it has no output.
13
+ * A rope hung from its own top is a rope whose top entity pins particle 0:
14
+ *
15
+ * ```js
16
+ * rope_top.add(Cloth.from(ClothDynamics.ROPE));
17
+ * rope_top.add(ClothPin.from({ cloth: rope_top, particles: [0] }));
18
+ * ```
19
+ *
20
+ * **The particles are numbered by the walk**: breadth-first from node 0,
21
+ * siblings in the order `findChildrenOf` gives them, which is ascending entity
22
+ * id. A single chain is therefore numbered by depth whatever the ids; a pin on a
23
+ * branching subtree names a node of a walk that depends on how its siblings'
24
+ * ids were allocated, and `ClothSystem#particle_of` is how code that has the
25
+ * entity asks for the number.
11
26
  *
12
27
  * ## What "bend rows along each chain" turned out to mean
13
28
  *
@@ -1 +1 @@
1
- {"version":3,"file":"cloth_seed_subtree.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_seed_subtree.js"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH;;;;;;;;;GASG;AACH,6CAPW,aAAa,2EAGb,MAAM,GAEJ,IAAI,CAwGhB;AA6GD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,gDAJW,aAAa,gCAEX,IAAI,CAkChB;8BAnU6B,oBAAoB"}
1
+ {"version":3,"file":"cloth_seed_subtree.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_seed_subtree.js"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAEH;;;;;;;;;GASG;AACH,6CAPW,aAAa,2EAGb,MAAM,GAEJ,IAAI,CAqHhB;AA8GD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,gDAJW,aAAa,gCAEX,IAAI,CAkChB;8BAhW6B,oBAAoB"}