@woosh/meep-engine 3.24.0 → 3.26.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 (349) hide show
  1. package/package.json +1 -1
  2. package/src/core/geom/3d/shape/HeightMapShape3D.d.ts +59 -0
  3. package/src/core/geom/3d/shape/HeightMapShape3D.d.ts.map +1 -1
  4. package/src/core/geom/3d/shape/HeightMapShape3D.js +285 -0
  5. package/src/core/geom/3d/shape/PosedShape3D.d.ts.map +1 -1
  6. package/src/core/geom/3d/shape/PosedShape3D.js +57 -0
  7. package/src/core/geom/3d/shape/TransformedShape3D.d.ts.map +1 -1
  8. package/src/core/geom/3d/shape/TransformedShape3D.js +102 -0
  9. package/src/core/geom/3d/shape/UnionShape3D.d.ts.map +1 -1
  10. package/src/core/geom/3d/shape/UnionShape3D.js +64 -0
  11. package/src/engine/graphics3/PickingSystem.d.ts +3 -3
  12. package/src/engine/graphics3/PickingSystem.d.ts.map +1 -1
  13. package/src/engine/graphics3/PickingSystem.js +52 -55
  14. package/src/engine/graphics3/shader_picking_gather.d.ts +40 -0
  15. package/src/engine/graphics3/shader_picking_gather.d.ts.map +1 -0
  16. package/src/engine/graphics3/shader_picking_gather.js +120 -0
  17. package/src/engine/physics/cloth/MEASUREMENTS.md +1632 -0
  18. package/src/engine/physics/cloth/PLAN.md +738 -95
  19. package/src/engine/physics/cloth/collider/ClothColliderIndex.d.ts +84 -17
  20. package/src/engine/physics/cloth/collider/ClothColliderIndex.d.ts.map +1 -1
  21. package/src/engine/physics/cloth/collider/ClothColliderIndex.js +451 -42
  22. package/src/engine/physics/cloth/ecs/ClothColliderSerializationAdapter.d.ts +52 -0
  23. package/src/engine/physics/cloth/ecs/ClothColliderSerializationAdapter.d.ts.map +1 -0
  24. package/src/engine/physics/cloth/ecs/ClothColliderSerializationAdapter.js +70 -0
  25. package/src/engine/physics/cloth/ecs/ClothDynamics.d.ts +12 -3
  26. package/src/engine/physics/cloth/ecs/ClothDynamics.d.ts.map +1 -1
  27. package/src/engine/physics/cloth/ecs/ClothDynamics.js +340 -331
  28. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts +101 -29
  29. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts.map +1 -1
  30. package/src/engine/physics/cloth/ecs/ClothInstance.js +110 -31
  31. package/src/engine/physics/cloth/ecs/ClothSerializationAdapter.d.ts +84 -0
  32. package/src/engine/physics/cloth/ecs/ClothSerializationAdapter.d.ts.map +1 -0
  33. package/src/engine/physics/cloth/ecs/ClothSerializationAdapter.js +141 -0
  34. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts +71 -81
  35. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts.map +1 -1
  36. package/src/engine/physics/cloth/ecs/ClothSystem.js +135 -856
  37. package/src/engine/physics/cloth/ecs/ClothWorkerCore.d.ts +48 -0
  38. package/src/engine/physics/cloth/ecs/ClothWorkerCore.d.ts.map +1 -0
  39. package/src/engine/physics/cloth/ecs/ClothWorkerCore.js +107 -0
  40. package/src/engine/physics/cloth/ecs/ClothWorld.d.ts +323 -0
  41. package/src/engine/physics/cloth/ecs/ClothWorld.d.ts.map +1 -0
  42. package/src/engine/physics/cloth/ecs/ClothWorld.js +1248 -0
  43. package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts +192 -0
  44. package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts.map +1 -0
  45. package/src/engine/physics/cloth/ecs/WorkerClothSystem.js +578 -0
  46. package/src/engine/physics/cloth/ecs/cloth.worker.d.ts +2 -0
  47. package/src/engine/physics/cloth/ecs/cloth.worker.d.ts.map +1 -0
  48. package/src/engine/physics/cloth/ecs/cloth.worker.js +12 -0
  49. package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts.map +1 -1
  50. package/src/engine/physics/cloth/ecs/cloth_build_rows.js +2 -1
  51. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts +85 -3
  52. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts.map +1 -1
  53. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.js +366 -271
  54. package/src/engine/physics/cloth/ecs/cloth_gather_colliders.d.ts +95 -12
  55. package/src/engine/physics/cloth/ecs/cloth_gather_colliders.d.ts.map +1 -1
  56. package/src/engine/physics/cloth/ecs/cloth_gather_colliders.js +170 -27
  57. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts +19 -0
  58. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts.map +1 -1
  59. package/src/engine/physics/cloth/ecs/cloth_seed_rig.js +249 -201
  60. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts +21 -0
  61. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts.map +1 -1
  62. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.js +62 -1
  63. package/src/engine/physics/cloth/ecs/cloth_worker_protocol.d.ts +29 -0
  64. package/src/engine/physics/cloth/ecs/cloth_worker_protocol.d.ts.map +1 -0
  65. package/src/engine/physics/cloth/ecs/cloth_worker_protocol.js +78 -0
  66. package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts.map +1 -1
  67. package/src/engine/physics/cloth/ecs/cloth_write_back.js +18 -10
  68. package/src/engine/physics/cloth/ecs/makeClothWorker.d.ts +17 -0
  69. package/src/engine/physics/cloth/ecs/makeClothWorker.d.ts.map +1 -0
  70. package/src/engine/physics/cloth/ecs/makeClothWorker.js +18 -0
  71. package/src/engine/physics/cloth/playground/README.md +73 -2
  72. package/src/engine/physics/cloth/playground/collide_main.js +1 -1
  73. package/src/engine/physics/cloth/playground/wind.html +166 -0
  74. package/src/engine/physics/cloth/playground/wind_build.d.ts +81 -0
  75. package/src/engine/physics/cloth/playground/wind_build.d.ts.map +1 -0
  76. package/src/engine/physics/cloth/playground/wind_build.js +141 -0
  77. package/src/engine/physics/cloth/playground/wind_main.d.ts +2 -0
  78. package/src/engine/physics/cloth/playground/wind_main.d.ts.map +1 -0
  79. package/src/engine/physics/cloth/playground/wind_main.js +681 -0
  80. package/src/engine/physics/cloth/solver/ClothState.d.ts +134 -79
  81. package/src/engine/physics/cloth/solver/ClothState.d.ts.map +1 -1
  82. package/src/engine/physics/cloth/solver/ClothState.js +273 -12
  83. package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts +29 -8
  84. package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts.map +1 -1
  85. package/src/engine/physics/cloth/solver/cloth_contact_find.js +37 -9
  86. package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts +45 -2
  87. package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts.map +1 -1
  88. package/src/engine/physics/cloth/solver/cloth_solver_constants.js +46 -2
  89. package/src/engine/physics/cloth/solver/cloth_step.d.ts +21 -2
  90. package/src/engine/physics/cloth/solver/cloth_step.d.ts.map +1 -1
  91. package/src/engine/physics/cloth/solver/cloth_step.js +173 -4
  92. package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts +40 -0
  93. package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts.map +1 -0
  94. package/src/engine/physics/cloth/solver/cloth_step_instance.js +284 -0
  95. package/src/engine/physics/cloth/solver/cloth_wind_accelerate.d.ts +107 -0
  96. package/src/engine/physics/cloth/solver/cloth_wind_accelerate.d.ts.map +1 -0
  97. package/src/engine/physics/cloth/solver/cloth_wind_accelerate.js +263 -0
  98. package/src/engine/physics/cloth/solver/constraint/cloth_backstop_row.d.ts +9 -2
  99. package/src/engine/physics/cloth/solver/constraint/cloth_backstop_row.d.ts.map +1 -1
  100. package/src/engine/physics/cloth/solver/constraint/cloth_backstop_row.js +9 -2
  101. package/src/engine/physics/cloth/wind/AbstractClothWind.d.ts +102 -0
  102. package/src/engine/physics/cloth/wind/AbstractClothWind.d.ts.map +1 -0
  103. package/src/engine/physics/cloth/wind/AbstractClothWind.js +114 -0
  104. package/src/engine/physics/cloth/wind/ClothAmbientWind.d.ts +87 -0
  105. package/src/engine/physics/cloth/wind/ClothAmbientWind.d.ts.map +1 -0
  106. package/src/engine/physics/cloth/wind/ClothAmbientWind.js +185 -0
  107. package/src/engine/physics/cloth/wind/ClothFluidWind.d.ts +79 -0
  108. package/src/engine/physics/cloth/wind/ClothFluidWind.d.ts.map +1 -0
  109. package/src/engine/physics/cloth/wind/ClothFluidWind.js +213 -0
  110. package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts +106 -0
  111. package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts.map +1 -0
  112. package/src/engine/physics/cloth/wind/cloth_sample_air.js +297 -0
  113. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  114. package/src/shade/device/mock/texture_copy.d.ts.map +1 -1
  115. package/src/shade/device/mock/texture_copy.js +28 -0
  116. package/src/shade/playground/vgeo_runtime/README.md +94 -0
  117. package/src/shade/playground/vgeo_runtime/index.html +62 -0
  118. package/src/shade/playground/vgeo_runtime/main.d.ts +2 -0
  119. package/src/shade/playground/vgeo_runtime/main.d.ts.map +1 -0
  120. package/src/shade/playground/vgeo_runtime/main.js +399 -0
  121. package/src/shade/playground/vgeo_viewer/sample_asset.js +1 -1
  122. package/src/shade/renderer/camera/Camera.d.ts +14 -0
  123. package/src/shade/renderer/camera/Camera.d.ts.map +1 -1
  124. package/src/shade/renderer/camera/Camera.js +7 -1
  125. package/src/shade/renderer/geometry/GEOMETRY_METADATA_STRUCT.d.ts.map +1 -1
  126. package/src/shade/renderer/geometry/GEOMETRY_METADATA_STRUCT.js +16 -1
  127. package/src/shade/renderer/geometry/GPUGeometryManager.d.ts.map +1 -1
  128. package/src/shade/renderer/geometry/GPUGeometryManager.js +29 -9
  129. package/src/shade/renderer/geometry/GPUGeometryMetadata.d.ts +10 -0
  130. package/src/shade/renderer/geometry/GPUGeometryMetadata.d.ts.map +1 -1
  131. package/src/shade/renderer/geometry/GPUGeometryMetadata.js +13 -0
  132. package/src/shade/renderer/geometry/virtual/VGEO_FORMAT.md +46 -18
  133. package/src/shade/renderer/geometry/virtual/VIRTUAL_GEOMETRY_DESIGN.md +70 -22
  134. package/src/shade/renderer/geometry/virtual/VIRTUAL_GEOMETRY_PLAN.md +97 -19
  135. package/src/shade/renderer/geometry/virtual/build/VGeoBuildOptions.d.ts +12 -2
  136. package/src/shade/renderer/geometry/virtual/build/VGeoBuildOptions.d.ts.map +1 -1
  137. package/src/shade/renderer/geometry/virtual/build/VGeoBuildOptions.js +14 -3
  138. package/src/shade/renderer/geometry/virtual/build/vgeo_assemble_pages.d.ts +2 -2
  139. package/src/shade/renderer/geometry/virtual/build/vgeo_assemble_pages.d.ts.map +1 -1
  140. package/src/shade/renderer/geometry/virtual/build/vgeo_assemble_pages.js +124 -6
  141. package/src/shade/renderer/geometry/virtual/build/vgeo_page_node_count.d.ts +22 -0
  142. package/src/shade/renderer/geometry/virtual/build/vgeo_page_node_count.d.ts.map +1 -0
  143. package/src/shade/renderer/geometry/virtual/build/vgeo_page_node_count.js +53 -0
  144. package/src/shade/renderer/geometry/virtual/format/VGeoWriteOptions.d.ts +8 -1
  145. package/src/shade/renderer/geometry/virtual/format/VGeoWriteOptions.d.ts.map +1 -1
  146. package/src/shade/renderer/geometry/virtual/format/VGeoWriteOptions.js +8 -1
  147. package/src/shade/renderer/geometry/virtual/format/header/VGEO_FEATURE_IGNORABLE_BOUNDED_PAGES.d.ts +16 -0
  148. package/src/shade/renderer/geometry/virtual/format/header/VGEO_FEATURE_IGNORABLE_BOUNDED_PAGES.d.ts.map +1 -0
  149. package/src/shade/renderer/geometry/virtual/format/header/VGEO_FEATURE_IGNORABLE_BOUNDED_PAGES.js +15 -0
  150. package/src/shade/renderer/geometry/virtual/format/page/VGEO_DEFAULT_PAGE_SIZE.d.ts +54 -0
  151. package/src/shade/renderer/geometry/virtual/format/page/VGEO_DEFAULT_PAGE_SIZE.d.ts.map +1 -0
  152. package/src/shade/renderer/geometry/virtual/format/page/VGEO_DEFAULT_PAGE_SIZE.js +53 -0
  153. package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerHeader.d.ts +13 -2
  154. package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerHeader.d.ts.map +1 -1
  155. package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerHeader.js +14 -2
  156. package/src/shade/renderer/geometry/virtual/format/read/VGeoPage.d.ts +100 -0
  157. package/src/shade/renderer/geometry/virtual/format/read/VGeoPage.d.ts.map +1 -1
  158. package/src/shade/renderer/geometry/virtual/format/read/VGeoPage.js +113 -0
  159. package/src/shade/renderer/geometry/virtual/format/read/vgeo_read_header.d.ts.map +1 -1
  160. package/src/shade/renderer/geometry/virtual/format/read/vgeo_read_header.js +5 -0
  161. package/src/shade/renderer/geometry/virtual/format/read/vgeo_read_page.d.ts.map +1 -1
  162. package/src/shade/renderer/geometry/virtual/format/read/vgeo_read_page.js +108 -0
  163. package/src/shade/renderer/geometry/virtual/format/vgeo_validate_container.d.ts.map +1 -1
  164. package/src/shade/renderer/geometry/virtual/format/vgeo_validate_container.js +23 -0
  165. package/src/shade/renderer/geometry/virtual/format/vgeo_write_container.d.ts.map +1 -1
  166. package/src/shade/renderer/geometry/virtual/format/vgeo_write_container.js +40 -0
  167. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryPool.d.ts +228 -0
  168. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryPool.d.ts.map +1 -0
  169. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryPool.js +932 -0
  170. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts +176 -0
  171. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts.map +1 -0
  172. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.js +425 -0
  173. package/src/shade/renderer/geometry/virtual/runtime/REVIEW_LEDGER.md +241 -0
  174. package/src/shade/renderer/geometry/virtual/runtime/RUNTIME_PLAN.md +574 -0
  175. package/src/shade/renderer/geometry/virtual/runtime/VGeoFeedbackLoop.d.ts +120 -0
  176. package/src/shade/renderer/geometry/virtual/runtime/VGeoFeedbackLoop.d.ts.map +1 -0
  177. package/src/shade/renderer/geometry/virtual/runtime/VGeoFeedbackLoop.js +674 -0
  178. package/src/shade/renderer/geometry/virtual/runtime/VGeoRuntimeTables.d.ts +287 -0
  179. package/src/shade/renderer/geometry/virtual/runtime/VGeoRuntimeTables.d.ts.map +1 -0
  180. package/src/shade/renderer/geometry/virtual/runtime/VGeoRuntimeTables.js +976 -0
  181. package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.d.ts +42 -0
  182. package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.d.ts.map +1 -0
  183. package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.js +96 -0
  184. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_FLAG_CULL.d.ts +16 -0
  185. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_FLAG_CULL.d.ts.map +1 -0
  186. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_FLAG_CULL.js +15 -0
  187. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_PARAMS_STRUCT.d.ts +19 -0
  188. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_PARAMS_STRUCT.d.ts.map +1 -0
  189. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_PARAMS_STRUCT.js +83 -0
  190. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_WORKGROUP_SIZE.d.ts +9 -0
  191. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_WORKGROUP_SIZE.d.ts.map +1 -0
  192. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_WORKGROUP_SIZE.js +8 -0
  193. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_access.d.ts +19 -0
  194. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_access.d.ts.map +1 -0
  195. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_access.js +160 -0
  196. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_collect.d.ts +3 -0
  197. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_collect.d.ts.map +1 -0
  198. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_collect.js +255 -0
  199. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_queue_prepare.d.ts +3 -0
  200. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_queue_prepare.d.ts.map +1 -0
  201. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_queue_prepare.js +80 -0
  202. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_seed.d.ts +3 -0
  203. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_seed.d.ts.map +1 -0
  204. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_seed.js +144 -0
  205. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_traverse.d.ts +3 -0
  206. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_traverse.d.ts.map +1 -0
  207. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_traverse.js +530 -0
  208. package/src/shade/renderer/geometry/virtual/runtime/cut/vgeo_cut_feedback_layout.d.ts +39 -0
  209. package/src/shade/renderer/geometry/virtual/runtime/cut/vgeo_cut_feedback_layout.d.ts.map +1 -0
  210. package/src/shade/renderer/geometry/virtual/runtime/cut/vgeo_cut_feedback_layout.js +54 -0
  211. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_if_enabled.d.ts +41 -0
  212. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_if_enabled.d.ts.map +1 -0
  213. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_if_enabled.js +56 -0
  214. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.d.ts +49 -0
  215. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.d.ts.map +1 -0
  216. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.js +328 -0
  217. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_CLUSTER_ROW_OFFSET.d.ts +10 -0
  218. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_CLUSTER_ROW_OFFSET.d.ts.map +1 -0
  219. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_CLUSTER_ROW_OFFSET.js +51 -0
  220. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_CLUSTER_ROW_WORDS.d.ts +13 -0
  221. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_CLUSTER_ROW_WORDS.d.ts.map +1 -0
  222. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_CLUSTER_ROW_WORDS.js +12 -0
  223. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_CUT_STAT.d.ts +17 -0
  224. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_CUT_STAT.d.ts.map +1 -0
  225. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_CUT_STAT.js +99 -0
  226. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_CUT_STAT_COUNT.d.ts +9 -0
  227. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_CUT_STAT_COUNT.d.ts.map +1 -0
  228. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_CUT_STAT_COUNT.js +8 -0
  229. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_FEEDBACK_OFFSET.d.ts +7 -0
  230. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_FEEDBACK_OFFSET.d.ts.map +1 -0
  231. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_FEEDBACK_OFFSET.js +27 -0
  232. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GEOMETRY_ROW_NONE.d.ts +14 -0
  233. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GEOMETRY_ROW_NONE.d.ts.map +1 -0
  234. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GEOMETRY_ROW_NONE.js +13 -0
  235. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GEOMETRY_ROW_OFFSET.d.ts +7 -0
  236. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GEOMETRY_ROW_OFFSET.d.ts.map +1 -0
  237. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GEOMETRY_ROW_OFFSET.js +35 -0
  238. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GEOMETRY_ROW_WORDS.d.ts +9 -0
  239. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GEOMETRY_ROW_WORDS.d.ts.map +1 -0
  240. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GEOMETRY_ROW_WORDS.js +8 -0
  241. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GROUP_FLAG_SELECTABLE.d.ts +15 -0
  242. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GROUP_FLAG_SELECTABLE.d.ts.map +1 -0
  243. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GROUP_FLAG_SELECTABLE.js +14 -0
  244. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GROUP_ROW_OFFSET.d.ts +7 -0
  245. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GROUP_ROW_OFFSET.d.ts.map +1 -0
  246. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GROUP_ROW_OFFSET.js +36 -0
  247. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GROUP_ROW_WORDS.d.ts +10 -0
  248. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GROUP_ROW_WORDS.d.ts.map +1 -0
  249. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_GROUP_ROW_WORDS.js +9 -0
  250. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_OFFSET.d.ts +11 -0
  251. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_OFFSET.d.ts.map +1 -0
  252. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_OFFSET.js +54 -0
  253. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_WORDS.d.ts +9 -0
  254. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_WORDS.d.ts.map +1 -0
  255. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_WORDS.js +8 -0
  256. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_NODE_ROW_LEAF_BIT.d.ts +11 -0
  257. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_NODE_ROW_LEAF_BIT.d.ts.map +1 -0
  258. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_NODE_ROW_LEAF_BIT.js +10 -0
  259. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_NODE_ROW_OFFSET.d.ts +7 -0
  260. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_NODE_ROW_OFFSET.d.ts.map +1 -0
  261. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_NODE_ROW_OFFSET.js +30 -0
  262. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_NODE_ROW_WORDS.d.ts +9 -0
  263. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_NODE_ROW_WORDS.d.ts.map +1 -0
  264. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_NODE_ROW_WORDS.js +8 -0
  265. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_NO_CHILD_PAGE.d.ts +13 -0
  266. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_NO_CHILD_PAGE.d.ts.map +1 -0
  267. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_NO_CHILD_PAGE.js +12 -0
  268. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_PAGE_ROW_NONE.d.ts +14 -0
  269. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_PAGE_ROW_NONE.d.ts.map +1 -0
  270. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_PAGE_ROW_NONE.js +13 -0
  271. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_PAGE_ROW_OFFSET.d.ts +11 -0
  272. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_PAGE_ROW_OFFSET.d.ts.map +1 -0
  273. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_PAGE_ROW_OFFSET.js +61 -0
  274. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_PAGE_ROW_WORDS.d.ts +9 -0
  275. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_PAGE_ROW_WORDS.d.ts.map +1 -0
  276. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_PAGE_ROW_WORDS.js +8 -0
  277. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_QUEUE_ITEM_WORDS.d.ts +13 -0
  278. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_QUEUE_ITEM_WORDS.d.ts.map +1 -0
  279. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_QUEUE_ITEM_WORDS.js +12 -0
  280. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_QUEUE_TARGET_GROUP_BIT.d.ts +9 -0
  281. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_QUEUE_TARGET_GROUP_BIT.d.ts.map +1 -0
  282. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_QUEUE_TARGET_GROUP_BIT.js +8 -0
  283. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_WANT_WORDS.d.ts +20 -0
  284. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_WANT_WORDS.d.ts.map +1 -0
  285. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_WANT_WORDS.js +19 -0
  286. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_meshlet_batch.d.ts +23 -0
  287. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_meshlet_batch.d.ts.map +1 -0
  288. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_meshlet_batch.js +70 -0
  289. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_page_block_words.d.ts +18 -0
  290. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_page_block_words.d.ts.map +1 -0
  291. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_page_block_words.js +25 -0
  292. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_page_slot_words.d.ts +35 -0
  293. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_page_slot_words.d.ts.map +1 -0
  294. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_page_slot_words.js +41 -0
  295. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_write_page_block.d.ts +32 -0
  296. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_write_page_block.d.ts.map +1 -0
  297. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_write_page_block.js +138 -0
  298. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  299. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  300. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
  301. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +9 -0
  302. package/src/shade/renderer/rasterize/fast/graph_rasterize_scene_fast.d.ts.map +1 -1
  303. package/src/shade/renderer/rasterize/fast/graph_rasterize_scene_fast.js +12 -1
  304. package/src/shade/renderer/rasterize/standard/graph_rasterize_partial_opaque.d.ts.map +1 -1
  305. package/src/shade/renderer/rasterize/standard/graph_rasterize_partial_opaque.js +12 -1
  306. package/src/shade/renderer/rasterize/standard/graph_rasterize_remaining_opaque.d.ts.map +1 -1
  307. package/src/shade/renderer/rasterize/standard/graph_rasterize_remaining_opaque.js +10 -0
  308. package/src/shade/renderer/scene/GPUSceneContext.d.ts +18 -0
  309. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  310. package/src/shade/renderer/scene/GPUSceneContext.js +647 -594
  311. package/src/shade/renderer/scene/rows/GPUSceneRows.d.ts.map +1 -1
  312. package/src/shade/renderer/scene/rows/GPUSceneRows.js +22 -0
  313. package/src/shade/renderer/shader/chunk/geometry/mat3/chunk_mat3_singular_values.d.ts +35 -0
  314. package/src/shade/renderer/shader/chunk/geometry/mat3/chunk_mat3_singular_values.d.ts.map +1 -0
  315. package/src/shade/renderer/shader/chunk/geometry/mat3/chunk_mat3_singular_values.js +91 -0
  316. package/src/engine/graphics3/instantiate_scene_bundle.d.ts +0 -54
  317. package/src/engine/graphics3/instantiate_scene_bundle.d.ts.map +0 -1
  318. package/src/engine/graphics3/shade_node_to_entity_composition.d.ts +0 -39
  319. package/src/engine/graphics3/shade_node_to_entity_composition.d.ts.map +0 -1
  320. package/src/shade/renderer/animation/compute_skin_world_bounds.d.ts +0 -35
  321. package/src/shade/renderer/animation/compute_skin_world_bounds.d.ts.map +0 -1
  322. package/src/shade/renderer/animation/compute_skinned_mesh_clip_bounding_sphere.d.ts +0 -96
  323. package/src/shade/renderer/animation/compute_skinned_mesh_clip_bounding_sphere.d.ts.map +0 -1
  324. package/src/shade/renderer/animation/pose/pose_evaluate_world.d.ts +0 -20
  325. package/src/shade/renderer/animation/pose/pose_evaluate_world.d.ts.map +0 -1
  326. package/src/shade/renderer/animation/skin_bind_transform.d.ts +0 -25
  327. package/src/shade/renderer/animation/skin_bind_transform.d.ts.map +0 -1
  328. package/src/shade/renderer/animation/skin_frame_defect.d.ts +0 -34
  329. package/src/shade/renderer/animation/skin_frame_defect.d.ts.map +0 -1
  330. package/src/shade/renderer/animation/skin_joint_matrix.d.ts +0 -24
  331. package/src/shade/renderer/animation/skin_joint_matrix.d.ts.map +0 -1
  332. package/src/shade/renderer/animation/skin_normalize_mesh_frame.d.ts +0 -70
  333. package/src/shade/renderer/animation/skin_normalize_mesh_frame.d.ts.map +0 -1
  334. package/src/shade/renderer/buffer/table/GPUReadbackStagingRing.d.ts +0 -96
  335. package/src/shade/renderer/buffer/table/GPUReadbackStagingRing.d.ts.map +0 -1
  336. package/src/shade/renderer/scene/InstanceBatch.d.ts +0 -92
  337. package/src/shade/renderer/scene/InstanceBatch.d.ts.map +0 -1
  338. package/src/shade/renderer/scene/Mesh.d.ts +0 -55
  339. package/src/shade/renderer/scene/Mesh.d.ts.map +0 -1
  340. package/src/shade/renderer/scene/Node3D.d.ts +0 -159
  341. package/src/shade/renderer/scene/Node3D.d.ts.map +0 -1
  342. package/src/shade/renderer/scene/Node3DDirtyList.d.ts +0 -59
  343. package/src/shade/renderer/scene/Node3DDirtyList.d.ts.map +0 -1
  344. package/src/shade/renderer/scene/SceneNodeBinding.d.ts +0 -52
  345. package/src/shade/renderer/scene/SceneNodeBinding.d.ts.map +0 -1
  346. package/src/shade/renderer/scene/SkinnedMesh.d.ts +0 -27
  347. package/src/shade/renderer/scene/SkinnedMesh.d.ts.map +0 -1
  348. package/src/shade/renderer/scene/TransformAuthority.d.ts +0 -19
  349. package/src/shade/renderer/scene/TransformAuthority.d.ts.map +0 -1
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Worker-side logic for {@link WorkerClothSystem}: holds one {@link ClothState}
3
+ * view per registered cloth and steps the ones the main thread nominates.
4
+ *
5
+ * The states are not copies. Each is a {@link ClothState} whose views are cut
6
+ * over the very memory the main thread's `ClothInstance` holds, so a step
7
+ * mutates that cloth in place and there is nothing to send back — the result is
8
+ * published by the {@link SystemWorkerHost} advancing `DONE`, and the three
9
+ * scalars a caller needs from a step are in the buffer too
10
+ * (`ClothState#result`).
11
+ *
12
+ * The exclusion set travels with the registration and *is* copied, because it is
13
+ * the one thing here that the step only reads: built once from the row tables
14
+ * when the cloth seeds, replaced by a re-seed, and never written by either side.
15
+ * A shared buffer for it would buy nothing and cost a region.
16
+ *
17
+ * Deliberately free of worker globals (`self`, `postMessage`, `Worker`) so it is
18
+ * ordinary node-testable code; {@link SystemWorkerHost} owns everything that
19
+ * needs a real worker.
20
+ *
21
+ * @author Alex Goldring
22
+ * @copyright Company Named Limited (c) 2026
23
+ */
24
+ export class ClothWorkerCore {
25
+ /**
26
+ * @param {*} data
27
+ */
28
+ handleMessage(data: any): void;
29
+ /**
30
+ * @returns {number} how many cloths are currently registered
31
+ */
32
+ get cloth_count(): number;
33
+ /**
34
+ * @param {number} id
35
+ * @returns {ClothState|undefined} the worker's view of that cloth
36
+ */
37
+ stateOf(id: number): ClothState | undefined;
38
+ /**
39
+ * Step every cloth the main thread nominated for this tick.
40
+ *
41
+ * @param {number} tick
42
+ * @param {Float64Array} command
43
+ */
44
+ step(tick: number, command: Float64Array): void;
45
+ #private;
46
+ }
47
+ import { ClothState } from "../solver/ClothState.js";
48
+ //# sourceMappingURL=ClothWorkerCore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClothWorkerCore.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/ClothWorkerCore.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH;IAQI;;OAEG;IACH,+BAiBC;IAED;;OAEG;IACH,0BAEC;IAED;;;OAGG;IACH,YAHW,MAAM,GACJ,UAAU,GAAC,SAAS,CAMhC;IAED;;;;;OAKG;IACH,WAHW,MAAM,WACN,YAAY,QA2BtB;;CACJ;2BA1G0B,yBAAyB"}
@@ -0,0 +1,107 @@
1
+ import { ClothState } from "../solver/ClothState.js";
2
+ import { ClothStepParam, cloth_step_instance } from "../solver/cloth_step_instance.js";
3
+ import { ClothCommand, cloth_command_offset } from "./cloth_worker_protocol.js";
4
+
5
+ /**
6
+ * Worker-side logic for {@link WorkerClothSystem}: holds one {@link ClothState}
7
+ * view per registered cloth and steps the ones the main thread nominates.
8
+ *
9
+ * The states are not copies. Each is a {@link ClothState} whose views are cut
10
+ * over the very memory the main thread's `ClothInstance` holds, so a step
11
+ * mutates that cloth in place and there is nothing to send back — the result is
12
+ * published by the {@link SystemWorkerHost} advancing `DONE`, and the three
13
+ * scalars a caller needs from a step are in the buffer too
14
+ * (`ClothState#result`).
15
+ *
16
+ * The exclusion set travels with the registration and *is* copied, because it is
17
+ * the one thing here that the step only reads: built once from the row tables
18
+ * when the cloth seeds, replaced by a re-seed, and never written by either side.
19
+ * A shared buffer for it would buy nothing and cost a region.
20
+ *
21
+ * Deliberately free of worker globals (`self`, `postMessage`, `Worker`) so it is
22
+ * ordinary node-testable code; {@link SystemWorkerHost} owns everything that
23
+ * needs a real worker.
24
+ *
25
+ * @author Alex Goldring
26
+ * @copyright Company Named Limited (c) 2026
27
+ */
28
+ export class ClothWorkerCore {
29
+
30
+ /**
31
+ * Registered cloths by id, populated over the cold plane.
32
+ * @type {Map<number, {state: ClothState, exclusions: {offset: Int32Array, partner: Int32Array}}>}
33
+ */
34
+ #cloths = new Map();
35
+
36
+ /**
37
+ * @param {*} data
38
+ */
39
+ handleMessage(data) {
40
+ if (data.type === "add_cloth") {
41
+ this.#cloths.set(data.id, {
42
+ state: ClothState.fromSharedDescriptor(data.state),
43
+ exclusions: data.self_exclusions
44
+ });
45
+
46
+ return;
47
+ }
48
+
49
+ if (data.type === "remove_cloth") {
50
+ this.#cloths.delete(data.id);
51
+
52
+ return;
53
+ }
54
+
55
+ throw new Error(`ClothWorkerCore: unknown message type '${data.type}'`);
56
+ }
57
+
58
+ /**
59
+ * @returns {number} how many cloths are currently registered
60
+ */
61
+ get cloth_count() {
62
+ return this.#cloths.size;
63
+ }
64
+
65
+ /**
66
+ * @param {number} id
67
+ * @returns {ClothState|undefined} the worker's view of that cloth
68
+ */
69
+ stateOf(id) {
70
+ const entry = this.#cloths.get(id);
71
+
72
+ return entry === undefined ? undefined : entry.state;
73
+ }
74
+
75
+ /**
76
+ * Step every cloth the main thread nominated for this tick.
77
+ *
78
+ * @param {number} tick
79
+ * @param {Float64Array} command
80
+ */
81
+ step(tick, command) {
82
+ const cloth_count = command[ClothCommand.CLOTH_COUNT];
83
+
84
+ for (let i = 0; i < cloth_count; i++) {
85
+ const offset = cloth_command_offset(i);
86
+
87
+ const entry = this.#cloths.get(command[offset + ClothStepParam.ID]);
88
+
89
+ if (entry === undefined) {
90
+ // The cloth was removed — or re-seeded, which retires its id —
91
+ // after this step was dispatched. An ordinary despawn or a
92
+ // structure change, not a protocol error: `remove_cloth` travels
93
+ // on the cold plane and can be delivered before the pump runs a
94
+ // step that was published earlier.
95
+ //
96
+ // Skipping is correct, because the main thread drops a cloth
97
+ // from the nomination list the moment it unlinks and never joins
98
+ // a result it did not nominate. Throwing here instead would fail
99
+ // the whole bridge — and with it every other cloth in the scene
100
+ // — every time a garment is despawned at the wrong moment.
101
+ continue;
102
+ }
103
+
104
+ cloth_step_instance(entry.state, entry.exclusions, command, offset);
105
+ }
106
+ }
107
+ }
@@ -0,0 +1,323 @@
1
+ /**
2
+ * # Every cloth in a scene, and everything a step needs that is not arithmetic
3
+ *
4
+ * One {@link ClothInstance} per {@link Cloth} component, stepped at the fixed
5
+ * rate. Per step, per cloth: move the local frame with the anchor, point the
6
+ * leash rows at where they measure from, gather the colliders that could touch
7
+ * it, step, and put the result back on the subtree. The animated pose the
8
+ * leashes are measured against is not recomposed per step — in the entity path
9
+ * it is constant in the anchor's own frame, and `cloth_seed_subtree.js` bakes
10
+ * it.
11
+ *
12
+ * ## Why this is not a `System`
13
+ *
14
+ * Because two of them drive it. {@link ClothSystem} steps every cloth inline;
15
+ * {@link WorkerClothSystem} hands the arithmetic to a worker and joins it on the
16
+ * next tick. §12 asks those two to produce **bit-identical** results, and the
17
+ * cheapest way to be sure of that is for there to be one copy of everything
18
+ * except the dispatch — so the registry, the seeding, the frame handling, the
19
+ * broadphase and the write-back live here, and the two systems differ only in
20
+ * where {@link ClothWorld#prepare} and {@link ClothWorld#finish} are separated
21
+ * by a thread.
22
+ *
23
+ * That split is also exactly §12's: "arbitrary user-facing work — component
24
+ * reads, `Transform64` sync, index queries — stays on the main thread; the pure
25
+ * numeric step crosses". {@link ensure_seeded} and {@link advance} are the first
26
+ * half, `cloth_step_instance` is the second, {@link finish} is what the result
27
+ * is worth.
28
+ *
29
+ * Seeding is its own call rather than the top of {@link advance} because the
30
+ * worker needs to get between them: a cloth's `ClothState` is what it registers
31
+ * with the worker, so it has to exist — and be acknowledged — before the cloth
32
+ * can be nominated for a step, and a re-seed replaces it and starts that again.
33
+ *
34
+ * ## The parameter block
35
+ *
36
+ * {@link prepare} does not call the step and does not return its arguments; it
37
+ * **writes them into a `Float64` block** the caller supplies. For
38
+ * {@link ClothSystem} that block is a private scratch array and the step follows
39
+ * immediately; for {@link WorkerClothSystem} it is a slice of the shared command
40
+ * region and the step happens on another thread. Neither system ever computes a
41
+ * step parameter of its own, so neither can compute one differently.
42
+ *
43
+ * ## The local frame and the inertia model — §7 P7
44
+ *
45
+ * Particles live in the anchor's own frame. When the anchor moves, the cloth is
46
+ * asked how much of that motion it would like to feel:
47
+ * `ClothDynamics#inertia = 1` keeps every particle's **world** position and
48
+ * velocity, so a cape trails a sprinting character; `0` keeps their **local**
49
+ * ones, so the cloth rides the anchor as though it were standing still. The
50
+ * blend between the two is a lerp in the local frame, which is all the frame
51
+ * change is.
52
+ *
53
+ * The felt motion is limited before the blend, which is what makes "character
54
+ * sprints, cape behaves" a default rather than a tuning exercise, and the limits
55
+ * are derived from the cloth's own reach rather than authored.
56
+ *
57
+ * ## The wind — §10
58
+ *
59
+ * {@link wind} is a source of air and {@link advance} samples it into the
60
+ * cloth's own buffer, once per particle per step. That is the one piece of M6
61
+ * that stays on this thread: a fluid field is an ECS component holding a
62
+ * hundred thousand floats that its own solver rewrites every step, and the
63
+ * *answer* is three floats a particle. `cloth_sample_air.js` carries the
64
+ * decision; the aerodynamic arithmetic built on top of it lives in
65
+ * `cloth_step_instance` with everything else the budget is spent on.
66
+ *
67
+ * A source is optional and additive, like the collider index. With none, the
68
+ * step's drag response is zero, `cloth_step` takes the uniform-gravity path,
69
+ * and a scene produces the bytes M5 measured.
70
+ *
71
+ * ## Teleport — §7 P6
72
+ *
73
+ * Anchor motion past a threshold is not locomotion and is not treated as any
74
+ * amount of it. `ClothFlags.TeleportKeep` carries the shape across, which in a
75
+ * local frame is literally doing nothing; the default re-seeds at the animated
76
+ * pose with zero velocity and opens a stabilisation window in which the
77
+ * velocity limit ramps back from nothing, so the first steps after a reset
78
+ * cannot produce a whip.
79
+ *
80
+ * @author Alex Goldring
81
+ * @copyright Company Named Limited (c) 2026
82
+ */
83
+ export class ClothWorld {
84
+ /**
85
+ * World gravity, m/s². Rotated into each cloth's local frame per step.
86
+ * @type {Float64Array}
87
+ */
88
+ gravity: Float64Array;
89
+ /**
90
+ * Live cloths, in the order they were linked.
91
+ *
92
+ * **Not sorted by hierarchy depth**, and it used to be. The sort existed so
93
+ * that a nested cloth advanced against an anchor the cloth above it had
94
+ * already written this step — which `WorkerClothSystem` cannot do, because
95
+ * the step it is writing back happened on another thread a tick ago. Both
96
+ * systems now advance every cloth, then step every cloth, then finish every
97
+ * cloth, so a nested cloth reads its parent one fixed step stale on both
98
+ * sides and the sort has nothing left to decide. `ClothSystem#fixedUpdate`
99
+ * carries the argument; `MEASUREMENTS.md` §56 carries the measurement.
100
+ * @type {ClothInstance[]}
101
+ */
102
+ instances: ClothInstance[];
103
+ /**
104
+ * Where a skinned model instance comes from. Anything that answers
105
+ * `instance_of(entity)` with a `PrefabInstance` — skins whose joints
106
+ * are entities — will do, and {@link MeshSystem} is what does in a
107
+ * running engine.
108
+ *
109
+ * Public and assignable because a garment's joints are a *rendering*
110
+ * structure and `MeshSystem` needs a graphics engine, a scene and a loader
111
+ * to exist — so a spec that wants joints without a renderer sets this
112
+ * instead, and gets exactly the interface the system uses.
113
+ *
114
+ * `null` means no rig can seed, which is the same additive shape the
115
+ * collider index has: a scene without one gets M1's cloth rather than an
116
+ * error.
117
+ * @type {{instance_of: function(number): (PrefabInstance|null)}|null}
118
+ */
119
+ models: {
120
+ instance_of: (arg0: number) => (PrefabInstance | null);
121
+ } | null;
122
+ /**
123
+ * @type {EntityManager|null}
124
+ */
125
+ entityManager: EntityManager | null;
126
+ /**
127
+ * @type {TransformAttachmentSystem|null}
128
+ */
129
+ attachments: TransformAttachmentSystem | null;
130
+ /**
131
+ * The collider index's owner, or `null` when the manager has none — in
132
+ * which case cloth simply does not collide, which is exactly M1's
133
+ * behaviour and is what makes the collision layer additive rather than a
134
+ * new requirement on every scene.
135
+ * @type {ClothColliderSystem|null}
136
+ */
137
+ colliders: ClothColliderSystem | null;
138
+ /**
139
+ * Where the air comes from — §10. `null` means no air, which is the
140
+ * default and is **additive** in exactly the way the collider index is: a
141
+ * scene without one gets M5's cloth rather than an error, and adding one is
142
+ * the whole of turning wind on.
143
+ *
144
+ * Null rather than a still-air ambient, and the distinction is real. A
145
+ * source that answers zero everywhere is not "no wind": the drag row is a
146
+ * relaxation toward the air, so still air still resists a *moving* cloth,
147
+ * with the normal-facing factor making that resistance anisotropic. That is
148
+ * better physics than `ClothDynamics#damping`'s isotropic decay and it is
149
+ * not free — so it is a thing a scene asks for. What a cloth does in air
150
+ * that is not moving is `damping`'s job (§7 P5, where it is load-bearing);
151
+ * what it does in air that *is* is this.
152
+ *
153
+ * Assign {@link ClothAmbientWind} for weather, {@link ClothFluidWind} to
154
+ * read the fluid simulation and fall back to weather outside it.
155
+ * @type {AbstractClothWind|null}
156
+ */
157
+ wind: AbstractClothWind | null;
158
+ /**
159
+ * Seconds of fixed step this world has **stepped**, which is the clock a
160
+ * wind source's gust is a function of.
161
+ *
162
+ * Accumulated from `dt` rather than read from a wall clock, because
163
+ * {@link ClothSystem} and {@link WorkerClothSystem} share this object and
164
+ * §12's parity gate is over every byte of every step: two runs of the same
165
+ * scene have the same `dt` sequence and therefore the same weather.
166
+ *
167
+ * **Stepped rather than ticked**, and that distinction is load-bearing
168
+ * rather than pedantic. A cloth under the worker is not advanced until its
169
+ * registration is acknowledged (§39), so the two systems reach a cloth's
170
+ * *first* step at different tick counts — and a clock that counted ticks
171
+ * would hand that cloth a different gust on the same step under the two
172
+ * systems, which is a divergence the parity gate would report and the design
173
+ * would deserve. So the clock moves when {@link advance} first runs in a
174
+ * tick: the world's weather is a function of how much cloth time has
175
+ * passed, not of how long something has been asking.
176
+ * @type {number}
177
+ */
178
+ time: number;
179
+ /**
180
+ * Fixed-step seconds this tick owes the clock, consumed by the first
181
+ * {@link advance} — see {@link time}. Zero once spent.
182
+ * @type {number}
183
+ * @private
184
+ */
185
+ private __wind_pending;
186
+ /**
187
+ * Whether a cloth's {@link ClothState} must be backed by a
188
+ * `SharedArrayBuffer`. Stamped onto every instance as it is linked;
189
+ * {@link WorkerClothSystem} sets it, {@link ClothSystem} leaves it alone.
190
+ * @type {boolean}
191
+ */
192
+ shared_state: boolean;
193
+ /**
194
+ * @type {Map<number, ClothInstance>}
195
+ * @private
196
+ */
197
+ private __by_entity;
198
+ /**
199
+ * Watches `Cloth` + {@link ClothRig} so the rig path is a **live**
200
+ * discriminator rather than one read once.
201
+ *
202
+ * `ClothSystem#dependencies` is `[Cloth, Transform64]` — the tuple that
203
+ * makes something a cloth — so a `ClothRig` added to a live cloth completes
204
+ * no tuple the system observes and a `ClothRig` removed from one breaks
205
+ * none. §3.1's "the discriminator is a component's presence" then holds only
206
+ * for a character spawned whole, which is the one case a spec constructs and
207
+ * the least likely one in a scene where a model loads asynchronously.
208
+ *
209
+ * Both edges re-seed. The removing edge also gives the joints back first,
210
+ * because the instance that knows which they were is about to stop being a
211
+ * rig.
212
+ * @type {EntityObserver}
213
+ * @private
214
+ */
215
+ private __rig_observer;
216
+ /**
217
+ * Resolve the systems a cloth world reads. Called from the owning system's
218
+ * `startup`.
219
+ *
220
+ * @param {EntityManager} entityManager
221
+ */
222
+ attach(entityManager: EntityManager): void;
223
+ /**
224
+ * @param {Cloth} cloth
225
+ * @param {Transform64} transform
226
+ * @param {number} entity
227
+ * @returns {ClothInstance}
228
+ */
229
+ link(cloth: Cloth, transform: Transform64, entity: number): ClothInstance;
230
+ /**
231
+ * Watch this dataset for a {@link ClothRig} arriving at or leaving a live
232
+ * cloth. Called from the owning system's `handleDatasetAttached`; see
233
+ * {@link ClothWorld#__rig_observer} for why the system's own dependency
234
+ * tuple cannot answer this.
235
+ *
236
+ * @param {EntityComponentDataset} dataset
237
+ * @returns {void}
238
+ */
239
+ attach_dataset(dataset: EntityComponentDataset): void;
240
+ /**
241
+ * @param {EntityComponentDataset} dataset
242
+ * @returns {void}
243
+ */
244
+ detach_dataset(dataset: EntityComponentDataset): void;
245
+ /**
246
+ * @param {number} entity
247
+ * @returns {ClothInstance|undefined} the instance that was removed
248
+ */
249
+ unlink(entity: number): ClothInstance | undefined;
250
+ /**
251
+ * Throw away a cloth's binding so the next step walks its subtree again.
252
+ *
253
+ * The walk is done once, because a rope's links do not come and go. When
254
+ * they do — a chain gains a link, a rig is rebuilt — this is how you say so,
255
+ * and it is the same contract `TransformAttachment#parent` already carries:
256
+ * the structure is immutable while it is attached, and changing it is an
257
+ * explicit act rather than something the engine polls for.
258
+ *
259
+ * @param {number} entity
260
+ * @returns {ClothInstance|undefined} the instance that will re-seed
261
+ */
262
+ reseed(entity: number): ClothInstance | undefined;
263
+ /**
264
+ * Wake a sleeping cloth. Anchor motion and a `ClothDynamics` change do this
265
+ * on their own; a caller that has changed the world in some way the cloth
266
+ * cannot see — M6's wind, for one — says so here.
267
+ *
268
+ * @param {number} entity
269
+ * @returns {void}
270
+ */
271
+ wake(entity: number): void;
272
+ /**
273
+ * @param {number} entity
274
+ * @returns {ClothInstance|undefined}
275
+ */
276
+ instanceOf(entity: number): ClothInstance | undefined;
277
+ /**
278
+ * Everything that happens once per tick rather than once per cloth.
279
+ *
280
+ * @param {EntityComponentDataset} ecd
281
+ * @param {number} dt seconds
282
+ */
283
+ begin(ecd: EntityComponentDataset, dt: number): void;
284
+ /**
285
+ * Make sure this cloth has a `ClothState` that matches its current
286
+ * `ClothDynamics`, seeding or re-seeding it if not.
287
+ *
288
+ * @param {ClothInstance} instance
289
+ * @param {EntityComponentDataset} ecd
290
+ * @param {number} dt seconds
291
+ * @returns {boolean} whether the cloth is ready to be stepped — `false` for
292
+ * one that has been refused, or a rig whose model has not loaded yet
293
+ */
294
+ ensure_seeded(instance: ClothInstance, ecd: EntityComponentDataset, dt: number): boolean;
295
+ /**
296
+ * Take what the step produced: the sleep test, and the pose onto whichever
297
+ * hierarchy this cloth was built on.
298
+ *
299
+ * @param {ClothInstance} instance
300
+ * @param {EntityComponentDataset} ecd
301
+ * @returns {void}
302
+ */
303
+ finish(instance: ClothInstance, ecd: EntityComponentDataset): void;
304
+ /**
305
+ * Carry one seeded cloth to the edge of its step and write the parameters
306
+ * the step will run on: whatever the anchor did to the local frame, where
307
+ * the leash rows measure from, and the colliders within reach.
308
+ *
309
+ * @param {ClothInstance} instance
310
+ * @param {number} dt seconds
311
+ * @param {Float64Array} params
312
+ * @param {number} offset first word of this cloth's block in `params`
313
+ * @returns {boolean} whether the cloth should be stepped — `false` for one
314
+ * that is asleep, and then nothing has been written to `params`
315
+ */
316
+ advance(instance: ClothInstance, dt: number, params: Float64Array, offset: number): boolean;
317
+ #private;
318
+ }
319
+ import { ClothInstance } from "./ClothInstance.js";
320
+ import { TransformAttachmentSystem } from "../../../ecs/transform-attachment/TransformAttachmentSystem.js";
321
+ import { ClothColliderSystem } from "./ClothColliderSystem.js";
322
+ import { Cloth } from "./Cloth.js";
323
+ //# sourceMappingURL=ClothWorld.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClothWorld.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/ecs/ClothWorld.js"],"names":[],"mappings":"AA2DA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AACH;IAEI;;;OAGG;IACH,SAFU,YAAY,CAEoB;IAE1C;;;;;;;;;;;;OAYG;IACH,WAFU,aAAa,EAAE,CAEV;IAEf;;;;;;;;;;;;;;;OAeG;IACH,QAFU;QAAC,WAAW,SAAW,MAAM,KAAG,CAAC,iBAAe,IAAI,CAAC,CAAA;KAAC,GAAC,IAAI,CAEvD;IAEd;;OAEG;IACH,eAFU,gBAAc,IAAI,CAEP;IAErB;;OAEG;IACH,aAFU,yBAAyB,GAAC,IAAI,CAErB;IAEnB;;;;;;OAMG;IACH,WAFU,mBAAmB,GAAC,IAAI,CAEjB;IAEjB;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAFU,oBAAkB,IAAI,CAEpB;IAEZ;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAFU,MAAM,CAEP;IAET;;;;;OAKG;IACH,uBAAmB;IAEnB;;;;;OAKG;IACH,cAFU,OAAO,CAEI;IAErB;;;OAGG;IACH,oBAAwB;IAExB;;;;;;;;;;;;;;;;OAgBG;IACH,uBAKE;IAEF;;;;;OAKG;IACH,2CAiBC;IAED;;;;;OAKG;IACH,YALW,KAAK,kCAEL,MAAM,GACJ,aAAa,CAczB;IAED;;;;;;;;OAQG;IACH,iDAFa,IAAI,CAIhB;IAED;;;OAGG;IACH,iDAFa,IAAI,CAIhB;IAED;;;OAGG;IACH,eAHW,MAAM,GACJ,aAAa,GAAC,SAAS,CA0BnC;IA+CD;;;;;;;;;;;OAWG;IACH,eAHW,MAAM,GACJ,aAAa,GAAC,SAAS,CAanC;IAED;;;;;;;OAOG;IACH,aAHW,MAAM,GACJ,IAAI,CAShB;IAED;;;OAGG;IACH,mBAHW,MAAM,GACJ,aAAa,GAAC,SAAS,CAInC;IAED;;;;;OAKG;IACH,uCAFW,MAAM,QAgBhB;IAED;;;;;;;;;OASG;IACH,wBANW,aAAa,mCAEb,MAAM,GACJ,OAAO,CA8BnB;IAED;;;;;;;OAOG;IACH,iBAJW,aAAa,gCAEX,IAAI,CA2BhB;IAwFD;;;;;;;;;;;OAWG;IACH,kBAPW,aAAa,MACb,MAAM,UACN,YAAY,UACZ,MAAM,GACJ,OAAO,CAgPnB;;CA8EJ;8BAl8B6B,oBAAoB;0CAjB3C,gEAAgE;oCAcnC,0BAA0B;sBA4BxC,YAAY"}