@woosh/meep-engine 3.42.0 → 3.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (345) hide show
  1. package/editor/prototypeEditorShell.d.ts.map +1 -1
  2. package/editor/prototypeEditorShell.js +4 -2
  3. package/package.json +91 -96
  4. package/src/engine/Clock.d.ts +15 -0
  5. package/src/engine/Clock.d.ts.map +1 -1
  6. package/src/engine/Clock.js +29 -5
  7. package/src/engine/Engine.d.ts.map +1 -1
  8. package/src/engine/Engine.js +11 -19
  9. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.d.ts +57 -0
  10. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.d.ts.map +1 -0
  11. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.js +84 -0
  12. package/src/engine/graphics3/AnimationGraphSystem.d.ts +23 -13
  13. package/src/engine/graphics3/AnimationGraphSystem.d.ts.map +1 -1
  14. package/src/engine/graphics3/AnimationGraphSystem.js +61 -64
  15. package/src/engine/graphics3/AnimationSystem.d.ts +24 -15
  16. package/src/engine/graphics3/AnimationSystem.d.ts.map +1 -1
  17. package/src/engine/graphics3/AnimationSystem.js +67 -61
  18. package/src/engine/graphics3/MeshSkinSystem.d.ts +56 -0
  19. package/src/engine/graphics3/MeshSkinSystem.d.ts.map +1 -0
  20. package/src/engine/graphics3/MeshSkinSystem.js +317 -0
  21. package/src/engine/graphics3/MeshSystem.d.ts +15 -35
  22. package/src/engine/graphics3/MeshSystem.d.ts.map +1 -1
  23. package/src/engine/graphics3/MeshSystem.js +21 -298
  24. package/src/engine/graphics3/RowChains.d.ts +76 -0
  25. package/src/engine/graphics3/RowChains.d.ts.map +1 -0
  26. package/src/engine/graphics3/RowChains.js +347 -0
  27. package/src/engine/graphics3/ShadedGeometrySystem.d.ts +6 -0
  28. package/src/engine/graphics3/ShadedGeometrySystem.d.ts.map +1 -1
  29. package/src/engine/graphics3/ShadedGeometrySystem.js +329 -309
  30. package/src/engine/graphics3/animation/AnimationClips.d.ts +56 -0
  31. package/src/engine/graphics3/animation/AnimationClips.d.ts.map +1 -0
  32. package/src/engine/graphics3/animation/AnimationClips.js +79 -0
  33. package/src/engine/graphics3/animation/ClipListPlayer.d.ts +13 -14
  34. package/src/engine/graphics3/animation/ClipListPlayer.d.ts.map +1 -1
  35. package/src/engine/graphics3/animation/ClipListPlayer.js +262 -263
  36. package/src/engine/graphics3/animation/write_clip_playback.d.ts +3 -3
  37. package/src/engine/graphics3/animation/write_clip_playback.js +4 -4
  38. package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts +5 -0
  39. package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts.map +1 -1
  40. package/src/engine/graphics3/pose/query_entity_node_world_pose.js +80 -75
  41. package/src/engine/graphics3/prefab/PrefabInstance.d.ts +4 -24
  42. package/src/engine/graphics3/prefab/PrefabInstance.d.ts.map +1 -1
  43. package/src/engine/graphics3/prefab/PrefabInstance.js +60 -80
  44. package/src/engine/graphics3/prefab/prefab_instantiate.d.ts +16 -3
  45. package/src/engine/graphics3/prefab/prefab_instantiate.d.ts.map +1 -1
  46. package/src/engine/graphics3/prefab/prefab_instantiate.js +49 -12
  47. package/src/engine/graphics3/prefab/prefab_place.d.ts +31 -17
  48. package/src/engine/graphics3/prefab/prefab_place.d.ts.map +1 -1
  49. package/src/engine/graphics3/prefab/prefab_place.js +175 -130
  50. package/src/engine/graphics3/register_clips.d.ts +64 -0
  51. package/src/engine/graphics3/register_clips.d.ts.map +1 -0
  52. package/src/engine/graphics3/register_clips.js +114 -0
  53. package/src/engine/physics/cloth/MEASUREMENTS.md +795 -0
  54. package/src/engine/physics/cloth/PLAN.md +339 -9
  55. package/src/engine/physics/cloth/build/ClothProxy.d.ts +113 -61
  56. package/src/engine/physics/cloth/build/ClothProxy.d.ts.map +1 -1
  57. package/src/engine/physics/cloth/build/ClothProxy.js +142 -77
  58. package/src/engine/physics/cloth/build/cloth_bind_in_frame.d.ts +22 -0
  59. package/src/engine/physics/cloth/build/cloth_bind_in_frame.d.ts.map +1 -0
  60. package/src/engine/physics/cloth/build/cloth_bind_in_frame.js +75 -0
  61. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts +43 -30
  62. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts.map +1 -1
  63. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.js +357 -284
  64. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.d.ts +62 -0
  65. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.d.ts.map +1 -0
  66. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.js +280 -0
  67. package/src/engine/physics/cloth/collider/cloth_collider_sdf.d.ts +1 -1
  68. package/src/engine/physics/cloth/collider/cloth_collider_sdf.js +1 -1
  69. package/src/engine/physics/cloth/ecs/Cloth.d.ts +17 -9
  70. package/src/engine/physics/cloth/ecs/Cloth.d.ts.map +1 -1
  71. package/src/engine/physics/cloth/ecs/Cloth.js +220 -212
  72. package/src/engine/physics/cloth/ecs/ClothDynamicsFlags.js +6 -0
  73. package/src/engine/physics/cloth/ecs/ClothHold.d.ts +91 -0
  74. package/src/engine/physics/cloth/ecs/ClothHold.d.ts.map +1 -0
  75. package/src/engine/physics/cloth/ecs/ClothHold.js +103 -0
  76. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts +254 -48
  77. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts.map +1 -1
  78. package/src/engine/physics/cloth/ecs/ClothInstance.js +277 -47
  79. package/src/engine/physics/cloth/ecs/ClothPin.d.ts +73 -0
  80. package/src/engine/physics/cloth/ecs/ClothPin.d.ts.map +1 -0
  81. package/src/engine/physics/cloth/ecs/ClothPin.js +92 -0
  82. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.d.ts +36 -0
  83. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.d.ts.map +1 -0
  84. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.js +61 -0
  85. package/src/engine/physics/cloth/ecs/ClothRig.d.ts +23 -17
  86. package/src/engine/physics/cloth/ecs/ClothRig.d.ts.map +1 -1
  87. package/src/engine/physics/cloth/ecs/ClothRig.js +29 -27
  88. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts +12 -14
  89. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts.map +1 -1
  90. package/src/engine/physics/cloth/ecs/ClothSystem.js +20 -15
  91. package/src/engine/physics/cloth/ecs/ClothWorld.d.ts +57 -36
  92. package/src/engine/physics/cloth/ecs/ClothWorld.d.ts.map +1 -1
  93. package/src/engine/physics/cloth/ecs/ClothWorld.js +816 -179
  94. package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts +12 -13
  95. package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts.map +1 -1
  96. package/src/engine/physics/cloth/ecs/WorkerClothSystem.js +20 -14
  97. package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts +63 -11
  98. package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts.map +1 -1
  99. package/src/engine/physics/cloth/ecs/cloth_build_rows.js +321 -84
  100. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts +9 -7
  101. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts.map +1 -1
  102. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.js +9 -7
  103. package/src/engine/physics/cloth/ecs/cloth_gather_colliders.d.ts +3 -3
  104. package/src/engine/physics/cloth/ecs/cloth_gather_colliders.js +30 -30
  105. package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts +37 -0
  106. package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts.map +1 -0
  107. package/src/engine/physics/cloth/ecs/cloth_geodesic.js +142 -0
  108. package/src/engine/physics/cloth/ecs/cloth_holds.d.ts +97 -0
  109. package/src/engine/physics/cloth/ecs/cloth_holds.d.ts.map +1 -0
  110. package/src/engine/physics/cloth/ecs/cloth_holds.js +608 -0
  111. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts +2 -2
  112. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts.map +1 -1
  113. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.js +160 -9
  114. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts +17 -22
  115. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts.map +1 -1
  116. package/src/engine/physics/cloth/ecs/cloth_seed_rig.js +55 -117
  117. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts +21 -6
  118. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts.map +1 -1
  119. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.js +44 -15
  120. package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts +5 -0
  121. package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts.map +1 -1
  122. package/src/engine/physics/cloth/ecs/cloth_write_back.js +60 -16
  123. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.d.ts.map +1 -1
  124. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.js +65 -58
  125. package/src/engine/physics/cloth/playground/collide_main.js +1 -1
  126. package/src/engine/physics/cloth/playground/garment_build.d.ts.map +1 -1
  127. package/src/engine/physics/cloth/playground/garment_build.js +17 -5
  128. package/src/engine/physics/cloth/playground/garment_main.js +1 -1
  129. package/src/engine/physics/cloth/playground/rig_build.d.ts.map +1 -1
  130. package/src/engine/physics/cloth/playground/rig_build.js +302 -296
  131. package/src/engine/physics/cloth/solver/ClothState.d.ts +45 -7
  132. package/src/engine/physics/cloth/solver/ClothState.d.ts.map +1 -1
  133. package/src/engine/physics/cloth/solver/ClothState.js +63 -7
  134. package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts +6 -1
  135. package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts.map +1 -1
  136. package/src/engine/physics/cloth/solver/cloth_contact_find.js +7 -2
  137. package/src/engine/physics/cloth/solver/cloth_hold_line.d.ts +114 -0
  138. package/src/engine/physics/cloth/solver/cloth_hold_line.d.ts.map +1 -0
  139. package/src/engine/physics/cloth/solver/cloth_hold_line.js +362 -0
  140. package/src/engine/physics/cloth/solver/cloth_self_find.d.ts +6 -2
  141. package/src/engine/physics/cloth/solver/cloth_self_find.d.ts.map +1 -1
  142. package/src/engine/physics/cloth/solver/cloth_self_find.js +13 -13
  143. package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts +24 -12
  144. package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts.map +1 -1
  145. package/src/engine/physics/cloth/solver/cloth_solver_constants.js +24 -12
  146. package/src/engine/physics/cloth/solver/cloth_step.d.ts +16 -0
  147. package/src/engine/physics/cloth/solver/cloth_step.d.ts.map +1 -1
  148. package/src/engine/physics/cloth/solver/cloth_step.js +183 -20
  149. package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts +1 -0
  150. package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts.map +1 -1
  151. package/src/engine/physics/cloth/solver/cloth_step_instance.js +10 -3
  152. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.d.ts +1 -1
  153. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.d.ts.map +1 -1
  154. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.js +353 -346
  155. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts +7 -5
  156. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts.map +1 -1
  157. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.js +7 -5
  158. package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts +9 -9
  159. package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts.map +1 -1
  160. package/src/engine/physics/cloth/wind/cloth_sample_air.js +26 -26
  161. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  162. package/src/engine/simulation/Ticker.d.ts +13 -0
  163. package/src/engine/simulation/Ticker.d.ts.map +1 -1
  164. package/src/engine/simulation/Ticker.js +43 -8
  165. package/src/shade/RENDERER_CONTRACT.md +8 -2
  166. package/src/shade/playground/mesh_row_ceiling/main.js +2 -1
  167. package/src/shade/playground/skinned_blas_refit/main.d.ts.map +1 -1
  168. package/src/shade/playground/skinned_blas_refit/main.js +11 -19
  169. package/src/shade/playground/skinned_blas_refit/place_character.d.ts +6 -3
  170. package/src/shade/playground/skinned_blas_refit/place_character.d.ts.map +1 -1
  171. package/src/shade/playground/skinned_blas_refit/place_character.js +90 -90
  172. package/src/shade/playground/skinned_mesh_soup/main.d.ts.map +1 -1
  173. package/src/shade/playground/skinned_mesh_soup/main.js +502 -509
  174. package/src/shade/playground/texture_encode/README.md +129 -109
  175. package/src/shade/playground/texture_encode/main.js +1430 -1430
  176. package/src/shade/playground/vgeo_runtime/README.md +5 -4
  177. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  178. package/src/shade/renderer/Renderer.js +6 -5
  179. package/src/shade/renderer/animation/GPUAnimationManager.d.ts +45 -14
  180. package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
  181. package/src/shade/renderer/animation/GPUAnimationManager.js +316 -64
  182. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts +5 -0
  183. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
  184. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +11 -1
  185. package/src/shade/renderer/atmosphere/GPUSky.d.ts +12 -0
  186. package/src/shade/renderer/atmosphere/GPUSky.d.ts.map +1 -1
  187. package/src/shade/renderer/atmosphere/GPUSky.js +162 -147
  188. package/src/shade/renderer/geometry/BoxGeometry.d.ts +1 -11
  189. package/src/shade/renderer/geometry/BoxGeometry.d.ts.map +1 -1
  190. package/src/shade/renderer/geometry/BoxGeometry.js +6 -13
  191. package/src/shade/renderer/geometry/CapsuleGeometry.d.ts +19 -0
  192. package/src/shade/renderer/geometry/CapsuleGeometry.d.ts.map +1 -0
  193. package/src/shade/renderer/geometry/CapsuleGeometry.js +24 -0
  194. package/src/shade/renderer/geometry/ConeGeometry.d.ts +20 -0
  195. package/src/shade/renderer/geometry/ConeGeometry.d.ts.map +1 -0
  196. package/src/shade/renderer/geometry/ConeGeometry.js +33 -0
  197. package/src/shade/renderer/geometry/CylinderGeometry.d.ts +21 -0
  198. package/src/shade/renderer/geometry/CylinderGeometry.d.ts.map +1 -0
  199. package/src/shade/renderer/geometry/CylinderGeometry.js +35 -0
  200. package/src/shade/renderer/geometry/PlaneGeometry.d.ts +17 -0
  201. package/src/shade/renderer/geometry/PlaneGeometry.d.ts.map +1 -0
  202. package/src/shade/renderer/geometry/PlaneGeometry.js +22 -0
  203. package/src/shade/renderer/geometry/TorusGeometry.d.ts +18 -0
  204. package/src/shade/renderer/geometry/TorusGeometry.d.ts.map +1 -0
  205. package/src/shade/renderer/geometry/TorusGeometry.js +23 -0
  206. package/src/shade/renderer/geometry/UVSphereGeometry.d.ts +21 -0
  207. package/src/shade/renderer/geometry/UVSphereGeometry.d.ts.map +1 -0
  208. package/src/shade/renderer/geometry/UVSphereGeometry.js +34 -0
  209. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts +19 -0
  210. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts.map +1 -0
  211. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.js +205 -0
  212. package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts +21 -0
  213. package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts.map +1 -0
  214. package/src/shade/renderer/geometry/primitives/make_cone_geometry.js +36 -0
  215. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts +1 -1
  216. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts.map +1 -1
  217. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.js +44 -9
  218. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts +20 -0
  219. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts.map +1 -0
  220. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.js +190 -0
  221. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.d.ts.map +1 -1
  222. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.js +7 -2
  223. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts +26 -8
  224. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts.map +1 -1
  225. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js +56 -39
  226. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts +7 -0
  227. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts.map +1 -1
  228. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.js +46 -4
  229. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.d.ts.map +1 -1
  230. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.js +4 -2
  231. package/src/shade/renderer/gpu_primitive/sort/defs.d.ts +2 -2
  232. package/src/shade/renderer/gpu_primitive/sort/defs.js +79 -79
  233. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts +1 -1
  234. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts.map +1 -1
  235. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.js +7 -3
  236. package/src/shade/renderer/lightmap/bake/shader_lightmap_denoise_sh.d.ts.map +1 -1
  237. package/src/shade/renderer/lightmap/bake/shader_lightmap_denoise_sh.js +10 -3
  238. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  239. package/src/shade/renderer/particles/DESIGN.md +13 -9
  240. package/src/shade/renderer/particles/GPUParticleSystem.js +1 -1
  241. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts +4 -3
  242. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts.map +1 -1
  243. package/src/shade/renderer/particles/coherence/graph_particle_bucket.js +200 -194
  244. package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
  245. package/src/shade/renderer/particles/graph_particles.js +6 -2
  246. package/src/shade/renderer/particles/shaders/chunk_particle_lighting.d.ts +1 -1
  247. package/src/shade/renderer/particles/shaders/chunk_particle_lighting.js +1 -1
  248. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -1
  249. package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +334 -329
  250. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  251. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
  252. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +7 -2
  253. package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.d.ts.map +1 -1
  254. package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.js +16 -4
  255. package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts +3 -2
  256. package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts.map +1 -1
  257. package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.js +3 -2
  258. package/src/shade/renderer/scene/GPUSceneContext.d.ts +9 -1
  259. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  260. package/src/shade/renderer/scene/GPUSceneContext.js +23 -1
  261. package/src/shade/renderer/texture/COMPRESSED_TEXTURE_PLAN_2026_09_01.md +2444 -2345
  262. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts.map +1 -1
  263. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.js +312 -310
  264. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts +3 -3
  265. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts.map +1 -1
  266. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.js +383 -375
  267. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.d.ts.map +1 -1
  268. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.js +349 -346
  269. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts +58 -0
  270. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts.map +1 -0
  271. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.js +536 -0
  272. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts +21 -7
  273. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts.map +1 -1
  274. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js +291 -327
  275. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts +25 -0
  276. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts.map +1 -0
  277. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.js +99 -0
  278. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts +5 -3
  279. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts.map +1 -1
  280. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.js +47 -71
  281. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts +10 -0
  282. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts.map +1 -0
  283. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.js +50 -0
  284. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts +4 -5
  285. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts.map +1 -1
  286. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.js +7 -8
  287. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts +4 -1
  288. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
  289. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +74 -3
  290. package/src/shade/renderer/volumetrics/NOTES.md +1023 -957
  291. package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.d.ts +5 -4
  292. package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.d.ts.map +1 -1
  293. package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.js +5 -4
  294. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.d.ts +1 -1
  295. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.js +1 -1
  296. package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.d.ts +1 -1
  297. package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.js +1 -1
  298. package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts +41 -0
  299. package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts.map +1 -0
  300. package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.js +112 -0
  301. package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts +9 -23
  302. package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
  303. package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +18 -126
  304. package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts +22 -0
  305. package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts.map +1 -0
  306. package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.js +228 -0
  307. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
  308. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +0 -53
  309. package/src/shade/renderer/water/chunk_water_transport.d.ts.map +1 -1
  310. package/src/shade/renderer/water/chunk_water_transport.js +7 -5
  311. package/src/shade/renderer/water/medium/GPUWaterBodies.d.ts.map +1 -1
  312. package/src/shade/renderer/water/medium/GPUWaterBodies.js +8 -2
  313. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts +3 -2
  314. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts.map +1 -1
  315. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.js +3 -2
  316. package/src/shade/renderer/water/shader_water.d.ts.map +1 -1
  317. package/src/shade/renderer/water/shader_water.js +3 -1
  318. package/src/shade/renderer/water/surface/GPUWaterSurface.d.ts.map +1 -1
  319. package/src/shade/renderer/water/surface/GPUWaterSurface.js +3 -1
  320. package/src/shade/renderer/water/surface/chunk_water_surface_sample.d.ts +4 -3
  321. package/src/shade/renderer/water/surface/chunk_water_surface_sample.d.ts.map +1 -1
  322. package/src/shade/renderer/water/surface/chunk_water_surface_sample.js +17 -7
  323. package/src/shade/renderer/water/surface/graph_water_tessellation.d.ts.map +1 -1
  324. package/src/shade/renderer/water/surface/graph_water_tessellation.js +11 -4
  325. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
  326. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +93 -30
  327. package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts.map +1 -1
  328. package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.js +13 -5
  329. package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts +29 -8
  330. package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts.map +1 -1
  331. package/src/shade/renderer/water/surface/particles/chunk_water_particle.js +155 -30
  332. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts +6 -1
  333. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts.map +1 -1
  334. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.js +157 -39
  335. package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts +91 -21
  336. package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts.map +1 -1
  337. package/src/shade/renderer/water/surface/particles/shader_water_particles.js +442 -70
  338. package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +11 -3
  339. package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
  340. package/src/shade/wgsl/emulator/WGSLLanguageCore.js +3 -0
  341. package/src/shade/wgsl/validate_wgsl_source.d.ts.map +1 -1
  342. package/src/shade/wgsl/validate_wgsl_source.js +74 -3
  343. package/src/engine/graphics3/register_instance_animation.d.ts +0 -114
  344. package/src/engine/graphics3/register_instance_animation.d.ts.map +0 -1
  345. package/src/engine/graphics3/register_instance_animation.js +0 -201
@@ -1,23 +1,22 @@
1
1
  /**
2
- * Puts models into the scene as entities, and keeps their rows where the entities say.
2
+ * Loads models and spawns them as entities, so that a caller need not handle the loading lifecycle.
3
+ *
4
+ * **A shortcut, and nothing more.** Give an entity an {@link SGMesh} naming a file; when the file
5
+ * has loaded — whenever that is — the model appears under the entity as entities and components,
6
+ * and when the component goes, they go. Everything that makes the model work is those components,
7
+ * read by their own systems, exactly as if code had built them: `ShadedGeometry` draws through
8
+ * `ShadedGeometrySystem`, `MeshSkin` deforms through `MeshSkinSystem`, a `TransformAttachment`
9
+ * composes through `TransformAttachmentSystem`, and the `AnimationClips` on the entity play through
10
+ * `AnimationSystem` and `AnimationGraphSystem`. None of them knows this system exists, and this
11
+ * system puts nothing on the GPU itself.
3
12
  *
4
13
  * **A model is a prefab, and a placement is entities.** A loaded bundle is compiled once per url
5
- * ({@link prefab_compile}) and spawned once per entity that wears it
6
- * ({@link prefab_instantiate}): every node of the file becomes an entity attached to its parent's,
7
- * named, drawing where it draws, with the placing entity as the root. What used to be a private
8
- * copy of a node tree per placement is the dataset's own hierarchy, addressable by every system —
9
- * IK finds a foot by name, cloth seeds from joints, gameplay asks where a socket is — and the
10
- * renderer's tables are indexed by those entities, at `entity + 1`.
14
+ * ({@link prefab_compile}) and spawned once per entity that wears it ({@link prefab_instantiate}):
15
+ * every node of the file becomes an entity attached to its parent's, named, drawing where it draws,
16
+ * with the placing entity as the root.
11
17
  *
12
18
  * **It owns the scene and tells the facade to draw it**, rather than the facade handing a graph out
13
19
  * for anyone to write into.
14
- *
15
- * **Rows need a device, and registration does too.** A model loads whenever it loads, and there
16
- * may be no renderer yet; {@link update} attaches every instance's entities to the scene's GPU
17
- * context when one arrives, registers its skins with the animation manager, and does both again
18
- * after a renderer restart. Driving the clips is not this system's business — that is the
19
- * animation systems' — but a clip nothing has registered cannot be driven by anyone, which is why
20
- * the instance is handed out ({@link instance_of}) rather than kept.
21
20
  */
22
21
  export class MeshSystem extends System<any> {
23
22
  /**
@@ -32,12 +31,8 @@ export class MeshSystem extends System<any> {
32
31
  */
33
32
  get scene(): Scene;
34
33
  /**
35
- * The model an entity is showing, as entities: its skins and clips addressed to them, and its
36
- * nodes by name.
37
- *
38
- * Handed out rather than copied because an animation driver has to know *which* instance it is
39
- * bound to: a model swap builds a new one, and a driver still holding the old one would be
40
- * driving entities that have gone. The object's identity is the only signal that says so.
34
+ * The model an entity is showing, as entities: the prefab, and its node entities by index and by
35
+ * name. What loading produced — nothing a model needs in order to work is only here.
41
36
  *
42
37
  * **A model swap is remove-component then add-component.** Reassigning {@link SGMesh#url} on an
43
38
  * attached mesh is NOT one and is not observed: `link` reads the url once, the only other
@@ -51,19 +46,6 @@ export class MeshSystem extends System<any> {
51
46
  * whose model has not finished loading
52
47
  */
53
48
  instance_of(entity: number): PrefabInstance | null;
54
- /**
55
- * What the GPU's animation manager gave back for that instance — the skin ids, in the
56
- * instance's own order.
57
- *
58
- * Same reasoning as {@link instance_of} and a stronger version of it: these ids belong to one
59
- * renderer, and a restart voids every one of them. The object is replaced when that happens, so
60
- * a driver that compares it against what it bound against notices in the same frame.
61
- *
62
- * @param {number} entity
63
- * @returns {InstanceAnimationRegistration|null} `null` while there is nothing registered — no
64
- * model yet, no device yet, or a renderer restart that has not been drained
65
- */
66
- animation_of(entity: number): InstanceAnimationRegistration | null;
67
49
  /**
68
50
  * The entities of an entity's model that draw — one per primitive of the file. Each holds the
69
51
  * `meshes` row `entity + 1`, which is what the visibility buffer writes for every pixel it
@@ -104,11 +86,9 @@ export class MeshSystem extends System<any> {
104
86
  unlink(model: SGMesh, transform: Transform64, entity: number): void;
105
87
  #private;
106
88
  }
107
- export type GPUSceneContext = import("../../shade/renderer/scene/GPUSceneContext.js").GPUSceneContext;
108
89
  export type SceneBundle = import("../../shade/renderer/loader/SceneBundle.js").SceneBundle;
109
90
  export type Prefab = import("./prefab/Prefab.js").Prefab;
110
91
  export type PrefabInstance = import("./prefab/PrefabInstance.js").PrefabInstance;
111
- export type InstanceAnimationRegistration = import("./register_instance_animation.js").InstanceAnimationRegistration;
112
92
  export type GraphicsEngine = import("./GraphicsEngine.js").GraphicsEngine;
113
93
  import { System } from "../ecs/System.js";
114
94
  import { Transform64 } from "../ecs/transform/Transform64.js";
@@ -1 +1 @@
1
- {"version":3,"file":"MeshSystem.d.ts","sourceRoot":"","sources":["../../../../src/engine/graphics3/MeshSystem.js"],"names":[],"mappings":"AA6FA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IAqEI;;;;OAIG;IACH,sBAJW,cAAc,SACd,KAAK,eACI,MAAM,KAAG,QAAQ,WAAW,CAAC,EAchD;IADG,qDAAyC;IAG7C;;OAEG;IACH,mBAEC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,oBAJW,MAAM,GACJ,cAAc,GAAC,IAAI,CAW/B;IAED;;;;;;;;;;;OAWG;IACH,qBAJW,MAAM,GACJ,6BAA6B,GAAC,IAAI,CAW9C;IAED;;;;;;;;OAQG;IACH,yBAJW,MAAM,GACJ,UAAU,CAWtB;IAED;;;;;;;;;;;;OAYG;IACH,6BALW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,UACvC,MAAM,GACJ,OAAO,CAwCnB;IAED,2CAeC;IAED,4CASC;IAuID;;;;OAIG;IACH,YAJW,MAAM,aACN,WAAW,UACX,MAAM,QAgChB;IAED;;;;OAIG;IACH,cAJW,MAAM,aACN,WAAW,UACX,MAAM,QAIhB;;CAgJJ;8BAtpBY,OAAO,+CAA+C,EAAE,eAAe;0BACvE,OAAO,4CAA4C,EAAE,WAAW;qBAChE,OAAO,oBAAoB,EAAE,MAAM;6BACnC,OAAO,4BAA4B,EAAE,cAAc;4CACnD,OAAO,kCAAkC,EAAE,6BAA6B;6BACxE,OAAO,qBAAqB,EAAE,cAAc;uBAnBlC,kBAAkB;4BACb,iCAAiC;uBAItC,6CAA6C;sBAN9C,qCAAqC"}
1
+ {"version":3,"file":"MeshSystem.d.ts","sourceRoot":"","sources":["../../../../src/engine/graphics3/MeshSystem.js"],"names":[],"mappings":"AAiDA;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAmDI;;;;OAIG;IACH,sBAJW,cAAc,SACd,KAAK,eACI,MAAM,KAAG,QAAQ,WAAW,CAAC,EAchD;IADG,qDAAyC;IAG7C;;OAEG;IACH,mBAEC;IAED;;;;;;;;;;;;;;OAcG;IACH,oBAJW,MAAM,GACJ,cAAc,GAAC,IAAI,CAW/B;IAED;;;;;;;;OAQG;IACH,yBAJW,MAAM,GACJ,UAAU,CAWtB;IAED;;;;;;;;;;;;OAYG;IACH,6BALW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,UACvC,MAAM,GACJ,OAAO,CAwCnB;IAED,2CAeC;IAED,4CAMC;IA8BD;;;;OAIG;IACH,YAJW,MAAM,aACN,WAAW,UACX,MAAM,QAkBhB;IAED;;;;OAIG;IACH,cAJW,MAAM,aACN,WAAW,UACX,MAAM,QAIhB;;CA8EJ;0BAvYY,OAAO,4CAA4C,EAAE,WAAW;qBAChE,OAAO,oBAAoB,EAAE,MAAM;6BACnC,OAAO,4BAA4B,EAAE,cAAc;6BACnD,OAAO,qBAAqB,EAAE,cAAc;uBAXlC,kBAAkB;4BACb,iCAAiC;uBAEtC,6CAA6C;sBAJ9C,qCAAqC"}
@@ -4,23 +4,15 @@ import { aabb3_matrix4_project } from "../../core/geom/3d/aabb/aabb3_matrix4_pro
4
4
  import { Scene } from "../../shade/renderer/scene/Scene.js";
5
5
  import { System } from "../ecs/System.js";
6
6
  import { Transform64 } from "../ecs/transform/Transform64.js";
7
- import { TRANSFORM64_EVENT_CHANGE } from "../ecs/transform/TRANSFORM64_EVENT_CHANGE.js";
8
- import { TRANSFORM_ATTACHMENT_EVENT_CHANGE } from "../ecs/transform-attachment/TRANSFORM_ATTACHMENT_EVENT_CHANGE.js";
9
7
  import { ShadedGeometry } from "../graphics/ecs/mesh-v2/ShadedGeometry.js";
10
8
  import { SGMesh } from "../graphics/ecs/mesh-v2/aggregate/SGMesh.js";
11
9
  import { prefab_compile } from "./prefab/prefab_compile.js";
12
10
  import { prefab_instance_destroy, prefab_instantiate } from "./prefab/prefab_instantiate.js";
13
- import {
14
- register_instance_animation,
15
- unregister_instance_animation
16
- } from "./register_instance_animation.js";
17
11
 
18
12
  /**
19
- * @typedef {import("../../shade/renderer/scene/GPUSceneContext.js").GPUSceneContext} GPUSceneContext
20
13
  * @typedef {import("../../shade/renderer/loader/SceneBundle.js").SceneBundle} SceneBundle
21
14
  * @typedef {import("./prefab/Prefab.js").Prefab} Prefab
22
15
  * @typedef {import("./prefab/PrefabInstance.js").PrefabInstance} PrefabInstance
23
- * @typedef {import("./register_instance_animation.js").InstanceAnimationRegistration} InstanceAnimationRegistration
24
16
  * @typedef {import("./GraphicsEngine.js").GraphicsEngine} GraphicsEngine
25
17
  */
26
18
 
@@ -34,8 +26,7 @@ const NO_ENTITIES = new Int32Array(0);
34
26
  const SCRATCH_BOUNDS = new Float32Array(6);
35
27
 
36
28
  /**
37
- * What one entity has: its model, once loaded, as entities; the ids the GPU issued for the model's
38
- * skins; and what is listening on its behalf.
29
+ * What one entity has: its model, once loaded, as entities.
39
30
  */
40
31
  class Entry {
41
32
  /**
@@ -48,69 +39,33 @@ class Entry {
48
39
  */
49
40
  model = null;
50
41
 
51
- /**
52
- * @type {Transform64}
53
- */
54
- transform = null;
55
-
56
42
  /**
57
43
  * The model as entities, or null until it has loaded.
58
44
  *
59
45
  * @type {PrefabInstance|null}
60
46
  */
61
47
  instance = null;
62
-
63
- /**
64
- * What the GPU gave back for the instance's skins, or null while there is nothing registered —
65
- * no model yet, no device yet, or a renderer restart that has not been drained.
66
- *
67
- * @type {InstanceAnimationRegistration|null}
68
- */
69
- animation = null;
70
-
71
- /**
72
- * The GPU context the instance's entities hold their rows in, or null while they hold none.
73
- *
74
- * @type {GPUSceneContext|null}
75
- */
76
- context = null;
77
-
78
- /**
79
- * Fires when the placing entity's world transform moves.
80
- *
81
- * @type {function(): void}
82
- */
83
- on_moved = null;
84
-
85
- /**
86
- * One per entity of the instance, firing when that entity's offset from its parent moves —
87
- * a joint an IK solver, a ragdoll or a cloth wrote.
88
- *
89
- * @type {Map<number, function(): void>}
90
- */
91
- on_offset_moved = new Map();
92
48
  }
93
49
 
94
50
  /**
95
- * Puts models into the scene as entities, and keeps their rows where the entities say.
51
+ * Loads models and spawns them as entities, so that a caller need not handle the loading lifecycle.
52
+ *
53
+ * **A shortcut, and nothing more.** Give an entity an {@link SGMesh} naming a file; when the file
54
+ * has loaded — whenever that is — the model appears under the entity as entities and components,
55
+ * and when the component goes, they go. Everything that makes the model work is those components,
56
+ * read by their own systems, exactly as if code had built them: `ShadedGeometry` draws through
57
+ * `ShadedGeometrySystem`, `MeshSkin` deforms through `MeshSkinSystem`, a `TransformAttachment`
58
+ * composes through `TransformAttachmentSystem`, and the `AnimationClips` on the entity play through
59
+ * `AnimationSystem` and `AnimationGraphSystem`. None of them knows this system exists, and this
60
+ * system puts nothing on the GPU itself.
96
61
  *
97
62
  * **A model is a prefab, and a placement is entities.** A loaded bundle is compiled once per url
98
- * ({@link prefab_compile}) and spawned once per entity that wears it
99
- * ({@link prefab_instantiate}): every node of the file becomes an entity attached to its parent's,
100
- * named, drawing where it draws, with the placing entity as the root. What used to be a private
101
- * copy of a node tree per placement is the dataset's own hierarchy, addressable by every system —
102
- * IK finds a foot by name, cloth seeds from joints, gameplay asks where a socket is — and the
103
- * renderer's tables are indexed by those entities, at `entity + 1`.
63
+ * ({@link prefab_compile}) and spawned once per entity that wears it ({@link prefab_instantiate}):
64
+ * every node of the file becomes an entity attached to its parent's, named, drawing where it draws,
65
+ * with the placing entity as the root.
104
66
  *
105
67
  * **It owns the scene and tells the facade to draw it**, rather than the facade handing a graph out
106
68
  * for anyone to write into.
107
- *
108
- * **Rows need a device, and registration does too.** A model loads whenever it loads, and there
109
- * may be no renderer yet; {@link update} attaches every instance's entities to the scene's GPU
110
- * context when one arrives, registers its skins with the animation manager, and does both again
111
- * after a renderer restart. Driving the clips is not this system's business — that is the
112
- * animation systems' — but a clip nothing has registered cannot be driven by anyone, which is why
113
- * the instance is handed out ({@link instance_of}) rather than kept.
114
69
  */
115
70
  export class MeshSystem extends System {
116
71
  /**
@@ -141,24 +96,6 @@ export class MeshSystem extends System {
141
96
  */
142
97
  #entries = new Map();
143
98
 
144
- /**
145
- * Shade's GPU state for {@link scene}, as of the last {@link update}. Held to answer one
146
- * question: has the renderer been replaced since the last frame, so that everything placed has
147
- * to be attached and registered again.
148
- *
149
- * @type {GPUSceneContext|null}
150
- */
151
- #context = null;
152
-
153
- /**
154
- * Entries whose instance is not attached to {@link #context} — either because it has just
155
- * loaded, or because a restart invalidated what it had. A queue rather than a scan over every
156
- * entity, because this is per-frame work and the answer is almost always "nothing to do".
157
- *
158
- * @type {Entry[]}
159
- */
160
- #unregistered = [];
161
-
162
99
  /**
163
100
  * Entities whose `SGMesh` carried no url when it was linked.
164
101
  *
@@ -208,12 +145,8 @@ export class MeshSystem extends System {
208
145
  }
209
146
 
210
147
  /**
211
- * The model an entity is showing, as entities: its skins and clips addressed to them, and its
212
- * nodes by name.
213
- *
214
- * Handed out rather than copied because an animation driver has to know *which* instance it is
215
- * bound to: a model swap builds a new one, and a driver still holding the old one would be
216
- * driving entities that have gone. The object's identity is the only signal that says so.
148
+ * The model an entity is showing, as entities: the prefab, and its node entities by index and by
149
+ * name. What loading produced — nothing a model needs in order to work is only here.
217
150
  *
218
151
  * **A model swap is remove-component then add-component.** Reassigning {@link SGMesh#url} on an
219
152
  * attached mesh is NOT one and is not observed: `link` reads the url once, the only other
@@ -236,28 +169,6 @@ export class MeshSystem extends System {
236
169
  return entry.instance;
237
170
  }
238
171
 
239
- /**
240
- * What the GPU's animation manager gave back for that instance — the skin ids, in the
241
- * instance's own order.
242
- *
243
- * Same reasoning as {@link instance_of} and a stronger version of it: these ids belong to one
244
- * renderer, and a restart voids every one of them. The object is replaced when that happens, so
245
- * a driver that compares it against what it bound against notices in the same frame.
246
- *
247
- * @param {number} entity
248
- * @returns {InstanceAnimationRegistration|null} `null` while there is nothing registered — no
249
- * model yet, no device yet, or a renderer restart that has not been drained
250
- */
251
- animation_of(entity) {
252
- const entry = this.#entries.get(entity);
253
-
254
- if (entry === undefined) {
255
- return null;
256
- }
257
-
258
- return entry.animation;
259
- }
260
-
261
172
  /**
262
173
  * The entities of an entity's model that draw — one per primitive of the file. Each holds the
263
174
  * `meshes` row `entity + 1`, which is what the visibility buffer writes for every pixel it
@@ -352,81 +263,19 @@ export class MeshSystem extends System {
352
263
  }
353
264
 
354
265
  this.#models.clear();
355
-
356
- this.#context = null;
357
- this.#unregistered.length = 0;
358
266
  }
359
267
 
360
268
  /**
361
- * Tell the GPU about the models that have arrived since the last frame: their entities take
362
- * their rows, and their skins reach `GPUAnimationManager`.
363
- *
364
- * The manager hangs off the scene's GPU context, which exists only while there is a device, so
365
- * neither can happen where instances are built (a model loads whenever it loads, including
366
- * before the renderer has started). Registration is documented eventually-consistent at both
367
- * entry points, so a frame of latency here costs nothing: the ids are live immediately, and
368
- * what drives the deformation — a clip's bindings, a skin's meshes — follows when every entity
369
- * it names has its row.
370
- *
371
- * A restart is the same event seen from here: the context object changes, every id and every
372
- * row the old one issued is void, and everything currently placed queues up again.
269
+ * Load the models of entities whose url has turned up since the last frame.
373
270
  *
374
271
  * @param {number} time_delta_seconds
375
272
  */
376
273
  update(time_delta_seconds) {
377
274
  this.#collect_arrived_urls();
378
-
379
- const context = this.#graphics.scene_context(this.#scene);
380
-
381
- if (context === null) {
382
- // No device — before the first start, or after a stop. Nothing is registered while
383
- // this holds, and the next context to arrive is a change like any other.
384
- return;
385
- }
386
-
387
- if (context !== this.#context) {
388
- this.#invalidate_registrations(context);
389
- }
390
-
391
- const waiting = this.#unregistered;
392
-
393
- if (waiting.length === 0) {
394
- return;
395
- }
396
-
397
- /*
398
- **A throw in here must not cost the session.** The list used to be cleared after the loop,
399
- so a registration that threw partway left the entries before it *already registered* and
400
- *still queued*: the next update registered them a second time, `bind` found the entity
401
- already bound to another skin, and that assertion then fired once a frame for as long as
402
- the game ran — one failed model converted into permanent corruption of an unrelated one.
403
-
404
- So an entry comes off the list BEFORE it is registered, and can never be registered twice
405
- whatever happens next. The open question this leaves — what to do with an entry that
406
- *cannot* be registered — is answered the only way a frame loop can afford: it is dropped,
407
- once, with a message. That model does not appear; every other one does, and the next frame
408
- is a normal frame.
409
- */
410
- const entries = waiting.slice();
411
-
412
- waiting.length = 0;
413
-
414
- for (let i = 0; i < entries.length; i++) {
415
- const entry = entries[i];
416
-
417
- try {
418
- this.#register(entry, context);
419
- } catch (e) {
420
- console.error(`MeshSystem: failed to register entity ${entry.entity} ('${entry.model?.url}'), dropping it`, e);
421
- }
422
- }
423
275
  }
424
276
 
425
277
  /**
426
278
  * Load the models of entities whose url has turned up since the last frame.
427
- *
428
- * Ahead of everything the device gates, because a model arrives whenever it arrives and there
429
- * may be no renderer yet — the same bargain {@link #attach} makes with registration.
430
279
  */
431
280
  #collect_arrived_urls() {
432
281
  const waiting = this.#awaiting_url;
@@ -444,52 +293,6 @@ export class MeshSystem extends System {
444
293
  }
445
294
  }
446
295
 
447
- /**
448
- * A different renderer is drawing this scene now, so nothing that has been registered still is.
449
- *
450
- * @param {GPUSceneContext} context
451
- */
452
- #invalidate_registrations(context) {
453
- this.#context = context;
454
-
455
- const waiting = this.#unregistered;
456
-
457
- waiting.length = 0;
458
-
459
- for (const entry of this.#entries.values()) {
460
- if (entry.instance === null) {
461
- continue;
462
- }
463
-
464
- entry.animation = null;
465
- entry.context = null;
466
-
467
- waiting.push(entry);
468
- }
469
- }
470
-
471
- /**
472
- * Give an instance's entities their rows in a context, and its skins to the animation manager.
473
- *
474
- * Every entity of the model takes a `transforms` row — a joint composes on the GPU, a grouping
475
- * node is what its children compose under — and the placing entity takes one too, so the whole
476
- * hierarchy composes from it. The primitives' `meshes` rows are `ShadedGeometrySystem`'s.
477
- *
478
- * @param {Entry} entry
479
- * @param {GPUSceneContext} context
480
- */
481
- #register(entry, context) {
482
- const rows = context.rows;
483
- const entities = entry.instance.entities;
484
-
485
- for (let i = 0; i < entities.length; i++) {
486
- rows.acquire(entities[i]);
487
- }
488
-
489
- entry.animation = register_instance_animation(context, entry.instance);
490
- entry.context = context;
491
- }
492
-
493
296
  /**
494
297
  * @param {SGMesh} model
495
298
  * @param {Transform64} transform
@@ -500,23 +303,9 @@ export class MeshSystem extends System {
500
303
 
501
304
  entry.entity = entity;
502
305
  entry.model = model;
503
- entry.transform = transform;
504
306
 
505
307
  this.#entries.set(entity, entry);
506
308
 
507
- // The placing entity's own row is marked when its transform moves, not on a poll: an
508
- // entity that has not moved costs nothing, which is the same bargain the scene database
509
- // makes downstream. A Transform64 has no signals of its own, so the announcement comes from
510
- // the dataset. The entities under it follow through the attachment system and need no
511
- // marking of their own for a move of the root — the GPU composes them.
512
- entry.on_moved = () => {
513
- if (entry.context !== null) {
514
- entry.context.rows.mark_world(entity);
515
- }
516
- };
517
-
518
- this.entityManager.dataset.addEntityEventListener(entity, TRANSFORM64_EVENT_CHANGE, entry.on_moved);
519
-
520
309
  if (model.url === null) {
521
310
  // nothing to show yet; {@link update} watches for the url arriving
522
311
  this.#awaiting_url.push(entry);
@@ -578,34 +367,7 @@ export class MeshSystem extends System {
578
367
  return;
579
368
  }
580
369
 
581
- const dataset = this.entityManager.dataset;
582
-
583
- const instance = prefab_instantiate(prefab, dataset, entity);
584
-
585
- entry.instance = instance;
586
-
587
- // A joint's offset moving — an IK solver, a ragdoll, a cloth writing it — is that joint's
588
- // row. The world transforms the attachment system composes below it are not: the GPU
589
- // composes those itself, from the offsets.
590
- const entities = instance.entities;
591
-
592
- for (let i = 1; i < entities.length; i++) {
593
- const member = entities[i];
594
-
595
- const on_offset_moved = () => {
596
- if (entry.context !== null) {
597
- entry.context.rows.mark_local(member);
598
- }
599
- };
600
-
601
- entry.on_offset_moved.set(member, on_offset_moved);
602
-
603
- dataset.addEntityEventListener(member, TRANSFORM_ATTACHMENT_EVENT_CHANGE, on_offset_moved);
604
- }
605
-
606
- // The GPU hears about it on the next update rather than here: a model finishes loading
607
- // whenever it finishes, and there may be no device to tell.
608
- this.#unregistered.push(entry);
370
+ entry.instance = prefab_instantiate(prefab, this.entityManager.dataset, entity);
609
371
  }
610
372
 
611
373
  /**
@@ -620,19 +382,6 @@ export class MeshSystem extends System {
620
382
 
621
383
  this.#entries.delete(entity);
622
384
 
623
- const dataset = this.entityManager.dataset;
624
-
625
- if (dataset.entityExists(entity)) {
626
- dataset.removeEntityEventListener(entity, TRANSFORM64_EVENT_CHANGE, entry.on_moved);
627
- }
628
-
629
- const waiting = this.#unregistered.indexOf(entry);
630
-
631
- if (waiting !== -1) {
632
- // it left before the GPU was ever told about it
633
- this.#unregistered.splice(waiting, 1);
634
- }
635
-
636
385
  const awaiting = this.#awaiting_url.indexOf(entry);
637
386
 
638
387
  if (awaiting !== -1) {
@@ -648,34 +397,8 @@ export class MeshSystem extends System {
648
397
 
649
398
  entry.instance = null;
650
399
 
651
- for (const [member, listener] of entry.on_offset_moved) {
652
- if (dataset.entityExists(member)) {
653
- dataset.removeEntityEventListener(member, TRANSFORM_ATTACHMENT_EVENT_CHANGE, listener);
654
- }
655
- }
656
-
657
- entry.on_offset_moved.clear();
658
-
659
- // A destroyed context must not be handed its rows or its ids back: a renderer restart
660
- // takes the GPU scene context with it, and what the old one issued means nothing to the
661
- // context that replaces it — so the entry forgets them rather than returning them.
662
- if (entry.context !== null && entry.context === this.#graphics.scene_context(this.#scene)) {
663
- const rows = entry.context.rows;
664
- const entities = instance.entities;
665
-
666
- for (let i = 0; i < entities.length; i++) {
667
- rows.release(entities[i]);
668
- }
669
-
670
- if (entry.animation !== null) {
671
- unregister_instance_animation(entry.animation);
672
- }
673
- }
674
-
675
- entry.animation = null;
676
- entry.context = null;
677
-
678
- // the entities the model became are the model, so they go with it
679
- prefab_instance_destroy(dataset, instance);
400
+ // the entities the model became are the model, so they go with it — and what they held on
401
+ // the GPU goes with them, given back by the systems that took it
402
+ prefab_instance_destroy(this.entityManager.dataset, instance);
680
403
  }
681
404
  }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * The rows one system holds, each with the rows of everything it hangs from, kept where the
3
+ * entities say.
4
+ *
5
+ * **Why a chain and not a row.** A row whose attachment parent holds no row is written with its CPU
6
+ * world under the scene root. That is exact until something above it is driven on the GPU — a clip
7
+ * keying a joint takes the joint's whole subtree off the CPU, and its worlds there stop moving. So a
8
+ * primitive under an animated node, or a joint under another, composes correctly only when every
9
+ * entity above it holds a row too, and the GPU composes the chain from the top. A clip also binds
10
+ * only once every node it keys holds a row, so a chain is what lets it play at all.
11
+ *
12
+ * **Held per system.** One system's holds are its own: two primitives under one parent count twice
13
+ * here and hold the parent's row once. Two systems holding the same entity each hold its row — the
14
+ * rows count holders — and each follow it; across a model that overlap is the placing entity and a
15
+ * node or two.
16
+ *
17
+ * **Following is the dataset's events, as a placing system's always was.** An entity with an
18
+ * attachment holds its offset and its parent's row, so what moves it is a new offset, announced as
19
+ * `TRANSFORM_ATTACHMENT_EVENT_CHANGE`; its world follows on the GPU. The top of a chain holds its
20
+ * world, announced as `TRANSFORM64_EVENT_CHANGE`. One listener an entity, the same method for all of
21
+ * them, with the dataset passing the entity in.
22
+ *
23
+ * **A reparent is the attachment taken off and put back**, which no change event announces, so one
24
+ * observer on `TransformAttachment` watches for it and moves a held entity's hold onto its new chain.
25
+ *
26
+ * **Rows come and go with the device.** Until {@link bind} is given a scene's rows, holds and
27
+ * following are recorded and nothing is acquired; binding the rows of a new context after a restart
28
+ * acquires every held entity again, and no listener changes.
29
+ */
30
+ export class RowChains {
31
+ /**
32
+ * @param {EntityComponentDataset} dataset
33
+ */
34
+ constructor(dataset: EntityComponentDataset);
35
+ /**
36
+ * The rows the chains are held in, or null while there is no device.
37
+ *
38
+ * @returns {GPUSceneRows|null}
39
+ */
40
+ get rows(): import("../../shade/renderer/scene/rows/GPUSceneRows.js").GPUSceneRows;
41
+ /**
42
+ * Hold the chains in these rows from now on. Rows replaced by a restart took what they held
43
+ * with them, so nothing is given back to them; every held entity is acquired in the new ones.
44
+ *
45
+ * @param {GPUSceneRows|null} rows
46
+ */
47
+ bind(rows: GPUSceneRows | null): void;
48
+ /**
49
+ * Whether this holds the entity, for itself or for something hanging from it.
50
+ *
51
+ * @param {number} entity
52
+ * @returns {boolean}
53
+ */
54
+ holds(entity: number): boolean;
55
+ /**
56
+ * Hold the entity's row and the rows of everything it hangs from. Every hold is matched by a
57
+ * {@link release}.
58
+ *
59
+ * @param {number} entity
60
+ */
61
+ hold(entity: number): void;
62
+ /**
63
+ * Let go of one hold. The last lets go of the entity's row and of the hold it had on its parent.
64
+ *
65
+ * @param {number} entity
66
+ */
67
+ release(entity: number): void;
68
+ /**
69
+ * Let go of everything and stop watching the dataset.
70
+ */
71
+ destroy(): void;
72
+ #private;
73
+ }
74
+ export type EntityComponentDataset = import("../ecs/EntityComponentDataset.js").EntityComponentDataset;
75
+ export type GPUSceneRows = import("../../shade/renderer/scene/rows/GPUSceneRows.js").GPUSceneRows;
76
+ //# sourceMappingURL=RowChains.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RowChains.d.ts","sourceRoot":"","sources":["../../../../src/engine/graphics3/RowChains.js"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH;IAiCI;;OAEG;IACH,qBAFW,sBAAsB,EAchC;IAED;;;;OAIG;IACH,mFAEC;IAED;;;;;OAKG;IACH,WAFW,YAAY,GAAC,IAAI,QAgB3B;IAED;;;;;OAKG;IACH,cAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;OAKG;IACH,aAFW,MAAM,QA6BhB;IAED;;;;OAIG;IACH,gBAFW,MAAM,QA2BhB;IAED;;OAEG;IACH,gBAiBC;;CAyHJ;qCAnVY,OAAO,kCAAkC,EAAE,sBAAsB;2BACjE,OAAO,iDAAiD,EAAE,YAAY"}