@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
@@ -1491,7 +1491,8 @@ function emitVariableUpdatingStatement(c, node) {
1491
1491
  || isScalarUnsigned(lhs_compiled.type)
1492
1492
  || isScalarUnsigned(rhs_compiled.type)
1493
1493
  )) {
1494
- c.out.add(emitWriteStatement(lhs_compiled, `wgsl.${bitwise_helper}(${lhs_compiled.code}, ${rhs_compiled.code})`));
1494
+ c.out.add(emitWriteStatement(lhs_compiled,
1495
+ `wgsl.${shiftHelperFor(bitwise_helper, lhs_compiled.type)}(${lhs_compiled.code}, ${rhs_compiled.code})`));
1495
1496
  return;
1496
1497
  }
1497
1498
  c.out.add(`${lhs_compiled.code} ${op_text} ${rhs_compiled.code};`);
@@ -2155,14 +2156,15 @@ function compileBinaryExpression(c, node, op_type, mode) {
2155
2156
  // bit set was negative too. The helpers normalise with `>>> 0`, which is what WGSL u32 means.
2156
2157
  //
2157
2158
  // Deliberately not extended to i32: `bit_and` and friends return an unsigned result, and a
2158
- // signed operand is exactly the case raw JS already gets right.
2159
+ // signed operand is exactly the case raw JS already gets right. A shift is the exception: WGSL
2160
+ // makes its amount a u32 whatever it shifts, so an i32 shift lands here and takes the signed helper.
2159
2161
  const bitwise_helper = BITWISE_HELPER[op_text];
2160
2162
  if (bitwise_helper !== undefined) {
2161
2163
  if (isContainerType(left.type) || isContainerType(right.type)
2162
2164
  || isScalarBool(left.type) || isScalarBool(right.type)
2163
2165
  || isScalarUnsigned(left.type) || isScalarUnsigned(right.type)) {
2164
2166
  return {
2165
- code: `wgsl.${bitwise_helper}(${left.code}, ${right.code})`,
2167
+ code: `wgsl.${shiftHelperFor(bitwise_helper, left.type)}(${left.code}, ${right.code})`,
2166
2168
  type: inferRawBinaryResultType(left.type, right.type, op_text),
2167
2169
  };
2168
2170
  }
@@ -2193,6 +2195,12 @@ const BITWISE_HELPER = {
2193
2195
  '>>': 'shr',
2194
2196
  };
2195
2197
 
2198
+ /** The helper for a bitwise operator on a value of type `t`: a shift of an i32 (scalar or vector) keeps its sign. */
2199
+ function shiftHelperFor(helper, t) {
2200
+ if ((helper === 'shl' || helper === 'shr') && isIntegerType(t) && integerScalarName(t) === 'i32') { return `${helper}_i32`; }
2201
+ return helper;
2202
+ }
2203
+
2196
2204
  /** Map WGSL comparison operators to language-core element-wise helper names. */
2197
2205
  const COMPARISON_HELPER = {
2198
2206
  '==': 'eq',
@@ -1 +1 @@
1
- {"version":3,"file":"WGSLLanguageCore.d.ts","sourceRoot":"","sources":["../../../../../src/shade/wgsl/emulator/WGSLLanguageCore.js"],"names":[],"mappings":";IAs/CA;;;;;;;;;;;;;;OAcG;IACH,+DAmDC"}
1
+ {"version":3,"file":"WGSLLanguageCore.d.ts","sourceRoot":"","sources":["../../../../../src/shade/wgsl/emulator/WGSLLanguageCore.js"],"names":[],"mappings":";IAy/CA;;;;;;;;;;;;;;OAcG;IACH,+DAmDC"}
@@ -586,6 +586,9 @@ export const WGSLLanguageCore = {
586
586
  bit_xor: (a, b) => binop(a, b, (x, y) => typeof x === 'boolean' ? x !== y : (x ^ y) >>> 0),
587
587
  shl: (a, b) => binop(a, b, (x, y) => (x << y) >>> 0),
588
588
  shr: (a, b) => binop(a, b, (x, y) => x >>> y),
589
+ // The same on an i32, whose shift amount WGSL still makes a u32: `>>` sign-extends, and both stay signed.
590
+ shl_i32: (a, b) => binop(a, b, (x, y) => (x << y) | 0),
591
+ shr_i32: (a, b) => binop(a, b, (x, y) => x >> y),
589
592
 
590
593
  neg: (a) => unop(a, x => -x),
591
594
  not: (a) => unop(a, x => (~x) >>> 0),
@@ -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
- }