@luma.gl/graph 10.0.0-beta.2 → 10.0.0-beta.4

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 (317) hide show
  1. package/dist/arrow/gpu/arrow-gpu-analytics-adapters.cjs +22 -9
  2. package/dist/arrow/gpu/arrow-gpu-analytics-adapters.d.ts +11 -2
  3. package/dist/arrow/gpu/arrow-gpu-analytics-adapters.d.ts.map +1 -1
  4. package/dist/arrow/gpu/arrow-gpu-analytics-adapters.js +27 -10
  5. package/dist/arrow/gpu/arrow-gpu-analytics-adapters.js.map +1 -1
  6. package/dist/arrow/gpu/arrow-gpu-analytics-readback.cjs +24 -13
  7. package/dist/arrow/gpu/arrow-gpu-analytics-readback.d.ts +9 -1
  8. package/dist/arrow/gpu/arrow-gpu-analytics-readback.d.ts.map +1 -1
  9. package/dist/arrow/gpu/arrow-gpu-analytics-readback.js +41 -14
  10. package/dist/arrow/gpu/arrow-gpu-analytics-readback.js.map +1 -1
  11. package/dist/arrow/gpu/arrow-gpu-table-conversion.cjs +82 -23
  12. package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts +16 -1
  13. package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts.map +1 -1
  14. package/dist/arrow/gpu/arrow-gpu-table-conversion.js +98 -24
  15. package/dist/arrow/gpu/arrow-gpu-table-conversion.js.map +1 -1
  16. package/dist/arrow/gpu/arrow-gpu-vector-conversion.cjs +7 -0
  17. package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts +2 -0
  18. package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts.map +1 -1
  19. package/dist/arrow/gpu/arrow-gpu-vector-conversion.js +14 -0
  20. package/dist/arrow/gpu/arrow-gpu-vector-conversion.js.map +1 -1
  21. package/dist/arrow/index.cjs +2 -0
  22. package/dist/arrow/index.cjs.map +3 -3
  23. package/dist/arrow/index.d.ts +1 -1
  24. package/dist/arrow/index.d.ts.map +1 -1
  25. package/dist/arrow/index.js +1 -1
  26. package/dist/arrow/index.js.map +1 -1
  27. package/dist/arrow/vectors/arrow-temporal-gpu-vector.cjs +1 -2
  28. package/dist/arrow/vectors/arrow-temporal-gpu-vector.js +2 -2
  29. package/dist/arrow/vectors/arrow-temporal-gpu-vector.js.map +1 -1
  30. package/dist/dist.dev.js +62 -27
  31. package/dist/dist.min.js +48 -47
  32. package/dist/gpu-core/gpu-bvh-bounds.cjs +63 -0
  33. package/dist/gpu-core/gpu-bvh-bounds.d.ts +32 -0
  34. package/dist/gpu-core/gpu-bvh-bounds.d.ts.map +1 -0
  35. package/dist/gpu-core/gpu-bvh-bounds.js +56 -0
  36. package/dist/gpu-core/gpu-bvh-bounds.js.map +1 -0
  37. package/dist/gpu-core/gpu-command-graph-budget-controller.cjs +10 -2
  38. package/dist/gpu-core/gpu-command-graph-budget-controller.d.ts +4 -0
  39. package/dist/gpu-core/gpu-command-graph-budget-controller.d.ts.map +1 -1
  40. package/dist/gpu-core/gpu-command-graph-budget-controller.js +10 -2
  41. package/dist/gpu-core/gpu-command-graph-budget-controller.js.map +1 -1
  42. package/dist/gpu-core/gpu-command-graph-submission-pacer.cjs +92 -0
  43. package/dist/gpu-core/gpu-command-graph-submission-pacer.d.ts +41 -0
  44. package/dist/gpu-core/gpu-command-graph-submission-pacer.d.ts.map +1 -0
  45. package/dist/gpu-core/gpu-command-graph-submission-pacer.js +85 -0
  46. package/dist/gpu-core/gpu-command-graph-submission-pacer.js.map +1 -0
  47. package/dist/gpu-core/gpu-group-aggregation.cjs +45 -21
  48. package/dist/gpu-core/gpu-group-aggregation.d.ts +4 -0
  49. package/dist/gpu-core/gpu-group-aggregation.d.ts.map +1 -1
  50. package/dist/gpu-core/gpu-group-aggregation.js +58 -24
  51. package/dist/gpu-core/gpu-group-aggregation.js.map +1 -1
  52. package/dist/gpu-core/index.cjs +6 -0
  53. package/dist/gpu-core/index.cjs.map +3 -3
  54. package/dist/gpu-core/index.d.ts +4 -0
  55. package/dist/gpu-core/index.d.ts.map +1 -1
  56. package/dist/gpu-core/index.js +2 -0
  57. package/dist/gpu-core/index.js.map +1 -1
  58. package/dist/gpu-dataframe/gpu-analytics-compiler-utils.cjs +6 -6
  59. package/dist/gpu-dataframe/gpu-analytics-compiler-utils.d.ts +1 -1
  60. package/dist/gpu-dataframe/gpu-analytics-compiler-utils.d.ts.map +1 -1
  61. package/dist/gpu-dataframe/gpu-analytics-compiler-utils.js +6 -6
  62. package/dist/gpu-dataframe/gpu-analytics-compiler-utils.js.map +1 -1
  63. package/dist/gpu-dataframe/gpu-data-frame-query.cjs +55 -14
  64. package/dist/gpu-dataframe/gpu-data-frame-query.d.ts +13 -2
  65. package/dist/gpu-dataframe/gpu-data-frame-query.d.ts.map +1 -1
  66. package/dist/gpu-dataframe/gpu-data-frame-query.js +58 -17
  67. package/dist/gpu-dataframe/gpu-data-frame-query.js.map +1 -1
  68. package/dist/gpu-dataframe/gpu-data-frame.cjs +1 -3
  69. package/dist/gpu-dataframe/gpu-data-frame.d.ts +10 -0
  70. package/dist/gpu-dataframe/gpu-data-frame.d.ts.map +1 -1
  71. package/dist/gpu-dataframe/gpu-data-frame.js +1 -3
  72. package/dist/gpu-dataframe/gpu-data-frame.js.map +1 -1
  73. package/dist/gpu-dataframe/gpu-expression-shader.cjs +94 -44
  74. package/dist/gpu-dataframe/gpu-expression-shader.d.ts +8 -5
  75. package/dist/gpu-dataframe/gpu-expression-shader.d.ts.map +1 -1
  76. package/dist/gpu-dataframe/gpu-expression-shader.js +110 -47
  77. package/dist/gpu-dataframe/gpu-expression-shader.js.map +1 -1
  78. package/dist/gpu-dataframe/gpu-expression.cjs +14 -8
  79. package/dist/gpu-dataframe/gpu-expression.d.ts +12 -1
  80. package/dist/gpu-dataframe/gpu-expression.d.ts.map +1 -1
  81. package/dist/gpu-dataframe/gpu-expression.js +11 -6
  82. package/dist/gpu-dataframe/gpu-expression.js.map +1 -1
  83. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.cjs +8 -4
  84. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts +2 -1
  85. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts.map +1 -1
  86. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js +10 -4
  87. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js.map +1 -1
  88. package/dist/gpu-dataframe/gpu-global-aggregation-query.cjs +2 -2
  89. package/dist/gpu-dataframe/gpu-global-aggregation-query.d.ts +5 -1
  90. package/dist/gpu-dataframe/gpu-global-aggregation-query.d.ts.map +1 -1
  91. package/dist/gpu-dataframe/gpu-global-aggregation-query.js +6 -2
  92. package/dist/gpu-dataframe/gpu-global-aggregation-query.js.map +1 -1
  93. package/dist/gpu-dataframe/gpu-global-sort-compiler.cjs +156 -124
  94. package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts +12 -2
  95. package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts.map +1 -1
  96. package/dist/gpu-dataframe/gpu-global-sort-compiler.js +160 -128
  97. package/dist/gpu-dataframe/gpu-global-sort-compiler.js.map +1 -1
  98. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.cjs +366 -53
  99. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts +26 -4
  100. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts.map +1 -1
  101. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js +378 -47
  102. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js.map +1 -1
  103. package/dist/gpu-dataframe/gpu-group-by-query.cjs +20 -9
  104. package/dist/gpu-dataframe/gpu-group-by-query.d.ts +15 -2
  105. package/dist/gpu-dataframe/gpu-group-by-query.d.ts.map +1 -1
  106. package/dist/gpu-dataframe/gpu-group-by-query.js +22 -8
  107. package/dist/gpu-dataframe/gpu-group-by-query.js.map +1 -1
  108. package/dist/gpu-dataframe/gpu-join-compiler.cjs +61 -8
  109. package/dist/gpu-dataframe/gpu-join-compiler.d.ts +10 -2
  110. package/dist/gpu-dataframe/gpu-join-compiler.d.ts.map +1 -1
  111. package/dist/gpu-dataframe/gpu-join-compiler.js +60 -7
  112. package/dist/gpu-dataframe/gpu-join-compiler.js.map +1 -1
  113. package/dist/gpu-dataframe/gpu-query-compiler.cjs +61 -11
  114. package/dist/gpu-dataframe/gpu-query-compiler.d.ts +5 -1
  115. package/dist/gpu-dataframe/gpu-query-compiler.d.ts.map +1 -1
  116. package/dist/gpu-dataframe/gpu-query-compiler.js +61 -10
  117. package/dist/gpu-dataframe/gpu-query-compiler.js.map +1 -1
  118. package/dist/gpu-dataframe/index.cjs +4 -2
  119. package/dist/gpu-dataframe/index.cjs.map +3 -3
  120. package/dist/gpu-dataframe/index.d.ts +1 -1
  121. package/dist/gpu-dataframe/index.d.ts.map +1 -1
  122. package/dist/gpu-dataframe/index.js +1 -1
  123. package/dist/gpu-dataframe/index.js.map +1 -1
  124. package/dist/gpu-graph/index.cjs.map +1 -1
  125. package/dist/gpu-graph-algorithms/benchmarks.cjs.map +2 -2
  126. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.cjs +182 -62
  127. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.d.ts +29 -2
  128. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.d.ts.map +1 -1
  129. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.js +200 -64
  130. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.js.map +1 -1
  131. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.cjs +135 -9
  132. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.d.ts +55 -8
  133. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.d.ts.map +1 -1
  134. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.js +145 -14
  135. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.js.map +1 -1
  136. package/dist/gpu-graph-algorithms/index.cjs.map +3 -3
  137. package/dist/gpu-physics/articulation-tree-shader.cjs +177 -0
  138. package/dist/gpu-physics/articulation-tree-shader.d.ts +3 -0
  139. package/dist/gpu-physics/articulation-tree-shader.d.ts.map +1 -0
  140. package/dist/gpu-physics/articulation-tree-shader.js +159 -0
  141. package/dist/gpu-physics/articulation-tree-shader.js.map +1 -0
  142. package/dist/gpu-physics/gpu-articulation-tree.cjs +203 -0
  143. package/dist/gpu-physics/gpu-articulation-tree.d.ts +81 -0
  144. package/dist/gpu-physics/gpu-articulation-tree.d.ts.map +1 -0
  145. package/dist/gpu-physics/gpu-articulation-tree.js +205 -0
  146. package/dist/gpu-physics/gpu-articulation-tree.js.map +1 -0
  147. package/dist/gpu-physics/gpu-physics-batch.cjs +11 -10
  148. package/dist/gpu-physics/gpu-physics-batch.d.ts +1 -0
  149. package/dist/gpu-physics/gpu-physics-batch.d.ts.map +1 -1
  150. package/dist/gpu-physics/gpu-physics-batch.js +14 -10
  151. package/dist/gpu-physics/gpu-physics-batch.js.map +1 -1
  152. package/dist/gpu-physics/gpu-physics-ensemble.cjs +9 -4
  153. package/dist/gpu-physics/gpu-physics-ensemble.d.ts +10 -1
  154. package/dist/gpu-physics/gpu-physics-ensemble.d.ts.map +1 -1
  155. package/dist/gpu-physics/gpu-physics-ensemble.js +11 -4
  156. package/dist/gpu-physics/gpu-physics-ensemble.js.map +1 -1
  157. package/dist/gpu-physics/gpu-rigid-body-world.cjs +323 -68
  158. package/dist/gpu-physics/gpu-rigid-body-world.d.ts +59 -2
  159. package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
  160. package/dist/gpu-physics/gpu-rigid-body-world.js +400 -75
  161. package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
  162. package/dist/gpu-physics/index.cjs +3 -0
  163. package/dist/gpu-physics/index.cjs.map +3 -3
  164. package/dist/gpu-physics/index.d.ts +3 -1
  165. package/dist/gpu-physics/index.d.ts.map +1 -1
  166. package/dist/gpu-physics/index.js +1 -0
  167. package/dist/gpu-physics/index.js.map +1 -1
  168. package/dist/gpu-physics/rigid-body-cache-shaders.cjs +10 -6
  169. package/dist/gpu-physics/rigid-body-cache-shaders.d.ts +2 -1
  170. package/dist/gpu-physics/rigid-body-cache-shaders.d.ts.map +1 -1
  171. package/dist/gpu-physics/rigid-body-cache-shaders.js +15 -6
  172. package/dist/gpu-physics/rigid-body-cache-shaders.js.map +1 -1
  173. package/dist/gpu-physics/rigid-body-capacity.cjs +15 -2
  174. package/dist/gpu-physics/rigid-body-capacity.d.ts +3 -1
  175. package/dist/gpu-physics/rigid-body-capacity.d.ts.map +1 -1
  176. package/dist/gpu-physics/rigid-body-capacity.js +21 -2
  177. package/dist/gpu-physics/rigid-body-capacity.js.map +1 -1
  178. package/dist/gpu-physics/rigid-body-cast-index.cjs +192 -0
  179. package/dist/gpu-physics/rigid-body-cast-index.d.ts +44 -0
  180. package/dist/gpu-physics/rigid-body-cast-index.d.ts.map +1 -0
  181. package/dist/gpu-physics/rigid-body-cast-index.js +194 -0
  182. package/dist/gpu-physics/rigid-body-cast-index.js.map +1 -0
  183. package/dist/gpu-physics/rigid-body-ensemble-layout.cjs +4 -2
  184. package/dist/gpu-physics/rigid-body-ensemble-layout.d.ts +2 -1
  185. package/dist/gpu-physics/rigid-body-ensemble-layout.d.ts.map +1 -1
  186. package/dist/gpu-physics/rigid-body-ensemble-layout.js +5 -2
  187. package/dist/gpu-physics/rigid-body-ensemble-layout.js.map +1 -1
  188. package/dist/gpu-physics/rigid-body-ensemble-reset.cjs +11 -9
  189. package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts +1 -1
  190. package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts.map +1 -1
  191. package/dist/gpu-physics/rigid-body-ensemble-reset.js +13 -9
  192. package/dist/gpu-physics/rigid-body-ensemble-reset.js.map +1 -1
  193. package/dist/gpu-physics/rigid-body-ensemble-shaders.cjs +14 -7
  194. package/dist/gpu-physics/rigid-body-ensemble-shaders.d.ts +5 -0
  195. package/dist/gpu-physics/rigid-body-ensemble-shaders.d.ts.map +1 -1
  196. package/dist/gpu-physics/rigid-body-ensemble-shaders.js +17 -7
  197. package/dist/gpu-physics/rigid-body-ensemble-shaders.js.map +1 -1
  198. package/dist/gpu-physics/rigid-body-ensemble-transaction.cjs +21 -11
  199. package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts +2 -2
  200. package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts.map +1 -1
  201. package/dist/gpu-physics/rigid-body-ensemble-transaction.js +28 -12
  202. package/dist/gpu-physics/rigid-body-ensemble-transaction.js.map +1 -1
  203. package/dist/gpu-physics/rigid-body-event-compaction.cjs +184 -0
  204. package/dist/gpu-physics/rigid-body-event-compaction.d.ts +35 -0
  205. package/dist/gpu-physics/rigid-body-event-compaction.d.ts.map +1 -0
  206. package/dist/gpu-physics/rigid-body-event-compaction.js +168 -0
  207. package/dist/gpu-physics/rigid-body-event-compaction.js.map +1 -0
  208. package/dist/gpu-physics/rigid-body-event-snapshot.cjs +51 -0
  209. package/dist/gpu-physics/rigid-body-event-snapshot.d.ts +33 -0
  210. package/dist/gpu-physics/rigid-body-event-snapshot.d.ts.map +1 -0
  211. package/dist/gpu-physics/rigid-body-event-snapshot.js +34 -0
  212. package/dist/gpu-physics/rigid-body-event-snapshot.js.map +1 -0
  213. package/dist/gpu-physics/rigid-body-events.cjs +57 -25
  214. package/dist/gpu-physics/rigid-body-events.d.ts +2 -1
  215. package/dist/gpu-physics/rigid-body-events.d.ts.map +1 -1
  216. package/dist/gpu-physics/rigid-body-events.js +60 -25
  217. package/dist/gpu-physics/rigid-body-events.js.map +1 -1
  218. package/dist/gpu-physics/rigid-body-joints.cjs +8 -3
  219. package/dist/gpu-physics/rigid-body-joints.d.ts +2 -0
  220. package/dist/gpu-physics/rigid-body-joints.d.ts.map +1 -1
  221. package/dist/gpu-physics/rigid-body-joints.js +10 -6
  222. package/dist/gpu-physics/rigid-body-joints.js.map +1 -1
  223. package/dist/gpu-physics/rigid-body-queries.cjs +159 -16
  224. package/dist/gpu-physics/rigid-body-queries.d.ts +24 -1
  225. package/dist/gpu-physics/rigid-body-queries.d.ts.map +1 -1
  226. package/dist/gpu-physics/rigid-body-queries.js +166 -14
  227. package/dist/gpu-physics/rigid-body-queries.js.map +1 -1
  228. package/dist/gpu-physics/rigid-body-shaders.cjs +3 -3
  229. package/dist/gpu-physics/rigid-body-shaders.d.ts +1 -1
  230. package/dist/gpu-physics/rigid-body-shaders.d.ts.map +1 -1
  231. package/dist/gpu-physics/rigid-body-shaders.js +3 -3
  232. package/dist/gpu-physics/rigid-body-shaders.js.map +1 -1
  233. package/dist/gpu-physics/rigid-body-triggers.cjs +53 -15
  234. package/dist/gpu-physics/rigid-body-triggers.d.ts +1 -0
  235. package/dist/gpu-physics/rigid-body-triggers.d.ts.map +1 -1
  236. package/dist/gpu-physics/rigid-body-triggers.js +55 -15
  237. package/dist/gpu-physics/rigid-body-triggers.js.map +1 -1
  238. package/dist/gpu-physics/sphere-world-shaders.cjs +48 -20
  239. package/dist/gpu-physics/sphere-world-shaders.d.ts.map +1 -1
  240. package/dist/gpu-physics/sphere-world-shaders.js +51 -21
  241. package/dist/gpu-physics/sphere-world-shaders.js.map +1 -1
  242. package/dist/gpu-project/benchmarks.cjs.map +2 -2
  243. package/dist/gpu-project/crs.cjs.map +2 -2
  244. package/dist/gpu-project/graph.cjs.map +2 -2
  245. package/dist/gpu-project/index.cjs.map +2 -2
  246. package/dist/gpu-project/projection-program.cjs +2 -9
  247. package/dist/gpu-project/projection-program.d.ts.map +1 -1
  248. package/dist/gpu-project/projection-program.js +1 -8
  249. package/dist/gpu-project/projection-program.js.map +1 -1
  250. package/dist/gpu-simple-graph/index.cjs.map +2 -2
  251. package/dist/gpu-sql/gpu-sql.cjs +345 -81
  252. package/dist/gpu-sql/gpu-sql.d.ts +42 -2
  253. package/dist/gpu-sql/gpu-sql.d.ts.map +1 -1
  254. package/dist/gpu-sql/gpu-sql.js +393 -90
  255. package/dist/gpu-sql/gpu-sql.js.map +1 -1
  256. package/dist/gpu-sql/index.cjs.map +3 -3
  257. package/dist/gpu-sql/index.d.ts +1 -1
  258. package/dist/gpu-sql/index.d.ts.map +1 -1
  259. package/dist/index.cjs.map +1 -1
  260. package/dist/utils/float32.cjs +35 -0
  261. package/dist/utils/float32.d.ts +3 -0
  262. package/dist/utils/float32.d.ts.map +1 -0
  263. package/dist/utils/float32.js +16 -0
  264. package/dist/utils/float32.js.map +1 -0
  265. package/package.json +8 -8
  266. package/src/arrow/gpu/arrow-gpu-analytics-adapters.ts +77 -25
  267. package/src/arrow/gpu/arrow-gpu-analytics-readback.ts +52 -16
  268. package/src/arrow/gpu/arrow-gpu-table-conversion.ts +130 -31
  269. package/src/arrow/gpu/arrow-gpu-vector-conversion.ts +19 -0
  270. package/src/arrow/index.ts +1 -0
  271. package/src/arrow/vectors/arrow-temporal-gpu-vector.ts +2 -2
  272. package/src/gpu-core/gpu-bvh-bounds.ts +84 -0
  273. package/src/gpu-core/gpu-command-graph-budget-controller.ts +22 -2
  274. package/src/gpu-core/gpu-command-graph-submission-pacer.ts +102 -0
  275. package/src/gpu-core/gpu-group-aggregation.ts +68 -30
  276. package/src/gpu-core/index.ts +5 -0
  277. package/src/gpu-dataframe/gpu-analytics-compiler-utils.ts +7 -10
  278. package/src/gpu-dataframe/gpu-data-frame-query.ts +106 -25
  279. package/src/gpu-dataframe/gpu-data-frame.ts +35 -2
  280. package/src/gpu-dataframe/gpu-expression-shader.ts +172 -58
  281. package/src/gpu-dataframe/gpu-expression.ts +62 -9
  282. package/src/gpu-dataframe/gpu-global-aggregation-compiler.ts +15 -4
  283. package/src/gpu-dataframe/gpu-global-aggregation-query.ts +12 -3
  284. package/src/gpu-dataframe/gpu-global-sort-compiler.ts +231 -156
  285. package/src/gpu-dataframe/gpu-group-aggregation-compiler.ts +645 -61
  286. package/src/gpu-dataframe/gpu-group-by-query.ts +51 -14
  287. package/src/gpu-dataframe/gpu-join-compiler.ts +87 -6
  288. package/src/gpu-dataframe/gpu-query-compiler.ts +100 -18
  289. package/src/gpu-dataframe/index.ts +1 -1
  290. package/src/gpu-graph-algorithms/README.md +4 -2
  291. package/src/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.ts +248 -66
  292. package/src/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.ts +218 -20
  293. package/src/gpu-physics/articulation-tree-shader.ts +169 -0
  294. package/src/gpu-physics/gpu-articulation-tree.ts +279 -0
  295. package/src/gpu-physics/gpu-physics-batch.ts +19 -13
  296. package/src/gpu-physics/gpu-physics-ensemble.ts +20 -4
  297. package/src/gpu-physics/gpu-rigid-body-world.ts +510 -93
  298. package/src/gpu-physics/index.ts +16 -0
  299. package/src/gpu-physics/rigid-body-cache-shaders.ts +18 -6
  300. package/src/gpu-physics/rigid-body-capacity.ts +25 -4
  301. package/src/gpu-physics/rigid-body-cast-index.ts +277 -0
  302. package/src/gpu-physics/rigid-body-ensemble-layout.ts +6 -2
  303. package/src/gpu-physics/rigid-body-ensemble-reset.ts +21 -9
  304. package/src/gpu-physics/rigid-body-ensemble-shaders.ts +18 -7
  305. package/src/gpu-physics/rigid-body-ensemble-transaction.ts +31 -13
  306. package/src/gpu-physics/rigid-body-event-compaction.ts +252 -0
  307. package/src/gpu-physics/rigid-body-event-snapshot.ts +76 -0
  308. package/src/gpu-physics/rigid-body-events.ts +63 -25
  309. package/src/gpu-physics/rigid-body-joints.ts +11 -11
  310. package/src/gpu-physics/rigid-body-queries.ts +202 -14
  311. package/src/gpu-physics/rigid-body-shaders.ts +4 -3
  312. package/src/gpu-physics/rigid-body-triggers.ts +64 -20
  313. package/src/gpu-physics/sphere-world-shaders.ts +53 -21
  314. package/src/gpu-project/projection-program.ts +1 -9
  315. package/src/gpu-sql/gpu-sql.ts +629 -124
  316. package/src/gpu-sql/index.ts +1 -1
  317. package/src/utils/float32.ts +16 -0
@@ -45,7 +45,10 @@ var import_rigid_body_publication = require("./rigid-body-publication.cjs");
45
45
  var import_rigid_body_shaders = require("./rigid-body-shaders.cjs");
46
46
  var import_rigid_body_vehicle = require("./rigid-body-vehicle.cjs");
47
47
  var import_rigid_body_events = require("./rigid-body-events.cjs");
48
+ var import_rigid_body_event_compaction = require("./rigid-body-event-compaction.cjs");
49
+ var import_rigid_body_event_snapshot = require("./rigid-body-event-snapshot.cjs");
48
50
  var import_rigid_body_queries = require("./rigid-body-queries.cjs");
51
+ var import_rigid_body_cast_index = require("./rigid-body-cast-index.cjs");
49
52
  class GPURigidBodyWorld {
50
53
  worldOrigin = [0, 0, 0];
51
54
  id;
@@ -67,6 +70,14 @@ class GPURigidBodyWorld {
67
70
  sleepStates = null;
68
71
  /** World-owned GPU event ring; present only when eventCapacity is positive. */
69
72
  contactEvents = null;
73
+ /** Trigger history and authored group IDs remain stable until world destruction. */
74
+ triggerHistory = null;
75
+ /** Contact activity is recorded in pair-slot order after accepted steps. */
76
+ contactHistory = null;
77
+ /** A recovery read shares the incremental trigger cursor. */
78
+ triggerSnapshotRead = null;
79
+ /** A recovery read shares the incremental contact cursor. */
80
+ contactSnapshotRead = null;
70
81
  triggerEvents = null;
71
82
  triggerCursor = 0;
72
83
  triggerRead = null;
@@ -74,6 +85,18 @@ class GPURigidBodyWorld {
74
85
  eventRead = null;
75
86
  queryComputation = null;
76
87
  queryReduction = null;
88
+ /** Batched nearest-hit computation using the current world pose buffers. */
89
+ batchCast = null;
90
+ /** Compiled query graph that refits the world BVH and then casts. */
91
+ batchCastIndex = null;
92
+ /** Initial spatial order and stable collider ID mapping for indexed batches. */
93
+ batchCastOrder = null;
94
+ /** Query graph reservation before attachment, when the physical plan is unavailable. */
95
+ batchCastIndexEstimate;
96
+ /** Reusable storage for a bounded list of ray and sweep commands. */
97
+ batchCastCommands = null;
98
+ /** Reusable GPU output with one compact result per batch command. */
99
+ batchCastResults = null;
77
100
  /** Chassis definitions in GPU storage order. */
78
101
  vehicles;
79
102
  /** Whether any chassis has more than one terrain candidate. */
@@ -122,6 +145,9 @@ class GPURigidBodyWorld {
122
145
  broadPhaseCounters = null;
123
146
  constructor(props) {
124
147
  var _a, _b, _c, _d, _e, _f;
148
+ const queryBatchCapacity = props.queryBatchCapacity ?? 0;
149
+ if (!Number.isSafeInteger(queryBatchCapacity) || queryBatchCapacity < 0 || queryBatchCapacity > 65535 || queryBatchCapacity > 0 && !props.enableQueries || props.queryBatchIndex && queryBatchCapacity === 0)
150
+ throw new Error("Invalid collision cast batch capacity");
125
151
  for (const damping of [props.linearDamping ?? 0, props.angularDamping ?? 0]) {
126
152
  if (!Number.isFinite(damping) || damping < 0)
127
153
  throw new Error("Invalid damping");
@@ -228,6 +254,9 @@ class GPURigidBodyWorld {
228
254
  this.maximumPairs = this.broadPhase === "all-pairs" ? this.colliderStorageCount * this.colliderStorageCount : props.maximumPairs ?? 2 ** Math.ceil(Math.log2(Math.max(64, this.colliderStorageCount * 16)));
229
255
  if (!["all-pairs", "hierarchical-grid"].includes(this.broadPhase) || !Number.isSafeInteger(this.maximumPairs) || this.maximumPairs < 1 || this.maximumPairs > 1073741824 || this.broadPhase === "hierarchical-grid" && (this.maximumPairs & this.maximumPairs - 1) !== 0)
230
256
  throw new Error("Invalid rigid-body pair capacity");
257
+ const instancePairCapacity = props.ensemblePairsPerInstance;
258
+ if (instancePairCapacity !== void 0 && (!props.ensembleBodiesPerInstance || props.failurePolicy !== "rollback" || !Number.isSafeInteger(instancePairCapacity) || instancePairCapacity < 1 || instancePairCapacity * (this.count / props.ensembleBodiesPerInstance) > this.maximumPairs || (instancePairCapacity & instancePairCapacity - 1) !== 0))
259
+ throw new Error("Invalid ensemble instance contact capacity");
231
260
  if (props.continuous) {
232
261
  if (props.failurePolicy !== "rollback" || !Number.isInteger(props.continuous.maximumImpacts ?? 4) || (props.continuous.maximumImpacts ?? 4) < 1 || (props.continuous.maximumImpacts ?? 4) > 16 || !["sphere-static", "convex"].includes(props.continuous.mode ?? "sphere-static") || !Number.isSafeInteger(props.continuous.maximumCandidates ?? this.maximumPairs) || (props.continuous.maximumCandidates ?? this.maximumPairs) < 1 || (props.continuous.maximumCandidates ?? this.maximumPairs) > 1073741824 || props.continuous.mode === "convex" && (Boolean((_d = props.joints) == null ? void 0 : _d.length) || colliders.some((collider) => ["plane", "triangle-mesh", "height-field"].includes(collider.shape.type))))
233
262
  throw new Error("Invalid continuous settings");
@@ -246,6 +275,7 @@ class GPURigidBodyWorld {
246
275
  const definitions = structuredClone({ colliders, props });
247
276
  this.props = definitions.props;
248
277
  this.colliders = definitions.colliders;
278
+ this.batchCastIndexEstimate = this.props.queryBatchIndex && this.colliderCount ? (0, import_rigid_body_cast_index.estimateRigidBodyCastIndexBytes)(this.colliders.filter(import_rigid_body_cast_index.canIndexRigidBodyCastCollider).length) : 0;
249
279
  this.ensembleTerrainSlots = new Set(this.props.ensembleTerrainSlots);
250
280
  if (this.ensembleTerrainSlots.size && (!this.props.ensembleBodiesPerInstance || [...this.ensembleTerrainSlots].some((index) => {
251
281
  var _a2;
@@ -317,7 +347,7 @@ class GPURigidBodyWorld {
317
347
  sparse,
318
348
  extended,
319
349
  parallel,
320
- ...(0, import_rigid_body_capacity.getRigidBodyStorageLayout)(this.count, this.colliderStorageCount, this.maximumPairs, geometryWords, sparse, extended, parallel, this.props.eventCapacity ?? 0, this.props.enableQueries ?? false, this.props.failurePolicy === "rollback", Boolean(this.props.continuous), ((_b = this.props.joints) == null ? void 0 : _b.length) ?? 0, this.props.ensembleBodiesPerInstance ? this.count / this.props.ensembleBodiesPerInstance : 0)
350
+ ...(0, import_rigid_body_capacity.getRigidBodyStorageLayout)(this.count, this.colliderStorageCount, this.maximumPairs, geometryWords, sparse, extended, parallel, this.props.eventCapacity ?? 0, this.props.enableQueries ?? false, this.props.failurePolicy === "rollback", Boolean(this.props.continuous), ((_b = this.props.joints) == null ? void 0 : _b.length) ?? 0, this.props.ensembleBodiesPerInstance ? this.count / this.props.ensembleBodiesPerInstance : 0, Boolean(this.props.ensemblePairsPerInstance), this.props.queryBatchCapacity)
321
351
  };
322
352
  if (this.vehicles.length) {
323
353
  const byteLength = this.getVehicleByteLength();
@@ -374,7 +404,7 @@ class GPURigidBodyWorld {
374
404
  if (!this.device || !this.ensembleBuffer || this.destroyed)
375
405
  throw new Error("World has no ensemble scheduler");
376
406
  this.ensembleResetOrigin ??= this.origin;
377
- this.ensembleReset ??= (0, import_rigid_body_ensemble_reset.makeEnsembleReset)(this.device, this.id, this.ownedBuffers, this.count, this.props.ensembleBodiesPerInstance, this.props.collisionPartitionSize, this.maximumPairs, this.vehiclesPerInstance, this.ensembleTerrainSlots);
407
+ this.ensembleReset ??= (0, import_rigid_body_ensemble_reset.makeEnsembleReset)(this.device, this.id, this.ownedBuffers, this.count, this.props.ensembleBodiesPerInstance, this.props.collisionPartitionSize, this.maximumPairs, this.vehiclesPerInstance, this.ensembleTerrainSlots, this.props.ensemblePairsPerInstance);
378
408
  return this.ensembleReset.byteLength;
379
409
  }
380
410
  resetEnsembleInstance(instance) {
@@ -415,7 +445,7 @@ class GPURigidBodyWorld {
415
445
  metadata.write(new Float32Array((collider.position ?? [0, 0, 0]).map((value, axis) => value - center[axis])), this.count * 48 + index * 96 + 16);
416
446
  }
417
447
  this.ensembleReset.reset(instance, this.origin.map((value, axis) => value - this.ensembleResetOrigin[axis]));
418
- this.ensembleBuffer.write(new Uint32Array([0, 0, 0, 0, 1, 1]), (16 + instance * 8 + 1) * 4);
448
+ this.ensembleBuffer.write(new Uint32Array([0, 0, 0, 0, 1, 1, 0]), (16 + instance * 8 + 1) * 4);
419
449
  if (this.encodePosePublication) {
420
450
  const encoder = this.device.createCommandEncoder();
421
451
  this.encodePosePublication(encoder);
@@ -470,8 +500,9 @@ class GPURigidBodyWorld {
470
500
  if (!this.ensembleBuffer || this.destroyed || !Number.isSafeInteger(instance) || instance < 0 || instance >= this.count / this.props.ensembleBodiesPerInstance)
471
501
  throw new Error("Invalid ensemble instance");
472
502
  }
473
- /** Allocation preflight without GPU allocation. Graph scratch and driver overhead are separate. */
503
+ /** World buffer sizes and private query scratch. Simulation graph scratch and driver overhead are separate. */
474
504
  getCapacityInfo() {
505
+ var _a;
475
506
  const buffers = this.allocationPlan ? this.allocationPlan.map((buffer) => ({ ...buffer })) : this.getStorageLayout().buffers;
476
507
  return {
477
508
  bodyCount: this.count,
@@ -479,6 +510,7 @@ class GPURigidBodyWorld {
479
510
  maximumPairs: this.maximumPairs,
480
511
  pairWorkgroups: Math.ceil(this.maximumPairs / 64),
481
512
  buffers,
513
+ queryIndexScratchBytes: ((_a = this.batchCastIndex) == null ? void 0 : _a.stats.physicalTransientResourceBytes) ?? this.batchCastIndexEstimate,
482
514
  ownedBufferBytes: buffers.reduce((total, buffer) => total + buffer.byteLength, 0)
483
515
  };
484
516
  }
@@ -498,6 +530,8 @@ class GPURigidBodyWorld {
498
530
  if (buffer.byteLength > Math.min(graph.device.limits.maxBufferSize, bindingLimit))
499
531
  throw new Error(`Rigid-body ${buffer.name} storage exceeds device limits`);
500
532
  }
533
+ if ((this.props.queryBatchCapacity ?? 0) > graph.device.limits.maxComputeWorkgroupsPerDimension)
534
+ throw new Error("Collision cast batch exceeds device dispatch limits");
501
535
  this.allocationPlan = allocationPlan;
502
536
  this.device = graph.device;
503
537
  const allocate = (name, data, uniform = false) => {
@@ -614,7 +648,7 @@ class GPURigidBodyWorld {
614
648
  this.velocities = allocate("velocities", velocities);
615
649
  this.angularVelocities = allocate("angular-velocities", angular);
616
650
  this.sleepStates = allocate("sleep", this.count * 16);
617
- this.targets = allocate("targets", this.props.ensembleBodiesPerInstance ? (0, import_rigid_body_ensemble_layout.getEnsembleContactLayout)(this.count, this.count / this.props.ensembleBodiesPerInstance, this.maximumPairs).byteLength : Math.ceil((this.count * 32 + (sparse ? 32 + this.maximumPairs * 8 : 16)) / 16) * 16 + (((_c = this.props.joints) == null ? void 0 : _c.length) ?? 0) * import_rigid_body_joints.RIGID_BODY_JOINT_STATE_BYTES);
651
+ this.targets = allocate("targets", this.props.ensembleBodiesPerInstance ? (0, import_rigid_body_ensemble_layout.getEnsembleContactLayout)(this.count, this.count / this.props.ensembleBodiesPerInstance, this.maximumPairs, Boolean(this.props.ensemblePairsPerInstance)).byteLength : Math.ceil((this.count * 32 + (sparse ? 32 + this.maximumPairs * 8 : 16)) / 16) * 16 + (((_c = this.props.joints) == null ? void 0 : _c.length) ?? 0) * import_rigid_body_joints.RIGID_BODY_JOINT_STATE_BYTES);
618
652
  for (const [index, joint] of (this.props.joints ?? []).entries()) {
619
653
  this.targets.write((0, import_rigid_body_joints.packRigidBodyJointState)(joint), this.getJointStateOffset() + index * import_rigid_body_joints.RIGID_BODY_JOINT_STATE_BYTES);
620
654
  }
@@ -701,7 +735,7 @@ class GPURigidBodyWorld {
701
735
  byteLength: objectAttributes.byteLength,
702
736
  usage: import_core.Buffer.STORAGE
703
737
  }, objectAttributes), { format: "uint32", length: this.colliderStorageCount }) : void 0;
704
- const source = (0, import_rigid_body_shaders.getRigidBodyShader)(this.count, this.props.iterations ?? 16, this.colliderStorageCount, extended, sparseLayout, parallel, this.props.maximumMeshTraversalTestsPerPair ?? 65536, (0, import_rigid_body_joints.getRigidBodyJointShader)(this.props.joints ?? [], this.props.bodies), Boolean((_d = this.props.joints) == null ? void 0 : _d.length), this.props.linearDamping ?? 0, this.props.angularDamping ?? 0, ((_e = this.props.joints) == null ? void 0 : _e.length) ?? 0, this.props.compactContacts ?? true, this.props.collisionPartitionSize, this.props.ensembleBodiesPerInstance, this.props.parallelContactSolver === "block", this.colliders.some((collider) => collider.shape.type === "height-field"));
738
+ const source = (0, import_rigid_body_shaders.getRigidBodyShader)(this.count, this.props.iterations ?? 16, this.colliderStorageCount, extended, sparseLayout, parallel, this.props.maximumMeshTraversalTestsPerPair ?? 65536, (0, import_rigid_body_joints.getRigidBodyJointShader)(this.props.joints ?? [], this.props.bodies), Boolean((_d = this.props.joints) == null ? void 0 : _d.length), this.props.linearDamping ?? 0, this.props.angularDamping ?? 0, ((_e = this.props.joints) == null ? void 0 : _e.length) ?? 0, this.props.compactContacts ?? true, this.props.collisionPartitionSize, this.props.ensembleBodiesPerInstance, this.props.parallelContactSolver === "block", this.colliders.some((collider) => collider.shape.type === "height-field"), this.props.ensemblePairsPerInstance);
705
739
  const parallelBindings = {
706
740
  parallelReset: ["parallelState"],
707
741
  parallelResetCounters: ["parallelState"],
@@ -782,6 +816,8 @@ class GPURigidBodyWorld {
782
816
  location: 18
783
817
  }, allocate, Boolean((_i = this.props.joints) == null ? void 0 : _i.length), extended) : void 0;
784
818
  this.triggerEvents = (triggers == null ? void 0 : triggers.events) ?? null;
819
+ if (triggers && triggerLayout)
820
+ this.triggerHistory = { buffer: triggers.history, groups: triggerLayout.groups };
785
821
  const passDescriptions = {
786
822
  integrate: "Apply gravity and advance body velocities and predicted poses for this timestep.",
787
823
  prepare: "Reset broad-phase counters before generating potential collider pairs.",
@@ -936,7 +972,7 @@ class GPURigidBodyWorld {
936
972
  const restoreCheckpoint = this.props.failurePolicy === "rollback" ? this.ensembleBuffer ? (0, import_rigid_body_ensemble_transaction.addEnsembleCheckpoint)(graph, this.id, checkpointStates, { buffer: this.simulationStatistics, resource: statisticsResource }, bindings.find((binding) => binding.name === "ensemble"), bindings.find((binding) => binding.name === "manifolds"), this.props.ensembleBodiesPerInstance, this.maximumPairs, allocate, vehicleResource && {
937
973
  state: vehicleResource,
938
974
  vehiclesPerInstance: this.vehiclesPerInstance
939
- }) : (0, import_rigid_body_transaction.addRigidBodyCheckpoint)(graph, this.id, [
975
+ }, this.props.ensemblePairsPerInstance) : (0, import_rigid_body_transaction.addRigidBodyCheckpoint)(graph, this.id, [
940
976
  ...checkpointStates,
941
977
  bindings.find((binding) => binding.name === "manifolds"),
942
978
  ...vehicleResource ? [vehicleResource] : []
@@ -1248,7 +1284,10 @@ class GPURigidBodyWorld {
1248
1284
  });
1249
1285
  restoreCheckpoint == null ? void 0 : restoreCheckpoint.restore();
1250
1286
  if (this.ensembleBuffer)
1251
- (0, import_rigid_body_ensemble_shaders.addEnsembleStatus)(graph, this.id, this.count / this.props.ensembleBodiesPerInstance, this.props.ensembleBodiesPerInstance, diagnosticBinding("bodies"), diagnosticBinding("sleepStates"), diagnosticBinding("ensemble"), { buffer: this.simulationStatistics, resource: statisticsResource });
1287
+ (0, import_rigid_body_ensemble_shaders.addEnsembleStatus)(graph, this.id, this.count / this.props.ensembleBodiesPerInstance, this.props.ensembleBodiesPerInstance, diagnosticBinding("bodies"), diagnosticBinding("sleepStates"), diagnosticBinding("ensemble"), { buffer: this.simulationStatistics, resource: statisticsResource }, this.props.ensemblePairsPerInstance ? {
1288
+ ...diagnosticBinding("targets"),
1289
+ wordOffset: (0, import_rigid_body_ensemble_layout.getEnsembleContactLayout)(this.count, this.count / this.props.ensembleBodiesPerInstance, this.maximumPairs, true).failureOffset
1290
+ } : void 0);
1252
1291
  triggers == null ? void 0 : triggers.publish();
1253
1292
  if (this.props.publicationBounds || this.props.publishPoses) {
1254
1293
  const publication = (0, import_rigid_body_publication.addRigidBodyPosePublication)(graph, this.id, this.props.bodies, this.props.publicationBounds ?? this.props.bodies.map(() => [
@@ -1261,6 +1300,7 @@ class GPURigidBodyWorld {
1261
1300
  }
1262
1301
  if (this.props.eventCapacity) {
1263
1302
  const contactHistory = allocate("contact-history", this.maximumPairs * 16);
1303
+ this.contactHistory = contactHistory;
1264
1304
  this.contactEvents = allocate("contact-events", 16 + this.props.eventCapacity * 64);
1265
1305
  const eventBindings = [
1266
1306
  ...bindings.filter((binding) => ["bodies", "manifolds", "ensemble"].includes(binding.name)),
@@ -1284,35 +1324,21 @@ class GPURigidBodyWorld {
1284
1324
  }, binding.buffer)
1285
1325
  }))
1286
1326
  ];
1287
- const properties = {
1327
+ const contactResources = eventBindings.map(({ name, resource, location }) => ({
1328
+ name,
1329
+ resource,
1330
+ location,
1331
+ readOnly: name === "bodies" || name === "eventStatistics"
1332
+ }));
1333
+ (0, import_rigid_body_event_compaction.addRigidBodyEventCompaction)(graph, {
1288
1334
  id: `${this.id}-contact-events`,
1289
- source: source + (0, import_rigid_body_events.getRigidBodyEventShader)(this.props.eventCapacity, this.props.impactImpulseThreshold ?? 1, this.props.failurePolicy === "rollback"),
1290
- entryPoint: "recordContacts",
1291
- shaderLayout: {
1292
- bindings: eventBindings.map(({ name, location }) => ({
1293
- name,
1294
- location,
1295
- group: 0,
1296
- type: ["bodies", "eventStatistics"].includes(name) ? "read-only-storage" : "storage"
1297
- }))
1298
- }
1299
- };
1300
- const executable = (computation) => ({
1301
- encode: ({ computePass, getBuffer }) => {
1302
- Object.assign(computation.bindings, Object.fromEntries(eventBindings.map((binding) => [binding.name, getBuffer(binding.resource)])));
1303
- computation.kernel.dispatch(computePass, { bindings: computation.bindings, x: 1 });
1304
- },
1305
- destroy: () => computation.kernel.destroy()
1306
- });
1307
- graph.addComputePass({
1308
- id: properties.id,
1309
- description: "Compare contact history and publish contact begin, persist, and end events.",
1310
- resources: eventBindings.map((binding) => ({
1311
- buffer: binding.resource,
1312
- usage: ["bodies", "eventStatistics"].includes(binding.name) ? "storage-read" : "storage-read-write"
1313
- })),
1314
- compile: () => executable((0, import_bound_kernel.createBoundKernel)(graph.device, properties)),
1315
- compileAsync: async () => executable(await (0, import_bound_kernel.createBoundKernelAsync)(graph.device, properties))
1335
+ rowCount: this.maximumPairs,
1336
+ capacity: this.props.eventCapacity,
1337
+ ring: "contactEvents",
1338
+ source: source + (0, import_rigid_body_events.getRigidBodyEventShader)(this.props.eventCapacity, this.props.impactImpulseThreshold ?? 1, this.props.failurePolicy === "rollback", this.props.ensemblePairsPerInstance),
1339
+ classify: contactResources.filter((binding) => !["bodies", "contactEvents"].includes(binding.name)),
1340
+ commit: contactResources.filter((binding) => ["eventStatistics", "contactEvents"].includes(binding.name)),
1341
+ publish: contactResources.filter((binding) => !["eventStatistics", "ensemble"].includes(binding.name))
1316
1342
  });
1317
1343
  }
1318
1344
  if (this.props.enableQueries) {
@@ -1353,6 +1379,43 @@ class GPURigidBodyWorld {
1353
1379
  queryOutput: this.queryOutput
1354
1380
  }
1355
1381
  });
1382
+ if (this.props.queryBatchCapacity) {
1383
+ const capacity = this.props.queryBatchCapacity;
1384
+ this.batchCastCommands = allocate("query-batch-commands", capacity * import_rigid_body_queries.RIGID_BODY_CAST_COMMAND_BYTES);
1385
+ this.batchCastResults = allocate("query-batch-results", capacity * import_rigid_body_queries.RIGID_BODY_BATCH_RESULT_BYTES);
1386
+ const batchBindings = {
1387
+ positions: this.positions,
1388
+ orientations: this.orientations,
1389
+ bodies,
1390
+ querySelection: this.querySelection,
1391
+ batchCommands: this.batchCastCommands,
1392
+ batchResults: this.batchCastResults
1393
+ };
1394
+ const batchLayout = [
1395
+ ...queryProperties.shaderLayout.bindings.filter((binding) => ["positions", "orientations", "bodies", "querySelection"].includes(binding.name)),
1396
+ { name: "batchCommands", group: 0, location: 30, type: "read-only-storage" },
1397
+ { name: "batchResults", group: 0, location: 31, type: "storage" }
1398
+ ];
1399
+ this.batchCast = (0, import_bound_kernel.createBoundKernel)(graph.device, {
1400
+ id: `${this.id}-batched-casts`,
1401
+ entryPoint: "castBatch",
1402
+ source: queryProperties.source + (0, import_rigid_body_queries.getRigidBodyBatchCastShader)(),
1403
+ shaderLayout: { bindings: batchLayout },
1404
+ bindings: batchBindings
1405
+ });
1406
+ if (this.props.queryBatchIndex && this.colliderCount) {
1407
+ this.batchCastOrder = (0, import_rigid_body_cast_index.getRigidBodyCastOrder)(this.colliders, this.props.bodies);
1408
+ if (this.batchCastOrder.indexedCount) {
1409
+ this.batchCastIndex = (0, import_rigid_body_cast_index.createRigidBodyCastIndex)(graph.device, {
1410
+ id: `${this.id}-cast-index`,
1411
+ source: queryProperties.source,
1412
+ layout: batchLayout,
1413
+ buffers: batchBindings,
1414
+ indexedCount: this.batchCastOrder.indexedCount
1415
+ });
1416
+ }
1417
+ }
1418
+ }
1356
1419
  }
1357
1420
  this.controlSettings = allocate("control-settings", 64, true);
1358
1421
  const controlProperties = {
@@ -1491,7 +1554,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1491
1554
  }
1492
1555
  /** Rebase between submissions, preserving velocities, contact impulses and sleeping state. */
1493
1556
  shiftOrigin(shift) {
1494
- if (!this.device || this.destroyed || this.queryPending || this.eventRead || this.triggerRead)
1557
+ if (!this.device || this.destroyed || this.queryPending || this.eventReadsPending)
1495
1558
  throw new Error("Origin shifting requires an idle attached world");
1496
1559
  if (shift.length !== 3 || shift.some((value) => !Number.isFinite(value) || Math.fround(value) !== value))
1497
1560
  throw new Error("Origin shift must be an exactly representable float32 vector");
@@ -1635,6 +1698,16 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1635
1698
  metadata.write(data);
1636
1699
  this.props.publicationBounds = structuredClone(bounds);
1637
1700
  }
1701
+ /** Read the authored collider frame relative to its body's node origin, excluding COM offset. */
1702
+ getColliderTransform(colliderIndex) {
1703
+ const collider = this.colliders[colliderIndex];
1704
+ if (!Number.isInteger(colliderIndex) || !collider || this.destroyed)
1705
+ throw new Error("Invalid collider");
1706
+ return {
1707
+ position: [...collider.position ?? [0, 0, 0]],
1708
+ orientation: (0, import_rigid_body_properties.normalizeRigidBodyRotation)(collider.orientation)
1709
+ };
1710
+ }
1638
1711
  /** Applied scale relative to the initially cooked analytic shape. */
1639
1712
  getColliderShapeScale(colliderIndex) {
1640
1713
  this.getColliderShape(colliderIndex);
@@ -1703,7 +1776,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1703
1776
  if (!edits.length)
1704
1777
  return;
1705
1778
  const metadata = this.ownedBuffers.find((buffer) => buffer.id === `${this.id}-bodies`);
1706
- if (!metadata || this.destroyed || this.queryPending || this.eventRead || this.triggerRead)
1779
+ if (!metadata || this.destroyed || this.queryPending || this.eventReadsPending)
1707
1780
  throw new Error("Terrain streaming requires an idle attached world");
1708
1781
  const seen = /* @__PURE__ */ new Set();
1709
1782
  const packedFields = this.terrainAtlas ? /* @__PURE__ */ new Map() : void 0;
@@ -1980,6 +2053,68 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1980
2053
  throw new Error("Invalid joint");
1981
2054
  return structuredClone(joint);
1982
2055
  }
2056
+ /** Command a named angular force drive. Angles are radians and maximum torque is N·m. */
2057
+ setAngularActuator(id, axis, command) {
2058
+ const index = this.findAngularActuator(id, axis);
2059
+ const joint = this.props.joints[index];
2060
+ if (joint.type !== "general" || !joint.drive)
2061
+ throw new Error("Expected angular drive");
2062
+ if (command.stiffness === void 0 && command.damping === void 0 && command.maximumTorque === void 0) {
2063
+ this.setAngularDriveTargets(/* @__PURE__ */ new Map([[index, command.angle]]));
2064
+ return;
2065
+ }
2066
+ this.setJointParameters(index, {
2067
+ ...joint,
2068
+ drive: {
2069
+ ...joint.drive,
2070
+ positionTarget: command.angle,
2071
+ stiffness: command.stiffness ?? joint.drive.stiffness,
2072
+ damping: command.damping ?? joint.drive.damping,
2073
+ maximumForce: command.maximumTorque ?? joint.drive.maximumForce
2074
+ }
2075
+ });
2076
+ }
2077
+ /** Read the signed mean motor torque from the most recently submitted step. */
2078
+ async readAngularActuatorTorque(id, axis) {
2079
+ const index = this.findAngularActuator(id, axis);
2080
+ if (!this.targets || this.destroyed)
2081
+ throw new Error("Inactive world");
2082
+ const bytes = await this.targets.readAsync(this.getJointStateOffset() + index * import_rigid_body_joints.RIGID_BODY_JOINT_STATE_BYTES, 4);
2083
+ return new DataView(bytes.buffer, bytes.byteOffset, 4).getFloat32(0, true) / this.timeStep;
2084
+ }
2085
+ findAngularActuator(id, axis) {
2086
+ const indices = (this.props.joints ?? []).flatMap((joint, index) => joint.id === id && joint.type === "general" && joint.angular && joint.drive && joint.drive.mode !== "acceleration" && joint.axes[0] === axis ? [index] : []);
2087
+ if (indices.length !== 1)
2088
+ throw new Error("Missing or ambiguous angular force drive");
2089
+ return indices[0];
2090
+ }
2091
+ /** Retarget authored angular drive rows between steps while preserving the other joints' settings. */
2092
+ setAngularDriveTargets(targets) {
2093
+ var _a;
2094
+ const joints = [...this.props.joints ?? []];
2095
+ if (!this.targets || !this.sleepStates || this.destroyed)
2096
+ throw new Error("Inactive world");
2097
+ for (const [index, angle] of targets) {
2098
+ const joint = joints[index];
2099
+ if ((joint == null ? void 0 : joint.type) !== "general" || !joint.angular || !joint.drive || !Number.isFinite(Math.fround(angle))) {
2100
+ throw new Error("Invalid angular drive target");
2101
+ }
2102
+ if (Math.fround(joint.drive.positionTarget ?? 0) === Math.fround(angle))
2103
+ continue;
2104
+ joints[index] = { ...joint, drive: { ...joint.drive, positionTarget: angle } };
2105
+ }
2106
+ const drivenBodies = /* @__PURE__ */ new Set();
2107
+ for (const [index, angle] of targets) {
2108
+ if (joints[index] === ((_a = this.props.joints) == null ? void 0 : _a[index]))
2109
+ continue;
2110
+ drivenBodies.add(joints[index].first);
2111
+ drivenBodies.add(joints[index].second);
2112
+ this.targets.write(new Float32Array([angle]), this.getJointStateOffset() + index * import_rigid_body_joints.RIGID_BODY_JOINT_STATE_BYTES + 40 * 4);
2113
+ }
2114
+ this.props.joints = joints;
2115
+ for (const body of drivenBodies)
2116
+ this.sleepStates.write(new Float32Array(2), body * 16);
2117
+ }
1983
2118
  /** Update an existing constraint's response without recompiling or changing attachment topology. */
1984
2119
  setJointParameters(index, parameters) {
1985
2120
  this.setJointParameterEdits([{ index, parameters }]);
@@ -2038,15 +2173,22 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2038
2173
  readContactEvents() {
2039
2174
  if (!this.contactEvents || this.destroyed)
2040
2175
  return Promise.reject(new Error("Contact events are not enabled"));
2041
- if (!this.eventRead)
2042
- this.eventRead = this.contactEvents.readAsync().then((bytes) => {
2176
+ const afterSnapshot = this.contactSnapshotRead;
2177
+ if (this.eventRead && (!afterSnapshot || this.eventRead.afterSnapshot === afterSnapshot))
2178
+ return this.eventRead.result;
2179
+ const pending = {
2180
+ afterSnapshot,
2181
+ result: this.contactEvents.readAsync().finally(() => afterSnapshot).then((bytes) => {
2043
2182
  const batch = (0, import_rigid_body_events.decodeRigidBodyContactEvents)(new Uint32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4), this.eventCursor);
2044
2183
  this.eventCursor = batch.sequence;
2045
2184
  return batch;
2046
2185
  }).finally(() => {
2047
- this.eventRead = null;
2048
- });
2049
- return this.eventRead;
2186
+ if (this.eventRead === pending)
2187
+ this.eventRead = null;
2188
+ })
2189
+ };
2190
+ this.eventRead = pending;
2191
+ return pending.result;
2050
2192
  }
2051
2193
  /** Nearest exact sphere/OBB hit. Origins inside a shape return distance zero and a zero normal. */
2052
2194
  raycast(query) {
@@ -2056,6 +2198,57 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2056
2198
  overlapSphere(query) {
2057
2199
  return this.runQuery(query);
2058
2200
  }
2201
+ /**
2202
+ * Query the closest hit for each ray or sphere cast with one submission and readback.
2203
+ * Results follow input order. This snapshots already submitted poses, using one shared collider selection.
2204
+ */
2205
+ async castBatch(commands, options = {}) {
2206
+ if (!this.device || !this.batchCast || !this.querySelection || !this.batchCastCommands || !this.batchCastResults || this.destroyed || this.queryPending)
2207
+ throw new Error("Batched collision casts are disabled or busy");
2208
+ if (commands.length > this.props.queryBatchCapacity)
2209
+ throw new Error("Collision cast batch exceeds capacity");
2210
+ if (!commands.length)
2211
+ return [];
2212
+ if (options.strategy === "indexed" && !this.props.queryBatchIndex)
2213
+ throw new Error("Batched collision cast index is disabled");
2214
+ const order = options.strategy === "scan" ? null : this.batchCastOrder;
2215
+ const selection = options.colliderIndices ? Uint32Array.from(new Set(this.validateQueryColliders(options.colliderIndices))) : (order == null ? void 0 : order.indices) ?? Uint32Array.from({ length: this.colliderCount }, (_, index) => index);
2216
+ let indexedCount = (order == null ? void 0 : order.indexedCount) ?? 0;
2217
+ if (order && options.colliderIndices) {
2218
+ selection.sort((first, second) => order.ranks[first] - order.ranks[second]);
2219
+ const firstExtended = selection.findIndex((index) => order.ranks[index] >= order.indexedCount);
2220
+ indexedCount = firstExtended < 0 ? selection.length : firstExtended;
2221
+ }
2222
+ const data = (0, import_rigid_body_queries.packRigidBodyBatchCasts)(commands, this.count, selection.length, indexedCount);
2223
+ this.queryPending = true;
2224
+ try {
2225
+ this.batchCastCommands.write(data);
2226
+ if (selection.length)
2227
+ this.querySelection.write(selection);
2228
+ const encoder = this.device.createCommandEncoder();
2229
+ if (this.batchCastIndex && indexedCount) {
2230
+ this.batchCastIndex.encode(encoder, { parameters: commands.length });
2231
+ } else {
2232
+ const pass = encoder.beginComputePass();
2233
+ this.batchCast.kernel.dispatch(pass, {
2234
+ bindings: this.batchCast.bindings,
2235
+ x: commands.length
2236
+ });
2237
+ pass.end();
2238
+ }
2239
+ this.device.submit(encoder.finish());
2240
+ return (0, import_rigid_body_queries.decodeRigidBodyBatchCasts)(await this.batchCastResults.readAsync(0, commands.length * import_rigid_body_queries.RIGID_BODY_BATCH_RESULT_BYTES));
2241
+ } finally {
2242
+ this.queryPending = false;
2243
+ }
2244
+ }
2245
+ /** Reject invalid indices before scalar or batch query buffers are written. */
2246
+ validateQueryColliders(indices) {
2247
+ for (const index of indices)
2248
+ if (!Number.isInteger(index) || index < 0 || index >= this.colliderCount)
2249
+ throw new Error("Invalid query collider");
2250
+ return indices;
2251
+ }
2059
2252
  async runQuery(query) {
2060
2253
  if (!this.device || !this.queryComputation || !this.querySettings || !this.querySelection || !this.queryOutput || this.destroyed || this.queryPending)
2061
2254
  throw new Error("Queries are disabled or busy");
@@ -2069,9 +2262,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2069
2262
  throw new Error("Invalid collision query");
2070
2263
  const selected = query.colliderIndices ?? Array.from({ length: this.colliderCount }, (_, index) => index);
2071
2264
  const selection = new Uint32Array(this.colliderStorageCount);
2072
- for (const index of selected) {
2073
- if (!Number.isInteger(index) || index < 0 || index >= this.colliderCount)
2074
- throw new Error("Invalid query collider");
2265
+ for (const index of this.validateQueryColliders(selected)) {
2075
2266
  const collider = this.colliders[index];
2076
2267
  if (collider.body === query.excludeBody)
2077
2268
  continue;
@@ -2101,16 +2292,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2101
2292
  const bytes = await this.queryOutput.readAsync(0, 16 + maximumHits * 48);
2102
2293
  const words = new Uint32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4);
2103
2294
  const floats = new Float32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4);
2104
- const hits = Array.from({ length: words[0] }, (_, index) => {
2105
- const offset = 4 + index * 12;
2106
- return {
2107
- body: words[offset],
2108
- collider: words[offset + 1],
2109
- point: [floats[offset + 4], floats[offset + 5], floats[offset + 6]],
2110
- distance: floats[offset + 7],
2111
- normal: [floats[offset + 8], floats[offset + 9], floats[offset + 10]]
2112
- };
2113
- });
2295
+ const hits = Array.from({ length: words[0] }, (_, index) => (0, import_rigid_body_queries.decodeRigidBodyQueryHit)(words, floats, 4 + index * 12));
2114
2296
  return {
2115
2297
  hits,
2116
2298
  totalHits: words[1],
@@ -2155,16 +2337,87 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2155
2337
  readTriggerEvents() {
2156
2338
  if (!this.triggerEvents || this.destroyed)
2157
2339
  throw new Error("Triggers are disabled");
2158
- if (this.triggerRead)
2159
- return this.triggerRead;
2160
- this.triggerRead = this.triggerEvents.readAsync().then((bytes) => {
2161
- const batch = (0, import_rigid_body_triggers.decodeRigidBodyTriggerEvents)(new Uint32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4), this.triggerCursor);
2162
- this.triggerCursor = batch.sequence;
2163
- return batch;
2340
+ const afterSnapshot = this.triggerSnapshotRead;
2341
+ if (this.triggerRead && (!afterSnapshot || this.triggerRead.afterSnapshot === afterSnapshot))
2342
+ return this.triggerRead.result;
2343
+ const pending = {
2344
+ afterSnapshot,
2345
+ result: this.triggerEvents.readAsync().finally(() => afterSnapshot).then((bytes) => {
2346
+ const batch = (0, import_rigid_body_triggers.decodeRigidBodyTriggerEvents)(new Uint32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4), this.triggerCursor);
2347
+ this.triggerCursor = batch.sequence;
2348
+ return batch;
2349
+ }).finally(() => {
2350
+ if (this.triggerRead === pending)
2351
+ this.triggerRead = null;
2352
+ })
2353
+ };
2354
+ this.triggerRead = pending;
2355
+ return pending.result;
2356
+ }
2357
+ /** Recover the active contact set and advance the incremental cursor to the snapshot. */
2358
+ resyncContactEvents() {
2359
+ var _a;
2360
+ if (!this.device || !this.contactEvents || !this.contactHistory || this.destroyed)
2361
+ return Promise.reject(new Error("Contact events are not enabled"));
2362
+ if (this.contactSnapshotRead)
2363
+ return this.contactSnapshotRead;
2364
+ const priorRead = (_a = this.eventRead) == null ? void 0 : _a.result.catch(() => void 0);
2365
+ const snapshot = (0, import_rigid_body_event_snapshot.readRigidBodyEventSnapshot)(this.device, this.contactEvents, this.contactHistory, (header, rows) => {
2366
+ const contacts = [];
2367
+ for (let offset = 0; offset < rows.length; offset += 4) {
2368
+ if (rows[offset + 2] === 0)
2369
+ continue;
2370
+ const first = rows[offset];
2371
+ const second = rows[offset + 1];
2372
+ contacts.push({
2373
+ colliders: [first, second],
2374
+ bodies: [this.colliders[first].body, this.colliders[second].body]
2375
+ });
2376
+ }
2377
+ return { ...header, contacts };
2378
+ });
2379
+ this.contactSnapshotRead = snapshot.finally(() => priorRead).then((result) => {
2380
+ this.eventCursor = result.sequence;
2381
+ return result;
2164
2382
  }).finally(() => {
2165
- this.triggerRead = null;
2383
+ this.contactSnapshotRead = null;
2166
2384
  });
2167
- return this.triggerRead;
2385
+ return this.contactSnapshotRead;
2386
+ }
2387
+ /** Recover the active trigger overlap set and advance the incremental trigger cursor. */
2388
+ resyncTriggerEvents() {
2389
+ var _a;
2390
+ if (!this.device || !this.triggerEvents || !this.triggerHistory || this.destroyed)
2391
+ return Promise.reject(new Error("Triggers are disabled"));
2392
+ if (this.triggerSnapshotRead)
2393
+ return this.triggerSnapshotRead;
2394
+ const { buffer, groups } = this.triggerHistory;
2395
+ const priorRead = (_a = this.triggerRead) == null ? void 0 : _a.result.catch(() => void 0);
2396
+ const snapshot = (0, import_rigid_body_event_snapshot.readRigidBodyEventSnapshot)(this.device, this.triggerEvents, buffer, (header, rows) => {
2397
+ const overlaps = [];
2398
+ for (let offset = 0; offset < rows.length; offset += 4) {
2399
+ if ((rows[offset] & 1) === 0)
2400
+ continue;
2401
+ overlaps.push({
2402
+ trigger: groups[offset],
2403
+ body: groups[offset + 1],
2404
+ triggerCollider: rows[offset + 1],
2405
+ collider: rows[offset + 2]
2406
+ });
2407
+ }
2408
+ return { ...header, overlaps };
2409
+ });
2410
+ this.triggerSnapshotRead = snapshot.finally(() => priorRead).then((result) => {
2411
+ this.triggerCursor = result.sequence;
2412
+ return result;
2413
+ }).finally(() => {
2414
+ this.triggerSnapshotRead = null;
2415
+ });
2416
+ return this.triggerSnapshotRead;
2417
+ }
2418
+ /** Reset, capture and origin operations require stable event cursors. */
2419
+ get eventReadsPending() {
2420
+ return Boolean(this.eventRead || this.triggerRead || this.contactSnapshotRead || this.triggerSnapshotRead);
2168
2421
  }
2169
2422
  getSnapshotBuffers(includeRollbackScratch = true) {
2170
2423
  return this.ownedBuffers.filter((buffer) => includeRollbackScratch || !buffer.id.startsWith(`${this.id}-checkpoint-`));
@@ -2199,7 +2452,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2199
2452
  throw error;
2200
2453
  }
2201
2454
  const copy = (restore) => {
2202
- if (released || this.destroyed || this.queryPending || this.eventRead || this.triggerRead)
2455
+ if (released || this.destroyed || this.queryPending || this.eventReadsPending)
2203
2456
  throw new Error("Checkpoint requires an idle live world");
2204
2457
  const encoder = device.createCommandEncoder();
2205
2458
  for (const [index, buffer] of checkpointBuffers.entries())
@@ -2259,7 +2512,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2259
2512
  /** Stop graph submissions and controls first; includes diagnostics, caches and event history. */
2260
2513
  async captureState(options = {}) {
2261
2514
  var _a;
2262
- if (!this.device || this.destroyed || this.queryPending || this.eventRead || this.triggerRead)
2515
+ if (!this.device || this.destroyed || this.queryPending || this.eventReadsPending)
2263
2516
  throw new Error("Capture requires an idle attached world");
2264
2517
  return {
2265
2518
  version: 1,
@@ -2281,7 +2534,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2281
2534
  restoreState(capture) {
2282
2535
  const checkpointBuffers = this.getSnapshotBuffers(capture.includeRollbackScratch);
2283
2536
  const terrainRevision = capture.terrainRevision ?? 1;
2284
- if (!this.device || this.destroyed || this.queryPending || this.eventRead || this.triggerRead || capture.version !== 1 || Boolean(capture.terrainAtlasLeases) !== Boolean(this.terrainAtlas) || !Number.isInteger(terrainRevision) || terrainRevision < 1 || terrainRevision > 16777215 || capture.origin !== void 0 && (capture.origin.length !== 3 || !capture.origin.every(Number.isFinite)) || capture.buffers.length !== checkpointBuffers.length || serializeCaptureProps(capture.props) !== serializeCaptureProps(this.props) || ![capture.contactCursor, capture.triggerCursor].every((value) => Number.isInteger(value) && value >= 0 && value <= 4294967295))
2537
+ if (!this.device || this.destroyed || this.queryPending || this.eventReadsPending || capture.version !== 1 || Boolean(capture.terrainAtlasLeases) !== Boolean(this.terrainAtlas) || !Number.isInteger(terrainRevision) || terrainRevision < 1 || terrainRevision > 16777215 || capture.origin !== void 0 && (capture.origin.length !== 3 || !capture.origin.every(Number.isFinite)) || capture.buffers.length !== checkpointBuffers.length || serializeCaptureProps(capture.props) !== serializeCaptureProps(this.props) || ![capture.contactCursor, capture.triggerCursor].every((value) => Number.isInteger(value) && value >= 0 && value <= 4294967295))
2285
2538
  throw new Error("Incompatible rigid-body capture");
2286
2539
  const shapeScales = new Map(capture.colliderShapeScales ?? []);
2287
2540
  for (const [index, scale] of shapeScales) {
@@ -2414,7 +2667,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2414
2667
  }
2415
2668
  /** Destroy the compiled graph and finish readbacks before destroying its world. */
2416
2669
  destroy() {
2417
- var _a, _b, _c, _d, _e, _f;
2670
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2418
2671
  if (this.destroyed)
2419
2672
  return;
2420
2673
  (_a = this.ensembleReset) == null ? void 0 : _a.destroy();
@@ -2426,6 +2679,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2426
2679
  (_d = this.terrainWake) == null ? void 0 : _d.kernel.destroy();
2427
2680
  (_e = this.queryComputation) == null ? void 0 : _e.kernel.destroy();
2428
2681
  (_f = this.queryReduction) == null ? void 0 : _f.kernel.destroy();
2682
+ (_g = this.batchCastIndex) == null ? void 0 : _g.destroy();
2683
+ (_h = this.batchCast) == null ? void 0 : _h.kernel.destroy();
2429
2684
  for (const buffer of this.ownedBuffers)
2430
2685
  buffer.destroy();
2431
2686
  this.ownedBuffers.length = 0;