@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
@@ -13,18 +13,33 @@ import {
13
13
  import { Cloth } from "./Cloth.js";
14
14
  import { ClothExclude } from "./ClothExclude.js";
15
15
  import { ClothInstance } from "./ClothInstance.js";
16
- import { cloth_build_children, cloth_build_rows } from "./cloth_build_rows.js";
16
+ import { cloth_build_children, cloth_build_rows, cloth_build_surface, cloth_tree_graph } from "./cloth_build_rows.js";
17
17
 
18
18
  /**
19
19
  * # Seeding a cloth from an entity subtree — §11.1
20
20
  *
21
21
  * One particle per entity in the transform subtree of the entity the
22
- * {@link Cloth} is on, walked breadth-first through
23
- * `TransformAttachmentSystem#findChildrenOf`, stopping at a nested `Cloth` or a
24
- * {@link ClothExclude}. Stretch rows along the parent-child links, a bending
25
- * model along each chain, and the anchor itself as the fixed set — so `d_geo`
26
- * is distance along the chain from the anchor and every derived quantity in
27
- * §3.4 works unchanged.
22
+ * {@link Cloth} is on — that entity included, as node 0 — walked breadth-first
23
+ * through `TransformAttachmentSystem#findChildrenOf`, stopping at a nested
24
+ * `Cloth` or a {@link ClothExclude}. Stretch rows along the parent-child links
25
+ * and a bending model along each chain.
26
+ *
27
+ * **Node 0 is the cloth's frame and nothing holds it.** It is a particle like
28
+ * any other — links run from it, a {@link ClothPin} can hold it — but its
29
+ * entity is the frame, which cloth reads and never writes, so it has no output.
30
+ * A rope hung from its own top is a rope whose top entity pins particle 0:
31
+ *
32
+ * ```js
33
+ * rope_top.add(Cloth.from(ClothDynamics.ROPE));
34
+ * rope_top.add(ClothPin.from({ cloth: rope_top, particles: [0] }));
35
+ * ```
36
+ *
37
+ * **The particles are numbered by the walk**: breadth-first from node 0,
38
+ * siblings in the order `findChildrenOf` gives them, which is ascending entity
39
+ * id. A single chain is therefore numbered by depth whatever the ids; a pin on a
40
+ * branching subtree names a node of a walk that depends on how its siblings'
41
+ * ids were allocated, and `ClothSystem#particle_of` is how code that has the
42
+ * entity asks for the number.
28
43
  *
29
44
  * ## What "bend rows along each chain" turned out to mean
30
45
  *
@@ -158,8 +173,8 @@ export function cloth_seed_subtree(instance, ecd, attachments, dt) {
158
173
 
159
174
  assert.defined(transform, `Transform64 of cloth node ${node} (entity ${entity})`);
160
175
 
161
- // A subtree cloth is a CPU chain from its anchor down; a garment hanging off a GPU-driven
162
- // joint is the rig path's, which evaluates the anchor exactly instead of reading it.
176
+ // A subtree cloth is a CPU chain from its frame down; a garment hanging off a GPU-driven
177
+ // joint is the rig path's, which evaluates its frame exactly instead of reading it.
163
178
  gpu_authority_assert_cpu(ecd, entity, GPUStateAuthorityFlags.Transform64);
164
179
 
165
180
  instance.node_transform[node] = transform;
@@ -168,7 +183,20 @@ export function cloth_seed_subtree(instance, ecd, attachments, dt) {
168
183
  : ecd.getComponent(entity, TransformAttachment);
169
184
  }
170
185
 
186
+ // The root is the frame: read, never written. Its pose in its own frame is
187
+ // the identity, which is what its children's local transforms are written
188
+ // against.
189
+ instance.frame_entity = anchor;
190
+
191
+ instance.node_output = new Uint8Array(node_count).fill(1);
192
+ instance.node_output[0] = 0;
193
+
194
+ instance.boundary_pose = new Float64Array(node_count * 7);
195
+ instance.boundary_pose[6] = 1;
196
+
171
197
  cloth_build_children(instance);
198
+ cloth_tree_graph(instance);
199
+ cloth_build_surface(instance);
172
200
  read_rest_pose(instance, remembered);
173
201
 
174
202
  instance.dynamics_seen.copy(instance.cloth.dynamics);
@@ -177,7 +205,7 @@ export function cloth_seed_subtree(instance, ecd, attachments, dt) {
177
205
  }
178
206
 
179
207
  /**
180
- * Capture the authored pose, and compose it into the anchor's frame.
208
+ * Capture the authored pose, and compose it into the cloth's frame.
181
209
  *
182
210
  * The **local** transforms are the source, not the world ones. That is not a
183
211
  * preference: the write-back takes ownership of `TransformAttachment#transform`
@@ -190,8 +218,9 @@ export function cloth_seed_subtree(instance, ecd, attachments, dt) {
190
218
  * every node that was already in it.
191
219
  *
192
220
  * The composed result is constant — the subtree's authored pose is rigid
193
- * relative to its anchor, so in the anchor's own frame it does not move — which
194
- * is why nothing recomposes it per step.
221
+ * relative to its root, so in the root's own frame it does not move. What moves
222
+ * is the pose hung from the holds (`ClothInstance#animated_position`), which is
223
+ * built from this.
195
224
  *
196
225
  * @param {ClothInstance} instance
197
226
  * @param {Map<number, {position: number[], rotation: number[]}>} remembered
@@ -206,7 +235,7 @@ function read_rest_pose(instance, remembered) {
206
235
  const position = new Float32Array(node_count * 3);
207
236
  const rotation = new Float32Array(node_count * 4);
208
237
 
209
- // The anchor is the origin of the frame it anchors: no offset, no rotation.
238
+ // The root is the origin of the frame it is: no offset, no rotation.
210
239
  local_rotation[3] = 1;
211
240
  rotation[3] = 1;
212
241
 
@@ -279,8 +308,8 @@ function read_rest_pose(instance, remembered) {
279
308
  instance.rest_local_position = local_position;
280
309
  instance.rest_local_rotation = local_rotation;
281
310
 
282
- instance.animated_position = position;
283
- instance.animated_rotation = rotation;
311
+ instance.rest_position = position;
312
+ instance.rest_rotation = rotation;
284
313
  }
285
314
 
286
315
  /**
@@ -60,6 +60,11 @@ export function cloth_write_back(instance: ClothInstance, ecd: EntityComponentDa
60
60
  * One node's pose relative to its parent's, in whatever `Transform64` the
61
61
  * caller holds. Both writers need it and neither owns it.
62
62
  *
63
+ * The parent's pose is the one its **entity** will have: the reconstructed pose
64
+ * when cloth writes the parent too, and when it does not — a subtree's frame, a
65
+ * bone a garment hangs from — the pose that entity's owner gave it this step
66
+ * (`ClothInstance#boundary_pose`), whatever its particle is doing.
67
+ *
63
68
  * @param {Transform64} local written in place, matrix included
64
69
  * @param {ClothInstance} instance
65
70
  * @param {number} node
@@ -1 +1 @@
1
- {"version":3,"file":"cloth_write_back.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_write_back.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH;;;;;;GAMG;AACH,wFAFa,IAAI,CAiDhB;AAyBD;;;;;;;;;GASG;AACH,0FAJW,MAAM,UACN,MAAM,GACJ,IAAI,CA6BhB"}
1
+ {"version":3,"file":"cloth_write_back.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_write_back.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH;;;;;;GAMG;AACH,wFAFa,IAAI,CAwDhB;AAyBD;;;;;;;;;;;;;;GAcG;AACH,0FAJW,MAAM,UACN,MAAM,GACJ,IAAI,CA6DhB"}
@@ -86,28 +86,35 @@ export function cloth_write_back(instance, ecd) {
86
86
  // transforms either way (§4.1) — but a **nested** cloth reads this pose as
87
87
  // its own anchor, and then the two systems hand it different numbers.
88
88
  // `MEASUREMENTS.md` §56.
89
- const ax = instance.anchor_translation[0];
90
- const ay = instance.anchor_translation[1];
91
- const az = instance.anchor_translation[2];
89
+ const ax = instance.frame_translation[0];
90
+ const ay = instance.frame_translation[1];
91
+ const az = instance.frame_translation[2];
92
92
 
93
93
  // The rotations go in as arrays, read where they sit: handed over as seven and eight numbers,
94
94
  // each was boxed into a heap object wherever the call was not inlined.
95
- const anchor_rotation = instance.anchor_rotation;
95
+ const frame_rotation = instance.frame_rotation;
96
96
 
97
97
  const parent = instance.node_parent;
98
98
 
99
- for (let node = 1; node < node_count; node++) {
99
+ const node_output = instance.node_output;
100
+
101
+ for (let node = 0; node < node_count; node++) {
102
+ if (node_output[node] === 0) {
103
+ // the frame itself: read, never written
104
+ continue;
105
+ }
106
+
100
107
  const transform = instance.node_transform[node];
101
108
 
102
109
  const n = node * 3;
103
110
 
104
- v3_quaternion_apply_array(transform, TRANSFORM64_TRANSLATION_OFFSET, blended, n, anchor_rotation, 0);
111
+ v3_quaternion_apply_array(transform, TRANSFORM64_TRANSLATION_OFFSET, blended, n, frame_rotation, 0);
105
112
 
106
113
  transform[TRANSFORM64_TRANSLATION_OFFSET] += ax;
107
114
  transform[TRANSFORM64_TRANSLATION_OFFSET + 1] += ay;
108
115
  transform[TRANSFORM64_TRANSLATION_OFFSET + 2] += az;
109
116
 
110
- quat3_multiply_array(transform, TRANSFORM64_ROTATION_OFFSET, anchor_rotation, 0, reconstructed, node * 4);
117
+ quat3_multiply_array(transform, TRANSFORM64_ROTATION_OFFSET, frame_rotation, 0, reconstructed, node * 4);
111
118
 
112
119
  transform.updateMatrix();
113
120
 
@@ -144,6 +151,11 @@ function write_local(instance, node, parent) {
144
151
  * One node's pose relative to its parent's, in whatever `Transform64` the
145
152
  * caller holds. Both writers need it and neither owns it.
146
153
  *
154
+ * The parent's pose is the one its **entity** will have: the reconstructed pose
155
+ * when cloth writes the parent too, and when it does not — a subtree's frame, a
156
+ * bone a garment hangs from — the pose that entity's owner gave it this step
157
+ * (`ClothInstance#boundary_pose`), whatever its particle is doing.
158
+ *
147
159
  * @param {Transform64} local written in place, matrix included
148
160
  * @param {ClothInstance} instance
149
161
  * @param {number} node
@@ -158,19 +170,51 @@ export function cloth_write_local_pose(local, instance, node, parent) {
158
170
  // offset and the conjugate through scratch: handed over as seven and eight numbers, each was
159
171
  // boxed into a heap object wherever the call was not inlined.
160
172
  const offset = scratch_local_offset;
173
+ const conjugate = scratch_parent_conjugate;
161
174
 
162
- offset[0] = blended[node * 3] - blended[parent * 3];
163
- offset[1] = blended[node * 3 + 1] - blended[parent * 3 + 1];
164
- offset[2] = blended[node * 3 + 2] - blended[parent * 3 + 2];
175
+ if (parent < 0) {
176
+ // A joint hanging straight off the frame — every joint of a generated
177
+ // skin — is written in the frame, which is the identity in itself.
178
+ local[TRANSFORM64_TRANSLATION_OFFSET] = blended[node * 3];
179
+ local[TRANSFORM64_TRANSLATION_OFFSET + 1] = blended[node * 3 + 1];
180
+ local[TRANSFORM64_TRANSLATION_OFFSET + 2] = blended[node * 3 + 2];
165
181
 
166
- v3_quaternion_apply_inverse_array(local, TRANSFORM64_TRANSLATION_OFFSET, offset, 0, rotation, parent * 4);
182
+ local[TRANSFORM64_ROTATION_OFFSET] = rotation[node * 4];
183
+ local[TRANSFORM64_ROTATION_OFFSET + 1] = rotation[node * 4 + 1];
184
+ local[TRANSFORM64_ROTATION_OFFSET + 2] = rotation[node * 4 + 2];
185
+ local[TRANSFORM64_ROTATION_OFFSET + 3] = rotation[node * 4 + 3];
167
186
 
168
- const conjugate = scratch_parent_conjugate;
187
+ local.updateMatrix();
188
+
189
+ return;
190
+ }
191
+
192
+ if (instance.node_output[parent] !== 0) {
193
+ offset[0] = blended[node * 3] - blended[parent * 3];
194
+ offset[1] = blended[node * 3 + 1] - blended[parent * 3 + 1];
195
+ offset[2] = blended[node * 3 + 2] - blended[parent * 3 + 2];
196
+
197
+ v3_quaternion_apply_inverse_array(local, TRANSFORM64_TRANSLATION_OFFSET, offset, 0, rotation, parent * 4);
169
198
 
170
- conjugate[0] = -rotation[parent * 4];
171
- conjugate[1] = -rotation[parent * 4 + 1];
172
- conjugate[2] = -rotation[parent * 4 + 2];
173
- conjugate[3] = rotation[parent * 4 + 3];
199
+ conjugate[0] = -rotation[parent * 4];
200
+ conjugate[1] = -rotation[parent * 4 + 1];
201
+ conjugate[2] = -rotation[parent * 4 + 2];
202
+ conjugate[3] = rotation[parent * 4 + 3];
203
+ } else {
204
+ const boundary = instance.boundary_pose;
205
+ const b = parent * 7;
206
+
207
+ offset[0] = blended[node * 3] - boundary[b];
208
+ offset[1] = blended[node * 3 + 1] - boundary[b + 1];
209
+ offset[2] = blended[node * 3 + 2] - boundary[b + 2];
210
+
211
+ v3_quaternion_apply_inverse_array(local, TRANSFORM64_TRANSLATION_OFFSET, offset, 0, boundary, b + 3);
212
+
213
+ conjugate[0] = -boundary[b + 3];
214
+ conjugate[1] = -boundary[b + 4];
215
+ conjugate[2] = -boundary[b + 5];
216
+ conjugate[3] = boundary[b + 6];
217
+ }
174
218
 
175
219
  quat3_multiply_array(local, TRANSFORM64_ROTATION_OFFSET, conjugate, 0, rotation, node * 4);
176
220
 
@@ -1 +1 @@
1
- {"version":3,"file":"cloth_write_back_rig.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_write_back_rig.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;GAKG;AACH,iGAqBC"}
1
+ {"version":3,"file":"cloth_write_back_rig.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/cloth_write_back_rig.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;GAKG;AACH,iGA4BC"}
@@ -1,58 +1,65 @@
1
- import { TRANSFORM_ATTACHMENT_EVENT_CHANGE } from "../../../ecs/transform-attachment/TRANSFORM_ATTACHMENT_EVENT_CHANGE.js";
2
- import { cloth_reconstruct_pose } from "./cloth_reconstruct_pose.js";
3
- import { cloth_write_local_pose } from "./cloth_write_back.js";
4
-
5
- /**
6
- * # Putting the answer back onto a skinned model's joints — §11.2
7
- *
8
- * The same reconstruction the entity path uses, written onto the joint entities' offsets.
9
- * **Cloth moves joints; it does not produce vertices** — the mapping from a simulated joint to a
10
- * render vertex already exists in this engine and it is the skin, so the existing skinning pass
11
- * does the rest, including bounds refresh and BLAS refit that a bespoke vertex-deformation path
12
- * would have to reimplement.
13
- *
14
- * ## The offset is the output
15
- *
16
- * A joint's `TransformAttachment` offset is its own truth and the handle §11.2 names: it is what
17
- * the joint's row holds, and the GPU composes the world from it under the anchor's animated
18
- * row. Writing it is announced on the joint, which is what carries it to the row — the model
19
- * marks the row on that announcement — and what lets the attachment system recompose the CPU's
20
- * copy of the world below it. That copy is composed under the anchor as the CPU knows it, which
21
- * for a GPU-driven anchor is its rest pose: what the simulation may read about a cape joint is
22
- * its offset, or an exact evaluation, never that composed world.
23
- *
24
- * Nothing above the anchor is touched: the anchor is the character's, animated by its clips,
25
- * and this pass hangs a cape from it.
26
- *
27
- * @author Alex Goldring
28
- * @copyright Company Named Limited (c) 2026
29
- */
30
-
31
- /**
32
- * Write the reconstructed pose onto the rig's joints.
33
- *
34
- * @param {ClothInstance} instance
35
- * @param {EntityComponentDataset} ecd
36
- */
37
- export function cloth_write_back_rig(instance, ecd) {
38
- cloth_reconstruct_pose(instance);
39
-
40
- const node_count = instance.node_count;
41
-
42
- const parent = instance.node_parent;
43
- const node_joint = instance.node_joint;
44
- const node_attachment = instance.node_attachment;
45
-
46
- for (let node = 1; node < node_count; node++) {
47
- const joint = node_joint[node];
48
- const attachment = node_attachment[node];
49
-
50
- if (attachment === undefined || attachment === null || !ecd.entityExists(joint)) {
51
- continue;
52
- }
53
-
54
- cloth_write_local_pose(attachment.transform, instance, node, parent[node]);
55
-
56
- ecd.sendEvent(joint, TRANSFORM_ATTACHMENT_EVENT_CHANGE);
57
- }
58
- }
1
+ import { TRANSFORM_ATTACHMENT_EVENT_CHANGE } from "../../../ecs/transform-attachment/TRANSFORM_ATTACHMENT_EVENT_CHANGE.js";
2
+ import { cloth_reconstruct_pose } from "./cloth_reconstruct_pose.js";
3
+ import { cloth_write_local_pose } from "./cloth_write_back.js";
4
+
5
+ /**
6
+ * # Putting the answer back onto a skinned model's joints — §11.2
7
+ *
8
+ * The same reconstruction the entity path uses, written onto the joint entities' offsets.
9
+ * **Cloth moves joints; it does not produce vertices** — the mapping from a simulated joint to a
10
+ * render vertex already exists in this engine and it is the skin, so the existing skinning pass
11
+ * does the rest, including bounds refresh and BLAS refit that a bespoke vertex-deformation path
12
+ * would have to reimplement.
13
+ *
14
+ * ## The offset is the output
15
+ *
16
+ * A joint's `TransformAttachment` offset is its own truth and the handle §11.2 names: it is what
17
+ * the joint's row holds, and the GPU composes the world from it under the anchor's animated
18
+ * row. Writing it is announced on the joint, which is what carries it to the row — the model
19
+ * marks the row on that announcement — and what lets the attachment system recompose the CPU's
20
+ * copy of the world below it. That copy is composed under the anchor as the CPU knows it, which
21
+ * for a GPU-driven anchor is its rest pose: what the simulation may read about a cape joint is
22
+ * its offset, or an exact evaluation, never that composed world.
23
+ *
24
+ * Nothing above the anchor is touched: the anchor is the character's, animated by its clips,
25
+ * and this pass hangs a cape from it.
26
+ *
27
+ * @author Alex Goldring
28
+ * @copyright Company Named Limited (c) 2026
29
+ */
30
+
31
+ /**
32
+ * Write the reconstructed pose onto the rig's joints.
33
+ *
34
+ * @param {ClothInstance} instance
35
+ * @param {EntityComponentDataset} ecd
36
+ */
37
+ export function cloth_write_back_rig(instance, ecd) {
38
+ cloth_reconstruct_pose(instance);
39
+
40
+ const node_count = instance.node_count;
41
+
42
+ const parent = instance.node_parent;
43
+ const node_joint = instance.node_joint;
44
+ const node_attachment = instance.node_attachment;
45
+
46
+ const node_output = instance.node_output;
47
+
48
+ for (let node = 0; node < node_count; node++) {
49
+ if (node_output[node] === 0) {
50
+ // a bone the garment hangs from: the character's, not cloth's
51
+ continue;
52
+ }
53
+
54
+ const joint = node_joint[node];
55
+ const attachment = node_attachment[node];
56
+
57
+ if (attachment === undefined || attachment === null || !ecd.entityExists(joint)) {
58
+ continue;
59
+ }
60
+
61
+ cloth_write_local_pose(attachment.transform, instance, node, parent[node]);
62
+
63
+ ecd.sendEvent(joint, TRANSFORM_ATTACHMENT_EVENT_CHANGE);
64
+ }
65
+ }
@@ -173,7 +173,7 @@ function step_once() {
173
173
 
174
174
  const started = performance.now();
175
175
 
176
- contact_rows = cloth_contact_find(state, colliders.table, colliders.keys, colliders.count, FIXED_STEP);
176
+ contact_rows = cloth_contact_find(state, colliders.table, colliders.keys, colliders.count, FIXED_STEP, 0);
177
177
 
178
178
  cloth_step(
179
179
  state, FIXED_STEP, 0, -9.81, 0,
@@ -1 +1 @@
1
- {"version":3,"file":"garment_build.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/playground/garment_build.js"],"names":[],"mappings":"AA8FA;;;GAGG;AACH,6FAHW,MAAM,GACJ,QAAQ,YAAY,CAAC,CA6EjC;AAiKD;;;;;;GAMG;AACH,8CAHW,MAAM,GACJ,IAAI,CAyBhB;AAnVD;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;GAYG;AAEH;;;;;;;IAqCE;;SAjDY,sBAAsB;WACtB,WAAW;eACX,mBAAmB;YACnB,MAAM;;;;;;;;;UAGN,QAAQ;;;;WACR,QAAQ;;;;;UAER,MAAM,EAAE,EAAE;;uCA7Ce,wCAAwC;4BAcnD,uBAAuB;oCAHf,+BAA+B"}
1
+ {"version":3,"file":"garment_build.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/playground/garment_build.js"],"names":[],"mappings":"AAgGA;;;GAGG;AACH,6FAHW,MAAM,GACJ,QAAQ,YAAY,CAAC,CAuFjC;AAiKD;;;;;;GAMG;AACH,8CAHW,MAAM,GACJ,IAAI,CAyBhB;AA7VD;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;GAYG;AAEH;;;;;;;IAqCE;;SAjDY,sBAAsB;WACtB,WAAW;eACX,mBAAmB;YACnB,MAAM;;;;;;;;;UAGN,QAAQ;;;;WACR,QAAQ;;;;;UAER,MAAM,EAAE,EAAE;;uCA/Ce,wCAAwC;4BAgBnD,uBAAuB;oCAJf,+BAA+B"}
@@ -15,10 +15,12 @@ import { Transform64 } from "../../../ecs/transform/Transform64.js";
15
15
  import { Collider } from "../../ecs/Collider.js";
16
16
  import { cloth_proxy_from_joints } from "../build/cloth_proxy_from_joints.js";
17
17
  import { Cloth } from "../ecs/Cloth.js";
18
+ import { ClothPin } from "../ecs/ClothPin.js";
18
19
  import { ClothCollider } from "../ecs/ClothCollider.js";
19
20
  import { ClothColliderSystem } from "../ecs/ClothColliderSystem.js";
20
21
  import { ClothFlags } from "../ecs/ClothFlags.js";
21
22
  import { ClothRig } from "../ecs/ClothRig.js";
23
+ import { MeshSkin } from "../../../graphics/ecs/mesh-v2/MeshSkin.js";
22
24
  import { ClothSystem } from "../ecs/ClothSystem.js";
23
25
  import { ClothDynamicsFlags } from "../ecs/ClothDynamicsFlags.js";
24
26
  import { CLOTH_DYNAMICS_BY_NAME } from "../ecs/cloth_dynamics_library.js";
@@ -118,7 +120,7 @@ export async function build_garment({ preset, dynamics, links, spacing, collide,
118
120
  const entry = GARMENT_PRESETS.find(p => p.id === preset) ?? GARMENT_PRESETS[0];
119
121
 
120
122
  const skeleton = build_skeleton(ecd, entry, links, spacing);
121
- const { proxy, error } = cloth_proxy_from_joints(skeleton.prefab, skeleton.skin, skeleton.garment_names, {
123
+ const { proxy, groups, error } = cloth_proxy_from_joints(skeleton.prefab, skeleton.skin, skeleton.garment_names, {
122
124
  name: entry.label
123
125
  });
124
126
 
@@ -132,8 +134,14 @@ export async function build_garment({ preset, dynamics, links, spacing, collide,
132
134
 
133
135
  transform.updateMatrix();
134
136
 
137
+ // the garment's skin, on an entity of its own: what the rig drives
138
+ const joints = Int32Array.from(skeleton.skin.joints, joint => skeleton.instance.entities[joint]);
139
+ const skinned = ecd.createEntity();
140
+
141
+ ecd.addComponentToEntity(skinned, MeshSkin.from(joints, skeleton.skin.inverse_bind_matrices));
142
+
135
143
  ecd.addComponentToEntity(entity, transform);
136
- ecd.addComponentToEntity(entity, ClothRig.from(proxy));
144
+ ecd.addComponentToEntity(entity, ClothRig.from(proxy, skinned));
137
145
 
138
146
  // The library entry is frozen and shared, so a page that wants to switch
139
147
  // one flag owns a copy — which is the whole of what `.clone()` is for.
@@ -145,9 +153,13 @@ export async function build_garment({ preset, dynamics, links, spacing, collide,
145
153
 
146
154
  ecd.addComponentToEntity(entity, Cloth.from(fabric, { flags: ClothFlags.NeverSleep }));
147
155
 
148
- // the one method `ClothSystem` calls on a model provider: the instance whose skins address the
149
- // joints as entities
150
- cloth.models = { instance_of: () => skeleton.instance };
156
+ // held at the bones the garment hangs from, as the build said
157
+ for (const group of groups) {
158
+ ecd.addComponentToEntity(
159
+ joints[group.joint],
160
+ ClothPin.from({ cloth: entity, particles: group.particles })
161
+ );
162
+ }
151
163
 
152
164
  if (collide) {
153
165
  add_body_colliders(ecd, skeleton);
@@ -410,7 +410,7 @@ function refresh_readout() {
410
410
 
411
411
  const state = instance.state;
412
412
 
413
- element('r_joints').textContent = String(scene.proxy.joint_count);
413
+ element('r_joints').textContent = String(scene.proxy.particle_count);
414
414
  element('r_particles').textContent = String(state.particle_count);
415
415
  element('r_rows').textContent = `${state.stretch_count} / ${state.leash_count}`;
416
416
  element('r_contacts').textContent = String(instance.contact_count);
@@ -1 +1 @@
1
- {"version":3,"file":"rig_build.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/playground/rig_build.js"],"names":[],"mappings":"AAmFA;;;;;;;;;;;;;GAaG;AACH;IAN2B,GAAG,EAAnB,MAAM;IACU,QAAQ,EAAxB,MAAM;IACU,KAAK,EAArB,MAAM;IACU,OAAO,EAAvB,MAAM;IACJ,QAAQ,aAAa,CAAC,CAyClC;AA1HD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;;;GAQG;AAEH;;;GAGG;AACH,yBAFU,MAAM;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAAC,CAiC3E;;QA3CY,aAAa;SACb,sBAAsB;WACtB,WAAW;;;;YACX,MAAM,EAAE;;;;YACR,MAAM,EAAE,EAAE;;;;cACV,MAAM,EAAE;;8BA1CQ,+BAA+B;uCADtB,wCAAwC;4BAWnD,uBAAuB"}
1
+ {"version":3,"file":"rig_build.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/playground/rig_build.js"],"names":[],"mappings":"AAoFA;;;;;;;;;;;;;GAaG;AACH;IAN2B,GAAG,EAAnB,MAAM;IACU,QAAQ,EAAxB,MAAM;IACU,KAAK,EAArB,MAAM;IACU,OAAO,EAAvB,MAAM;IACJ,QAAQ,aAAa,CAAC,CAyClC;AA1HD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;;;GAQG;AAEH;;;GAGG;AACH,yBAFU,MAAM;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAAC,CAiC3E;;QA3CY,aAAa;SACb,sBAAsB;WACtB,WAAW;;;;YACX,MAAM,EAAE;;;;YACR,MAAM,EAAE,EAAE;;;;cACV,MAAM,EAAE;;8BA3CQ,+BAA+B;uCADtB,wCAAwC;4BAYnD,uBAAuB"}