@woosh/meep-engine 3.43.0 → 3.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/editor/prototypeEditorShell.d.ts.map +1 -1
  2. package/editor/prototypeEditorShell.js +4 -2
  3. package/package.json +1 -1
  4. package/src/engine/Clock.d.ts +15 -0
  5. package/src/engine/Clock.d.ts.map +1 -1
  6. package/src/engine/Clock.js +29 -5
  7. package/src/engine/Engine.d.ts.map +1 -1
  8. package/src/engine/Engine.js +11 -19
  9. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.d.ts +57 -0
  10. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.d.ts.map +1 -0
  11. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.js +84 -0
  12. package/src/engine/graphics3/AnimationGraphSystem.d.ts +23 -13
  13. package/src/engine/graphics3/AnimationGraphSystem.d.ts.map +1 -1
  14. package/src/engine/graphics3/AnimationGraphSystem.js +61 -64
  15. package/src/engine/graphics3/AnimationSystem.d.ts +24 -15
  16. package/src/engine/graphics3/AnimationSystem.d.ts.map +1 -1
  17. package/src/engine/graphics3/AnimationSystem.js +67 -61
  18. package/src/engine/graphics3/MeshSkinSystem.d.ts +56 -0
  19. package/src/engine/graphics3/MeshSkinSystem.d.ts.map +1 -0
  20. package/src/engine/graphics3/MeshSkinSystem.js +317 -0
  21. package/src/engine/graphics3/MeshSystem.d.ts +15 -35
  22. package/src/engine/graphics3/MeshSystem.d.ts.map +1 -1
  23. package/src/engine/graphics3/MeshSystem.js +21 -298
  24. package/src/engine/graphics3/RowChains.d.ts +76 -0
  25. package/src/engine/graphics3/RowChains.d.ts.map +1 -0
  26. package/src/engine/graphics3/RowChains.js +347 -0
  27. package/src/engine/graphics3/ShadedGeometrySystem.d.ts +6 -0
  28. package/src/engine/graphics3/ShadedGeometrySystem.d.ts.map +1 -1
  29. package/src/engine/graphics3/ShadedGeometrySystem.js +329 -309
  30. package/src/engine/graphics3/animation/AnimationClips.d.ts +56 -0
  31. package/src/engine/graphics3/animation/AnimationClips.d.ts.map +1 -0
  32. package/src/engine/graphics3/animation/AnimationClips.js +79 -0
  33. package/src/engine/graphics3/animation/ClipListPlayer.d.ts +13 -14
  34. package/src/engine/graphics3/animation/ClipListPlayer.d.ts.map +1 -1
  35. package/src/engine/graphics3/animation/ClipListPlayer.js +262 -263
  36. package/src/engine/graphics3/animation/write_clip_playback.d.ts +3 -3
  37. package/src/engine/graphics3/animation/write_clip_playback.js +4 -4
  38. package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts +5 -0
  39. package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts.map +1 -1
  40. package/src/engine/graphics3/pose/query_entity_node_world_pose.js +80 -75
  41. package/src/engine/graphics3/prefab/PrefabInstance.d.ts +4 -24
  42. package/src/engine/graphics3/prefab/PrefabInstance.d.ts.map +1 -1
  43. package/src/engine/graphics3/prefab/PrefabInstance.js +60 -80
  44. package/src/engine/graphics3/prefab/prefab_instantiate.d.ts +16 -3
  45. package/src/engine/graphics3/prefab/prefab_instantiate.d.ts.map +1 -1
  46. package/src/engine/graphics3/prefab/prefab_instantiate.js +49 -12
  47. package/src/engine/graphics3/prefab/prefab_place.d.ts +31 -17
  48. package/src/engine/graphics3/prefab/prefab_place.d.ts.map +1 -1
  49. package/src/engine/graphics3/prefab/prefab_place.js +175 -130
  50. package/src/engine/graphics3/register_clips.d.ts +64 -0
  51. package/src/engine/graphics3/register_clips.d.ts.map +1 -0
  52. package/src/engine/graphics3/register_clips.js +114 -0
  53. package/src/engine/physics/cloth/MEASUREMENTS.md +795 -0
  54. package/src/engine/physics/cloth/PLAN.md +339 -9
  55. package/src/engine/physics/cloth/build/ClothProxy.d.ts +113 -61
  56. package/src/engine/physics/cloth/build/ClothProxy.d.ts.map +1 -1
  57. package/src/engine/physics/cloth/build/ClothProxy.js +142 -77
  58. package/src/engine/physics/cloth/build/cloth_bind_in_frame.d.ts +22 -0
  59. package/src/engine/physics/cloth/build/cloth_bind_in_frame.d.ts.map +1 -0
  60. package/src/engine/physics/cloth/build/cloth_bind_in_frame.js +75 -0
  61. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts +43 -30
  62. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts.map +1 -1
  63. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.js +357 -284
  64. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.d.ts +62 -0
  65. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.d.ts.map +1 -0
  66. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.js +280 -0
  67. package/src/engine/physics/cloth/collider/cloth_collider_sdf.d.ts +1 -1
  68. package/src/engine/physics/cloth/collider/cloth_collider_sdf.js +1 -1
  69. package/src/engine/physics/cloth/ecs/Cloth.d.ts +17 -9
  70. package/src/engine/physics/cloth/ecs/Cloth.d.ts.map +1 -1
  71. package/src/engine/physics/cloth/ecs/Cloth.js +220 -212
  72. package/src/engine/physics/cloth/ecs/ClothDynamicsFlags.js +6 -0
  73. package/src/engine/physics/cloth/ecs/ClothHold.d.ts +91 -0
  74. package/src/engine/physics/cloth/ecs/ClothHold.d.ts.map +1 -0
  75. package/src/engine/physics/cloth/ecs/ClothHold.js +103 -0
  76. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts +254 -48
  77. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts.map +1 -1
  78. package/src/engine/physics/cloth/ecs/ClothInstance.js +277 -47
  79. package/src/engine/physics/cloth/ecs/ClothPin.d.ts +73 -0
  80. package/src/engine/physics/cloth/ecs/ClothPin.d.ts.map +1 -0
  81. package/src/engine/physics/cloth/ecs/ClothPin.js +92 -0
  82. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.d.ts +36 -0
  83. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.d.ts.map +1 -0
  84. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.js +61 -0
  85. package/src/engine/physics/cloth/ecs/ClothRig.d.ts +23 -17
  86. package/src/engine/physics/cloth/ecs/ClothRig.d.ts.map +1 -1
  87. package/src/engine/physics/cloth/ecs/ClothRig.js +29 -27
  88. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts +12 -14
  89. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts.map +1 -1
  90. package/src/engine/physics/cloth/ecs/ClothSystem.js +20 -15
  91. package/src/engine/physics/cloth/ecs/ClothWorld.d.ts +57 -36
  92. package/src/engine/physics/cloth/ecs/ClothWorld.d.ts.map +1 -1
  93. package/src/engine/physics/cloth/ecs/ClothWorld.js +816 -179
  94. package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts +12 -13
  95. package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts.map +1 -1
  96. package/src/engine/physics/cloth/ecs/WorkerClothSystem.js +20 -14
  97. package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts +63 -11
  98. package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts.map +1 -1
  99. package/src/engine/physics/cloth/ecs/cloth_build_rows.js +321 -84
  100. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts +9 -7
  101. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts.map +1 -1
  102. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.js +9 -7
  103. package/src/engine/physics/cloth/ecs/cloth_gather_colliders.d.ts +3 -3
  104. package/src/engine/physics/cloth/ecs/cloth_gather_colliders.js +30 -30
  105. package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts +37 -0
  106. package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts.map +1 -0
  107. package/src/engine/physics/cloth/ecs/cloth_geodesic.js +142 -0
  108. package/src/engine/physics/cloth/ecs/cloth_holds.d.ts +97 -0
  109. package/src/engine/physics/cloth/ecs/cloth_holds.d.ts.map +1 -0
  110. package/src/engine/physics/cloth/ecs/cloth_holds.js +608 -0
  111. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts +2 -2
  112. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts.map +1 -1
  113. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.js +160 -9
  114. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts +17 -22
  115. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts.map +1 -1
  116. package/src/engine/physics/cloth/ecs/cloth_seed_rig.js +55 -117
  117. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts +21 -6
  118. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts.map +1 -1
  119. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.js +44 -15
  120. package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts +5 -0
  121. package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts.map +1 -1
  122. package/src/engine/physics/cloth/ecs/cloth_write_back.js +60 -16
  123. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.d.ts.map +1 -1
  124. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.js +65 -58
  125. package/src/engine/physics/cloth/playground/collide_main.js +1 -1
  126. package/src/engine/physics/cloth/playground/garment_build.d.ts.map +1 -1
  127. package/src/engine/physics/cloth/playground/garment_build.js +17 -5
  128. package/src/engine/physics/cloth/playground/garment_main.js +1 -1
  129. package/src/engine/physics/cloth/playground/rig_build.d.ts.map +1 -1
  130. package/src/engine/physics/cloth/playground/rig_build.js +302 -296
  131. package/src/engine/physics/cloth/solver/ClothState.d.ts +45 -7
  132. package/src/engine/physics/cloth/solver/ClothState.d.ts.map +1 -1
  133. package/src/engine/physics/cloth/solver/ClothState.js +63 -7
  134. package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts +6 -1
  135. package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts.map +1 -1
  136. package/src/engine/physics/cloth/solver/cloth_contact_find.js +7 -2
  137. package/src/engine/physics/cloth/solver/cloth_hold_line.d.ts +114 -0
  138. package/src/engine/physics/cloth/solver/cloth_hold_line.d.ts.map +1 -0
  139. package/src/engine/physics/cloth/solver/cloth_hold_line.js +362 -0
  140. package/src/engine/physics/cloth/solver/cloth_self_find.d.ts +6 -2
  141. package/src/engine/physics/cloth/solver/cloth_self_find.d.ts.map +1 -1
  142. package/src/engine/physics/cloth/solver/cloth_self_find.js +13 -13
  143. package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts +24 -12
  144. package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts.map +1 -1
  145. package/src/engine/physics/cloth/solver/cloth_solver_constants.js +24 -12
  146. package/src/engine/physics/cloth/solver/cloth_step.d.ts +16 -0
  147. package/src/engine/physics/cloth/solver/cloth_step.d.ts.map +1 -1
  148. package/src/engine/physics/cloth/solver/cloth_step.js +183 -20
  149. package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts +1 -0
  150. package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts.map +1 -1
  151. package/src/engine/physics/cloth/solver/cloth_step_instance.js +10 -3
  152. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.d.ts +1 -1
  153. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.d.ts.map +1 -1
  154. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.js +353 -346
  155. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts +7 -5
  156. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts.map +1 -1
  157. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.js +7 -5
  158. package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts +9 -9
  159. package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts.map +1 -1
  160. package/src/engine/physics/cloth/wind/cloth_sample_air.js +26 -26
  161. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  162. package/src/engine/simulation/Ticker.d.ts +13 -0
  163. package/src/engine/simulation/Ticker.d.ts.map +1 -1
  164. package/src/engine/simulation/Ticker.js +43 -8
  165. package/src/shade/RENDERER_CONTRACT.md +8 -2
  166. package/src/shade/playground/mesh_row_ceiling/main.js +2 -1
  167. package/src/shade/playground/skinned_blas_refit/main.d.ts.map +1 -1
  168. package/src/shade/playground/skinned_blas_refit/main.js +11 -19
  169. package/src/shade/playground/skinned_blas_refit/place_character.d.ts +6 -3
  170. package/src/shade/playground/skinned_blas_refit/place_character.d.ts.map +1 -1
  171. package/src/shade/playground/skinned_blas_refit/place_character.js +90 -90
  172. package/src/shade/playground/skinned_mesh_soup/main.d.ts.map +1 -1
  173. package/src/shade/playground/skinned_mesh_soup/main.js +502 -509
  174. package/src/shade/playground/texture_encode/README.md +129 -109
  175. package/src/shade/playground/texture_encode/main.js +1430 -1430
  176. package/src/shade/renderer/animation/GPUAnimationManager.d.ts +45 -14
  177. package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
  178. package/src/shade/renderer/animation/GPUAnimationManager.js +316 -64
  179. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts +5 -0
  180. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
  181. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +11 -1
  182. package/src/shade/renderer/geometry/BoxGeometry.d.ts +1 -11
  183. package/src/shade/renderer/geometry/BoxGeometry.d.ts.map +1 -1
  184. package/src/shade/renderer/geometry/BoxGeometry.js +6 -13
  185. package/src/shade/renderer/geometry/CapsuleGeometry.d.ts +19 -0
  186. package/src/shade/renderer/geometry/CapsuleGeometry.d.ts.map +1 -0
  187. package/src/shade/renderer/geometry/CapsuleGeometry.js +24 -0
  188. package/src/shade/renderer/geometry/ConeGeometry.d.ts +20 -0
  189. package/src/shade/renderer/geometry/ConeGeometry.d.ts.map +1 -0
  190. package/src/shade/renderer/geometry/ConeGeometry.js +33 -0
  191. package/src/shade/renderer/geometry/CylinderGeometry.d.ts +21 -0
  192. package/src/shade/renderer/geometry/CylinderGeometry.d.ts.map +1 -0
  193. package/src/shade/renderer/geometry/CylinderGeometry.js +35 -0
  194. package/src/shade/renderer/geometry/PlaneGeometry.d.ts +17 -0
  195. package/src/shade/renderer/geometry/PlaneGeometry.d.ts.map +1 -0
  196. package/src/shade/renderer/geometry/PlaneGeometry.js +22 -0
  197. package/src/shade/renderer/geometry/TorusGeometry.d.ts +18 -0
  198. package/src/shade/renderer/geometry/TorusGeometry.d.ts.map +1 -0
  199. package/src/shade/renderer/geometry/TorusGeometry.js +23 -0
  200. package/src/shade/renderer/geometry/UVSphereGeometry.d.ts +21 -0
  201. package/src/shade/renderer/geometry/UVSphereGeometry.d.ts.map +1 -0
  202. package/src/shade/renderer/geometry/UVSphereGeometry.js +34 -0
  203. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts +19 -0
  204. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts.map +1 -0
  205. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.js +205 -0
  206. package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts +21 -0
  207. package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts.map +1 -0
  208. package/src/shade/renderer/geometry/primitives/make_cone_geometry.js +36 -0
  209. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts +1 -1
  210. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts.map +1 -1
  211. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.js +44 -9
  212. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts +20 -0
  213. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts.map +1 -0
  214. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.js +190 -0
  215. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.d.ts.map +1 -1
  216. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.js +7 -2
  217. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts +26 -8
  218. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts.map +1 -1
  219. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js +56 -39
  220. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts +7 -0
  221. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts.map +1 -1
  222. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.js +46 -4
  223. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.d.ts.map +1 -1
  224. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.js +4 -2
  225. package/src/shade/renderer/gpu_primitive/sort/defs.d.ts +2 -2
  226. package/src/shade/renderer/gpu_primitive/sort/defs.js +79 -79
  227. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts +1 -1
  228. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts.map +1 -1
  229. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.js +7 -3
  230. package/src/shade/renderer/particles/GPUParticleSystem.js +1 -1
  231. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts +4 -3
  232. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts.map +1 -1
  233. package/src/shade/renderer/particles/coherence/graph_particle_bucket.js +200 -194
  234. package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
  235. package/src/shade/renderer/particles/graph_particles.js +6 -2
  236. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -1
  237. package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +334 -329
  238. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
  239. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +7 -2
  240. package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.d.ts.map +1 -1
  241. package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.js +16 -4
  242. package/src/shade/renderer/texture/COMPRESSED_TEXTURE_PLAN_2026_09_01.md +2444 -2345
  243. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts.map +1 -1
  244. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.js +312 -310
  245. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts +3 -3
  246. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts.map +1 -1
  247. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.js +383 -375
  248. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.d.ts.map +1 -1
  249. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.js +349 -346
  250. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts +58 -0
  251. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts.map +1 -0
  252. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.js +536 -0
  253. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts +21 -7
  254. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts.map +1 -1
  255. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js +291 -327
  256. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts +25 -0
  257. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts.map +1 -0
  258. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.js +99 -0
  259. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts +5 -3
  260. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts.map +1 -1
  261. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.js +47 -71
  262. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts +10 -0
  263. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts.map +1 -0
  264. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.js +50 -0
  265. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts +4 -5
  266. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts.map +1 -1
  267. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.js +7 -8
  268. package/src/shade/renderer/water/chunk_water_transport.d.ts.map +1 -1
  269. package/src/shade/renderer/water/chunk_water_transport.js +7 -5
  270. package/src/shade/renderer/water/medium/GPUWaterBodies.d.ts.map +1 -1
  271. package/src/shade/renderer/water/medium/GPUWaterBodies.js +8 -2
  272. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts +3 -2
  273. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts.map +1 -1
  274. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.js +3 -2
  275. package/src/shade/renderer/water/shader_water.d.ts.map +1 -1
  276. package/src/shade/renderer/water/shader_water.js +3 -1
  277. package/src/shade/renderer/water/surface/GPUWaterSurface.d.ts.map +1 -1
  278. package/src/shade/renderer/water/surface/GPUWaterSurface.js +3 -1
  279. package/src/shade/renderer/water/surface/graph_water_tessellation.d.ts.map +1 -1
  280. package/src/shade/renderer/water/surface/graph_water_tessellation.js +11 -4
  281. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
  282. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +37 -20
  283. package/src/shade/wgsl/validate_wgsl_source.d.ts.map +1 -1
  284. package/src/shade/wgsl/validate_wgsl_source.js +74 -3
  285. package/src/engine/graphics3/register_instance_animation.d.ts +0 -114
  286. package/src/engine/graphics3/register_instance_animation.d.ts.map +0 -1
  287. package/src/engine/graphics3/register_instance_animation.js +0 -201
@@ -1,5 +1,8 @@
1
1
  import { assert } from "../../../../../core/assert.js";
2
- import { graph_prefix_scan_csdldf } from "../../../gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js";
2
+ import {
3
+ graph_prefix_scan_csdldf,
4
+ prefix_scan_csdldf_output_descriptor
5
+ } from "../../../gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js";
3
6
  import {
4
7
  build_indirect_compute_dispatch_command,
5
8
  INDIRECT_COMPUTE_COMMAND_DESCRIPTOR
@@ -53,11 +56,14 @@ export class GPUWaterParticles {
53
56
  #parity = 0;
54
57
  #particles = [];
55
58
  #children = null;
59
+ #child_sums = null;
56
60
  #images = null;
57
61
  #fronts = null;
62
+ #front_sums = null;
58
63
  #runs = null;
59
64
  #draw = null;
60
65
  #buckets = null;
66
+ #offsets = null;
61
67
  #slots = null;
62
68
  #bucket_amplitude = null;
63
69
  #bucket_weight = null;
@@ -69,7 +75,7 @@ export class GPUWaterParticles {
69
75
  #commands = null;
70
76
 
71
77
  /** @returns {GPUBuffer} the frame's hash: table size, then inclusive bucket offsets */
72
- get offsets() { return this.#buckets; }
78
+ get offsets() { return this.#offsets; }
73
79
  /** @returns {GPUBuffer} the frame's entries, bucket by bucket, each bucket ordered by particle */
74
80
  get entries() { return this.#entries; }
75
81
  /** @returns {GPUBuffer} per wave row: occupied-level mask, then a height bound per level (f32 bits) */
@@ -102,15 +108,21 @@ export class GPUWaterParticles {
102
108
  size: Math.max(16, size), usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC | usage });
103
109
  const array_size = 16 + capacity * WATER_PARTICLE_STRUCT.size;
104
110
  this.#particles = [buffer('a', array_size), buffer('b', array_size)];
111
+ // a scan reads one buffer and writes another: per particle how many it leaves, then where they end
112
+ const sums = elements => prefix_scan_csdldf_output_descriptor(elements).size;
105
113
  this.#children = buffer('children', 16 + capacity * 4);
114
+ this.#child_sums = buffer('child sums', sums(capacity));
106
115
  // per particle the mirror image the step left beside it at the outline
107
116
  this.#images = buffer('images', capacity * WATER_PARTICLE_STRUCT.size);
108
- // per particle the scanned run it is in; per run its first particle and its share; per particle its run
109
- // and how it is drawn
117
+ // per particle whether it starts a run, then the scanned run it is in; per run its first particle and its
118
+ // share; per particle its run and how it is drawn
110
119
  this.#fronts = buffer('fronts', 16 + capacity * 4);
120
+ this.#front_sums = buffer('front sums', sums(capacity));
111
121
  this.#runs = buffer('runs', capacity * 8);
112
122
  this.#draw = buffer('draw', capacity * 8);
123
+ // per bucket its entries, then the hash: table size and inclusive offsets
113
124
  this.#buckets = buffer('buckets', 16 + this.#table_limit * 4);
125
+ this.#offsets = buffer('offsets', sums(this.#table_limit));
114
126
  this.#slots = buffer('slots', capacity * WATER_PARTICLE_CORNERS * 4);
115
127
  this.#bucket_amplitude = buffer('bucket amplitude', this.#table_limit * 4);
116
128
  // the summed steepness, the largest front and front complement entered, and the entries; then the most a point
@@ -145,13 +157,15 @@ export class GPUWaterParticles {
145
157
  }
146
158
 
147
159
  dispose() {
148
- for (const buffer of [...this.#particles, this.#children, this.#images, this.#fronts, this.#runs, this.#draw, this.#buckets, this.#slots,
149
- this.#bucket_amplitude, this.#bucket_weight, this.#bucket_nest, this.#visible, this.#staging, this.#entries, this.#body_bounds, ...(this.#commands ?? [])]) {
160
+ for (const buffer of [...this.#particles, this.#children, this.#child_sums, this.#images, this.#fronts, this.#front_sums, this.#runs,
161
+ this.#draw, this.#buckets, this.#offsets, this.#slots, this.#bucket_amplitude, this.#bucket_weight, this.#bucket_nest, this.#visible,
162
+ this.#staging, this.#entries, this.#body_bounds, ...(this.#commands ?? [])]) {
150
163
  buffer?.destroy();
151
164
  }
152
165
  this.#particles = [];
153
- this.#children = this.#images = this.#buckets = this.#slots = this.#bucket_amplitude = this.#staging = this.#entries = null;
154
- this.#fronts = this.#runs = this.#draw = null;
166
+ this.#children = this.#child_sums = this.#images = this.#buckets = this.#offsets = this.#slots = this.#bucket_amplitude = null;
167
+ this.#staging = this.#entries = null;
168
+ this.#fronts = this.#front_sums = this.#runs = this.#draw = null;
155
169
  this.#bucket_weight = this.#bucket_nest = this.#visible = null;
156
170
  this.#body_bounds = null;
157
171
  this.#commands = null;
@@ -188,8 +202,11 @@ export class GPUWaterParticles {
188
202
  const [command_current, command_next, command_table] = this.#commands;
189
203
  const geometries = scene.geometries;
190
204
  let children = graph_import_buffer(graph, this.#children, 'Water / particle children');
205
+ let child_sums = graph_import_buffer(graph, this.#child_sums, 'Water / particle child sums');
191
206
  let buckets = graph_import_buffer(graph, this.#buckets, 'Water / particle buckets');
207
+ let offsets = graph_import_buffer(graph, this.#offsets, 'Water / particle offsets');
192
208
  let fronts = graph_import_buffer(graph, this.#fronts, 'Water / particle fronts');
209
+ let front_sums = graph_import_buffer(graph, this.#front_sums, 'Water / particle front sums');
193
210
  const node = (name, execute, reads, writes) => {
194
211
  const data = {};
195
212
  const pass = graph.add(name, data, (d, resources, context) => execute(resources, context, d));
@@ -211,19 +228,19 @@ export class GPUWaterParticles {
211
228
  meshlet_metadata: geometries.meshlets.buffer_metadata, meshlet_data: geometries.meshlets.buffer_data,
212
229
  } });
213
230
  }, {}, { children }).children;
214
- children = graph_prefix_scan_csdldf({ graph, data: children, element_max_count: capacity });
231
+ child_sums = graph_prefix_scan_csdldf({ graph, input: children, output: child_sums, element_max_count: capacity });
215
232
 
216
233
  // What they leave into the next array, then the frame's splashes after them.
217
234
  node('Water / particles split and emit', (resources, { encoder }) => {
218
235
  shader_water_particles_split.dispatchIndirect({ encoder, command: command_current, bindings: {
219
- capacity, particles: current, children: this.#children, images: this.#images, next } });
220
- shader_water_particles_total.dispatch({ encoder, bindings: { capacity, children: this.#children, next } });
236
+ capacity, particles: current, children: this.#child_sums, images: this.#images, next } });
237
+ shader_water_particles_total.dispatch({ encoder, bindings: { capacity, children: this.#child_sums, next } });
221
238
  shader_water_particles_emit.dispatchIndirect({ encoder, command: commands, command_offset: emit_command,
222
239
  bindings: { capacity, scene_database: scene.scene_database_buffer, emit_rows, steep, activity,
223
240
  particle_bounds: this.#body_bounds, next } });
224
241
  shader_water_particles_finalize.dispatch({ encoder, bindings: { limits: { capacity, table_limit }, next, offsets: this.#buckets,
225
242
  table_command: command_table } });
226
- }, { children }, {});
243
+ }, { child_sums }, {});
227
244
  }
228
245
 
229
246
  // Each front's run of particles, so that a whole one is drawn as the seven it was emitted as.
@@ -237,14 +254,14 @@ export class GPUWaterParticles {
237
254
  encoder.copyBufferToBuffer(next, 0, this.#fronts, 0, 4);
238
255
  shader_water_particles_fronts.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#fronts } });
239
256
  }, {}, { fronts }).fronts;
240
- fronts = graph_prefix_scan_csdldf({ graph, data: fronts, element_max_count: capacity });
257
+ front_sums = graph_prefix_scan_csdldf({ graph, input: fronts, output: front_sums, element_max_count: capacity });
241
258
 
242
259
  // The frame's hash: how each particle is drawn, how crowded each cell is and so how much of each run its crowd
243
260
  // leaves drawn, then each packet drawn into the cells its support overlaps, offsets, entries in order.
244
261
  buckets = node('Water / particles bin', (resources, { encoder }) => {
245
262
  const draw = this.#draw, runs = this.#runs;
246
- shader_water_particles_runs.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#fronts, runs } });
247
- shader_water_particles_groups.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#fronts, runs, draw } });
263
+ shader_water_particles_runs.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#front_sums, runs } });
264
+ shader_water_particles_groups.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#front_sums, runs, draw } });
248
265
  shader_water_particles_clear.dispatchIndirect({ encoder, command: command_table, bindings: {
249
266
  buckets: this.#buckets, bucket_amplitude: this.#bucket_amplitude, bucket_weight: this.#bucket_weight,
250
267
  bucket_nest: this.#bucket_nest } });
@@ -259,16 +276,16 @@ export class GPUWaterParticles {
259
276
  shader_water_particles_bin.dispatchIndirect({ encoder, command: command_next, bindings: {
260
277
  next, activity, buckets: this.#buckets, slots: this.#slots, bucket_amplitude: this.#bucket_amplitude,
261
278
  body_bounds: this.#body_bounds, draw, runs, visible: this.#visible } });
262
- }, { fronts }, { buckets }).buckets;
263
- buckets = graph_prefix_scan_csdldf({ graph, data: buckets, element_max_count: table_limit });
279
+ }, { front_sums }, { buckets }).buckets;
280
+ offsets = graph_prefix_scan_csdldf({ graph, input: buckets, output: offsets, element_max_count: table_limit });
264
281
  node('Water / particles order and bound', (resources, { encoder }) => {
265
- const bindings = { next, offsets: this.#buckets, slots: this.#slots, draw: this.#draw };
282
+ const bindings = { next, offsets: this.#offsets, slots: this.#slots, draw: this.#draw };
266
283
  shader_water_particles_scatter.dispatchIndirect({ encoder, command: command_next, bindings: { ...bindings,
267
284
  visible: this.#visible, staging: this.#staging } });
268
285
  shader_water_particles_rank.dispatchIndirect({ encoder, command: command_next, bindings: { ...bindings,
269
286
  staging: this.#staging, entries: this.#entries } });
270
287
  shader_water_particles_bounds.dispatchIndirect({ encoder, command: command_next, bindings: { next, activity,
271
- offsets: this.#buckets, bucket_amplitude: this.#bucket_amplitude, draw: this.#draw, body_bounds: this.#body_bounds } });
272
- }, { buckets }, {});
288
+ offsets: this.#offsets, bucket_amplitude: this.#bucket_amplitude, draw: this.#draw, body_bounds: this.#body_bounds } });
289
+ }, { offsets }, {});
273
290
  }
274
291
  }
@@ -1 +1 @@
1
- {"version":3,"file":"validate_wgsl_source.d.ts","sourceRoot":"","sources":["../../../../src/shade/wgsl/validate_wgsl_source.js"],"names":[],"mappings":"AAuKA;;;;;;GAMG;AACH,6CAJW,MAAM,UACN,OAAO,iBAAiB,EAAE,UAAU,GAClC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CA6M7D"}
1
+ {"version":3,"file":"validate_wgsl_source.d.ts","sourceRoot":"","sources":["../../../../src/shade/wgsl/validate_wgsl_source.js"],"names":[],"mappings":"AAqMA;;;;;;GAMG;AACH,6CAJW,MAAM,UACN,OAAO,iBAAiB,EAAE,UAAU,GAClC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAsP7D"}
@@ -12,6 +12,8 @@ import { WGSLLanguageCore } from "./emulator/WGSLLanguageCore.js";
12
12
  * - immutable-assignment: assigning to a `let`/`const` local or a function parameter
13
13
  * (all immutable in WGSL); only `var` is mutable.
14
14
  * - swizzle-store: assigning to a multi-component swizzle (`v.xy = …`), which WGSL forbids.
15
+ * A struct may name a member `xy`, and then the store is legal; where one does, only a base
16
+ * declared as a vector is flagged.
15
17
  * - foreign-token: HLSL/GLSL constructs that are not WGSL (`float3`, `int2`, `#if`,
16
18
  * `imageAtomicMax`, `lerp(`, `rsqrt(`, …) — unambiguous, lexical.
17
19
  * - reserved-keyword: an identifier that is a WGSL reserved word (`target`, `filter`,
@@ -87,13 +89,16 @@ const WGSL_BUILTIN_NAMES = new Set([
87
89
 
88
90
  const SWIZZLE_COMPONENTS = /^[xyzwrgba]+$/;
89
91
  const LHS_SWIZZLE_TAIL = /\.([xyzwrgba]{2,})\s*$/;
92
+ const VECTOR_TYPE_NAME = /^vec[234][fhiu]?$/;
90
93
 
91
- // Unambiguous non-WGSL tokens. Each entry is a regex and a human label.
94
+ // Unambiguous non-WGSL tokens. Each entry is a regex and a human label. The bare scalar names
95
+ // (`float`, `int`, `half`, `fixed`) are neither keywords nor reserved words in WGSL, so they are
96
+ // legal identifiers (`let half = n / 2u;`) and only their vector forms are matched.
92
97
  const FOREIGN_TOKENS = [
93
98
  [/\bfloat[1-4]x[1-4]\b/, 'HLSL matrix type (use matNxM<f32>)'],
94
99
  [/\bfloat[2-4]\b/, 'HLSL vector type (use vecN<f32>)'],
95
100
  [/\b(?:int|uint)[2-4]\b/, 'HLSL integer vector type (use vecN<i32|u32>)'],
96
- [/\b(?:half|fixed)[2-4]?\b/, 'HLSL scalar/vector type'],
101
+ [/\b(?:half|fixed)[2-4]\b/, 'HLSL vector type (use vecN<f16>)'],
97
102
  [/#\s*(?:if|ifdef|ifndef|endif|else|elif|define|pragma)\b/, 'C-preprocessor directive'],
98
103
  [/\bimageAtomic(?:Max|Min|Add|And|Or|Xor|Exchange)\b/, 'GLSL image atomic (use atomic* on a storage binding)'],
99
104
  [/\bimageStore\b/, 'GLSL imageStore (use textureStore)'],
@@ -153,6 +158,31 @@ function firstIdentToken(node) {
153
158
  return null;
154
159
  }
155
160
 
161
+ /**
162
+ * Whether a `type_specifier` or `call_phrase` names a vector type (`vec3<f32>`, `vec4f`, …).
163
+ * @param {Node} node
164
+ */
165
+ function namesVector(node) {
166
+ const ident = node.namedChildren.find(c => c.type === 'template_elaborated_ident')
167
+ ?.namedChildren.find(c => c.type === 'ident');
168
+ return ident !== undefined && VECTOR_TYPE_NAME.test(ident.text.trim());
169
+ }
170
+
171
+ /**
172
+ * Whether a declaration can be seen to be a vector without inferring types: its type annotation
173
+ * names one, or, unannotated, its whole initializer is a vector constructor (`vec3<f32>(0.0)`).
174
+ * @param {Node|undefined} type_specifier
175
+ * @param {Node|undefined} initializer
176
+ */
177
+ function declaresVector(type_specifier, initializer) {
178
+ if (type_specifier !== undefined) return namesVector(type_specifier);
179
+ if (initializer === undefined) return false;
180
+
181
+ let node = initializer;
182
+ while (node.namedChildren.length === 1) node = node.namedChildren[0];
183
+ return node.type === 'call_phrase' && namesVector(node);
184
+ }
185
+
156
186
  /**
157
187
  * Strip line comments and block comments and string-free WGSL has no strings, so a coarse
158
188
  * comment strip is enough to keep the lexical foreign-token scan from firing inside a
@@ -181,6 +211,8 @@ export function validate_wgsl_source(source, parser) {
181
211
  // ── collect the symbol table (user functions + structs) ──
182
212
  const declared_functions = new Set();
183
213
  const declared_structs = new Set();
214
+ /** Every struct member name; one shaped like a swizzle makes `x.xy = …` legal on that struct. */
215
+ const declared_members = new Set();
184
216
 
185
217
  for (const fn of descendantsOfType(root, 'function_decl')) {
186
218
  const header = fn.namedChildren.find(c => c.type === 'function_header');
@@ -191,6 +223,11 @@ export function validate_wgsl_source(source, parser) {
191
223
  for (const s of descendantsOfType(root, 'struct_decl')) {
192
224
  const ident = s.namedChildren.find(c => c.type === 'ident');
193
225
  if (ident !== undefined) declared_structs.add(ident.text.trim());
226
+
227
+ for (const member of descendantsOfType(s, 'struct_member')) {
228
+ const name = member.namedChildren.find(c => c.type === 'member_ident');
229
+ if (name !== undefined) declared_members.add(name.text.trim());
230
+ }
194
231
  }
195
232
 
196
233
  const core_builtins = new Set(Object.keys(WGSLLanguageCore));
@@ -209,6 +246,21 @@ export function validate_wgsl_source(source, parser) {
209
246
  /** Everything a const-expression may NOT read: parameters, `var`, `let`. @type {Set<string>} */
210
247
  const runtime = new Set();
211
248
 
249
+ // Scopes are flat here, so a name is a vector only if every declaration of it says so.
250
+ /** Names every declaration of which is seen to be a vector. @type {Set<string>} */
251
+ const vectors = new Set();
252
+ /** Names declared at least once as anything else. @type {Set<string>} */
253
+ const not_vectors = new Set();
254
+
255
+ const declare_vector = (name, is_vector) => {
256
+ if (is_vector && !not_vectors.has(name)) {
257
+ vectors.add(name);
258
+ } else {
259
+ vectors.delete(name);
260
+ not_vectors.add(name);
261
+ }
262
+ };
263
+
212
264
  // Value parameters are immutable; POINTER parameters are not — writing through a
213
265
  // pointer (`*p = …`, `p.x = …`, `memory[i] = …`) is the legal, common case in this
214
266
  // codebase, so excluding them is what keeps this rule free of false positives.
@@ -223,6 +275,7 @@ export function validate_wgsl_source(source, parser) {
223
275
  if (!is_pointer) immutable.add(id.text.trim());
224
276
 
225
277
  runtime.add(id.text.trim());
278
+ declare_vector(id.text.trim(), declaresVector(type, undefined));
226
279
  }
227
280
  }
228
281
  }
@@ -237,6 +290,11 @@ export function validate_wgsl_source(source, parser) {
237
290
  const name = opt !== undefined && opt !== null ? firstIdentToken(opt) : null;
238
291
  if (name === null) continue;
239
292
 
293
+ declare_vector(name, declaresVector(
294
+ opt.namedChildren.find(c => c.type === 'type_specifier'),
295
+ decl.namedChildren.find(c => c.type === 'expression'),
296
+ ));
297
+
240
298
  if (is_var) {
241
299
  mutable.add(name);
242
300
  immutable.delete(name);
@@ -269,8 +327,21 @@ export function validate_wgsl_source(source, parser) {
269
327
  if (lhs === undefined) return;
270
328
 
271
329
  // swizzle-store
330
+ //
331
+ // `.xy` is an l-value only as a struct member, so with no struct declaring one the
332
+ // store is illegal whatever the base is. With one, the base has to be seen to be a
333
+ // vector: a parameter or local declared as one and stored to directly (`v.xy`).
272
334
  const tail = lhs.text.match(LHS_SWIZZLE_TAIL);
273
- if (tail !== null && SWIZZLE_COMPONENTS.test(tail[1])) {
335
+ const core = lhs.namedChildren.find(c => c.type === 'core_lhs_expression');
336
+ const access = lhs.namedChildren.find(c => c.type === 'component_or_swizzle_specifier');
337
+ const base = core?.namedChildren.find(c => c.type === 'ident');
338
+ const on_vector = base !== undefined
339
+ && access !== undefined
340
+ && access.namedChildren.length === 1
341
+ && access.namedChildren[0].type === 'member_ident'
342
+ && vectors.has(base.text.trim());
343
+
344
+ if (tail !== null && SWIZZLE_COMPONENTS.test(tail[1]) && (!declared_members.has(tail[1]) || on_vector)) {
274
345
  diagnostics.push({
275
346
  rule: 'swizzle-store',
276
347
  message: `assignment to multi-component swizzle '.${tail[1]}' is not an l-value in WGSL`,
@@ -1,114 +0,0 @@
1
- /**
2
- * Hand one entity's instance to the GPU: its skins become deformations.
3
- *
4
- * **Registration is eventually consistent by design**, which is what makes this callable the moment
5
- * an instance exists rather than at some later moment when the scene is known to be built. An id is
6
- * allocated and returned synchronously, while the skin's meshes are bound to it only once every
7
- * joint has a row in the scene. Until then the skin is inert rather than wrong: its meshes draw
8
- * undeformed.
9
- *
10
- * The instance's entities therefore do **not** have to hold their rows yet.
11
- *
12
- * @param {GPUSceneContext} context the scene's GPU state, which owns the manager and is what the
13
- * registration is stamped with so it can be given back to the right one
14
- * @param {PrefabInstance} instance its skins name joint and mesh entities
15
- * @returns {InstanceAnimationRegistration}
16
- */
17
- export function register_instance_animation(context: GPUSceneContext, instance: PrefabInstance): InstanceAnimationRegistration;
18
- /**
19
- * Give back everything {@link register_instance_animation} took out, for a manager that is still
20
- * the one that issued it.
21
- *
22
- * **A destroyed manager must not be handed its own ids back.** A renderer restart takes the GPU
23
- * scene context with it, and the ids it issued mean nothing to the context that replaces it — so
24
- * the caller forgets them rather than returning them. This is only for the ordinary case: an entity
25
- * that leaves while the renderer it registered with is still running, and the registration's own
26
- * {@link InstanceAnimationRegistration#context} is how a caller tells the two apart.
27
- *
28
- * @param {InstanceAnimationRegistration} registration
29
- */
30
- export function unregister_instance_animation(registration: InstanceAnimationRegistration): void;
31
- /**
32
- * Make some of an instance's clips playable — the ones a driver actually plays, and no others.
33
- *
34
- * **Registering a clip is not free of consequence, which is why this takes a set.** The pose
35
- * accumulator marks a joint dirty for every bound clip that writes to it, whatever its weight, so a
36
- * bound clip at weight zero resolves the joints only it drives to zero rather than leaving them at
37
- * rest. A driver therefore registers what it can play and re-registers when that changes; a clip no
38
- * driver claims is never bound and so moves nothing.
39
- *
40
- * Each index is registered once however many times it is named. Two states of one graph can play
41
- * the same clip of the model, and two registrations of one clip are two rows the accumulator would
42
- * add together.
43
- *
44
- * @param {GPUSceneContext} context
45
- * @param {PrefabInstance} instance its clips target entities
46
- * @param {ArrayLike<number>} slots indices into `instance.clips`; duplicates are ignored
47
- * @returns {InstanceClipRegistration}
48
- */
49
- export function register_instance_clips(context: GPUSceneContext, instance: PrefabInstance, slots: ArrayLike<number>): InstanceClipRegistration;
50
- /**
51
- * Give back everything {@link register_instance_clips} took out, for a manager that is still the one
52
- * that issued it — see {@link unregister_instance_animation} for why that qualification matters.
53
- *
54
- * @param {InstanceClipRegistration} registration
55
- */
56
- export function unregister_instance_clips(registration: InstanceClipRegistration): void;
57
- /**
58
- * What the animation manager handed back for one {@link PrefabInstance}'s **skins**.
59
- *
60
- * Positional: `skins[i]` is the id of the instance's `skins[i]`.
61
- *
62
- * **Clips are not here, and that is D37.** A skin belongs to the model — it is how the mesh
63
- * deforms, and every placement of the model needs it whatever is playing — so the system that
64
- * places the model registers it. A clip belongs to whatever plays it, and a clip nothing plays must
65
- * not be registered at all: the pose accumulator marks a joint dirty for any *bound* clip, weight
66
- * and all, so a joint driven only by clips at weight zero resolves to zero rather than to its rest
67
- * pose. A model carrying clips and no animation component used to render the sum of every one of
68
- * them. See {@link register_instance_clips}.
69
- */
70
- export class InstanceAnimationRegistration {
71
- /**
72
- * The GPU scene context these ids were issued by.
73
- *
74
- * Carried rather than inferred, because **an id may only be handed back to the manager that
75
- * issued it** and there is no other way to be sure. A renderer restart builds a new context, and
76
- * a holder comparing this against what `scene_context` answers now knows in one `===` whether
77
- * giving the ids back is returning them or corrupting a stranger's table — without depending on
78
- * when anything last ran.
79
- *
80
- * @type {GPUSceneContext}
81
- */
82
- context: GPUSceneContext;
83
- /**
84
- * @type {number[]}
85
- */
86
- skins: number[];
87
- }
88
- /**
89
- * The id a clip has when nobody registered it.
90
- * @type {number}
91
- */
92
- export const CLIP_NOT_REGISTERED: number;
93
- /**
94
- * Which of an instance's clips a driver has playable, by the instance's own clip index.
95
- *
96
- * `ids[i]` is the manager's id for `instance.clips[i]`, or {@link CLIP_NOT_REGISTERED} where this
97
- * driver does not play that clip. Indexed by the instance rather than packed, because that is how
98
- * both drivers already address a clip — the graph resolves a name to a model slot, the clip list
99
- * does the same — and a packed array would want a second table to say what each entry was.
100
- */
101
- export class InstanceClipRegistration {
102
- /**
103
- * The GPU scene context these ids were issued by. See
104
- * {@link InstanceAnimationRegistration#context} — same reasoning, same `===` check.
105
- *
106
- * @type {GPUSceneContext|null}
107
- */
108
- context: GPUSceneContext | null;
109
- /**
110
- * @type {Int32Array}
111
- */
112
- ids: Int32Array;
113
- }
114
- //# sourceMappingURL=register_instance_animation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register_instance_animation.d.ts","sourceRoot":"","sources":["../../../../src/engine/graphics3/register_instance_animation.js"],"names":[],"mappings":"AAmCA;;;;;;;;;;;;;;;GAeG;AACH,iGAFa,6BAA6B,CAmBzC;AAED;;;;;;;;;;;GAWG;AACH,4DAFW,6BAA6B,QAevC;AA+BD;;;;;;;;;;;;;;;;;GAiBG;AACH,mGAHW,UAAU,MAAM,CAAC,GACf,wBAAwB,CA+BpC;AAED;;;;;GAKG;AACH,wDAFW,wBAAwB,QAqBlC;AAtMD;;;;;;;;;;;;GAYG;AACH;IACI;;;;;;;;;;OAUG;IACH,yBAAe;IAEf;;OAEG;IACH,OAFU,MAAM,EAAE,CAEP;CACd;AAgED;;;GAGG;AACH,kCAFU,MAAM,CAEsB;AAEtC;;;;;;;GAOG;AACH;IACI;;;;;OAKG;IACH,SAFU,kBAAgB,IAAI,CAEf;IAEf;;OAEG;IACH,KAFU,UAAU,CAEI;CAC3B"}
@@ -1,201 +0,0 @@
1
- import { assert } from "../../core/assert.js";
2
-
3
- /**
4
- * What the animation manager handed back for one {@link PrefabInstance}'s **skins**.
5
- *
6
- * Positional: `skins[i]` is the id of the instance's `skins[i]`.
7
- *
8
- * **Clips are not here, and that is D37.** A skin belongs to the model — it is how the mesh
9
- * deforms, and every placement of the model needs it whatever is playing — so the system that
10
- * places the model registers it. A clip belongs to whatever plays it, and a clip nothing plays must
11
- * not be registered at all: the pose accumulator marks a joint dirty for any *bound* clip, weight
12
- * and all, so a joint driven only by clips at weight zero resolves to zero rather than to its rest
13
- * pose. A model carrying clips and no animation component used to render the sum of every one of
14
- * them. See {@link register_instance_clips}.
15
- */
16
- export class InstanceAnimationRegistration {
17
- /**
18
- * The GPU scene context these ids were issued by.
19
- *
20
- * Carried rather than inferred, because **an id may only be handed back to the manager that
21
- * issued it** and there is no other way to be sure. A renderer restart builds a new context, and
22
- * a holder comparing this against what `scene_context` answers now knows in one `===` whether
23
- * giving the ids back is returning them or corrupting a stranger's table — without depending on
24
- * when anything last ran.
25
- *
26
- * @type {GPUSceneContext}
27
- */
28
- context = null;
29
-
30
- /**
31
- * @type {number[]}
32
- */
33
- skins = [];
34
- }
35
-
36
- /**
37
- * Hand one entity's instance to the GPU: its skins become deformations.
38
- *
39
- * **Registration is eventually consistent by design**, which is what makes this callable the moment
40
- * an instance exists rather than at some later moment when the scene is known to be built. An id is
41
- * allocated and returned synchronously, while the skin's meshes are bound to it only once every
42
- * joint has a row in the scene. Until then the skin is inert rather than wrong: its meshes draw
43
- * undeformed.
44
- *
45
- * The instance's entities therefore do **not** have to hold their rows yet.
46
- *
47
- * @param {GPUSceneContext} context the scene's GPU state, which owns the manager and is what the
48
- * registration is stamped with so it can be given back to the right one
49
- * @param {PrefabInstance} instance its skins name joint and mesh entities
50
- * @returns {InstanceAnimationRegistration}
51
- */
52
- export function register_instance_animation(context, instance) {
53
- assert.defined(context, 'context');
54
- assert.defined(instance, 'instance');
55
-
56
- const manager = context.animation_manager;
57
-
58
- const r = new InstanceAnimationRegistration();
59
-
60
- r.context = context;
61
-
62
- const skins = instance.skins;
63
-
64
- for (let i = 0; i < skins.length; i++) {
65
- r.skins.push(manager.register_skin(skins[i]));
66
- }
67
-
68
- return r;
69
- }
70
-
71
- /**
72
- * Give back everything {@link register_instance_animation} took out, for a manager that is still
73
- * the one that issued it.
74
- *
75
- * **A destroyed manager must not be handed its own ids back.** A renderer restart takes the GPU
76
- * scene context with it, and the ids it issued mean nothing to the context that replaces it — so
77
- * the caller forgets them rather than returning them. This is only for the ordinary case: an entity
78
- * that leaves while the renderer it registered with is still running, and the registration's own
79
- * {@link InstanceAnimationRegistration#context} is how a caller tells the two apart.
80
- *
81
- * @param {InstanceAnimationRegistration} registration
82
- */
83
- export function unregister_instance_animation(registration) {
84
- assert.defined(registration, 'registration');
85
- assert.defined(registration.context, 'registration.context');
86
-
87
- const manager = registration.context.animation_manager;
88
-
89
- const skins = registration.skins;
90
-
91
- for (let i = 0; i < skins.length; i++) {
92
- manager.unregister_skin(skins[i]);
93
- }
94
-
95
- skins.length = 0;
96
- }
97
-
98
- /**
99
- * The id a clip has when nobody registered it.
100
- * @type {number}
101
- */
102
- export const CLIP_NOT_REGISTERED = -1;
103
-
104
- /**
105
- * Which of an instance's clips a driver has playable, by the instance's own clip index.
106
- *
107
- * `ids[i]` is the manager's id for `instance.clips[i]`, or {@link CLIP_NOT_REGISTERED} where this
108
- * driver does not play that clip. Indexed by the instance rather than packed, because that is how
109
- * both drivers already address a clip — the graph resolves a name to a model slot, the clip list
110
- * does the same — and a packed array would want a second table to say what each entry was.
111
- */
112
- export class InstanceClipRegistration {
113
- /**
114
- * The GPU scene context these ids were issued by. See
115
- * {@link InstanceAnimationRegistration#context} — same reasoning, same `===` check.
116
- *
117
- * @type {GPUSceneContext|null}
118
- */
119
- context = null;
120
-
121
- /**
122
- * @type {Int32Array}
123
- */
124
- ids = new Int32Array(0);
125
- }
126
-
127
- /**
128
- * Make some of an instance's clips playable — the ones a driver actually plays, and no others.
129
- *
130
- * **Registering a clip is not free of consequence, which is why this takes a set.** The pose
131
- * accumulator marks a joint dirty for every bound clip that writes to it, whatever its weight, so a
132
- * bound clip at weight zero resolves the joints only it drives to zero rather than leaving them at
133
- * rest. A driver therefore registers what it can play and re-registers when that changes; a clip no
134
- * driver claims is never bound and so moves nothing.
135
- *
136
- * Each index is registered once however many times it is named. Two states of one graph can play
137
- * the same clip of the model, and two registrations of one clip are two rows the accumulator would
138
- * add together.
139
- *
140
- * @param {GPUSceneContext} context
141
- * @param {PrefabInstance} instance its clips target entities
142
- * @param {ArrayLike<number>} slots indices into `instance.clips`; duplicates are ignored
143
- * @returns {InstanceClipRegistration}
144
- */
145
- export function register_instance_clips(context, instance, slots) {
146
- assert.defined(context, 'context');
147
- assert.defined(instance, 'instance');
148
- assert.defined(slots, 'slots');
149
-
150
- const manager = context.animation_manager;
151
-
152
- const clips = instance.clips;
153
-
154
- const r = new InstanceClipRegistration();
155
-
156
- r.context = context;
157
- r.ids = new Int32Array(clips.length).fill(CLIP_NOT_REGISTERED);
158
-
159
- for (let i = 0; i < slots.length; i++) {
160
- const slot = slots[i];
161
-
162
- assert.isNonNegativeInteger(slot, 'slot');
163
- assert.lessThan(slot, clips.length, 'slot');
164
-
165
- if (r.ids[slot] !== CLIP_NOT_REGISTERED) {
166
- // named twice by one driver, which is one clip either way
167
- continue;
168
- }
169
-
170
- r.ids[slot] = manager.register_clip(clips[slot]);
171
- }
172
-
173
- return r;
174
- }
175
-
176
- /**
177
- * Give back everything {@link register_instance_clips} took out, for a manager that is still the one
178
- * that issued it — see {@link unregister_instance_animation} for why that qualification matters.
179
- *
180
- * @param {InstanceClipRegistration} registration
181
- */
182
- export function unregister_instance_clips(registration) {
183
- assert.defined(registration, 'registration');
184
- assert.defined(registration.context, 'registration.context');
185
-
186
- const manager = registration.context.animation_manager;
187
-
188
- const ids = registration.ids;
189
-
190
- for (let i = 0; i < ids.length; i++) {
191
- const id = ids[i];
192
-
193
- if (id === CLIP_NOT_REGISTERED) {
194
- continue;
195
- }
196
-
197
- manager.unregister_clip(id);
198
- }
199
-
200
- ids.fill(CLIP_NOT_REGISTERED);
201
- }