@woosh/meep-engine 3.23.0 → 3.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (522) hide show
  1. package/editor/entity_world_bounds.d.ts +9 -3
  2. package/editor/entity_world_bounds.d.ts.map +1 -1
  3. package/editor/entity_world_bounds.js +61 -4
  4. package/package.json +1 -1
  5. package/src/core/binary/allocator/OffsetAllocator.d.ts +40 -2
  6. package/src/core/binary/allocator/OffsetAllocator.d.ts.map +1 -1
  7. package/src/core/binary/allocator/OffsetAllocator.js +124 -29
  8. package/src/core/collection/map/u32_index.d.ts +83 -0
  9. package/src/core/collection/map/u32_index.d.ts.map +1 -0
  10. package/src/core/collection/map/u32_index.js +247 -0
  11. package/src/engine/asset/loaders/GLTFSceneBundleAssetLoader.d.ts +2 -2
  12. package/src/engine/asset/loaders/GLTFSceneBundleAssetLoader.js +2 -2
  13. package/src/engine/asset/loaders/USDSceneBundleAssetLoader.d.ts +1 -2
  14. package/src/engine/asset/loaders/USDSceneBundleAssetLoader.d.ts.map +1 -1
  15. package/src/engine/asset/loaders/USDSceneBundleAssetLoader.js +4 -12
  16. package/src/engine/ecs/gpu/GPUStateAuthority.d.ts +55 -0
  17. package/src/engine/ecs/gpu/GPUStateAuthority.d.ts.map +1 -0
  18. package/src/engine/ecs/gpu/GPUStateAuthority.js +72 -0
  19. package/src/engine/ecs/gpu/GPUStateAuthorityFlags.d.ts +40 -0
  20. package/src/engine/ecs/gpu/GPUStateAuthorityFlags.d.ts.map +1 -0
  21. package/src/engine/ecs/gpu/GPUStateAuthorityFlags.js +79 -0
  22. package/src/engine/ecs/gpu/gpu_authority_assert_cpu.d.ts +18 -0
  23. package/src/engine/ecs/gpu/gpu_authority_assert_cpu.d.ts.map +1 -0
  24. package/src/engine/ecs/gpu/gpu_authority_assert_cpu.js +27 -0
  25. package/src/engine/ecs/gpu/gpu_authority_declare.d.ts +23 -0
  26. package/src/engine/ecs/gpu/gpu_authority_declare.d.ts.map +1 -0
  27. package/src/engine/ecs/gpu/gpu_authority_declare.js +39 -0
  28. package/src/engine/ecs/gpu/gpu_authority_grant.d.ts +15 -0
  29. package/src/engine/ecs/gpu/gpu_authority_grant.d.ts.map +1 -0
  30. package/src/engine/ecs/gpu/gpu_authority_grant.js +38 -0
  31. package/src/engine/ecs/gpu/gpu_authority_has.d.ts +18 -0
  32. package/src/engine/ecs/gpu/gpu_authority_has.d.ts.map +1 -0
  33. package/src/engine/ecs/gpu/gpu_authority_has.js +28 -0
  34. package/src/engine/ecs/gpu/gpu_authority_revoke.d.ts +24 -0
  35. package/src/engine/ecs/gpu/gpu_authority_revoke.d.ts.map +1 -0
  36. package/src/engine/ecs/gpu/gpu_authority_revoke.js +49 -0
  37. package/src/engine/ecs/ik/IKProblem.d.ts +14 -0
  38. package/src/engine/ecs/ik/IKProblem.d.ts.map +1 -1
  39. package/src/engine/ecs/ik/IKProblem.js +16 -0
  40. package/src/engine/ecs/ik/InverseKinematicsSystem.d.ts.map +1 -1
  41. package/src/engine/ecs/ik/InverseKinematicsSystem.js +19 -0
  42. package/src/engine/ecs/ik/OneBoneSurfaceAlignmentSolver.js +2 -2
  43. package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.js +2 -2
  44. package/src/engine/ecs/ik/ik_bone_chain.d.ts +11 -2
  45. package/src/engine/ecs/ik/ik_bone_chain.d.ts.map +1 -1
  46. package/src/engine/ecs/ik/ik_bone_chain.js +47 -2
  47. package/src/engine/ecs/ik/ik_write_local_rotation.d.ts.map +1 -1
  48. package/src/engine/ecs/ik/ik_write_local_rotation.js +6 -0
  49. package/src/engine/ecs/speaker/VoiceSystem.d.ts.map +1 -1
  50. package/src/engine/ecs/speaker/VoiceSystem.js +6 -0
  51. package/src/engine/ecs/transform/T64WorldCache.d.ts +50 -0
  52. package/src/engine/ecs/transform/T64WorldCache.d.ts.map +1 -0
  53. package/src/engine/ecs/transform/T64WorldCache.js +139 -0
  54. package/src/engine/ecs/transform/t64_evaluate_world.d.ts +31 -0
  55. package/src/engine/ecs/transform/t64_evaluate_world.d.ts.map +1 -0
  56. package/src/engine/ecs/transform/t64_evaluate_world.js +126 -0
  57. package/src/engine/ecs/transform-attachment/TransformAttachmentSystem.d.ts +8 -0
  58. package/src/engine/ecs/transform-attachment/TransformAttachmentSystem.d.ts.map +1 -1
  59. package/src/engine/ecs/transform-attachment/TransformAttachmentSystem.js +59 -30
  60. package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.d.ts.map +1 -1
  61. package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.js +4 -11
  62. package/src/engine/graphics/ecs/mesh-v2/SHADED_GEOMETRY_EVENT_CHANGE.d.ts +14 -0
  63. package/src/engine/graphics/ecs/mesh-v2/SHADED_GEOMETRY_EVENT_CHANGE.d.ts.map +1 -0
  64. package/src/engine/graphics/ecs/mesh-v2/SHADED_GEOMETRY_EVENT_CHANGE.js +13 -0
  65. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +2 -14
  66. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts.map +1 -1
  67. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +11 -21
  68. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometryFlags.d.ts +1 -0
  69. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometryFlags.js +7 -0
  70. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshHighlightSystem.d.ts +5 -6
  71. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshHighlightSystem.d.ts.map +1 -1
  72. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshHighlightSystem.js +13 -11
  73. package/src/engine/graphics/ecs/mesh-v2/shaded_geometry_announce_change.d.ts +14 -0
  74. package/src/engine/graphics/ecs/mesh-v2/shaded_geometry_announce_change.d.ts.map +1 -0
  75. package/src/engine/graphics/ecs/mesh-v2/shaded_geometry_announce_change.js +21 -0
  76. package/src/engine/graphics/ecs/particles/ParticleEffect.d.ts +1 -1
  77. package/src/engine/graphics/ecs/particles/ParticleEffect.js +1 -1
  78. package/src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.d.ts +1 -1
  79. package/src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.js +1 -1
  80. package/src/engine/graphics3/AnimationGraphSystem.js +3 -3
  81. package/src/engine/graphics3/AnimationSystem.js +2 -2
  82. package/src/engine/graphics3/DebugDrawSystem.d.ts.map +1 -1
  83. package/src/engine/graphics3/DebugDrawSystem.js +2 -4
  84. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +34 -27
  85. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
  86. package/src/engine/graphics3/GPUParticleEmitterSystem.js +185 -85
  87. package/src/engine/graphics3/HighlightOutlineSystem.d.ts +4 -3
  88. package/src/engine/graphics3/HighlightOutlineSystem.d.ts.map +1 -1
  89. package/src/engine/graphics3/HighlightOutlineSystem.js +7 -9
  90. package/src/engine/graphics3/LightSystem.d.ts +7 -5
  91. package/src/engine/graphics3/LightSystem.d.ts.map +1 -1
  92. package/src/engine/graphics3/LightSystem.js +36 -22
  93. package/src/engine/graphics3/MeshSystem.d.ts +43 -39
  94. package/src/engine/graphics3/MeshSystem.d.ts.map +1 -1
  95. package/src/engine/graphics3/MeshSystem.js +324 -331
  96. package/src/engine/graphics3/PathDisplaySystem.d.ts.map +1 -1
  97. package/src/engine/graphics3/PathDisplaySystem.js +2 -4
  98. package/src/engine/graphics3/PickingQuery.d.ts +15 -21
  99. package/src/engine/graphics3/PickingQuery.d.ts.map +1 -1
  100. package/src/engine/graphics3/PickingQuery.js +21 -25
  101. package/src/engine/graphics3/PickingSystem.d.ts +60 -31
  102. package/src/engine/graphics3/PickingSystem.d.ts.map +1 -1
  103. package/src/engine/graphics3/PickingSystem.js +416 -273
  104. package/src/engine/graphics3/ShadedGeometrySystem.d.ts +22 -12
  105. package/src/engine/graphics3/ShadedGeometrySystem.d.ts.map +1 -1
  106. package/src/engine/graphics3/ShadedGeometrySystem.js +309 -174
  107. package/src/engine/graphics3/TerrainSystem.d.ts +19 -11
  108. package/src/engine/graphics3/TerrainSystem.d.ts.map +1 -1
  109. package/src/engine/graphics3/TerrainSystem.js +102 -53
  110. package/src/engine/graphics3/TooltipComponentSystem.d.ts.map +1 -1
  111. package/src/engine/graphics3/TooltipComponentSystem.js +2 -14
  112. package/src/engine/graphics3/Trail3DSystem.d.ts.map +1 -1
  113. package/src/engine/graphics3/Trail3DSystem.js +2 -4
  114. package/src/engine/graphics3/animation/ClipListPlayer.d.ts +4 -4
  115. package/src/engine/graphics3/animation/ClipListPlayer.d.ts.map +1 -1
  116. package/src/engine/graphics3/animation/ClipListPlayer.js +2 -2
  117. package/src/engine/graphics3/highlight/pack_highlight_table.d.ts +9 -11
  118. package/src/engine/graphics3/highlight/pack_highlight_table.d.ts.map +1 -1
  119. package/src/engine/graphics3/highlight/pack_highlight_table.js +11 -18
  120. package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts +4 -3
  121. package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts.map +1 -1
  122. package/src/engine/graphics3/pose/query_entity_node_world_pose.js +75 -74
  123. package/src/engine/graphics3/prefab/Prefab.d.ts +130 -0
  124. package/src/engine/graphics3/prefab/Prefab.d.ts.map +1 -0
  125. package/src/engine/graphics3/prefab/Prefab.js +162 -0
  126. package/src/engine/graphics3/prefab/PrefabInstance.d.ts +72 -0
  127. package/src/engine/graphics3/prefab/PrefabInstance.d.ts.map +1 -0
  128. package/src/engine/graphics3/prefab/PrefabInstance.js +80 -0
  129. package/src/engine/graphics3/prefab/prefab_compile.d.ts +23 -0
  130. package/src/engine/graphics3/prefab/prefab_compile.d.ts.map +1 -0
  131. package/src/engine/graphics3/prefab/prefab_compile.js +334 -0
  132. package/src/engine/graphics3/prefab/prefab_instantiate.d.ts +46 -0
  133. package/src/engine/graphics3/prefab/prefab_instantiate.d.ts.map +1 -0
  134. package/src/engine/graphics3/prefab/prefab_instantiate.js +230 -0
  135. package/src/engine/graphics3/prefab/prefab_normalize_skin_frames.d.ts +70 -0
  136. package/src/engine/graphics3/prefab/prefab_normalize_skin_frames.d.ts.map +1 -0
  137. package/src/engine/graphics3/prefab/prefab_normalize_skin_frames.js +210 -0
  138. package/src/engine/graphics3/prefab/prefab_place.d.ts +60 -0
  139. package/src/engine/graphics3/prefab/prefab_place.d.ts.map +1 -0
  140. package/src/engine/graphics3/prefab/prefab_place.js +130 -0
  141. package/src/engine/graphics3/prefab/prefab_skin_clip_scale_conflicts.d.ts +60 -0
  142. package/src/engine/graphics3/prefab/prefab_skin_clip_scale_conflicts.d.ts.map +1 -0
  143. package/src/engine/graphics3/prefab/prefab_skin_clip_scale_conflicts.js +128 -0
  144. package/src/engine/graphics3/prefab/prefab_skin_frame.d.ts +40 -0
  145. package/src/engine/graphics3/prefab/prefab_skin_frame.d.ts.map +1 -0
  146. package/src/engine/graphics3/prefab/prefab_skin_frame.js +116 -0
  147. package/src/engine/graphics3/preview/make_model_preview_scene.d.ts +16 -14
  148. package/src/engine/graphics3/preview/make_model_preview_scene.d.ts.map +1 -1
  149. package/src/engine/graphics3/preview/make_model_preview_scene.js +126 -154
  150. package/src/engine/graphics3/preview/make_model_thumbnail.js +1 -1
  151. package/src/engine/graphics3/register_instance_animation.d.ts +6 -6
  152. package/src/engine/graphics3/register_instance_animation.d.ts.map +1 -1
  153. package/src/engine/graphics3/register_instance_animation.js +4 -4
  154. package/src/engine/graphics3/shade_bundle_bounds.d.ts +2 -6
  155. package/src/engine/graphics3/shade_bundle_bounds.d.ts.map +1 -1
  156. package/src/engine/graphics3/shade_bundle_bounds.js +47 -55
  157. package/src/engine/graphics3/terrain/pack_terrain_row_table.d.ts +11 -18
  158. package/src/engine/graphics3/terrain/pack_terrain_row_table.d.ts.map +1 -1
  159. package/src/engine/graphics3/terrain/pack_terrain_row_table.js +48 -53
  160. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts +17 -2
  161. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts.map +1 -1
  162. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.js +284 -256
  163. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts +13 -15
  164. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts.map +1 -1
  165. package/src/engine/physics/cloth/ecs/ClothInstance.js +12 -14
  166. package/src/engine/physics/cloth/ecs/ClothRig.d.ts +7 -8
  167. package/src/engine/physics/cloth/ecs/ClothRig.d.ts.map +1 -1
  168. package/src/engine/physics/cloth/ecs/ClothRig.js +7 -8
  169. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts +5 -4
  170. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts.map +1 -1
  171. package/src/engine/physics/cloth/ecs/ClothSystem.js +11 -12
  172. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts +19 -23
  173. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts.map +1 -1
  174. package/src/engine/physics/cloth/ecs/cloth_seed_rig.js +201 -199
  175. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts.map +1 -1
  176. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.js +8 -0
  177. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.d.ts +18 -34
  178. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.d.ts.map +1 -1
  179. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.js +58 -115
  180. package/src/engine/physics/cloth/playground/README.md +11 -11
  181. package/src/engine/physics/cloth/playground/garment_build.d.ts +0 -1
  182. package/src/engine/physics/cloth/playground/garment_build.d.ts.map +1 -1
  183. package/src/engine/physics/cloth/playground/garment_build.js +64 -58
  184. package/src/engine/physics/cloth/playground/garment_main.js +59 -33
  185. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  186. package/src/shade/RENDERER_CONTRACT.md +85 -53
  187. package/src/shade/device/ShadeGPUCommandContext.d.ts +23 -0
  188. package/src/shade/device/ShadeGPUCommandContext.d.ts.map +1 -1
  189. package/src/shade/device/ShadeGPUCommandContext.js +36 -0
  190. package/src/shade/playground/add_random_meshes.d.ts +4 -4
  191. package/src/shade/playground/add_random_meshes.d.ts.map +1 -1
  192. package/src/shade/playground/add_random_meshes.js +20 -16
  193. package/src/shade/playground/avboit/main.d.ts +1 -0
  194. package/src/shade/playground/avboit/main.d.ts.map +1 -1
  195. package/src/shade/playground/avboit/main.js +916 -875
  196. package/src/shade/playground/basis_textures/main.d.ts.map +1 -1
  197. package/src/shade/playground/basis_textures/main.js +22 -8
  198. package/src/shade/playground/basis_textures/texture_inventory.d.ts +2 -2
  199. package/src/shade/playground/basis_textures/texture_inventory.d.ts.map +1 -1
  200. package/src/shade/playground/basis_textures/texture_inventory.js +6 -7
  201. package/src/shade/playground/ground_seam/main.d.ts.map +1 -1
  202. package/src/shade/playground/ground_seam/main.js +13 -4
  203. package/src/shade/playground/ground_seam/make_ground.d.ts +13 -4
  204. package/src/shade/playground/ground_seam/make_ground.d.ts.map +1 -1
  205. package/src/shade/playground/ground_seam/make_ground.js +21 -16
  206. package/src/shade/playground/particle_ecs/bonfire_editor.js +3 -3
  207. package/src/shade/playground/particle_system/main.js +11 -10
  208. package/src/shade/playground/particle_system/particle_prototype.d.ts +15 -10
  209. package/src/shade/playground/particle_system/particle_prototype.d.ts.map +1 -1
  210. package/src/shade/playground/particle_system/particle_prototype.js +56 -15
  211. package/src/shade/playground/particle_system/particle_scene.d.ts +68 -28
  212. package/src/shade/playground/particle_system/particle_scene.d.ts.map +1 -1
  213. package/src/shade/playground/particle_system/particle_scene.js +149 -53
  214. package/src/shade/playground/readback_crossover/index.html +41 -0
  215. package/src/shade/playground/readback_crossover/main.d.ts +2 -0
  216. package/src/shade/playground/readback_crossover/main.d.ts.map +1 -0
  217. package/src/shade/playground/readback_crossover/main.js +372 -0
  218. package/src/shade/playground/skinned_blas_refit/README.md +11 -7
  219. package/src/shade/playground/skinned_blas_refit/add_floor.d.ts +13 -44
  220. package/src/shade/playground/skinned_blas_refit/add_floor.d.ts.map +1 -1
  221. package/src/shade/playground/skinned_blas_refit/add_floor.js +19 -59
  222. package/src/shade/playground/skinned_blas_refit/main.d.ts.map +1 -1
  223. package/src/shade/playground/skinned_blas_refit/main.js +67 -58
  224. package/src/shade/playground/skinned_blas_refit/place_character.d.ts +40 -54
  225. package/src/shade/playground/skinned_blas_refit/place_character.d.ts.map +1 -1
  226. package/src/shade/playground/skinned_blas_refit/place_character.js +47 -74
  227. package/src/shade/playground/skinned_blas_refit/sweep_views.d.ts +3 -3
  228. package/src/shade/playground/skinned_blas_refit/sweep_views.d.ts.map +1 -1
  229. package/src/shade/playground/skinned_blas_refit/sweep_views.js +4 -3
  230. package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.d.ts +3 -3
  231. package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.d.ts.map +1 -1
  232. package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.js +11 -4
  233. package/src/shade/playground/skinned_blas_refit/verify_instance_bounds.d.ts.map +1 -1
  234. package/src/shade/playground/skinned_blas_refit/verify_instance_bounds.js +38 -9
  235. package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.d.ts +3 -3
  236. package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.d.ts.map +1 -1
  237. package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.js +9 -6
  238. package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.d.ts +3 -3
  239. package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.d.ts.map +1 -1
  240. package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.js +3 -3
  241. package/src/shade/playground/skinned_mesh_soup/README.md +6 -6
  242. package/src/shade/playground/skinned_mesh_soup/main.d.ts.map +1 -1
  243. package/src/shade/playground/skinned_mesh_soup/main.js +44 -102
  244. package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.d.ts +5 -5
  245. package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.d.ts.map +1 -1
  246. package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.js +42 -33
  247. package/src/shade/playground/sponza_path_trace/main.d.ts +1 -0
  248. package/src/shade/playground/sponza_path_trace/main.d.ts.map +1 -1
  249. package/src/shade/playground/sponza_path_trace/main.js +393 -363
  250. package/src/shade/playground/ssr_reprojection/main.js +11 -9
  251. package/src/shade/playground/ssr_reprojection/scene.d.ts +15 -4
  252. package/src/shade/playground/ssr_reprojection/scene.d.ts.map +1 -1
  253. package/src/shade/playground/ssr_reprojection/scene.js +32 -11
  254. package/src/shade/playground/ssr_variance/main.js +1 -1
  255. package/src/shade/playground/ssr_variance/scene.d.ts +10 -4
  256. package/src/shade/playground/ssr_variance/scene.d.ts.map +1 -1
  257. package/src/shade/playground/ssr_variance/scene.js +39 -15
  258. package/src/shade/playground/vgeo_viewer/main.js +6 -2
  259. package/src/shade/playground/volumetrics_froxel/main.d.ts.map +1 -1
  260. package/src/shade/playground/volumetrics_froxel/main.js +936 -922
  261. package/src/shade/renderer/GraphicsContext.d.ts +7 -0
  262. package/src/shade/renderer/GraphicsContext.d.ts.map +1 -1
  263. package/src/shade/renderer/GraphicsContext.js +11 -0
  264. package/src/shade/renderer/Renderer.d.ts +3 -2
  265. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  266. package/src/shade/renderer/Renderer.js +3 -2
  267. package/src/shade/renderer/animation/GPUAnimationManager.d.ts +39 -47
  268. package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
  269. package/src/shade/renderer/animation/GPUAnimationManager.js +319 -256
  270. package/src/shade/renderer/animation/ShadeAnimationChannel.d.ts +26 -22
  271. package/src/shade/renderer/animation/ShadeAnimationChannel.d.ts.map +1 -1
  272. package/src/shade/renderer/animation/ShadeAnimationChannel.js +28 -23
  273. package/src/shade/renderer/animation/ShadeAnimationClip.d.ts +14 -6
  274. package/src/shade/renderer/animation/ShadeAnimationClip.d.ts.map +1 -1
  275. package/src/shade/renderer/animation/ShadeAnimationClip.js +20 -8
  276. package/src/shade/renderer/animation/Skin.d.ts +19 -19
  277. package/src/shade/renderer/animation/Skin.d.ts.map +1 -1
  278. package/src/shade/renderer/animation/Skin.js +15 -13
  279. package/src/shade/renderer/animation/pose/pose_evaluate_local.d.ts +6 -5
  280. package/src/shade/renderer/animation/pose/pose_evaluate_local.d.ts.map +1 -1
  281. package/src/shade/renderer/animation/pose/pose_evaluate_local.js +9 -9
  282. package/src/shade/renderer/animation/skin_clip_scale_conflicts.d.ts +5 -59
  283. package/src/shade/renderer/animation/skin_clip_scale_conflicts.d.ts.map +1 -1
  284. package/src/shade/renderer/animation/skin_clip_scale_conflicts.js +8 -132
  285. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts +65 -62
  286. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
  287. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +148 -194
  288. package/src/shade/renderer/animation/skinning/SKINNING_BINDING_STRUCT.d.ts.map +1 -1
  289. package/src/shade/renderer/animation/skinning/SKINNING_BINDING_STRUCT.js +4 -7
  290. package/src/shade/renderer/animation/skinning/chunk_skin_blend_mesh_local.d.ts +2 -2
  291. package/src/shade/renderer/animation/skinning/chunk_skin_blend_mesh_local.js +2 -2
  292. package/src/shade/renderer/buffer/GPUBufferReadbackAllocator.d.ts +74 -0
  293. package/src/shade/renderer/buffer/GPUBufferReadbackAllocator.d.ts.map +1 -0
  294. package/src/shade/renderer/buffer/GPUBufferReadbackAllocator.js +240 -0
  295. package/src/shade/renderer/buffer/table/GPUDatabase.d.ts +14 -0
  296. package/src/shade/renderer/buffer/table/GPUDatabase.d.ts.map +1 -1
  297. package/src/shade/renderer/buffer/table/GPUDatabase.js +64 -6
  298. package/src/shade/renderer/buffer/table/GPUDatabaseReadback.d.ts +190 -0
  299. package/src/shade/renderer/buffer/table/GPUDatabaseReadback.d.ts.map +1 -0
  300. package/src/shade/renderer/buffer/table/GPUDatabaseReadback.js +1323 -0
  301. package/src/shade/renderer/buffer/table/GPUPageMetadata.d.ts +10 -0
  302. package/src/shade/renderer/buffer/table/GPUPageMetadata.d.ts.map +1 -1
  303. package/src/shade/renderer/buffer/table/GPUPageMetadata.js +12 -0
  304. package/src/shade/renderer/buffer/table/GPUReadbackStagingRing.d.ts +96 -0
  305. package/src/shade/renderer/buffer/table/GPUReadbackStagingRing.d.ts.map +1 -0
  306. package/src/shade/renderer/buffer/table/GPUReadbackStatus.d.ts +15 -0
  307. package/src/shade/renderer/buffer/table/GPUReadbackStatus.d.ts.map +1 -0
  308. package/src/shade/renderer/buffer/table/GPUReadbackStatus.js +34 -0
  309. package/src/shade/renderer/buffer/table/GPUTypedTable.d.ts +75 -7
  310. package/src/shade/renderer/buffer/table/GPUTypedTable.d.ts.map +1 -1
  311. package/src/shade/renderer/buffer/table/GPUTypedTable.js +518 -135
  312. package/src/shade/renderer/buffer/table/GPU_TABLE_GATHER_DESCRIPTOR_WORDS.d.ts +19 -0
  313. package/src/shade/renderer/buffer/table/GPU_TABLE_GATHER_DESCRIPTOR_WORDS.d.ts.map +1 -0
  314. package/src/shade/renderer/buffer/table/GPU_TABLE_GATHER_DESCRIPTOR_WORDS.js +18 -0
  315. package/src/shade/renderer/buffer/table/WordViews.d.ts +39 -0
  316. package/src/shade/renderer/buffer/table/WordViews.d.ts.map +1 -0
  317. package/src/shade/renderer/buffer/table/WordViews.js +62 -0
  318. package/src/shade/renderer/buffer/table/gpu_table_gather_shader.d.ts +27 -0
  319. package/src/shade/renderer/buffer/table/gpu_table_gather_shader.d.ts.map +1 -0
  320. package/src/shade/renderer/buffer/table/gpu_table_gather_shader.js +117 -0
  321. package/src/shade/renderer/buffer/table/serde/generate_record_writer.d.ts +121 -0
  322. package/src/shade/renderer/buffer/table/serde/generate_record_writer.d.ts.map +1 -0
  323. package/src/shade/renderer/buffer/table/serde/generate_record_writer.js +395 -0
  324. package/src/shade/renderer/buffer/table/single/GPUSingleTypeTable.d.ts.map +1 -1
  325. package/src/shade/renderer/buffer/table/single/GPUSingleTypeTable.js +70 -20
  326. package/src/shade/renderer/dynamic/GPUDynamicMeshResidency.js +1 -1
  327. package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts.map +1 -1
  328. package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.js +6 -5
  329. package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.d.ts +3 -3
  330. package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.d.ts.map +1 -1
  331. package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.js +15 -11
  332. package/src/shade/renderer/global_illumination/brick4/cpu/brick4_bake_for_scene.d.ts +1 -1
  333. package/src/shade/renderer/global_illumination/brick4/cpu/brick4_bake_for_scene.js +4 -4
  334. package/src/shade/renderer/global_illumination/brick4/cpu/brick4_generate_tree_from_scene.d.ts +1 -3
  335. package/src/shade/renderer/global_illumination/brick4/cpu/brick4_generate_tree_from_scene.d.ts.map +1 -1
  336. package/src/shade/renderer/global_illumination/brick4/cpu/brick4_generate_tree_from_scene.js +5 -4
  337. package/src/shade/renderer/global_illumination/brick4/gpu/bake/brick4_bake_basic.js +1 -1
  338. package/src/shade/renderer/global_illumination/lpv/bake/GPULightProbeVolumeRenderer.d.ts.map +1 -1
  339. package/src/shade/renderer/global_illumination/lpv/bake/GPULightProbeVolumeRenderer.js +1 -4
  340. package/src/shade/renderer/global_illumination/lpv/lpv_visualise_probes.d.ts +8 -3
  341. package/src/shade/renderer/global_illumination/lpv/lpv_visualise_probes.d.ts.map +1 -1
  342. package/src/shade/renderer/global_illumination/lpv/lpv_visualise_probes.js +19 -14
  343. package/src/shade/renderer/global_illumination/lpv/placement/graph_generate_probe_locations.d.ts.map +1 -1
  344. package/src/shade/renderer/global_illumination/lpv/placement/graph_generate_probe_locations.js +9 -1
  345. package/src/shade/renderer/global_illumination/lpv/placement/software/lpv_generate_probe_locations2.d.ts +3 -3
  346. package/src/shade/renderer/global_illumination/lpv/placement/software/lpv_generate_probe_locations2.d.ts.map +1 -1
  347. package/src/shade/renderer/global_illumination/lpv/placement/software/lpv_generate_probe_locations2.js +12 -5
  348. package/src/shade/renderer/global_illumination/probe/octahedral/GPUProbeAtlas.js +1 -1
  349. package/src/shade/renderer/light/GPULightCollection.d.ts +29 -0
  350. package/src/shade/renderer/light/GPULightCollection.d.ts.map +1 -1
  351. package/src/shade/renderer/light/GPULightCollection.js +444 -329
  352. package/src/shade/renderer/light/LIGHT_DATABASE_SPEC.d.ts.map +1 -1
  353. package/src/shade/renderer/light/LIGHT_DATABASE_SPEC.js +7 -1
  354. package/src/shade/renderer/light/LightCollection.d.ts +29 -1
  355. package/src/shade/renderer/light/LightCollection.d.ts.map +1 -1
  356. package/src/shade/renderer/light/LightCollection.js +50 -1
  357. package/src/shade/renderer/light/make_sunlight.js +2 -2
  358. package/src/shade/renderer/light/model/Light.d.ts +29 -2
  359. package/src/shade/renderer/light/model/Light.d.ts.map +1 -1
  360. package/src/shade/renderer/light/model/Light.js +30 -2
  361. package/src/shade/renderer/light/model/io/light_record_directional.d.ts +3 -1
  362. package/src/shade/renderer/light/model/io/light_record_directional.d.ts.map +1 -1
  363. package/src/shade/renderer/light/model/io/light_record_directional.js +8 -5
  364. package/src/shade/renderer/light/model/io/light_record_point.d.ts +3 -1
  365. package/src/shade/renderer/light/model/io/light_record_point.d.ts.map +1 -1
  366. package/src/shade/renderer/light/model/io/light_record_point.js +5 -2
  367. package/src/shade/renderer/light/model/io/light_record_spot.d.ts +4 -1
  368. package/src/shade/renderer/light/model/io/light_record_spot.d.ts.map +1 -1
  369. package/src/shade/renderer/light/model/io/light_record_spot.js +10 -6
  370. package/src/shade/renderer/light/place_light.d.ts +16 -0
  371. package/src/shade/renderer/light/place_light.d.ts.map +1 -0
  372. package/src/shade/renderer/light/place_light.js +36 -0
  373. package/src/shade/renderer/light/shader_refresh_light_poses.d.ts +44 -0
  374. package/src/shade/renderer/light/shader_refresh_light_poses.d.ts.map +1 -0
  375. package/src/shade/renderer/light/shader_refresh_light_poses.js +154 -0
  376. package/src/shade/renderer/lightmap/GPULightMap.js +1 -1
  377. package/src/shade/renderer/lightmap/bake/raster/graph_draw_lightmap_viz_buffer.d.ts.map +1 -1
  378. package/src/shade/renderer/lightmap/bake/raster/graph_draw_lightmap_viz_buffer.js +12 -14
  379. package/src/shade/renderer/loader/SceneBundle.d.ts +53 -28
  380. package/src/shade/renderer/loader/SceneBundle.d.ts.map +1 -1
  381. package/src/shade/renderer/loader/SceneBundle.js +111 -56
  382. package/src/shade/renderer/loader/SceneNode.d.ts +81 -0
  383. package/src/shade/renderer/loader/SceneNode.d.ts.map +1 -0
  384. package/src/shade/renderer/loader/SceneNode.js +114 -0
  385. package/src/shade/renderer/loader/gltf/load_gltf.d.ts +3 -2
  386. package/src/shade/renderer/loader/gltf/load_gltf.d.ts.map +1 -1
  387. package/src/shade/renderer/loader/gltf/load_gltf.js +110 -142
  388. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  389. package/src/shade/renderer/loader/usd/UsdExtensionRegistry.d.ts +4 -4
  390. package/src/shade/renderer/loader/usd/UsdExtensionRegistry.d.ts.map +1 -1
  391. package/src/shade/renderer/loader/usd/UsdExtensionRegistry.js +2 -2
  392. package/src/shade/renderer/loader/usd/load_usd.d.ts +3 -2
  393. package/src/shade/renderer/loader/usd/load_usd.d.ts.map +1 -1
  394. package/src/shade/renderer/loader/usd/load_usd.js +4 -5
  395. package/src/shade/renderer/loader/usd/usd_build_scene.d.ts +3 -3
  396. package/src/shade/renderer/loader/usd/usd_build_scene.d.ts.map +1 -1
  397. package/src/shade/renderer/loader/usd/usd_build_scene.js +47 -55
  398. package/src/shade/renderer/material/GPUMaterialManager.js +1 -1
  399. package/src/shade/renderer/material/resident/GPUResidentMaterialContext.d.ts +5 -4
  400. package/src/shade/renderer/material/resident/GPUResidentMaterialContext.d.ts.map +1 -1
  401. package/src/shade/renderer/material/resident/GPUResidentMaterialContext.js +8 -15
  402. package/src/shade/renderer/object_property/shader_refresh_all_mesh_bounds.d.ts +15 -13
  403. package/src/shade/renderer/object_property/shader_refresh_all_mesh_bounds.d.ts.map +1 -1
  404. package/src/shade/renderer/object_property/shader_refresh_all_mesh_bounds.js +40 -21
  405. package/src/shade/renderer/particles/DESIGN.md +53 -50
  406. package/src/shade/renderer/particles/GPUParticleSystem.d.ts +31 -17
  407. package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
  408. package/src/shade/renderer/particles/GPUParticleSystem.js +54 -91
  409. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts +12 -11
  410. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts.map +1 -1
  411. package/src/shade/renderer/particles/runtime/EmitterRegistry.js +12 -11
  412. package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.d.ts +13 -19
  413. package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.d.ts.map +1 -1
  414. package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.js +19 -25
  415. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts +34 -24
  416. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts.map +1 -1
  417. package/src/shade/renderer/particles/runtime/ParticleEmitter.js +53 -40
  418. package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.js +1 -1
  419. package/src/shade/renderer/path_tracer/graph_path_trace_scene.js +1 -1
  420. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  421. package/src/shade/renderer/rasterize/expand/bucket/mesh/graph_meshes_classify_buckets.d.ts.map +1 -1
  422. package/src/shade/renderer/rasterize/expand/bucket/mesh/graph_meshes_classify_buckets.js +2 -1
  423. package/src/shade/renderer/rasterize/expand/bucket/mesh/graph_scene_meshes_cull_and_classify_buckets.d.ts.map +1 -1
  424. package/src/shade/renderer/rasterize/expand/bucket/mesh/graph_scene_meshes_cull_and_classify_buckets.js +5 -2
  425. package/src/shade/renderer/rasterize/fast/graph_rasterize_scene_fast.js +1 -1
  426. package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.js +1 -1
  427. package/src/shade/renderer/rasterize/native/graph_rasterize_meshes_alpha_tested.js +1 -1
  428. package/src/shade/renderer/rasterize/native/oit/graph_rasterize_meshes_transparent_oit.js +1 -1
  429. package/src/shade/renderer/rasterize/standard/graph_rasterize_scene.js +1 -1
  430. package/src/shade/renderer/scene/DynamicMesh.d.ts +13 -4
  431. package/src/shade/renderer/scene/DynamicMesh.d.ts.map +1 -1
  432. package/src/shade/renderer/scene/DynamicMesh.js +14 -4
  433. package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.d.ts +38 -18
  434. package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.d.ts.map +1 -1
  435. package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.js +112 -60
  436. package/src/shade/renderer/scene/GPUSceneContext.d.ts +55 -48
  437. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  438. package/src/shade/renderer/scene/GPUSceneContext.js +594 -928
  439. package/src/shade/renderer/scene/NODE3D_STRUCT.d.ts +5 -5
  440. package/src/shade/renderer/scene/NODE3D_STRUCT.js +5 -5
  441. package/src/shade/renderer/scene/Node3D.d.ts +27 -8
  442. package/src/shade/renderer/scene/Node3D.d.ts.map +1 -1
  443. package/src/shade/renderer/scene/Node3DDirtyList.d.ts +59 -0
  444. package/src/shade/renderer/scene/Node3DDirtyList.d.ts.map +1 -0
  445. package/src/shade/renderer/scene/Scene.d.ts +18 -60
  446. package/src/shade/renderer/scene/Scene.d.ts.map +1 -1
  447. package/src/shade/renderer/scene/Scene.js +53 -146
  448. package/src/shade/renderer/scene/SkinnedMesh.d.ts +10 -93
  449. package/src/shade/renderer/scene/SkinnedMesh.d.ts.map +1 -1
  450. package/src/shade/renderer/scene/bvh/StaticSceneBVH.d.ts +24 -3
  451. package/src/shade/renderer/scene/bvh/StaticSceneBVH.d.ts.map +1 -1
  452. package/src/shade/renderer/scene/bvh/StaticSceneBVH.js +53 -13
  453. package/src/shade/renderer/scene/hierarchy/graph_scene_update_transform_hierarchy.d.ts +5 -6
  454. package/src/shade/renderer/scene/hierarchy/graph_scene_update_transform_hierarchy.d.ts.map +1 -1
  455. package/src/shade/renderer/scene/hierarchy/graph_scene_update_transform_hierarchy.js +5 -6
  456. package/src/shade/renderer/scene/optimization/scene_optimize.d.ts +10 -2
  457. package/src/shade/renderer/scene/optimization/scene_optimize.d.ts.map +1 -1
  458. package/src/shade/renderer/scene/optimization/scene_optimize.js +266 -230
  459. package/src/shade/renderer/scene/rows/GPUEntityBoundsReadback.d.ts +53 -0
  460. package/src/shade/renderer/scene/rows/GPUEntityBoundsReadback.d.ts.map +1 -0
  461. package/src/shade/renderer/scene/rows/GPUEntityBoundsReadback.js +144 -0
  462. package/src/shade/renderer/scene/rows/GPUSceneRows.d.ts +227 -0
  463. package/src/shade/renderer/scene/rows/GPUSceneRows.d.ts.map +1 -0
  464. package/src/shade/renderer/scene/rows/GPUSceneRows.js +1136 -0
  465. package/src/shade/renderer/scene/rows/place_primitive.d.ts +48 -0
  466. package/src/shade/renderer/scene/rows/place_primitive.d.ts.map +1 -0
  467. package/src/shade/renderer/scene/rows/place_primitive.js +98 -0
  468. package/src/shade/renderer/scene/serialization/deserialize_scene.d.ts +10 -8
  469. package/src/shade/renderer/scene/serialization/deserialize_scene.d.ts.map +1 -1
  470. package/src/shade/renderer/scene/serialization/deserialize_scene.js +24 -27
  471. package/src/shade/renderer/scene/serialization/serialize_scene.d.ts +9 -2
  472. package/src/shade/renderer/scene/serialization/serialize_scene.d.ts.map +1 -1
  473. package/src/shade/renderer/scene/serialization/serialize_scene.js +25 -4
  474. package/src/shade/renderer/scene/verify_gpu_tlas_build.js +2 -2
  475. package/src/shade/renderer/shader/chunk/light/DIRECTIONAL_LIGHT_STRUCT.d.ts.map +1 -1
  476. package/src/shade/renderer/shader/chunk/light/DIRECTIONAL_LIGHT_STRUCT.js +5 -0
  477. package/src/shade/renderer/shader/chunk/light/POINT_LIGHT_STRUCT.d.ts.map +1 -1
  478. package/src/shade/renderer/shader/chunk/light/POINT_LIGHT_STRUCT.js +5 -0
  479. package/src/shade/renderer/shader/chunk/light/SPOT_LIGHT_STRUCT.d.ts.map +1 -1
  480. package/src/shade/renderer/shader/chunk/light/SPOT_LIGHT_STRUCT.js +5 -0
  481. package/src/shade/renderer/shadow/map/DirectionalLightShadowmap.d.ts +39 -0
  482. package/src/shade/renderer/shadow/map/DirectionalLightShadowmap.d.ts.map +1 -1
  483. package/src/shade/renderer/shadow/map/DirectionalLightShadowmap.js +112 -64
  484. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts +7 -0
  485. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts.map +1 -1
  486. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +1541 -1352
  487. package/src/shade/renderer/shadow/map/PointLightShadowmap.js +1 -1
  488. package/src/shade/renderer/shadow/map/SpotLightShadowmap.js +1 -1
  489. package/src/shade/renderer/shadow/map/TetrahedronPointLightShadowmap.js +1 -1
  490. package/src/shade/renderer/shadow/map/csm/CSM_CASTER_RANGE_STRUCT.d.ts +29 -0
  491. package/src/shade/renderer/shadow/map/csm/CSM_CASTER_RANGE_STRUCT.d.ts.map +1 -0
  492. package/src/shade/renderer/shadow/map/csm/CSM_CASTER_RANGE_STRUCT.js +43 -0
  493. package/src/shade/renderer/shadow/map/csm/SHADOWMAP_CSM_CASTER_RANGE_MARGIN_FRACTION.d.ts +13 -0
  494. package/src/shade/renderer/shadow/map/csm/SHADOWMAP_CSM_CASTER_RANGE_MARGIN_FRACTION.d.ts.map +1 -0
  495. package/src/shade/renderer/shadow/map/csm/SHADOWMAP_CSM_CASTER_RANGE_MARGIN_FRACTION.js +12 -0
  496. package/src/shade/renderer/shadow/map/csm/shader/shader_csm_caster_range.d.ts +49 -0
  497. package/src/shade/renderer/shadow/map/csm/shader/shader_csm_caster_range.d.ts.map +1 -0
  498. package/src/shade/renderer/shadow/map/csm/shader/shader_csm_caster_range.js +194 -0
  499. package/src/shade/renderer/shadow/map/csm_debug_draw_preview.js +1 -1
  500. package/src/shade/renderer/shadow/map/shadowmap_update_score.js +1 -1
  501. package/src/shade/renderer/shadow/ray/RTXShadows.js +1 -1
  502. package/src/shade/renderer/shadow/ray/staged/trace/graph_trace_rays.js +1 -1
  503. package/src/shade/renderer/shadow/sdf/cascade/CascadedSceneSDF.d.ts.map +1 -1
  504. package/src/shade/renderer/shadow/sdf/cascade/CascadedSceneSDF.js +3 -1
  505. package/src/shade/renderer/texture/bindless/GPUBindlessTextureManager.js +8 -8
  506. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
  507. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +4 -3
  508. package/src/engine/graphics3/instantiate_scene_bundle.js +0 -164
  509. package/src/engine/graphics3/shade_node_to_entity_composition.js +0 -88
  510. package/src/shade/renderer/animation/compute_skin_world_bounds.js +0 -146
  511. package/src/shade/renderer/animation/compute_skinned_mesh_clip_bounding_sphere.js +0 -531
  512. package/src/shade/renderer/animation/pose/pose_evaluate_world.js +0 -76
  513. package/src/shade/renderer/animation/skin_bind_transform.js +0 -33
  514. package/src/shade/renderer/animation/skin_frame_defect.js +0 -132
  515. package/src/shade/renderer/animation/skin_joint_matrix.js +0 -46
  516. package/src/shade/renderer/animation/skin_normalize_mesh_frame.js +0 -216
  517. package/src/shade/renderer/scene/InstanceBatch.js +0 -235
  518. package/src/shade/renderer/scene/Mesh.js +0 -168
  519. package/src/shade/renderer/scene/Node3D.js +0 -263
  520. package/src/shade/renderer/scene/SceneNodeBinding.js +0 -56
  521. package/src/shade/renderer/scene/SkinnedMesh.js +0 -170
  522. package/src/shade/renderer/scene/TransformAuthority.js +0 -33
@@ -1,9 +1,15 @@
1
1
  /**
2
2
  * Where an entity's model is, in world space.
3
3
  *
4
- * The renderer refreshes a world box per scene node as part of placing it, so the answer is the
5
- * renderer's rather than the component's — which is why this is a reader built from an engine rather
6
- * than a function over a component.
4
+ * The box the renderer draws a model by is derived on the GPU — from each primitive's geometry
5
+ * under the world transform the hierarchy pass composed, which for a subtree the GPU drives is a
6
+ * matrix the CPU never sees, and for a skinned primitive is the deformed clone's box rather than
7
+ * the rest pose's. So the answer is the renderer's where the renderer has one: the reader asks the
8
+ * scene context's bounds readback for every primitive of the model each time it is called, and
9
+ * once every primitive's box has landed the answer is their union, a frame or two behind the
10
+ * device. Until then — and with no device at all — it is what the ECS composes, from the same
11
+ * geometry under the entity's own transforms: exact for a model the CPU places, and what the
12
+ * renderer would draw were it drawing.
7
13
  *
8
14
  * **Precondition:** the engine has a {@link MeshSystem}. It is what puts anything on a screen at
9
15
  * all, so an editor running without one has nothing to select.
@@ -1 +1 @@
1
- {"version":3,"file":"entity_world_bounds.d.ts","sourceRoot":"","sources":["../../editor/entity_world_bounds.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,mEAJsB,UAAU,MAAM,CAAC,QAAE,MAAM,KAAG,OAAO,CAYxD"}
1
+ {"version":3,"file":"entity_world_bounds.d.ts","sourceRoot":"","sources":["../../editor/entity_world_bounds.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,mEAJsB,UAAU,MAAM,CAAC,QAAE,MAAM,KAAG,OAAO,CAuBxD"}
@@ -1,12 +1,21 @@
1
1
  import { assert } from "../src/core/assert.js";
2
+ import { aabb3_array_combine } from "../src/core/geom/3d/aabb/aabb3_array_combine.js";
2
3
  import { MeshSystem } from "../src/engine/graphics3/MeshSystem.js";
3
4
 
5
+ const SCRATCH_BOX = new Float32Array(6);
6
+
4
7
  /**
5
8
  * Where an entity's model is, in world space.
6
9
  *
7
- * The renderer refreshes a world box per scene node as part of placing it, so the answer is the
8
- * renderer's rather than the component's — which is why this is a reader built from an engine rather
9
- * than a function over a component.
10
+ * The box the renderer draws a model by is derived on the GPU — from each primitive's geometry
11
+ * under the world transform the hierarchy pass composed, which for a subtree the GPU drives is a
12
+ * matrix the CPU never sees, and for a skinned primitive is the deformed clone's box rather than
13
+ * the rest pose's. So the answer is the renderer's where the renderer has one: the reader asks the
14
+ * scene context's bounds readback for every primitive of the model each time it is called, and
15
+ * once every primitive's box has landed the answer is their union, a frame or two behind the
16
+ * device. Until then — and with no device at all — it is what the ECS composes, from the same
17
+ * geometry under the entity's own transforms: exact for a model the CPU places, and what the
18
+ * renderer would draw were it drawing.
10
19
  *
11
20
  * **Precondition:** the engine has a {@link MeshSystem}. It is what puts anything on a screen at
12
21
  * all, so an editor running without one has nothing to select.
@@ -23,5 +32,53 @@ export function entity_world_bounds_reader(engine) {
23
32
 
24
33
  assert.notNull(meshes, 'MeshSystem');
25
34
 
26
- return (target, entity) => meshes.compute_world_bounds(target, entity);
35
+ const graphics = engine.graphics;
36
+ const scene = meshes.scene;
37
+
38
+ return (target, entity) => {
39
+ const context = graphics === null || graphics === undefined ? null : graphics.scene_context(scene);
40
+
41
+ if (context !== null && drawn_bounds(context.bounds, meshes.mesh_entities_of(entity), target)) {
42
+ return true;
43
+ }
44
+
45
+ return meshes.compute_world_bounds(target, entity);
46
+ };
47
+ }
48
+
49
+ /**
50
+ * The union of the primitives' boxes as the GPU holds them, asking for each again for the frames
51
+ * to come.
52
+ *
53
+ * @param {import("../src/shade/renderer/scene/rows/GPUEntityBoundsReadback.js").GPUEntityBoundsReadback} bounds
54
+ * @param {number[]} primitives
55
+ * @param {ArrayLike<number>} target
56
+ * @returns {boolean} whether every primitive's box has landed; `false` leaves `target` alone
57
+ */
58
+ function drawn_bounds(bounds, primitives, target) {
59
+ if (primitives.length === 0) {
60
+ return false;
61
+ }
62
+
63
+ let complete = true;
64
+
65
+ for (let i = 0; i < primitives.length; i++) {
66
+ const primitive = primitives[i];
67
+
68
+ bounds.request(primitive);
69
+
70
+ if (!bounds.get(primitive, SCRATCH_BOX)) {
71
+ complete = false;
72
+
73
+ continue;
74
+ }
75
+
76
+ if (complete) {
77
+ // combining the first box with itself is how it lands in `target` — one operation for
78
+ // both cases, rather than a copy that only ever runs once
79
+ aabb3_array_combine(target, 0, i === 0 ? SCRATCH_BOX : target, 0, SCRATCH_BOX, 0);
80
+ }
81
+ }
82
+
83
+ return complete;
27
84
  }
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "Advanced 3D game engine",
7
7
  "type": "module",
8
8
  "author": "Alexander Goldring",
9
- "version": "3.23.0",
9
+ "version": "3.24.0",
10
10
  "exports": {
11
11
  "./build/*": "./build/*",
12
12
  "./src/*": "./src/*",
@@ -1,3 +1,20 @@
1
+ /**
2
+ * The smallest free run {@link OffsetAllocator#allocate} will accept for an allocation of `size`.
3
+ *
4
+ * Bins are 3-bit floats. A free run is filed under the largest bin that fits INSIDE it and a
5
+ * request is looked up from the smallest bin that fits the REQUEST, so consecutive bins being up
6
+ * to 9/8 apart is also how far apart those two answers can be: a free run of 68 is filed under 64,
7
+ * a request for 68 is looked up from 72, and the allocation is refused over space that is there.
8
+ * A run of exactly this value is filed in the bin the request starts from, and is the first one
9
+ * that is not — one element less is refused.
10
+ *
11
+ * For sizing a region that has to hold ONE allocation. A region holding a sequence of them needs
12
+ * the last of the sequence to still find a run this big, which is a larger question.
13
+ *
14
+ * @param {number} size the allocation to make room for, in elements
15
+ * @returns {number} free run size, in elements; never less than `size`
16
+ */
17
+ export function allocator_run_size_for(size: number): number;
1
18
  export const ALLOCATOR_NO_SPACE: 4294967295;
2
19
  /**
3
20
  * One range handed out by {@link OffsetAllocator#allocate}: where it starts, plus the allocator's
@@ -119,6 +136,26 @@ export class OffsetAllocator {
119
136
  * @see free_node
120
137
  */
121
138
  free(allocation: Allocation): void;
139
+ /**
140
+ * The arena size {@link grow} has to be given for `allocate(size)` to succeed — the total, not
141
+ * the shortfall, and never less than the current {@link size}.
142
+ *
143
+ * Exact and minimal, so a caller with its own growth policy — a buffer alignment, a geometric
144
+ * step — is free to round this up and pass that instead. One element less than this is refused.
145
+ *
146
+ * Growth appends to the arena's end, so what the allocation is waiting for is the free run at
147
+ * that end reaching {@link allocator_run_size_for}. Free space the arena already ends in counts
148
+ * towards it; free space anywhere else does not, and does not need to — a run elsewhere large
149
+ * enough to take the request would have taken it already, and growing at the end never merges
150
+ * with one that is not.
151
+ *
152
+ * The one shortfall growing cannot answer is nodes: an allocator with none left to describe a
153
+ * region with refuses at any arena size, and {@link maxAllocs} is not raised by growing.
154
+ *
155
+ * @param {number} size the allocation to make room for, in elements
156
+ * @returns {number} arena size to grow to
157
+ */
158
+ grow_target_for(size: number): number;
122
159
  /**
123
160
  * Enlarge the arena in place. Every live allocation keeps the offset it was given.
124
161
  *
@@ -134,8 +171,9 @@ export class OffsetAllocator {
134
171
  * stripped that check is gone and the freelist pop underflows, so size {@link maxAllocs} for the
135
172
  * allocation count you intend to reach.
136
173
  *
137
- * Growing by exactly N does not promise an allocation of N now fits: the bins round free runs
138
- * down and requests up, up to 9/8 apart. Grow by `required * 9 / 8` before allocating `required`.
174
+ * Growing by exactly N does not promise an allocation of N now fits — the bins round free runs
175
+ * down and requests up, so the run has to reach a whole bin. Do not work that margin out at the
176
+ * call site: {@link grow_target_for} is the size to grow to, exactly.
139
177
  *
140
178
  * @param {number} new_size new total number of contiguous elements, must be >= the current size
141
179
  * @see reset
@@ -1 +1 @@
1
- {"version":3,"file":"OffsetAllocator.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/allocator/OffsetAllocator.js"],"names":[],"mappings":"AAaA,4CAA6C;AAoC7C;;;;;;;;GAQG;AACH;IAII;;;;;OAKG;IACH,oBAJW,MAAM,YACN,MAAM,GACL,UAAU,CASrB;IAED;;;OAGG;IACH,yBAFU,UAAU,CAEoE;IAtBxF,eAA4B;IAC5B,iBAA8B;CAsBjC;AA6BD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAoEI;;;;OAIG;IACH,kBAHW,MAAM,cACN,MAAM,EAYhB;IAlFD;;;;OAIG;IACH,MAFU,MAAM,CAEP;IAET;;;;OAIG;IACH,WAFU,MAAM,CAEF;IAEd;;;OAGG;IACH,aAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,aAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,UAFU,UAAU,CAEoB;IAExC;;;OAGG;IACH,YAFU,WAAW,CAEuB;IAE5C;;;OAGG;IACH,OAFU,aAAa,CAEmB;IAE1C;;OAEG;IACH,WAFU,WAAW,CAEX;IAEV;;;OAGG;IACH,YAFU,MAAM,CAED;IA+Bf;;;;OAIG;IACH,eAHW,MAAM,GACJ,UAAU,CAkGtB;IAED;;;;;;;OAOG;IACH,sBAHW,MAAM,QAqFhB;IAED;;;OAGG;IACH,iBAHW,UAAU,QAUpB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,eAHW,MAAM,QA8DhB;IA0ID;;;OAGG;IACH,cA4BC;IAED;;;OAGG;IACH,iBAFY,aAAa,CA2BxB;;CACJ;8BAnsB6B,yCAAyC;AAqGvE;IACI,uBAAkB;IAClB,0BAAqB;CACxB"}
1
+ {"version":3,"file":"OffsetAllocator.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/allocator/OffsetAllocator.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;GAeG;AACH,6CAHW,MAAM,GACJ,MAAM,CAYlB;AA7BD,4CAA6C;AAgE7C;;;;;;;;GAQG;AACH;IAII;;;;;OAKG;IACH,oBAJW,MAAM,YACN,MAAM,GACL,UAAU,CASrB;IAED;;;OAGG;IACH,yBAFU,UAAU,CAEoE;IAtBxF,eAA4B;IAC5B,iBAA8B;CAsBjC;AA6BD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAoEI;;;;OAIG;IACH,kBAHW,MAAM,cACN,MAAM,EAYhB;IAlFD;;;;OAIG;IACH,MAFU,MAAM,CAEP;IAET;;;;OAIG;IACH,WAFU,MAAM,CAEF;IAEd;;;OAGG;IACH,aAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,aAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,UAFU,UAAU,CAEoB;IAExC;;;OAGG;IACH,YAFU,WAAW,CAEuB;IAE5C;;;OAGG;IACH,OAFU,aAAa,CAEmB;IAE1C;;OAEG;IACH,WAFU,WAAW,CAEX;IAEV;;;OAGG;IACH,YAFU,MAAM,CAED;IAqEf;;;;OAIG;IACH,eAHW,MAAM,GACJ,UAAU,CA+EtB;IAED;;;;;;;OAOG;IACH,sBAHW,MAAM,QAqFhB;IAED;;;OAGG;IACH,iBAHW,UAAU,QAUpB;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,sBAHW,MAAM,GACJ,MAAM,CA4BlB;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,eAHW,MAAM,QA8DhB;IA0ID;;;OAGG;IACH,cA4BC;IAED;;;OAGG;IACH,iBAFY,aAAa,CA2BxB;;CACJ;8BAlyB6B,yCAAyC;AAiIvE;IACI,uBAAkB;IAClB,0BAAqB;CACxB"}
@@ -14,6 +14,34 @@ const NUM_LEAF_BINS = NUM_TOP_BINS * BINS_PER_LEAF;
14
14
  export const ALLOCATOR_NO_SPACE = 0xffffffff;
15
15
  const NODE_UNUSED = 0xffffffff
16
16
 
17
+ /**
18
+ * The smallest free run {@link OffsetAllocator#allocate} will accept for an allocation of `size`.
19
+ *
20
+ * Bins are 3-bit floats. A free run is filed under the largest bin that fits INSIDE it and a
21
+ * request is looked up from the smallest bin that fits the REQUEST, so consecutive bins being up
22
+ * to 9/8 apart is also how far apart those two answers can be: a free run of 68 is filed under 64,
23
+ * a request for 68 is looked up from 72, and the allocation is refused over space that is there.
24
+ * A run of exactly this value is filed in the bin the request starts from, and is the first one
25
+ * that is not — one element less is refused.
26
+ *
27
+ * For sizing a region that has to hold ONE allocation. A region holding a sequence of them needs
28
+ * the last of the sequence to still find a run this big, which is a larger question.
29
+ *
30
+ * @param {number} size the allocation to make room for, in elements
31
+ * @returns {number} free run size, in elements; never less than `size`
32
+ */
33
+ export function allocator_run_size_for(size) {
34
+ assert.isNonNegativeInteger(size, 'size');
35
+
36
+ const run = floatToUint(uintToFloatRoundUp(size));
37
+
38
+ // The bin above 0xF0000000 is 2^32, which floatToUint folds to 0 — an answer a caller would read
39
+ // as nothing needed. No arena reaches it (grow caps below ALLOCATOR_NO_SPACE), so name it.
40
+ assert.greaterThanOrEqual(run, size, 'run, the bin above the request is past u32');
41
+
42
+ return run;
43
+ }
44
+
17
45
  /**
18
46
  * Can potentially use u16, but number of allocation slots will be limited to 65k, so a severe limitation for little gain
19
47
  * @type {BinaryDataType}
@@ -217,48 +245,67 @@ export class OffsetAllocator {
217
245
  }
218
246
 
219
247
  /**
248
+ * The lowest non-empty bin at or above `min_bin_index`, or {@link ALLOCATOR_NO_SPACE} when
249
+ * every bin from there up is empty.
220
250
  *
221
- * @param {number} size
222
- * @returns {Allocation}
251
+ * Every run filed at or above a bin is at least that bin's own size, so this is exactly the
252
+ * search {@link allocate} does and exactly the one {@link grow_target_for} has to predict.
253
+ *
254
+ * @param {number} min_bin_index
255
+ * @returns {number} bin index, or ALLOCATOR_NO_SPACE
223
256
  */
224
- allocate(size) {
225
- assert.isNonNegativeInteger(size, 'size');
257
+ #find_bin_at_least(min_bin_index) {
258
+ const min_top_bin_index = min_bin_index >>> TOP_BINS_INDEX_SHIFT;
259
+ const min_leaf_bin_index = min_bin_index & LEAF_BINS_INDEX_MASK;
226
260
 
227
- // Out of allocations?
228
- if (this.freeOffset === 0) {
229
- return Allocation.from(ALLOCATOR_NO_SPACE, ALLOCATOR_NO_SPACE);
230
- }
231
-
232
- // Round up to bin index to ensure that alloc >= bin
233
- // Gives us min bin index that fits the size
234
- let minBinIndex = uintToFloatRoundUp(size);
235
-
236
- const minTopBinIndex = minBinIndex >>> TOP_BINS_INDEX_SHIFT;
237
- const minLeafBinIndex = minBinIndex & LEAF_BINS_INDEX_MASK;
238
-
239
- let topBinIndex = minTopBinIndex;
240
- let leafBinIndex = ALLOCATOR_NO_SPACE;
261
+ let top_bin_index = min_top_bin_index;
262
+ let leaf_bin_index = ALLOCATOR_NO_SPACE;
241
263
 
242
264
  // If top bin exists, scan its leaf bin. This can fail (NO_SPACE).
243
- if ((this.usedBinsTop & (1 << topBinIndex)) !== 0) {
244
- leafBinIndex = findLowestSetBitAfter(this.usedBins[topBinIndex], minLeafBinIndex);
265
+ if ((this.usedBinsTop & (1 << top_bin_index)) !== 0) {
266
+ leaf_bin_index = findLowestSetBitAfter(this.usedBins[top_bin_index], min_leaf_bin_index);
245
267
  }
246
268
 
247
269
  // If we didn't find space in top bin, we search top bin from +1
248
- if (leafBinIndex === ALLOCATOR_NO_SPACE) {
249
- topBinIndex = findLowestSetBitAfter(this.usedBinsTop, minTopBinIndex + 1);
270
+ if (leaf_bin_index === ALLOCATOR_NO_SPACE) {
271
+ top_bin_index = findLowestSetBitAfter(this.usedBinsTop, min_top_bin_index + 1);
250
272
 
251
- // Out of space?
252
- if (topBinIndex === ALLOCATOR_NO_SPACE) {
253
- return Allocation.from(ALLOCATOR_NO_SPACE, ALLOCATOR_NO_SPACE);
273
+ if (top_bin_index === ALLOCATOR_NO_SPACE) {
274
+ return ALLOCATOR_NO_SPACE;
254
275
  }
255
276
 
256
277
  // All leaf bins here fit the alloc, since the top bin was rounded up. Start leaf search from bit 0.
257
278
  // NOTE: This search can't fail since at least one leaf bit was set because the top bit was set.
258
- leafBinIndex = ctz32(this.usedBins[topBinIndex]);
279
+ leaf_bin_index = ctz32(this.usedBins[top_bin_index]);
259
280
  }
260
281
 
261
- let bin_index = ((topBinIndex << TOP_BINS_INDEX_SHIFT) | leafBinIndex) >>> 0; // ">>> 0" shift is to force UINT32
282
+ return ((top_bin_index << TOP_BINS_INDEX_SHIFT) | leaf_bin_index) >>> 0; // ">>> 0" shift is to force UINT32
283
+ }
284
+
285
+ /**
286
+ *
287
+ * @param {number} size
288
+ * @returns {Allocation}
289
+ */
290
+ allocate(size) {
291
+ assert.isNonNegativeInteger(size, 'size');
292
+
293
+ // Out of allocations?
294
+ if (this.freeOffset === 0) {
295
+ return Allocation.from(ALLOCATOR_NO_SPACE, ALLOCATOR_NO_SPACE);
296
+ }
297
+
298
+ // Round up to the bin index that fits the size: every run filed there or above is
299
+ // large enough, because a run is filed by rounding its size DOWN.
300
+ const bin_index = this.#find_bin_at_least(uintToFloatRoundUp(size));
301
+
302
+ if (bin_index === ALLOCATOR_NO_SPACE) {
303
+ // out of space
304
+ return Allocation.from(ALLOCATOR_NO_SPACE, ALLOCATOR_NO_SPACE);
305
+ }
306
+
307
+ const topBinIndex = bin_index >>> TOP_BINS_INDEX_SHIFT;
308
+ const leafBinIndex = bin_index & LEAF_BINS_INDEX_MASK;
262
309
 
263
310
  // Pop the top node of the bin. Bin top = node.next.
264
311
  let node_index = this.binIndices[bin_index];
@@ -424,6 +471,53 @@ export class OffsetAllocator {
424
471
  this.free_node(node_index);
425
472
  }
426
473
 
474
+ /**
475
+ * The arena size {@link grow} has to be given for `allocate(size)` to succeed — the total, not
476
+ * the shortfall, and never less than the current {@link size}.
477
+ *
478
+ * Exact and minimal, so a caller with its own growth policy — a buffer alignment, a geometric
479
+ * step — is free to round this up and pass that instead. One element less than this is refused.
480
+ *
481
+ * Growth appends to the arena's end, so what the allocation is waiting for is the free run at
482
+ * that end reaching {@link allocator_run_size_for}. Free space the arena already ends in counts
483
+ * towards it; free space anywhere else does not, and does not need to — a run elsewhere large
484
+ * enough to take the request would have taken it already, and growing at the end never merges
485
+ * with one that is not.
486
+ *
487
+ * The one shortfall growing cannot answer is nodes: an allocator with none left to describe a
488
+ * region with refuses at any arena size, and {@link maxAllocs} is not raised by growing.
489
+ *
490
+ * @param {number} size the allocation to make room for, in elements
491
+ * @returns {number} arena size to grow to
492
+ */
493
+ grow_target_for(size) {
494
+ assert.isNonNegativeInteger(size, 'size');
495
+
496
+ const required_run = allocator_run_size_for(size);
497
+
498
+ if (this.#find_bin_at_least(uintToFloatRoundUp(size)) !== ALLOCATOR_NO_SPACE) {
499
+ // a run that takes it is already filed; growing is not what this allocation is waiting for
500
+ return this.size;
501
+ }
502
+
503
+ const nodes = this.nodes;
504
+
505
+ // Only a free tail is extended by a grow; a used one is given a neighbour of the delta alone.
506
+ // The arena end is always described — reset() files one node ending at `size`, zero or not.
507
+ const tail_node = this.#tail_node;
508
+
509
+ const tail_run = (nodes.readCellValue(tail_node, NODE_FIELD_FLAGS) & NODE_FLAGS_USED) === 0
510
+ ? nodes.readCellValue(tail_node, NODE_FIELD_DATA_SIZE)
511
+ : 0;
512
+
513
+ // The search above consults the bins alone, so a free tail already reaching the run would
514
+ // have been found by it and answered from. Past that line the tail is short — of a whole
515
+ // bin, though not necessarily of `size` itself.
516
+ assert.lessThan(tail_run, required_run, 'tail run, a run the bin search did not find');
517
+
518
+ return this.size + (required_run - tail_run);
519
+ }
520
+
427
521
  /**
428
522
  * Enlarge the arena in place. Every live allocation keeps the offset it was given.
429
523
  *
@@ -439,8 +533,9 @@ export class OffsetAllocator {
439
533
  * stripped that check is gone and the freelist pop underflows, so size {@link maxAllocs} for the
440
534
  * allocation count you intend to reach.
441
535
  *
442
- * Growing by exactly N does not promise an allocation of N now fits: the bins round free runs
443
- * down and requests up, up to 9/8 apart. Grow by `required * 9 / 8` before allocating `required`.
536
+ * Growing by exactly N does not promise an allocation of N now fits — the bins round free runs
537
+ * down and requests up, so the run has to reach a whole bin. Do not work that margin out at the
538
+ * call site: {@link grow_target_for} is the size to grow to, exactly.
444
539
  *
445
540
  * @param {number} new_size new total number of contiguous elements, must be >= the current size
446
541
  * @see reset
@@ -0,0 +1,83 @@
1
+ /**
2
+ * An open-addressed `u32 -> i32` index in a single `Uint32Array`, as free functions over the array
3
+ * rather than an object wrapping it. Nothing per entry is allocated, so an index that has reached
4
+ * its working size costs the garbage collector nothing at all; a `Map<number,number>` doing the
5
+ * same work allocates a fresh backing store every time it is cleared.
6
+ *
7
+ * **Keys** are `u32` and stored as `key + 1`, so a zero word is an empty slot and a freshly
8
+ * allocated array is already a valid empty index — {@link u32_index_clear} is one `fill(0)`, and
9
+ * creation needs no fill at all. `0xFFFFFFFF` is therefore not a usable key.
10
+ *
11
+ * **Values** are `i32`. A caller storing `-1` makes the key read back as {@link U32_INDEX_MISS},
12
+ * which is how a key is retired: the slot stays claimed, and no tombstone state has to exist for
13
+ * the probe to step over. Values are not otherwise interpreted.
14
+ *
15
+ * The probe is {@link generate_next_linear_congruential_index}, which is full-cycle over a
16
+ * power-of-two table — it visits every slot before repeating. Combined with the load factor, which
17
+ * guarantees at least one empty slot at all times, **the probe terminates by construction** and
18
+ * neither lookup nor insert carries a step limit. Both properties are load-bearing: a table
19
+ * allowed to fill would let a lookup for an absent key run forever.
20
+ *
21
+ * Sized for a key set that turns over completely each frame — build it up, clear it, build it
22
+ * again — which is what the GPU table upload streams do with it.
23
+ *
24
+ * @see cpu_build_hash_table for the same layout in a table the GPU also reads, where the probe
25
+ * count is instead bounded to match a WGSL twin that cannot grow.
26
+ */
27
+ /**
28
+ * A new empty index.
29
+ *
30
+ * @param {number} [slots] power of two, rounded up to {@link MIN_SLOTS}
31
+ * @returns {Uint32Array}
32
+ */
33
+ export function u32_index_create(slots?: number): Uint32Array;
34
+ /**
35
+ * How many keys the index holds, retired ones included.
36
+ *
37
+ * @param {Uint32Array} table
38
+ * @returns {number}
39
+ */
40
+ export function u32_index_count(table: Uint32Array): number;
41
+ /**
42
+ * The value stored for a key, or {@link U32_INDEX_MISS} if the index does not hold it — or holds
43
+ * it retired.
44
+ *
45
+ * @param {Uint32Array} table
46
+ * @param {number} key
47
+ * @returns {number} i32
48
+ */
49
+ export function u32_index_get(table: Uint32Array, key: number): number;
50
+ /**
51
+ * Store a value for a key, replacing whatever the key held.
52
+ *
53
+ * Storing `-1` retires the key: it keeps its slot, and {@link u32_index_get} reports it as
54
+ * {@link U32_INDEX_MISS} from then on. That is the whole of the delete story — an open-addressed
55
+ * table cannot simply blank a slot without cutting the probe chains that run through it, and the
56
+ * callers that need removal only ever need the key to stop being found.
57
+ *
58
+ * Returns the index to store back: growing reallocates, so the array this hands back is not always
59
+ * the one it was given. Passing `null` creates one.
60
+ *
61
+ * @param {Uint32Array|null} table
62
+ * @param {number} key
63
+ * @param {number} value i32
64
+ * @returns {Uint32Array} the index to keep
65
+ */
66
+ export function u32_index_set(table: Uint32Array | null, key: number, value: number): Uint32Array;
67
+ /**
68
+ * Drop every key, keeping the allocation. The index is reusable immediately.
69
+ *
70
+ * @param {Uint32Array} table
71
+ */
72
+ export function u32_index_clear(table: Uint32Array): void;
73
+ /**
74
+ * What {@link u32_index_get} returns for a key the index does not hold.
75
+ *
76
+ * Also what a key holding the value `-1` reads back as — the two are deliberately
77
+ * indistinguishable, which is what lets a caller retire a key without the index needing tombstones.
78
+ * See {@link u32_index_set}.
79
+ *
80
+ * @type {number}
81
+ */
82
+ export const U32_INDEX_MISS: number;
83
+ //# sourceMappingURL=u32_index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"u32_index.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/map/u32_index.js"],"names":[],"mappings":"AAsCA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;;GAKG;AACH,yCAHW,MAAM,GACJ,WAAW,CAcvB;AAED;;;;;GAKG;AACH,uCAHW,WAAW,GACT,MAAM,CAIlB;AAED;;;;;;;GAOG;AACH,qCAJW,WAAW,OACX,MAAM,GACJ,MAAM,CAuBlB;AAED;;;;;;;;;;;;;;;GAeG;AACH,qCALW,WAAW,GAAC,IAAI,OAChB,MAAM,SACN,MAAM,GACJ,WAAW,CA2CvB;AAED;;;;GAIG;AACH,uCAFW,WAAW,QAQrB;AA/LD;;;;;;;;GAQG;AACH,6BAFU,MAAM,CAEiB"}