@woosh/meep-engine 3.23.0 → 3.24.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 (522) hide show
  1. package/editor/entity_world_bounds.d.ts +9 -3
  2. package/editor/entity_world_bounds.d.ts.map +1 -1
  3. package/editor/entity_world_bounds.js +61 -4
  4. package/package.json +1 -1
  5. package/src/core/binary/allocator/OffsetAllocator.d.ts +40 -2
  6. package/src/core/binary/allocator/OffsetAllocator.d.ts.map +1 -1
  7. package/src/core/binary/allocator/OffsetAllocator.js +124 -29
  8. package/src/core/collection/map/u32_index.d.ts +83 -0
  9. package/src/core/collection/map/u32_index.d.ts.map +1 -0
  10. package/src/core/collection/map/u32_index.js +247 -0
  11. package/src/engine/asset/loaders/GLTFSceneBundleAssetLoader.d.ts +2 -2
  12. package/src/engine/asset/loaders/GLTFSceneBundleAssetLoader.js +2 -2
  13. package/src/engine/asset/loaders/USDSceneBundleAssetLoader.d.ts +1 -2
  14. package/src/engine/asset/loaders/USDSceneBundleAssetLoader.d.ts.map +1 -1
  15. package/src/engine/asset/loaders/USDSceneBundleAssetLoader.js +4 -12
  16. package/src/engine/ecs/gpu/GPUStateAuthority.d.ts +55 -0
  17. package/src/engine/ecs/gpu/GPUStateAuthority.d.ts.map +1 -0
  18. package/src/engine/ecs/gpu/GPUStateAuthority.js +72 -0
  19. package/src/engine/ecs/gpu/GPUStateAuthorityFlags.d.ts +40 -0
  20. package/src/engine/ecs/gpu/GPUStateAuthorityFlags.d.ts.map +1 -0
  21. package/src/engine/ecs/gpu/GPUStateAuthorityFlags.js +79 -0
  22. package/src/engine/ecs/gpu/gpu_authority_assert_cpu.d.ts +18 -0
  23. package/src/engine/ecs/gpu/gpu_authority_assert_cpu.d.ts.map +1 -0
  24. package/src/engine/ecs/gpu/gpu_authority_assert_cpu.js +27 -0
  25. package/src/engine/ecs/gpu/gpu_authority_declare.d.ts +23 -0
  26. package/src/engine/ecs/gpu/gpu_authority_declare.d.ts.map +1 -0
  27. package/src/engine/ecs/gpu/gpu_authority_declare.js +39 -0
  28. package/src/engine/ecs/gpu/gpu_authority_grant.d.ts +15 -0
  29. package/src/engine/ecs/gpu/gpu_authority_grant.d.ts.map +1 -0
  30. package/src/engine/ecs/gpu/gpu_authority_grant.js +38 -0
  31. package/src/engine/ecs/gpu/gpu_authority_has.d.ts +18 -0
  32. package/src/engine/ecs/gpu/gpu_authority_has.d.ts.map +1 -0
  33. package/src/engine/ecs/gpu/gpu_authority_has.js +28 -0
  34. package/src/engine/ecs/gpu/gpu_authority_revoke.d.ts +24 -0
  35. package/src/engine/ecs/gpu/gpu_authority_revoke.d.ts.map +1 -0
  36. package/src/engine/ecs/gpu/gpu_authority_revoke.js +49 -0
  37. package/src/engine/ecs/ik/IKProblem.d.ts +14 -0
  38. package/src/engine/ecs/ik/IKProblem.d.ts.map +1 -1
  39. package/src/engine/ecs/ik/IKProblem.js +16 -0
  40. package/src/engine/ecs/ik/InverseKinematicsSystem.d.ts.map +1 -1
  41. package/src/engine/ecs/ik/InverseKinematicsSystem.js +19 -0
  42. package/src/engine/ecs/ik/OneBoneSurfaceAlignmentSolver.js +2 -2
  43. package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.js +2 -2
  44. package/src/engine/ecs/ik/ik_bone_chain.d.ts +11 -2
  45. package/src/engine/ecs/ik/ik_bone_chain.d.ts.map +1 -1
  46. package/src/engine/ecs/ik/ik_bone_chain.js +47 -2
  47. package/src/engine/ecs/ik/ik_write_local_rotation.d.ts.map +1 -1
  48. package/src/engine/ecs/ik/ik_write_local_rotation.js +6 -0
  49. package/src/engine/ecs/speaker/VoiceSystem.d.ts.map +1 -1
  50. package/src/engine/ecs/speaker/VoiceSystem.js +6 -0
  51. package/src/engine/ecs/transform/T64WorldCache.d.ts +50 -0
  52. package/src/engine/ecs/transform/T64WorldCache.d.ts.map +1 -0
  53. package/src/engine/ecs/transform/T64WorldCache.js +139 -0
  54. package/src/engine/ecs/transform/t64_evaluate_world.d.ts +31 -0
  55. package/src/engine/ecs/transform/t64_evaluate_world.d.ts.map +1 -0
  56. package/src/engine/ecs/transform/t64_evaluate_world.js +126 -0
  57. package/src/engine/ecs/transform-attachment/TransformAttachmentSystem.d.ts +8 -0
  58. package/src/engine/ecs/transform-attachment/TransformAttachmentSystem.d.ts.map +1 -1
  59. package/src/engine/ecs/transform-attachment/TransformAttachmentSystem.js +59 -30
  60. package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.d.ts.map +1 -1
  61. package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.js +4 -11
  62. package/src/engine/graphics/ecs/mesh-v2/SHADED_GEOMETRY_EVENT_CHANGE.d.ts +14 -0
  63. package/src/engine/graphics/ecs/mesh-v2/SHADED_GEOMETRY_EVENT_CHANGE.d.ts.map +1 -0
  64. package/src/engine/graphics/ecs/mesh-v2/SHADED_GEOMETRY_EVENT_CHANGE.js +13 -0
  65. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +2 -14
  66. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts.map +1 -1
  67. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +11 -21
  68. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometryFlags.d.ts +1 -0
  69. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometryFlags.js +7 -0
  70. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshHighlightSystem.d.ts +5 -6
  71. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshHighlightSystem.d.ts.map +1 -1
  72. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshHighlightSystem.js +13 -11
  73. package/src/engine/graphics/ecs/mesh-v2/shaded_geometry_announce_change.d.ts +14 -0
  74. package/src/engine/graphics/ecs/mesh-v2/shaded_geometry_announce_change.d.ts.map +1 -0
  75. package/src/engine/graphics/ecs/mesh-v2/shaded_geometry_announce_change.js +21 -0
  76. package/src/engine/graphics/ecs/particles/ParticleEffect.d.ts +1 -1
  77. package/src/engine/graphics/ecs/particles/ParticleEffect.js +1 -1
  78. package/src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.d.ts +1 -1
  79. package/src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.js +1 -1
  80. package/src/engine/graphics3/AnimationGraphSystem.js +3 -3
  81. package/src/engine/graphics3/AnimationSystem.js +2 -2
  82. package/src/engine/graphics3/DebugDrawSystem.d.ts.map +1 -1
  83. package/src/engine/graphics3/DebugDrawSystem.js +2 -4
  84. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +34 -27
  85. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
  86. package/src/engine/graphics3/GPUParticleEmitterSystem.js +185 -85
  87. package/src/engine/graphics3/HighlightOutlineSystem.d.ts +4 -3
  88. package/src/engine/graphics3/HighlightOutlineSystem.d.ts.map +1 -1
  89. package/src/engine/graphics3/HighlightOutlineSystem.js +7 -9
  90. package/src/engine/graphics3/LightSystem.d.ts +7 -5
  91. package/src/engine/graphics3/LightSystem.d.ts.map +1 -1
  92. package/src/engine/graphics3/LightSystem.js +36 -22
  93. package/src/engine/graphics3/MeshSystem.d.ts +43 -39
  94. package/src/engine/graphics3/MeshSystem.d.ts.map +1 -1
  95. package/src/engine/graphics3/MeshSystem.js +324 -331
  96. package/src/engine/graphics3/PathDisplaySystem.d.ts.map +1 -1
  97. package/src/engine/graphics3/PathDisplaySystem.js +2 -4
  98. package/src/engine/graphics3/PickingQuery.d.ts +15 -21
  99. package/src/engine/graphics3/PickingQuery.d.ts.map +1 -1
  100. package/src/engine/graphics3/PickingQuery.js +21 -25
  101. package/src/engine/graphics3/PickingSystem.d.ts +60 -31
  102. package/src/engine/graphics3/PickingSystem.d.ts.map +1 -1
  103. package/src/engine/graphics3/PickingSystem.js +416 -273
  104. package/src/engine/graphics3/ShadedGeometrySystem.d.ts +22 -12
  105. package/src/engine/graphics3/ShadedGeometrySystem.d.ts.map +1 -1
  106. package/src/engine/graphics3/ShadedGeometrySystem.js +309 -174
  107. package/src/engine/graphics3/TerrainSystem.d.ts +19 -11
  108. package/src/engine/graphics3/TerrainSystem.d.ts.map +1 -1
  109. package/src/engine/graphics3/TerrainSystem.js +102 -53
  110. package/src/engine/graphics3/TooltipComponentSystem.d.ts.map +1 -1
  111. package/src/engine/graphics3/TooltipComponentSystem.js +2 -14
  112. package/src/engine/graphics3/Trail3DSystem.d.ts.map +1 -1
  113. package/src/engine/graphics3/Trail3DSystem.js +2 -4
  114. package/src/engine/graphics3/animation/ClipListPlayer.d.ts +4 -4
  115. package/src/engine/graphics3/animation/ClipListPlayer.d.ts.map +1 -1
  116. package/src/engine/graphics3/animation/ClipListPlayer.js +2 -2
  117. package/src/engine/graphics3/highlight/pack_highlight_table.d.ts +9 -11
  118. package/src/engine/graphics3/highlight/pack_highlight_table.d.ts.map +1 -1
  119. package/src/engine/graphics3/highlight/pack_highlight_table.js +11 -18
  120. package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts +4 -3
  121. package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts.map +1 -1
  122. package/src/engine/graphics3/pose/query_entity_node_world_pose.js +75 -74
  123. package/src/engine/graphics3/prefab/Prefab.d.ts +130 -0
  124. package/src/engine/graphics3/prefab/Prefab.d.ts.map +1 -0
  125. package/src/engine/graphics3/prefab/Prefab.js +162 -0
  126. package/src/engine/graphics3/prefab/PrefabInstance.d.ts +72 -0
  127. package/src/engine/graphics3/prefab/PrefabInstance.d.ts.map +1 -0
  128. package/src/engine/graphics3/prefab/PrefabInstance.js +80 -0
  129. package/src/engine/graphics3/prefab/prefab_compile.d.ts +23 -0
  130. package/src/engine/graphics3/prefab/prefab_compile.d.ts.map +1 -0
  131. package/src/engine/graphics3/prefab/prefab_compile.js +334 -0
  132. package/src/engine/graphics3/prefab/prefab_instantiate.d.ts +46 -0
  133. package/src/engine/graphics3/prefab/prefab_instantiate.d.ts.map +1 -0
  134. package/src/engine/graphics3/prefab/prefab_instantiate.js +230 -0
  135. package/src/engine/graphics3/prefab/prefab_normalize_skin_frames.d.ts +70 -0
  136. package/src/engine/graphics3/prefab/prefab_normalize_skin_frames.d.ts.map +1 -0
  137. package/src/engine/graphics3/prefab/prefab_normalize_skin_frames.js +210 -0
  138. package/src/engine/graphics3/prefab/prefab_place.d.ts +60 -0
  139. package/src/engine/graphics3/prefab/prefab_place.d.ts.map +1 -0
  140. package/src/engine/graphics3/prefab/prefab_place.js +130 -0
  141. package/src/engine/graphics3/prefab/prefab_skin_clip_scale_conflicts.d.ts +60 -0
  142. package/src/engine/graphics3/prefab/prefab_skin_clip_scale_conflicts.d.ts.map +1 -0
  143. package/src/engine/graphics3/prefab/prefab_skin_clip_scale_conflicts.js +128 -0
  144. package/src/engine/graphics3/prefab/prefab_skin_frame.d.ts +40 -0
  145. package/src/engine/graphics3/prefab/prefab_skin_frame.d.ts.map +1 -0
  146. package/src/engine/graphics3/prefab/prefab_skin_frame.js +116 -0
  147. package/src/engine/graphics3/preview/make_model_preview_scene.d.ts +16 -14
  148. package/src/engine/graphics3/preview/make_model_preview_scene.d.ts.map +1 -1
  149. package/src/engine/graphics3/preview/make_model_preview_scene.js +126 -154
  150. package/src/engine/graphics3/preview/make_model_thumbnail.js +1 -1
  151. package/src/engine/graphics3/register_instance_animation.d.ts +6 -6
  152. package/src/engine/graphics3/register_instance_animation.d.ts.map +1 -1
  153. package/src/engine/graphics3/register_instance_animation.js +4 -4
  154. package/src/engine/graphics3/shade_bundle_bounds.d.ts +2 -6
  155. package/src/engine/graphics3/shade_bundle_bounds.d.ts.map +1 -1
  156. package/src/engine/graphics3/shade_bundle_bounds.js +47 -55
  157. package/src/engine/graphics3/terrain/pack_terrain_row_table.d.ts +11 -18
  158. package/src/engine/graphics3/terrain/pack_terrain_row_table.d.ts.map +1 -1
  159. package/src/engine/graphics3/terrain/pack_terrain_row_table.js +48 -53
  160. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts +17 -2
  161. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts.map +1 -1
  162. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.js +284 -256
  163. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts +13 -15
  164. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts.map +1 -1
  165. package/src/engine/physics/cloth/ecs/ClothInstance.js +12 -14
  166. package/src/engine/physics/cloth/ecs/ClothRig.d.ts +7 -8
  167. package/src/engine/physics/cloth/ecs/ClothRig.d.ts.map +1 -1
  168. package/src/engine/physics/cloth/ecs/ClothRig.js +7 -8
  169. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts +5 -4
  170. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts.map +1 -1
  171. package/src/engine/physics/cloth/ecs/ClothSystem.js +11 -12
  172. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts +19 -23
  173. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts.map +1 -1
  174. package/src/engine/physics/cloth/ecs/cloth_seed_rig.js +201 -199
  175. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts.map +1 -1
  176. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.js +8 -0
  177. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.d.ts +18 -34
  178. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.d.ts.map +1 -1
  179. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.js +58 -115
  180. package/src/engine/physics/cloth/playground/README.md +11 -11
  181. package/src/engine/physics/cloth/playground/garment_build.d.ts +0 -1
  182. package/src/engine/physics/cloth/playground/garment_build.d.ts.map +1 -1
  183. package/src/engine/physics/cloth/playground/garment_build.js +64 -58
  184. package/src/engine/physics/cloth/playground/garment_main.js +59 -33
  185. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  186. package/src/shade/RENDERER_CONTRACT.md +85 -53
  187. package/src/shade/device/ShadeGPUCommandContext.d.ts +23 -0
  188. package/src/shade/device/ShadeGPUCommandContext.d.ts.map +1 -1
  189. package/src/shade/device/ShadeGPUCommandContext.js +36 -0
  190. package/src/shade/playground/add_random_meshes.d.ts +4 -4
  191. package/src/shade/playground/add_random_meshes.d.ts.map +1 -1
  192. package/src/shade/playground/add_random_meshes.js +20 -16
  193. package/src/shade/playground/avboit/main.d.ts +1 -0
  194. package/src/shade/playground/avboit/main.d.ts.map +1 -1
  195. package/src/shade/playground/avboit/main.js +916 -875
  196. package/src/shade/playground/basis_textures/main.d.ts.map +1 -1
  197. package/src/shade/playground/basis_textures/main.js +22 -8
  198. package/src/shade/playground/basis_textures/texture_inventory.d.ts +2 -2
  199. package/src/shade/playground/basis_textures/texture_inventory.d.ts.map +1 -1
  200. package/src/shade/playground/basis_textures/texture_inventory.js +6 -7
  201. package/src/shade/playground/ground_seam/main.d.ts.map +1 -1
  202. package/src/shade/playground/ground_seam/main.js +13 -4
  203. package/src/shade/playground/ground_seam/make_ground.d.ts +13 -4
  204. package/src/shade/playground/ground_seam/make_ground.d.ts.map +1 -1
  205. package/src/shade/playground/ground_seam/make_ground.js +21 -16
  206. package/src/shade/playground/particle_ecs/bonfire_editor.js +3 -3
  207. package/src/shade/playground/particle_system/main.js +11 -10
  208. package/src/shade/playground/particle_system/particle_prototype.d.ts +15 -10
  209. package/src/shade/playground/particle_system/particle_prototype.d.ts.map +1 -1
  210. package/src/shade/playground/particle_system/particle_prototype.js +56 -15
  211. package/src/shade/playground/particle_system/particle_scene.d.ts +68 -28
  212. package/src/shade/playground/particle_system/particle_scene.d.ts.map +1 -1
  213. package/src/shade/playground/particle_system/particle_scene.js +149 -53
  214. package/src/shade/playground/readback_crossover/index.html +41 -0
  215. package/src/shade/playground/readback_crossover/main.d.ts +2 -0
  216. package/src/shade/playground/readback_crossover/main.d.ts.map +1 -0
  217. package/src/shade/playground/readback_crossover/main.js +372 -0
  218. package/src/shade/playground/skinned_blas_refit/README.md +11 -7
  219. package/src/shade/playground/skinned_blas_refit/add_floor.d.ts +13 -44
  220. package/src/shade/playground/skinned_blas_refit/add_floor.d.ts.map +1 -1
  221. package/src/shade/playground/skinned_blas_refit/add_floor.js +19 -59
  222. package/src/shade/playground/skinned_blas_refit/main.d.ts.map +1 -1
  223. package/src/shade/playground/skinned_blas_refit/main.js +67 -58
  224. package/src/shade/playground/skinned_blas_refit/place_character.d.ts +40 -54
  225. package/src/shade/playground/skinned_blas_refit/place_character.d.ts.map +1 -1
  226. package/src/shade/playground/skinned_blas_refit/place_character.js +47 -74
  227. package/src/shade/playground/skinned_blas_refit/sweep_views.d.ts +3 -3
  228. package/src/shade/playground/skinned_blas_refit/sweep_views.d.ts.map +1 -1
  229. package/src/shade/playground/skinned_blas_refit/sweep_views.js +4 -3
  230. package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.d.ts +3 -3
  231. package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.d.ts.map +1 -1
  232. package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.js +11 -4
  233. package/src/shade/playground/skinned_blas_refit/verify_instance_bounds.d.ts.map +1 -1
  234. package/src/shade/playground/skinned_blas_refit/verify_instance_bounds.js +38 -9
  235. package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.d.ts +3 -3
  236. package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.d.ts.map +1 -1
  237. package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.js +9 -6
  238. package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.d.ts +3 -3
  239. package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.d.ts.map +1 -1
  240. package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.js +3 -3
  241. package/src/shade/playground/skinned_mesh_soup/README.md +6 -6
  242. package/src/shade/playground/skinned_mesh_soup/main.d.ts.map +1 -1
  243. package/src/shade/playground/skinned_mesh_soup/main.js +44 -102
  244. package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.d.ts +5 -5
  245. package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.d.ts.map +1 -1
  246. package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.js +42 -33
  247. package/src/shade/playground/sponza_path_trace/main.d.ts +1 -0
  248. package/src/shade/playground/sponza_path_trace/main.d.ts.map +1 -1
  249. package/src/shade/playground/sponza_path_trace/main.js +393 -363
  250. package/src/shade/playground/ssr_reprojection/main.js +11 -9
  251. package/src/shade/playground/ssr_reprojection/scene.d.ts +15 -4
  252. package/src/shade/playground/ssr_reprojection/scene.d.ts.map +1 -1
  253. package/src/shade/playground/ssr_reprojection/scene.js +32 -11
  254. package/src/shade/playground/ssr_variance/main.js +1 -1
  255. package/src/shade/playground/ssr_variance/scene.d.ts +10 -4
  256. package/src/shade/playground/ssr_variance/scene.d.ts.map +1 -1
  257. package/src/shade/playground/ssr_variance/scene.js +39 -15
  258. package/src/shade/playground/vgeo_viewer/main.js +6 -2
  259. package/src/shade/playground/volumetrics_froxel/main.d.ts.map +1 -1
  260. package/src/shade/playground/volumetrics_froxel/main.js +936 -922
  261. package/src/shade/renderer/GraphicsContext.d.ts +7 -0
  262. package/src/shade/renderer/GraphicsContext.d.ts.map +1 -1
  263. package/src/shade/renderer/GraphicsContext.js +11 -0
  264. package/src/shade/renderer/Renderer.d.ts +3 -2
  265. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  266. package/src/shade/renderer/Renderer.js +3 -2
  267. package/src/shade/renderer/animation/GPUAnimationManager.d.ts +39 -47
  268. package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
  269. package/src/shade/renderer/animation/GPUAnimationManager.js +319 -256
  270. package/src/shade/renderer/animation/ShadeAnimationChannel.d.ts +26 -22
  271. package/src/shade/renderer/animation/ShadeAnimationChannel.d.ts.map +1 -1
  272. package/src/shade/renderer/animation/ShadeAnimationChannel.js +28 -23
  273. package/src/shade/renderer/animation/ShadeAnimationClip.d.ts +14 -6
  274. package/src/shade/renderer/animation/ShadeAnimationClip.d.ts.map +1 -1
  275. package/src/shade/renderer/animation/ShadeAnimationClip.js +20 -8
  276. package/src/shade/renderer/animation/Skin.d.ts +19 -19
  277. package/src/shade/renderer/animation/Skin.d.ts.map +1 -1
  278. package/src/shade/renderer/animation/Skin.js +15 -13
  279. package/src/shade/renderer/animation/pose/pose_evaluate_local.d.ts +6 -5
  280. package/src/shade/renderer/animation/pose/pose_evaluate_local.d.ts.map +1 -1
  281. package/src/shade/renderer/animation/pose/pose_evaluate_local.js +9 -9
  282. package/src/shade/renderer/animation/skin_clip_scale_conflicts.d.ts +5 -59
  283. package/src/shade/renderer/animation/skin_clip_scale_conflicts.d.ts.map +1 -1
  284. package/src/shade/renderer/animation/skin_clip_scale_conflicts.js +8 -132
  285. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts +65 -62
  286. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
  287. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +148 -194
  288. package/src/shade/renderer/animation/skinning/SKINNING_BINDING_STRUCT.d.ts.map +1 -1
  289. package/src/shade/renderer/animation/skinning/SKINNING_BINDING_STRUCT.js +4 -7
  290. package/src/shade/renderer/animation/skinning/chunk_skin_blend_mesh_local.d.ts +2 -2
  291. package/src/shade/renderer/animation/skinning/chunk_skin_blend_mesh_local.js +2 -2
  292. package/src/shade/renderer/buffer/GPUBufferReadbackAllocator.d.ts +74 -0
  293. package/src/shade/renderer/buffer/GPUBufferReadbackAllocator.d.ts.map +1 -0
  294. package/src/shade/renderer/buffer/GPUBufferReadbackAllocator.js +240 -0
  295. package/src/shade/renderer/buffer/table/GPUDatabase.d.ts +14 -0
  296. package/src/shade/renderer/buffer/table/GPUDatabase.d.ts.map +1 -1
  297. package/src/shade/renderer/buffer/table/GPUDatabase.js +64 -6
  298. package/src/shade/renderer/buffer/table/GPUDatabaseReadback.d.ts +190 -0
  299. package/src/shade/renderer/buffer/table/GPUDatabaseReadback.d.ts.map +1 -0
  300. package/src/shade/renderer/buffer/table/GPUDatabaseReadback.js +1323 -0
  301. package/src/shade/renderer/buffer/table/GPUPageMetadata.d.ts +10 -0
  302. package/src/shade/renderer/buffer/table/GPUPageMetadata.d.ts.map +1 -1
  303. package/src/shade/renderer/buffer/table/GPUPageMetadata.js +12 -0
  304. package/src/shade/renderer/buffer/table/GPUReadbackStagingRing.d.ts +96 -0
  305. package/src/shade/renderer/buffer/table/GPUReadbackStagingRing.d.ts.map +1 -0
  306. package/src/shade/renderer/buffer/table/GPUReadbackStatus.d.ts +15 -0
  307. package/src/shade/renderer/buffer/table/GPUReadbackStatus.d.ts.map +1 -0
  308. package/src/shade/renderer/buffer/table/GPUReadbackStatus.js +34 -0
  309. package/src/shade/renderer/buffer/table/GPUTypedTable.d.ts +75 -7
  310. package/src/shade/renderer/buffer/table/GPUTypedTable.d.ts.map +1 -1
  311. package/src/shade/renderer/buffer/table/GPUTypedTable.js +518 -135
  312. package/src/shade/renderer/buffer/table/GPU_TABLE_GATHER_DESCRIPTOR_WORDS.d.ts +19 -0
  313. package/src/shade/renderer/buffer/table/GPU_TABLE_GATHER_DESCRIPTOR_WORDS.d.ts.map +1 -0
  314. package/src/shade/renderer/buffer/table/GPU_TABLE_GATHER_DESCRIPTOR_WORDS.js +18 -0
  315. package/src/shade/renderer/buffer/table/WordViews.d.ts +39 -0
  316. package/src/shade/renderer/buffer/table/WordViews.d.ts.map +1 -0
  317. package/src/shade/renderer/buffer/table/WordViews.js +62 -0
  318. package/src/shade/renderer/buffer/table/gpu_table_gather_shader.d.ts +27 -0
  319. package/src/shade/renderer/buffer/table/gpu_table_gather_shader.d.ts.map +1 -0
  320. package/src/shade/renderer/buffer/table/gpu_table_gather_shader.js +117 -0
  321. package/src/shade/renderer/buffer/table/serde/generate_record_writer.d.ts +121 -0
  322. package/src/shade/renderer/buffer/table/serde/generate_record_writer.d.ts.map +1 -0
  323. package/src/shade/renderer/buffer/table/serde/generate_record_writer.js +395 -0
  324. package/src/shade/renderer/buffer/table/single/GPUSingleTypeTable.d.ts.map +1 -1
  325. package/src/shade/renderer/buffer/table/single/GPUSingleTypeTable.js +70 -20
  326. package/src/shade/renderer/dynamic/GPUDynamicMeshResidency.js +1 -1
  327. package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts.map +1 -1
  328. package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.js +6 -5
  329. package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.d.ts +3 -3
  330. package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.d.ts.map +1 -1
  331. package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.js +15 -11
  332. package/src/shade/renderer/global_illumination/brick4/cpu/brick4_bake_for_scene.d.ts +1 -1
  333. package/src/shade/renderer/global_illumination/brick4/cpu/brick4_bake_for_scene.js +4 -4
  334. package/src/shade/renderer/global_illumination/brick4/cpu/brick4_generate_tree_from_scene.d.ts +1 -3
  335. package/src/shade/renderer/global_illumination/brick4/cpu/brick4_generate_tree_from_scene.d.ts.map +1 -1
  336. package/src/shade/renderer/global_illumination/brick4/cpu/brick4_generate_tree_from_scene.js +5 -4
  337. package/src/shade/renderer/global_illumination/brick4/gpu/bake/brick4_bake_basic.js +1 -1
  338. package/src/shade/renderer/global_illumination/lpv/bake/GPULightProbeVolumeRenderer.d.ts.map +1 -1
  339. package/src/shade/renderer/global_illumination/lpv/bake/GPULightProbeVolumeRenderer.js +1 -4
  340. package/src/shade/renderer/global_illumination/lpv/lpv_visualise_probes.d.ts +8 -3
  341. package/src/shade/renderer/global_illumination/lpv/lpv_visualise_probes.d.ts.map +1 -1
  342. package/src/shade/renderer/global_illumination/lpv/lpv_visualise_probes.js +19 -14
  343. package/src/shade/renderer/global_illumination/lpv/placement/graph_generate_probe_locations.d.ts.map +1 -1
  344. package/src/shade/renderer/global_illumination/lpv/placement/graph_generate_probe_locations.js +9 -1
  345. package/src/shade/renderer/global_illumination/lpv/placement/software/lpv_generate_probe_locations2.d.ts +3 -3
  346. package/src/shade/renderer/global_illumination/lpv/placement/software/lpv_generate_probe_locations2.d.ts.map +1 -1
  347. package/src/shade/renderer/global_illumination/lpv/placement/software/lpv_generate_probe_locations2.js +12 -5
  348. package/src/shade/renderer/global_illumination/probe/octahedral/GPUProbeAtlas.js +1 -1
  349. package/src/shade/renderer/light/GPULightCollection.d.ts +29 -0
  350. package/src/shade/renderer/light/GPULightCollection.d.ts.map +1 -1
  351. package/src/shade/renderer/light/GPULightCollection.js +444 -329
  352. package/src/shade/renderer/light/LIGHT_DATABASE_SPEC.d.ts.map +1 -1
  353. package/src/shade/renderer/light/LIGHT_DATABASE_SPEC.js +7 -1
  354. package/src/shade/renderer/light/LightCollection.d.ts +29 -1
  355. package/src/shade/renderer/light/LightCollection.d.ts.map +1 -1
  356. package/src/shade/renderer/light/LightCollection.js +50 -1
  357. package/src/shade/renderer/light/make_sunlight.js +2 -2
  358. package/src/shade/renderer/light/model/Light.d.ts +29 -2
  359. package/src/shade/renderer/light/model/Light.d.ts.map +1 -1
  360. package/src/shade/renderer/light/model/Light.js +30 -2
  361. package/src/shade/renderer/light/model/io/light_record_directional.d.ts +3 -1
  362. package/src/shade/renderer/light/model/io/light_record_directional.d.ts.map +1 -1
  363. package/src/shade/renderer/light/model/io/light_record_directional.js +8 -5
  364. package/src/shade/renderer/light/model/io/light_record_point.d.ts +3 -1
  365. package/src/shade/renderer/light/model/io/light_record_point.d.ts.map +1 -1
  366. package/src/shade/renderer/light/model/io/light_record_point.js +5 -2
  367. package/src/shade/renderer/light/model/io/light_record_spot.d.ts +4 -1
  368. package/src/shade/renderer/light/model/io/light_record_spot.d.ts.map +1 -1
  369. package/src/shade/renderer/light/model/io/light_record_spot.js +10 -6
  370. package/src/shade/renderer/light/place_light.d.ts +16 -0
  371. package/src/shade/renderer/light/place_light.d.ts.map +1 -0
  372. package/src/shade/renderer/light/place_light.js +36 -0
  373. package/src/shade/renderer/light/shader_refresh_light_poses.d.ts +44 -0
  374. package/src/shade/renderer/light/shader_refresh_light_poses.d.ts.map +1 -0
  375. package/src/shade/renderer/light/shader_refresh_light_poses.js +154 -0
  376. package/src/shade/renderer/lightmap/GPULightMap.js +1 -1
  377. package/src/shade/renderer/lightmap/bake/raster/graph_draw_lightmap_viz_buffer.d.ts.map +1 -1
  378. package/src/shade/renderer/lightmap/bake/raster/graph_draw_lightmap_viz_buffer.js +12 -14
  379. package/src/shade/renderer/loader/SceneBundle.d.ts +53 -28
  380. package/src/shade/renderer/loader/SceneBundle.d.ts.map +1 -1
  381. package/src/shade/renderer/loader/SceneBundle.js +111 -56
  382. package/src/shade/renderer/loader/SceneNode.d.ts +81 -0
  383. package/src/shade/renderer/loader/SceneNode.d.ts.map +1 -0
  384. package/src/shade/renderer/loader/SceneNode.js +114 -0
  385. package/src/shade/renderer/loader/gltf/load_gltf.d.ts +3 -2
  386. package/src/shade/renderer/loader/gltf/load_gltf.d.ts.map +1 -1
  387. package/src/shade/renderer/loader/gltf/load_gltf.js +110 -142
  388. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  389. package/src/shade/renderer/loader/usd/UsdExtensionRegistry.d.ts +4 -4
  390. package/src/shade/renderer/loader/usd/UsdExtensionRegistry.d.ts.map +1 -1
  391. package/src/shade/renderer/loader/usd/UsdExtensionRegistry.js +2 -2
  392. package/src/shade/renderer/loader/usd/load_usd.d.ts +3 -2
  393. package/src/shade/renderer/loader/usd/load_usd.d.ts.map +1 -1
  394. package/src/shade/renderer/loader/usd/load_usd.js +4 -5
  395. package/src/shade/renderer/loader/usd/usd_build_scene.d.ts +3 -3
  396. package/src/shade/renderer/loader/usd/usd_build_scene.d.ts.map +1 -1
  397. package/src/shade/renderer/loader/usd/usd_build_scene.js +47 -55
  398. package/src/shade/renderer/material/GPUMaterialManager.js +1 -1
  399. package/src/shade/renderer/material/resident/GPUResidentMaterialContext.d.ts +5 -4
  400. package/src/shade/renderer/material/resident/GPUResidentMaterialContext.d.ts.map +1 -1
  401. package/src/shade/renderer/material/resident/GPUResidentMaterialContext.js +8 -15
  402. package/src/shade/renderer/object_property/shader_refresh_all_mesh_bounds.d.ts +15 -13
  403. package/src/shade/renderer/object_property/shader_refresh_all_mesh_bounds.d.ts.map +1 -1
  404. package/src/shade/renderer/object_property/shader_refresh_all_mesh_bounds.js +40 -21
  405. package/src/shade/renderer/particles/DESIGN.md +53 -50
  406. package/src/shade/renderer/particles/GPUParticleSystem.d.ts +31 -17
  407. package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
  408. package/src/shade/renderer/particles/GPUParticleSystem.js +54 -91
  409. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts +12 -11
  410. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts.map +1 -1
  411. package/src/shade/renderer/particles/runtime/EmitterRegistry.js +12 -11
  412. package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.d.ts +13 -19
  413. package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.d.ts.map +1 -1
  414. package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.js +19 -25
  415. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts +34 -24
  416. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts.map +1 -1
  417. package/src/shade/renderer/particles/runtime/ParticleEmitter.js +53 -40
  418. package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.js +1 -1
  419. package/src/shade/renderer/path_tracer/graph_path_trace_scene.js +1 -1
  420. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  421. package/src/shade/renderer/rasterize/expand/bucket/mesh/graph_meshes_classify_buckets.d.ts.map +1 -1
  422. package/src/shade/renderer/rasterize/expand/bucket/mesh/graph_meshes_classify_buckets.js +2 -1
  423. package/src/shade/renderer/rasterize/expand/bucket/mesh/graph_scene_meshes_cull_and_classify_buckets.d.ts.map +1 -1
  424. package/src/shade/renderer/rasterize/expand/bucket/mesh/graph_scene_meshes_cull_and_classify_buckets.js +5 -2
  425. package/src/shade/renderer/rasterize/fast/graph_rasterize_scene_fast.js +1 -1
  426. package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.js +1 -1
  427. package/src/shade/renderer/rasterize/native/graph_rasterize_meshes_alpha_tested.js +1 -1
  428. package/src/shade/renderer/rasterize/native/oit/graph_rasterize_meshes_transparent_oit.js +1 -1
  429. package/src/shade/renderer/rasterize/standard/graph_rasterize_scene.js +1 -1
  430. package/src/shade/renderer/scene/DynamicMesh.d.ts +13 -4
  431. package/src/shade/renderer/scene/DynamicMesh.d.ts.map +1 -1
  432. package/src/shade/renderer/scene/DynamicMesh.js +14 -4
  433. package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.d.ts +38 -18
  434. package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.d.ts.map +1 -1
  435. package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.js +112 -60
  436. package/src/shade/renderer/scene/GPUSceneContext.d.ts +55 -48
  437. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  438. package/src/shade/renderer/scene/GPUSceneContext.js +594 -928
  439. package/src/shade/renderer/scene/NODE3D_STRUCT.d.ts +5 -5
  440. package/src/shade/renderer/scene/NODE3D_STRUCT.js +5 -5
  441. package/src/shade/renderer/scene/Node3D.d.ts +27 -8
  442. package/src/shade/renderer/scene/Node3D.d.ts.map +1 -1
  443. package/src/shade/renderer/scene/Node3DDirtyList.d.ts +59 -0
  444. package/src/shade/renderer/scene/Node3DDirtyList.d.ts.map +1 -0
  445. package/src/shade/renderer/scene/Scene.d.ts +18 -60
  446. package/src/shade/renderer/scene/Scene.d.ts.map +1 -1
  447. package/src/shade/renderer/scene/Scene.js +53 -146
  448. package/src/shade/renderer/scene/SkinnedMesh.d.ts +10 -93
  449. package/src/shade/renderer/scene/SkinnedMesh.d.ts.map +1 -1
  450. package/src/shade/renderer/scene/bvh/StaticSceneBVH.d.ts +24 -3
  451. package/src/shade/renderer/scene/bvh/StaticSceneBVH.d.ts.map +1 -1
  452. package/src/shade/renderer/scene/bvh/StaticSceneBVH.js +53 -13
  453. package/src/shade/renderer/scene/hierarchy/graph_scene_update_transform_hierarchy.d.ts +5 -6
  454. package/src/shade/renderer/scene/hierarchy/graph_scene_update_transform_hierarchy.d.ts.map +1 -1
  455. package/src/shade/renderer/scene/hierarchy/graph_scene_update_transform_hierarchy.js +5 -6
  456. package/src/shade/renderer/scene/optimization/scene_optimize.d.ts +10 -2
  457. package/src/shade/renderer/scene/optimization/scene_optimize.d.ts.map +1 -1
  458. package/src/shade/renderer/scene/optimization/scene_optimize.js +266 -230
  459. package/src/shade/renderer/scene/rows/GPUEntityBoundsReadback.d.ts +53 -0
  460. package/src/shade/renderer/scene/rows/GPUEntityBoundsReadback.d.ts.map +1 -0
  461. package/src/shade/renderer/scene/rows/GPUEntityBoundsReadback.js +144 -0
  462. package/src/shade/renderer/scene/rows/GPUSceneRows.d.ts +227 -0
  463. package/src/shade/renderer/scene/rows/GPUSceneRows.d.ts.map +1 -0
  464. package/src/shade/renderer/scene/rows/GPUSceneRows.js +1136 -0
  465. package/src/shade/renderer/scene/rows/place_primitive.d.ts +48 -0
  466. package/src/shade/renderer/scene/rows/place_primitive.d.ts.map +1 -0
  467. package/src/shade/renderer/scene/rows/place_primitive.js +98 -0
  468. package/src/shade/renderer/scene/serialization/deserialize_scene.d.ts +10 -8
  469. package/src/shade/renderer/scene/serialization/deserialize_scene.d.ts.map +1 -1
  470. package/src/shade/renderer/scene/serialization/deserialize_scene.js +24 -27
  471. package/src/shade/renderer/scene/serialization/serialize_scene.d.ts +9 -2
  472. package/src/shade/renderer/scene/serialization/serialize_scene.d.ts.map +1 -1
  473. package/src/shade/renderer/scene/serialization/serialize_scene.js +25 -4
  474. package/src/shade/renderer/scene/verify_gpu_tlas_build.js +2 -2
  475. package/src/shade/renderer/shader/chunk/light/DIRECTIONAL_LIGHT_STRUCT.d.ts.map +1 -1
  476. package/src/shade/renderer/shader/chunk/light/DIRECTIONAL_LIGHT_STRUCT.js +5 -0
  477. package/src/shade/renderer/shader/chunk/light/POINT_LIGHT_STRUCT.d.ts.map +1 -1
  478. package/src/shade/renderer/shader/chunk/light/POINT_LIGHT_STRUCT.js +5 -0
  479. package/src/shade/renderer/shader/chunk/light/SPOT_LIGHT_STRUCT.d.ts.map +1 -1
  480. package/src/shade/renderer/shader/chunk/light/SPOT_LIGHT_STRUCT.js +5 -0
  481. package/src/shade/renderer/shadow/map/DirectionalLightShadowmap.d.ts +39 -0
  482. package/src/shade/renderer/shadow/map/DirectionalLightShadowmap.d.ts.map +1 -1
  483. package/src/shade/renderer/shadow/map/DirectionalLightShadowmap.js +112 -64
  484. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts +7 -0
  485. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts.map +1 -1
  486. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +1541 -1352
  487. package/src/shade/renderer/shadow/map/PointLightShadowmap.js +1 -1
  488. package/src/shade/renderer/shadow/map/SpotLightShadowmap.js +1 -1
  489. package/src/shade/renderer/shadow/map/TetrahedronPointLightShadowmap.js +1 -1
  490. package/src/shade/renderer/shadow/map/csm/CSM_CASTER_RANGE_STRUCT.d.ts +29 -0
  491. package/src/shade/renderer/shadow/map/csm/CSM_CASTER_RANGE_STRUCT.d.ts.map +1 -0
  492. package/src/shade/renderer/shadow/map/csm/CSM_CASTER_RANGE_STRUCT.js +43 -0
  493. package/src/shade/renderer/shadow/map/csm/SHADOWMAP_CSM_CASTER_RANGE_MARGIN_FRACTION.d.ts +13 -0
  494. package/src/shade/renderer/shadow/map/csm/SHADOWMAP_CSM_CASTER_RANGE_MARGIN_FRACTION.d.ts.map +1 -0
  495. package/src/shade/renderer/shadow/map/csm/SHADOWMAP_CSM_CASTER_RANGE_MARGIN_FRACTION.js +12 -0
  496. package/src/shade/renderer/shadow/map/csm/shader/shader_csm_caster_range.d.ts +49 -0
  497. package/src/shade/renderer/shadow/map/csm/shader/shader_csm_caster_range.d.ts.map +1 -0
  498. package/src/shade/renderer/shadow/map/csm/shader/shader_csm_caster_range.js +194 -0
  499. package/src/shade/renderer/shadow/map/csm_debug_draw_preview.js +1 -1
  500. package/src/shade/renderer/shadow/map/shadowmap_update_score.js +1 -1
  501. package/src/shade/renderer/shadow/ray/RTXShadows.js +1 -1
  502. package/src/shade/renderer/shadow/ray/staged/trace/graph_trace_rays.js +1 -1
  503. package/src/shade/renderer/shadow/sdf/cascade/CascadedSceneSDF.d.ts.map +1 -1
  504. package/src/shade/renderer/shadow/sdf/cascade/CascadedSceneSDF.js +3 -1
  505. package/src/shade/renderer/texture/bindless/GPUBindlessTextureManager.js +8 -8
  506. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
  507. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +4 -3
  508. package/src/engine/graphics3/instantiate_scene_bundle.js +0 -164
  509. package/src/engine/graphics3/shade_node_to_entity_composition.js +0 -88
  510. package/src/shade/renderer/animation/compute_skin_world_bounds.js +0 -146
  511. package/src/shade/renderer/animation/compute_skinned_mesh_clip_bounding_sphere.js +0 -531
  512. package/src/shade/renderer/animation/pose/pose_evaluate_world.js +0 -76
  513. package/src/shade/renderer/animation/skin_bind_transform.js +0 -33
  514. package/src/shade/renderer/animation/skin_frame_defect.js +0 -132
  515. package/src/shade/renderer/animation/skin_joint_matrix.js +0 -46
  516. package/src/shade/renderer/animation/skin_normalize_mesh_frame.js +0 -216
  517. package/src/shade/renderer/scene/InstanceBatch.js +0 -235
  518. package/src/shade/renderer/scene/Mesh.js +0 -168
  519. package/src/shade/renderer/scene/Node3D.js +0 -263
  520. package/src/shade/renderer/scene/SceneNodeBinding.js +0 -56
  521. package/src/shade/renderer/scene/SkinnedMesh.js +0 -170
  522. package/src/shade/renderer/scene/TransformAuthority.js +0 -33
@@ -1,115 +1,58 @@
1
- import { quat3_multiply } from "../../../../core/geom/3d/quaternion/quat3_multiply.js";
2
- import { v3_quaternion_apply } from "../../../../core/geom/vec3/v3_quaternion_apply.js";
3
- import {
4
- TRANSFORM64_ROTATION_OFFSET,
5
- TRANSFORM64_TRANSLATION_OFFSET
6
- } from "../../../ecs/transform/Transform64.js";
7
- import { cloth_reconstruct_pose } from "./cloth_reconstruct_pose.js";
8
- import { cloth_write_local_pose } from "./cloth_write_back.js";
9
-
10
- /**
11
- * # Putting the answer back onto a skinned model's joints — §11.2
12
- *
13
- * The same reconstruction the entity path uses, written onto `Node3D`s instead
14
- * of onto entities. **Cloth moves joints; it does not produce vertices** — the
15
- * mapping from a simulated joint to a render vertex already exists in this
16
- * engine and it is the skin, so the existing skinning pass does the rest,
17
- * including bounds refresh and BLAS refit that a bespoke vertex-deformation
18
- * path would have to reimplement.
19
- *
20
- * ## `transform_local` is the output, and `transform_global` is written too
21
- *
22
- * `transform_local` is a joint's own truth and the handle §11.2 names. It is
23
- * also *passive*: a `Node3D` does not track its components, and nothing
24
- * downstream sees a change until `updateMatrices` runs — which recurses into
25
- * every descendant, so calling it on the anchor would recompose the whole
26
- * character every fixed step to move a cape.
27
- *
28
- * So this pass composes the cloth subtree's `transform_global` itself, which
29
- * costs nothing because the pose is already in hand, and bumps each joint's
30
- * version through `needsUpdate` so the renderer uploads the row. Nothing above
31
- * the anchor is touched and nothing below the garment is walked.
32
- *
33
- * `transform_global` is derived, so writing it is only ever a shortcut for the
34
- * recomposition it saves — and it is a *correct* shortcut only because this
35
- * pass has the anchor's world pose and the whole chain under it. Anything that
36
- * moves the anchor without telling cloth invalidates it, which is the same
37
- * contract every consumer of a derived transform already has.
38
- *
39
- * ## What is not here
40
- *
41
- * No announcement, and no pruned boundary. The entity path has both because its
42
- * subtree is an entity hierarchy with other things hanging off it; a proxy's
43
- * joint list is closed by construction, and a socket parented to a cape joint
44
- * follows it through the ordinary node hierarchy.
45
- *
46
- * @author Alex Goldring
47
- * @copyright Company Named Limited (c) 2026
48
- */
49
-
50
- /**
51
- * Write one cloth's solved pose onto the joints it drives.
52
- *
53
- * @param {ClothInstance} instance
54
- * @param {Transform64} anchor the anchor joint's **world** pose, evaluated by
55
- * the caller — see `ClothSystem` for why it is not read off the node
56
- * @returns {void}
57
- */
58
- export function cloth_write_back_rig(instance, anchor) {
59
- cloth_reconstruct_pose(instance);
60
-
61
- const node_count = instance.node_count;
62
-
63
- const blended = instance.blended_position;
64
- const reconstructed = instance.blended_rotation;
65
-
66
- const ax = anchor[TRANSFORM64_TRANSLATION_OFFSET];
67
- const ay = anchor[TRANSFORM64_TRANSLATION_OFFSET + 1];
68
- const az = anchor[TRANSFORM64_TRANSLATION_OFFSET + 2];
69
-
70
- const aqx = anchor[TRANSFORM64_ROTATION_OFFSET];
71
- const aqy = anchor[TRANSFORM64_ROTATION_OFFSET + 1];
72
- const aqz = anchor[TRANSFORM64_ROTATION_OFFSET + 2];
73
- const aqw = anchor[TRANSFORM64_ROTATION_OFFSET + 3];
74
-
75
- const parent = instance.node_parent;
76
- const node_joint = instance.node_joint;
77
-
78
- for (let node = 1; node < node_count; node++) {
79
- const joint = node_joint[node];
80
-
81
- if (joint === undefined || joint === null) {
82
- continue;
83
- }
84
-
85
- cloth_write_local_pose(joint.transform_local, instance, node, parent[node]);
86
-
87
- const global = joint.transform_global;
88
-
89
- const n = node * 3;
90
-
91
- v3_quaternion_apply(
92
- global, TRANSFORM64_TRANSLATION_OFFSET,
93
- blended[n], blended[n + 1], blended[n + 2],
94
- aqx, aqy, aqz, aqw
95
- );
96
-
97
- global[TRANSFORM64_TRANSLATION_OFFSET] += ax;
98
- global[TRANSFORM64_TRANSLATION_OFFSET + 1] += ay;
99
- global[TRANSFORM64_TRANSLATION_OFFSET + 2] += az;
100
-
101
- quat3_multiply(
102
- global, TRANSFORM64_ROTATION_OFFSET,
103
- aqx, aqy, aqz, aqw,
104
- reconstructed[node * 4], reconstructed[node * 4 + 1],
105
- reconstructed[node * 4 + 2], reconstructed[node * 4 + 3]
106
- );
107
-
108
- global.updateMatrix();
109
-
110
- // The version is what the renderer compares against to decide whether
111
- // to upload the row, so a joint whose transform changed and whose
112
- // version did not is a joint that moved nowhere.
113
- joint.needsUpdate = true;
114
- }
115
- }
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
+ }
@@ -12,7 +12,7 @@ free port if 5173 is busy — the terminal says which.)
12
12
  | [`index.html`](./index.html) | **the solver, M0.** `cloth_step` over a `ClothState`, no ECS at all. |
13
13
  | [`rig.html`](./rig.html) | **the entity subtree, M1.** A real `EntityManager`, real entities, `ClothSystem` walking and writing back. |
14
14
  | [`collide.html`](./collide.html) | **collision, M2.** The solver again, with a packed collider table in the argument list. |
15
- | [`garment.html`](./garment.html) | **skinned garments, M3, and self-collision, M4.** A `Node3D` skeleton, a `Skin`, and a `Cloth` + `ClothRig` driving some of its joints. |
15
+ | [`garment.html`](./garment.html) | **skinned garments, M3, and self-collision, M4.** A skeleton of entities, a `Skin`, and a `Cloth` + `ClothRig` driving some of its joints. |
16
16
 
17
17
  Both are at
18
18
  `http://localhost:5173/src/engine/physics/cloth/playground/<page>`.
@@ -260,14 +260,14 @@ does not fire in a hidden pane, so a driver calls `step_once` itself.
260
260
  ## What it is
261
261
 
262
262
  `rig.html` is a `Cloth` over an entity subtree; this is a `Cloth` + a `ClothRig`
263
- over a skinned model's **joints**. Every point on screen is a
264
- `Node3D.transform_global` — a joint of a `Skin`, not an entity — and it is where
265
- it is because the solver wrote its `transform_local` and this page composed the
266
- chain.
263
+ over a skinned model's **joints**. Every point on screen is a joint's
264
+ `Transform64` — an entity of the skeleton's prefab instance, named by a `Skin` —
265
+ and it is where it is because the solver wrote its attachment's local transform
266
+ and the attachment system composed the chain.
267
267
 
268
268
  `ClothSystem#models` takes a stub rather than a `MeshSystem` for the reason the
269
269
  field exists: a `MeshSystem` needs a graphics engine, a scene and a loader, and a
270
- garment's joints are a `Node3D` tree that needs none of the three. The stub
270
+ garment's joints are a prefab instance that needs none of the three. The stub
271
271
  answers exactly the one method the system calls.
272
272
 
273
273
  ## The garments
@@ -279,7 +279,7 @@ answers exactly the one method the system calls.
279
279
  - **coat tails** — three strips of nine in denim, which is the library entry that
280
280
  spends its two levers on particles rather than iterations.
281
281
  - **ponytail** — one chain of twelve off the neck. The rig path is the entity
282
- path with `Node3D`s in it, and a single chain is where that is most obviously
282
+ path over a skin's joints, and a single chain is where that is most obviously
283
283
  true.
284
284
  - **loincloth** — seven strips of five off the pelvis, and the one preset that
285
285
  spends most of its time against the leg colliders.
@@ -287,10 +287,10 @@ answers exactly the one method the system calls.
287
287
  ## The motion drives the character, and only the character
288
288
 
289
289
  The buttons write the **character's own bones**. The garment's joints are
290
- cloth's, and the seed says so: it claims `TransformAuthority.CPU` on every one of
291
- them, because a joint a clip drives is under GPU authority and its
292
- `transform_local` is not read by anything. Two writers of one row is the race the
293
- authority enum exists to prevent, and the claim is where a garment whose joints
290
+ cloth's, and the seed says so: it revokes the GPU's authority over the attachment
291
+ of every one of them, because a joint a clip drives is the GPU's and its local
292
+ transform is not read by anything. Two writers of one row is the race the
293
+ authority flags exist to prevent, and the claim is where a garment whose joints
294
294
  are *also* keyed shows up as an authoring error.
295
295
 
296
296
  **sprint** is §7 P7's own profile: a square wave in velocity, integrated. Written
@@ -74,5 +74,4 @@ export type GarmentScene = {
74
74
  import { EntityComponentDataset } from "../../../ecs/EntityComponentDataset.js";
75
75
  import { ClothSystem } from "../ecs/ClothSystem.js";
76
76
  import { ClothColliderSystem } from "../ecs/ClothColliderSystem.js";
77
- import { Node3D } from "../../../../shade/renderer/scene/Node3D.js";
78
77
  //# sourceMappingURL=garment_build.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"garment_build.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/playground/garment_build.js"],"names":[],"mappings":"AA2FA;;;GAGG;AACH,6FAHW,MAAM,GACJ,QAAQ,YAAY,CAAC,CA4EjC;AA8JD;;;;;;GAMG;AACH,8CAHW,MAAM,GACJ,IAAI,CA0BhB;AAhVD;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;GAYG;AAEH;;;;;;;IAqCE;;SAjDY,sBAAsB;WACtB,WAAW;eACX,mBAAmB;YACnB,MAAM;;;;UACN,MAAM;YACN,MAAM;;;;UACN,MAAM,EAAE;;;;WACR,MAAM,EAAE;;;;;UAER,MAAM,EAAE,EAAE;;uCA7Ce,wCAAwC;4BAcnD,uBAAuB;oCAHf,+BAA+B;uBAZ5C,4CAA4C"}
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,7 +1,10 @@
1
1
  import { CapsuleShape3D } from "../../../../core/geom/3d/shape/CapsuleShape3D.js";
2
2
  import { SphereShape3D } from "../../../../core/geom/3d/shape/SphereShape3D.js";
3
3
  import { Skin } from "../../../../shade/renderer/animation/Skin.js";
4
- import { Node3D } from "../../../../shade/renderer/scene/Node3D.js";
4
+ import { SceneBundle } from "../../../../shade/renderer/loader/SceneBundle.js";
5
+ import { SceneNode } from "../../../../shade/renderer/loader/SceneNode.js";
6
+ import { prefab_compile } from "../../../graphics3/prefab/prefab_compile.js";
7
+ import { prefab_instantiate } from "../../../graphics3/prefab/prefab_instantiate.js";
5
8
  import { EntityComponentDataset } from "../../../ecs/EntityComponentDataset.js";
6
9
  import { EntityManager } from "../../../ecs/EntityManager.js";
7
10
  import { TransformAttachment } from "../../../ecs/transform-attachment/TransformAttachment.js";
@@ -72,8 +75,8 @@ export const GARMENT_PRESETS = [
72
75
  {
73
76
  id: 'ponytail',
74
77
  label: 'ponytail — 1 × 12',
75
- blurb: 'One chain, deep. The rig path is the entity path with Node3Ds in it, and a single '
76
- + 'chain is where that is most obviously true.',
78
+ blurb: 'One chain, deep. The rig path is the entity path, and a single chain is where that '
79
+ + 'is most obviously true.',
77
80
  strips: 1,
78
81
  links: 12,
79
82
  dynamics: 'HAIR'
@@ -114,9 +117,8 @@ export async function build_garment({ preset, dynamics, links, spacing, collide,
114
117
 
115
118
  const entry = GARMENT_PRESETS.find(p => p.id === preset) ?? GARMENT_PRESETS[0];
116
119
 
117
- const skeleton = build_skeleton(entry, links, spacing);
118
-
119
- const { proxy, error } = cloth_proxy_from_joints(skeleton.skin, skeleton.garment_names, {
120
+ const skeleton = build_skeleton(ecd, entry, links, spacing);
121
+ const { proxy, error } = cloth_proxy_from_joints(skeleton.prefab, skeleton.skin, skeleton.garment_names, {
120
122
  name: entry.label
121
123
  });
122
124
 
@@ -143,7 +145,9 @@ export async function build_garment({ preset, dynamics, links, spacing, collide,
143
145
 
144
146
  ecd.addComponentToEntity(entity, Cloth.from(fabric, { flags: ClothFlags.NeverSleep }));
145
147
 
146
- cloth.models = { instance_of: () => ({ skins: [skeleton.skin] }) };
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 };
147
151
 
148
152
  if (collide) {
149
153
  add_body_colliders(ecd, skeleton);
@@ -152,11 +156,11 @@ export async function build_garment({ preset, dynamics, links, spacing, collide,
152
156
  // One step so the seed runs and the bind pose is on the joints.
153
157
  cloth.fixedUpdate(1 / 60);
154
158
 
155
- const bind = skeleton.joint.map(node => [
156
- node.transform_global.translation[0],
157
- node.transform_global.translation[1],
158
- node.transform_global.translation[2]
159
- ]);
159
+ const bind = skeleton.joint.map(entity => {
160
+ const t = ecd.getComponent(entity, Transform64).translation;
161
+
162
+ return [t[0], t[1], t[2]];
163
+ });
160
164
 
161
165
  return {
162
166
  ecd,
@@ -173,38 +177,26 @@ export async function build_garment({ preset, dynamics, links, spacing, collide,
173
177
  * A character: pelvis, spine, shoulders, two legs, and the garment's own strips
174
178
  * hanging from whichever bone the preset says.
175
179
  *
180
+ * @param {EntityComponentDataset} ecd the page's dataset, which the character becomes entities of
176
181
  * @param {object} entry
177
182
  * @param {number} links
178
183
  * @param {number} spacing
179
- * @returns {object}
184
+ * @returns {object} the bones and the garment's joints as entities, the prefab and its instance
180
185
  * @private
181
186
  */
182
- function build_skeleton(entry, links, spacing) {
183
- /** @type {Node3D[]} */
184
- const joints = [];
187
+ function build_skeleton(ecd, entry, links, spacing) {
188
+ // the character as a loader would describe it: nodes in pre-order, every one a joint of the skin
189
+ const bundle = new SceneBundle();
185
190
 
186
191
  /**
187
192
  * @param {string} name
188
- * @param {Node3D|null} parent
193
+ * @param {number} parent
189
194
  * @param {number[]} offset
190
- * @returns {Node3D}
195
+ * @returns {number} the node's index
191
196
  */
192
- const bone = (name, parent, offset) => {
193
- const node = new Node3D();
194
-
195
- node.name = name;
196
- node.transform_local.setTranslation(offset[0], offset[1], offset[2]);
197
-
198
- if (parent !== null) {
199
- parent.addChild(node);
200
- }
201
-
202
- joints.push(node);
197
+ const bone = (name, parent, offset) => bundle.add_node(SceneNode.from({ name, parent, translation: offset }));
203
198
 
204
- return node;
205
- };
206
-
207
- const root = bone('root', null, [0, 0, 0]);
199
+ const root = bone('root', -1, [0, 0, 0]);
208
200
  const pelvis = bone('pelvis', root, [0, 0.95, 0]);
209
201
  const spine = bone('spine', pelvis, [0, 0.22, 0]);
210
202
  const chest = bone('chest', spine, [0, 0.2, 0]);
@@ -218,15 +210,13 @@ function build_skeleton(entry, links, spacing) {
218
210
  bone('knee_l', left_leg, [0, -0.42, 0]);
219
211
  bone('knee_r', right_leg, [0, -0.42, 0]);
220
212
 
221
- const character = joints.slice();
213
+ const character_count = bundle.nodes.length;
222
214
 
223
215
  // The garment hangs from the chest for a cape and from the pelvis for a
224
216
  // loincloth, which is the difference between the two presets.
225
217
  const from = entry.id === 'loincloth' ? pelvis : (entry.id === 'ponytail' ? neck : chest);
226
218
 
227
219
  const garment_names = [];
228
- const garment = [];
229
-
230
220
  const strips = entry.strips;
231
221
 
232
222
  for (let s = 0; s < strips; s++) {
@@ -235,8 +225,10 @@ function build_skeleton(entry, links, spacing) {
235
225
  let parent = from;
236
226
 
237
227
  for (let i = 0; i < links; i++) {
238
- const node = bone(
239
- `garment_${s}_${i}`,
228
+ const name = `garment_${s}_${i}`;
229
+
230
+ parent = bone(
231
+ name,
240
232
  parent,
241
233
  i === 0
242
234
  // The first link carries the strip sideways and behind, so
@@ -252,25 +244,40 @@ function build_skeleton(entry, links, spacing) {
252
244
  : [0, -spacing, -spacing * 0.05]
253
245
  );
254
246
 
255
- garment_names.push(node.name);
256
- garment.push(node);
257
-
258
- parent = node;
247
+ garment_names.push(name);
259
248
  }
260
249
  }
261
250
 
262
- root.updateMatrices();
251
+ const joints = bundle.nodes.map((_node, index) => index);
252
+
253
+ bundle.skins = [Skin.from({
254
+ joints,
255
+ inverse_bind_matrices: new Float32Array(joints.length * 16)
256
+ })];
257
+
258
+ const prefab = prefab_compile(bundle);
259
+
260
+ // the character is entities of the page's dataset, under a placement standing at the origin;
261
+ // the attachment system composes every joint's world from there, the way a rig's would
262
+ const placement = ecd.createEntity();
263
+ const placement_transform = new Transform64();
264
+
265
+ placement_transform.updateMatrix();
266
+
267
+ ecd.addComponentToEntity(placement, placement_transform);
268
+
269
+ const instance = prefab_instantiate(prefab, ecd, placement);
263
270
 
264
271
  return {
265
- root,
266
- pelvis,
267
- bone: character,
268
- joint: garment,
272
+ prefab,
273
+ instance,
274
+ placement,
275
+ root: instance.entity_of('root'),
276
+ pelvis: instance.entity_of('pelvis'),
277
+ bone: bundle.nodes.slice(0, character_count).map(node => instance.entity_of(node.name)),
278
+ joint: garment_names.map(name => instance.entity_of(name)),
269
279
  garment_names,
270
- skin: Skin.from({
271
- joints,
272
- inverse_bind_matrices: new Float32Array(joints.length * 16)
273
- })
280
+ skin: prefab.skins[0]
274
281
  };
275
282
  }
276
283
 
@@ -278,7 +285,7 @@ function build_skeleton(entry, links, spacing) {
278
285
  * Capsules on the character's own bones, opted into cloth the way any collider
279
286
  * is: a `ClothCollider` beside an existing `(Collider, Transform64)`.
280
287
  *
281
- * They are entities rather than nodes because that is what a `ClothCollider`
288
+ * They are entities of their own because that is what a `ClothCollider`
282
289
  * is — §3.5's "the `RigidBody`-analogue" — and because a character's collision
283
290
  * capsules are authored as entities in a real scene too. The page keeps their
284
291
  * transforms in step with the bones by hand, which is what a rig would do.
@@ -288,7 +295,7 @@ function build_skeleton(entry, links, spacing) {
288
295
  * @private
289
296
  */
290
297
  function add_body_colliders(ecd, skeleton) {
291
- const by_name = new Map(skeleton.bone.map(node => [node.name, node]));
298
+ const instance = skeleton.instance;
292
299
 
293
300
  const parts = [
294
301
  { bone: 'spine', shape: CapsuleShape3D.from(0.13, 0.3), offset: [0, 0.1, 0] },
@@ -300,9 +307,9 @@ function add_body_colliders(ecd, skeleton) {
300
307
  skeleton.body = [];
301
308
 
302
309
  for (const part of parts) {
303
- const node = by_name.get(part.bone);
310
+ const node = instance.entity_of(part.bone);
304
311
 
305
- if (node === undefined) {
312
+ if (node === -1) {
306
313
  continue;
307
314
  }
308
315
 
@@ -340,9 +347,8 @@ export function garment_sync_colliders(scene) {
340
347
  }
341
348
 
342
349
  for (const part of body) {
343
- const node = part.node;
344
-
345
- const t = node.transform_global;
350
+ // the bone's world, as the attachment system composed it
351
+ const t = scene.ecd.getComponent(part.node, Transform64);
346
352
 
347
353
  part.transform.setTranslation(
348
354
  t.translation[0] + part.offset[0],
@@ -2,6 +2,9 @@ import { Cloth } from "../ecs/Cloth.js";
2
2
  import { CLOTH_DYNAMICS_BY_NAME } from "../ecs/cloth_dynamics_library.js";
3
3
  import { PlaygroundCamera, project } from "./cloth_playground_draw.js";
4
4
  import { GARMENT_PRESETS, build_garment, garment_sync_colliders } from "./garment_build.js";
5
+ import { TRANSFORM_ATTACHMENT_EVENT_CHANGE } from "../../../ecs/transform-attachment/TRANSFORM_ATTACHMENT_EVENT_CHANGE.js";
6
+ import { TransformAttachment } from "../../../ecs/transform-attachment/TransformAttachment.js";
7
+ import { Transform64 } from "../../../ecs/transform/Transform64.js";
5
8
 
6
9
  /**
7
10
  * # Skinned garments playground — M3
@@ -11,9 +14,9 @@ import { GARMENT_PRESETS, build_garment, garment_sync_colliders } from "./garmen
11
14
  *
12
15
  * The rig page (`rig.html`) is a `Cloth` over an entity subtree; this is a
13
16
  * `Cloth` + a `ClothRig` over a skinned model's **joints**. Every point on
14
- * screen is a `Node3D.transform_global` — a joint of a `Skin`, not an entity —
15
- * and it is where it is because the solver wrote its `transform_local` and this
16
- * page composed the chain.
17
+ * screen is a joint's world `Transform64` — an entity of the character's prefab
18
+ * instance — and it is where it is because the solver wrote the joint's own
19
+ * offset and the attachment system composed the chain.
17
20
  *
18
21
  * What it exists to show, because these are claims about a hierarchy rather
19
22
  * than about an array:
@@ -122,35 +125,43 @@ function step_once() {
122
125
  * the race it exists to prevent.
123
126
  */
124
127
  function drive_character() {
125
- const root = scene.root;
126
- const pelvis = scene.pelvis;
128
+ const ecd = scene.ecd;
129
+
130
+ // the bones' own offsets, under their parents: what a rig's animation would write
131
+ const root = ecd.getComponent(scene.root, TransformAttachment).transform;
132
+ const pelvis = ecd.getComponent(scene.pelvis, TransformAttachment).transform;
127
133
 
128
134
  if (control.motion === 'still') {
129
- root.transform_local.setTranslation(0, 0, 0);
130
- root.transform_local.setRotation(0, 0, 0, 1);
131
- pelvis.transform_local.setTranslation(0, 0.95, 0);
135
+ root.setTranslation(0, 0, 0);
136
+ root.setRotation(0, 0, 0, 1);
137
+ pelvis.setTranslation(0, 0.95, 0);
132
138
  } else if (control.motion === 'walk') {
133
- root.transform_local.setTranslation(0, 0, Math.sin(time * 1.6) * 0.9);
134
- root.transform_local.setRotation(0, 0, 0, 1);
135
- pelvis.transform_local.setTranslation(0, 0.95 + Math.sin(time * 6.4) * 0.02, 0);
139
+ root.setTranslation(0, 0, Math.sin(time * 1.6) * 0.9);
140
+ root.setRotation(0, 0, 0, 1);
141
+ pelvis.setTranslation(0, 0.95 + Math.sin(time * 6.4) * 0.02, 0);
136
142
  } else if (control.motion === 'turn') {
137
143
  const angle = time * 1.9;
138
144
 
139
- root.transform_local.setTranslation(0, 0, 0);
140
- root.transform_local.setRotation(0, Math.sin(angle * 0.5), 0, Math.cos(angle * 0.5));
141
- pelvis.transform_local.setTranslation(0, 0.95, 0);
145
+ root.setTranslation(0, 0, 0);
146
+ root.setRotation(0, Math.sin(angle * 0.5), 0, Math.cos(angle * 0.5));
147
+ pelvis.setTranslation(0, 0.95, 0);
142
148
  } else {
143
149
  // §7 P7's own profile: a **square wave in velocity**, integrated rather
144
150
  // than written as a position — a position that resets is a nine-metre
145
151
  // discontinuity, which is a teleport (§7 P6) wearing a sprint's clothes.
146
152
  sprint_z += (Math.floor(time) % 2 === 0 ? 9 : -9) * FIXED_STEP;
147
153
 
148
- root.transform_local.setTranslation(0, 0, sprint_z);
149
- root.transform_local.setRotation(0, 0, 0, 1);
150
- pelvis.transform_local.setTranslation(0, 0.95, 0);
154
+ root.setTranslation(0, 0, sprint_z);
155
+ root.setRotation(0, 0, 0, 1);
156
+ pelvis.setTranslation(0, 0.95, 0);
151
157
  }
152
158
 
153
- root.updateMatrices();
159
+ root.updateMatrix();
160
+ pelvis.updateMatrix();
161
+
162
+ // announced, so the attachment system composes the chain below each
163
+ ecd.sendEvent(scene.root, TRANSFORM_ATTACHMENT_EVENT_CHANGE);
164
+ ecd.sendEvent(scene.pelvis, TRANSFORM_ATTACHMENT_EVENT_CHANGE);
154
165
  }
155
166
 
156
167
  // ------------------------------------------------------------------- draw
@@ -183,18 +194,35 @@ function draw() {
183
194
  }
184
195
 
185
196
  /**
186
- * @param {Node3D} node
197
+ * @param {number} node an entity of the character
187
198
  * @param {Float64Array} out
188
199
  * @param {number} width
189
200
  * @param {number} height
190
201
  * @returns {number} depth
191
202
  */
192
203
  function project_node(node, out, width, height) {
193
- const t = node.transform_global.translation;
204
+ const t = scene.ecd.getComponent(node, Transform64).translation;
194
205
 
195
206
  return project(out, camera, t[0], t[1], t[2], width, height);
196
207
  }
197
208
 
209
+ /**
210
+ * The bone an entity hangs from, or -1 at the top of the character — the placement above the
211
+ * root is not a bone.
212
+ *
213
+ * @param {number} node
214
+ * @returns {number}
215
+ */
216
+ function parent_of(node) {
217
+ const attachment = scene.ecd.getComponent(node, TransformAttachment);
218
+
219
+ if (attachment === undefined || attachment.parent === scene.placement) {
220
+ return -1;
221
+ }
222
+
223
+ return attachment.parent;
224
+ }
225
+
198
226
  function draw_ground(width, height) {
199
227
  context.save();
200
228
  context.strokeStyle = '#1d222a';
@@ -227,11 +255,13 @@ function draw_body(width, height) {
227
255
  context.lineWidth = Math.max(2, width / 500);
228
256
 
229
257
  for (const node of scene.bone) {
230
- if (node.parent === null) {
258
+ const parent = parent_of(node);
259
+
260
+ if (parent === -1) {
231
261
  continue;
232
262
  }
233
263
 
234
- project_node(node.parent, SCREEN, width, height);
264
+ project_node(parent, SCREEN, width, height);
235
265
  project_node(node, OTHER, width, height);
236
266
 
237
267
  context.beginPath();
@@ -257,17 +287,13 @@ function draw_bind(width, height) {
257
287
  const joint = scene.joint;
258
288
 
259
289
  for (let i = 0; i < joint.length; i++) {
260
- const node = joint[i];
261
-
262
- const parent_index = joint.indexOf(node.parent);
290
+ const node = joint[i];
291
+ const parent = parent_of(node);
292
+ const parent_index = joint.indexOf(parent);
263
293
 
264
294
  const from = parent_index >= 0
265
295
  ? bind[parent_index]
266
- : [
267
- node.parent.transform_global.translation[0],
268
- node.parent.transform_global.translation[1],
269
- node.parent.transform_global.translation[2]
270
- ];
296
+ : Array.from(scene.ecd.getComponent(parent, Transform64).translation);
271
297
 
272
298
  project(SCREEN, camera, from[0], from[1], from[2], width, height);
273
299
  project(OTHER, camera, bind[i][0], bind[i][1], bind[i][2], width, height);
@@ -287,7 +313,7 @@ function draw_garment(width, height) {
287
313
  context.lineWidth = Math.max(1.5, width / 700);
288
314
 
289
315
  for (const node of scene.joint) {
290
- project_node(node.parent, SCREEN, width, height);
316
+ project_node(parent_of(node), SCREEN, width, height);
291
317
  project_node(node, OTHER, width, height);
292
318
 
293
319
  context.beginPath();
@@ -313,7 +339,7 @@ function draw_garment(width, height) {
313
339
  * Each joint's reconstructed orientation, as an axis triple. A particle has no
314
340
  * orientation, so this is §11.1's swing — the minimal rotation from the link's
315
341
  * bind direction to its simulated one, and the reason the rig path can write a
316
- * `transform_local` at all.
342
+ * offset of its own at all.
317
343
  */
318
344
  function draw_frames(width, height) {
319
345
  const axes = [
@@ -328,7 +354,7 @@ function draw_frames(width, height) {
328
354
  context.lineWidth = 1;
329
355
 
330
356
  for (const node of scene.joint) {
331
- const t = node.transform_global;
357
+ const t = scene.ecd.getComponent(node, Transform64);
332
358
 
333
359
  project(SCREEN, camera, t.translation[0], t.translation[1], t.translation[2], width, height);
334
360