@luma.gl/graph 10.0.0-alpha.9 → 10.0.0-beta.2

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 (746) hide show
  1. package/LICENSE +4 -4
  2. package/THIRD-PARTY-NOTICES.md +19 -0
  3. package/dist/arrow/arrow-colors.cjs +99 -18
  4. package/dist/arrow/arrow-colors.d.ts +27 -10
  5. package/dist/arrow/arrow-colors.d.ts.map +1 -1
  6. package/dist/arrow/arrow-colors.js +107 -24
  7. package/dist/arrow/arrow-colors.js.map +1 -1
  8. package/dist/arrow/arrow-utils/arrow-paths.cjs +4 -3
  9. package/dist/arrow/arrow-utils/arrow-paths.d.ts.map +1 -1
  10. package/dist/arrow/arrow-utils/arrow-paths.js +5 -4
  11. package/dist/arrow/arrow-utils/arrow-paths.js.map +1 -1
  12. package/dist/arrow/cpu/arrow-coordinate-projection.cjs +30 -0
  13. package/dist/arrow/cpu/arrow-coordinate-projection.d.ts +5 -0
  14. package/dist/arrow/cpu/arrow-coordinate-projection.d.ts.map +1 -0
  15. package/dist/arrow/cpu/arrow-coordinate-projection.js +9 -0
  16. package/dist/arrow/cpu/arrow-coordinate-projection.js.map +1 -0
  17. package/dist/arrow/cpu/arrow-cpu-pipelines.cjs +31 -0
  18. package/dist/arrow/cpu/arrow-cpu-pipelines.d.ts +2 -0
  19. package/dist/arrow/cpu/arrow-cpu-pipelines.d.ts.map +1 -0
  20. package/dist/arrow/cpu/arrow-cpu-pipelines.js +5 -0
  21. package/dist/arrow/cpu/arrow-cpu-pipelines.js.map +1 -0
  22. package/dist/arrow/cpu/arrow-cpu-vector-adapters.cjs +99 -0
  23. package/dist/arrow/cpu/arrow-cpu-vector-adapters.d.ts +9 -0
  24. package/dist/arrow/cpu/arrow-cpu-vector-adapters.d.ts.map +1 -0
  25. package/dist/arrow/cpu/arrow-cpu-vector-adapters.js +100 -0
  26. package/dist/arrow/cpu/arrow-cpu-vector-adapters.js.map +1 -0
  27. package/dist/arrow/geoarrow/arrow-geoarrow-adapter.cjs +9 -371
  28. package/dist/arrow/geoarrow/arrow-geoarrow-adapter.d.ts +8 -28
  29. package/dist/arrow/geoarrow/arrow-geoarrow-adapter.d.ts.map +1 -1
  30. package/dist/arrow/geoarrow/arrow-geoarrow-adapter.js +4 -381
  31. package/dist/arrow/geoarrow/arrow-geoarrow-adapter.js.map +1 -1
  32. package/dist/arrow/geoarrow/arrow-geoarrow-conversion.cjs +11 -11
  33. package/dist/arrow/geoarrow/arrow-geoarrow-conversion.d.ts +2 -0
  34. package/dist/arrow/geoarrow/arrow-geoarrow-conversion.d.ts.map +1 -1
  35. package/dist/arrow/geoarrow/arrow-geoarrow-conversion.js +4 -4
  36. package/dist/arrow/geoarrow/arrow-geoarrow-conversion.js.map +1 -1
  37. package/dist/arrow/geoarrow/arrow-polygon-tessellation.cjs +2 -2
  38. package/dist/arrow/geoarrow/arrow-polygon-tessellation.js +1 -1
  39. package/dist/arrow/geoarrow/arrow-polygon-tessellation.js.map +1 -1
  40. package/dist/arrow/gpu/arrow-column-gpu-vector.cjs +27 -8
  41. package/dist/arrow/gpu/arrow-column-gpu-vector.d.ts +11 -1
  42. package/dist/arrow/gpu/arrow-column-gpu-vector.d.ts.map +1 -1
  43. package/dist/arrow/gpu/arrow-column-gpu-vector.js +33 -8
  44. package/dist/arrow/gpu/arrow-column-gpu-vector.js.map +1 -1
  45. package/dist/arrow/gpu/arrow-gpu-table-conversion.cjs +68 -3
  46. package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts +9 -2
  47. package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts.map +1 -1
  48. package/dist/arrow/gpu/arrow-gpu-table-conversion.js +76 -3
  49. package/dist/arrow/gpu/arrow-gpu-table-conversion.js.map +1 -1
  50. package/dist/arrow/gpu/arrow-gpu-vector-adapters.cjs +8 -6
  51. package/dist/arrow/gpu/arrow-gpu-vector-adapters.d.ts +1 -0
  52. package/dist/arrow/gpu/arrow-gpu-vector-adapters.d.ts.map +1 -1
  53. package/dist/arrow/gpu/arrow-gpu-vector-adapters.js +17 -7
  54. package/dist/arrow/gpu/arrow-gpu-vector-adapters.js.map +1 -1
  55. package/dist/arrow/gpu/arrow-gpu-vector-conversion.cjs +35 -5
  56. package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts +6 -1
  57. package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts.map +1 -1
  58. package/dist/arrow/gpu/arrow-gpu-vector-conversion.js +40 -5
  59. package/dist/arrow/gpu/arrow-gpu-vector-conversion.js.map +1 -1
  60. package/dist/arrow/index.cjs +19 -2
  61. package/dist/arrow/index.cjs.map +3 -3
  62. package/dist/arrow/index.d.ts +5 -2
  63. package/dist/arrow/index.d.ts.map +1 -1
  64. package/dist/arrow/index.js +4 -1
  65. package/dist/arrow/index.js.map +1 -1
  66. package/dist/arrow/internal.cjs.map +2 -2
  67. package/dist/dist.dev.js +3820 -1646
  68. package/dist/dist.min.js +450 -136
  69. package/dist/experimental/index.cjs.map +1 -1
  70. package/dist/experimental/simulation/index.cjs.map +1 -1
  71. package/dist/experimental-models.cjs +21 -0
  72. package/dist/experimental-models.d.ts +2 -0
  73. package/dist/experimental-models.d.ts.map +1 -0
  74. package/dist/experimental-models.js +5 -0
  75. package/dist/experimental-models.js.map +1 -0
  76. package/dist/experimental-simulation.cjs +21 -0
  77. package/dist/experimental-simulation.d.ts +2 -0
  78. package/dist/experimental-simulation.d.ts.map +1 -0
  79. package/dist/experimental-simulation.js +5 -0
  80. package/dist/experimental-simulation.js.map +1 -0
  81. package/dist/geospatial/gpu-point-spatial-query.cjs +2 -15
  82. package/dist/geospatial/gpu-point-spatial-query.d.ts.map +1 -1
  83. package/dist/geospatial/gpu-point-spatial-query.js +2 -15
  84. package/dist/geospatial/gpu-point-spatial-query.js.map +1 -1
  85. package/dist/geospatial/index.cjs.map +2 -2
  86. package/dist/gpu-a5/index.cjs.map +1 -1
  87. package/dist/gpu-core/compiled-gpu-graph.cjs +47 -0
  88. package/dist/gpu-core/compiled-gpu-graph.d.ts +5 -0
  89. package/dist/gpu-core/compiled-gpu-graph.d.ts.map +1 -1
  90. package/dist/gpu-core/compiled-gpu-graph.js +54 -1
  91. package/dist/gpu-core/compiled-gpu-graph.js.map +1 -1
  92. package/dist/gpu-core/gpu-command-graph-compiler.cjs +11 -2
  93. package/dist/gpu-core/gpu-command-graph-compiler.d.ts +2 -1
  94. package/dist/gpu-core/gpu-command-graph-compiler.d.ts.map +1 -1
  95. package/dist/gpu-core/gpu-command-graph-compiler.js +13 -2
  96. package/dist/gpu-core/gpu-command-graph-compiler.js.map +1 -1
  97. package/dist/gpu-core/gpu-command-graph-types.d.ts +16 -1
  98. package/dist/gpu-core/gpu-command-graph-types.d.ts.map +1 -1
  99. package/dist/gpu-core/gpu-command-graph-types.js.map +1 -1
  100. package/dist/gpu-core/gpu-command-graph.cjs +34 -11
  101. package/dist/gpu-core/gpu-command-graph.d.ts +17 -8
  102. package/dist/gpu-core/gpu-command-graph.d.ts.map +1 -1
  103. package/dist/gpu-core/gpu-command-graph.js +39 -11
  104. package/dist/gpu-core/gpu-command-graph.js.map +1 -1
  105. package/dist/gpu-core/gpu-cpu-execution.cjs +279 -0
  106. package/dist/gpu-core/gpu-cpu-execution.d.ts +22 -0
  107. package/dist/gpu-core/gpu-cpu-execution.d.ts.map +1 -0
  108. package/dist/gpu-core/gpu-cpu-execution.js +294 -0
  109. package/dist/gpu-core/gpu-cpu-execution.js.map +1 -0
  110. package/dist/gpu-core/gpu-cpu-operation.cjs +54 -0
  111. package/dist/gpu-core/gpu-cpu-operation.d.ts +40 -0
  112. package/dist/gpu-core/gpu-cpu-operation.d.ts.map +1 -0
  113. package/dist/gpu-core/gpu-cpu-operation.js +35 -0
  114. package/dist/gpu-core/gpu-cpu-operation.js.map +1 -0
  115. package/dist/gpu-core/gpu-dispatch-utils.cjs +7 -3
  116. package/dist/gpu-core/gpu-dispatch-utils.d.ts +2 -0
  117. package/dist/gpu-core/gpu-dispatch-utils.d.ts.map +1 -1
  118. package/dist/gpu-core/gpu-dispatch-utils.js +4 -1
  119. package/dist/gpu-core/gpu-dispatch-utils.js.map +1 -1
  120. package/dist/gpu-core/gpu-expression-operation.cjs +2 -2
  121. package/dist/gpu-core/gpu-expression-operation.d.ts +1 -1
  122. package/dist/gpu-core/gpu-expression-operation.d.ts.map +1 -1
  123. package/dist/gpu-core/gpu-expression-operation.js +1 -1
  124. package/dist/gpu-core/gpu-expression-operation.js.map +1 -1
  125. package/dist/gpu-core/gpu-expression-plan.cjs +5 -1
  126. package/dist/gpu-core/gpu-expression-plan.d.ts +3 -2
  127. package/dist/gpu-core/gpu-expression-plan.d.ts.map +1 -1
  128. package/dist/gpu-core/gpu-expression-plan.js +7 -1
  129. package/dist/gpu-core/gpu-expression-plan.js.map +1 -1
  130. package/dist/gpu-core/gpu-graph-compiler.cjs +48 -0
  131. package/dist/gpu-core/gpu-graph-compiler.d.ts +1 -0
  132. package/dist/gpu-core/gpu-graph-compiler.d.ts.map +1 -1
  133. package/dist/gpu-core/gpu-graph-compiler.js +50 -0
  134. package/dist/gpu-core/gpu-graph-compiler.js.map +1 -1
  135. package/dist/gpu-core/gpu-graph.d.ts +2 -2
  136. package/dist/gpu-core/gpu-graph.d.ts.map +1 -1
  137. package/dist/gpu-core/gpu-graph.js.map +1 -1
  138. package/dist/gpu-core/gpu-grid-aggregation.cjs +2 -5
  139. package/dist/gpu-core/gpu-grid-aggregation.d.ts.map +1 -1
  140. package/dist/gpu-core/gpu-grid-aggregation.js +2 -5
  141. package/dist/gpu-core/gpu-grid-aggregation.js.map +1 -1
  142. package/dist/gpu-core/gpu-grid-binning.cjs +2 -5
  143. package/dist/gpu-core/gpu-grid-binning.d.ts.map +1 -1
  144. package/dist/gpu-core/gpu-grid-binning.js +2 -5
  145. package/dist/gpu-core/gpu-grid-binning.js.map +1 -1
  146. package/dist/gpu-core/gpu-grid-coordinate.cjs +41 -0
  147. package/dist/gpu-core/gpu-grid-coordinate.d.ts +7 -0
  148. package/dist/gpu-core/gpu-grid-coordinate.d.ts.map +1 -0
  149. package/dist/gpu-core/gpu-grid-coordinate.js +24 -0
  150. package/dist/gpu-core/gpu-grid-coordinate.js.map +1 -0
  151. package/dist/gpu-core/gpu-grid-index-internals.cjs +2 -15
  152. package/dist/gpu-core/gpu-grid-index-internals.d.ts.map +1 -1
  153. package/dist/gpu-core/gpu-grid-index-internals.js +2 -15
  154. package/dist/gpu-core/gpu-grid-index-internals.js.map +1 -1
  155. package/dist/gpu-core/gpu-grid-index-query.cjs +2 -16
  156. package/dist/gpu-core/gpu-grid-index-query.d.ts.map +1 -1
  157. package/dist/gpu-core/gpu-grid-index-query.js +2 -16
  158. package/dist/gpu-core/gpu-grid-index-query.js.map +1 -1
  159. package/dist/gpu-core/gpu-group-aggregation.cjs +7 -15
  160. package/dist/gpu-core/gpu-group-aggregation.d.ts.map +1 -1
  161. package/dist/gpu-core/gpu-group-aggregation.js +7 -18
  162. package/dist/gpu-core/gpu-group-aggregation.js.map +1 -1
  163. package/dist/gpu-core/gpu-operation.d.ts +4 -4
  164. package/dist/gpu-core/gpu-operation.d.ts.map +1 -1
  165. package/dist/gpu-core/gpu-operation.js.map +1 -1
  166. package/dist/gpu-core/gpu-reduction.cjs +6 -14
  167. package/dist/gpu-core/gpu-reduction.d.ts.map +1 -1
  168. package/dist/gpu-core/gpu-reduction.js +6 -15
  169. package/dist/gpu-core/gpu-reduction.js.map +1 -1
  170. package/dist/gpu-core/gpu-render-operation.cjs +39 -0
  171. package/dist/gpu-core/gpu-render-operation.d.ts +21 -0
  172. package/dist/gpu-core/gpu-render-operation.d.ts.map +1 -0
  173. package/dist/gpu-core/gpu-render-operation.js +22 -0
  174. package/dist/gpu-core/gpu-render-operation.js.map +1 -0
  175. package/dist/gpu-core/gpu-scan.cjs +46 -32
  176. package/dist/gpu-core/gpu-scan.d.ts.map +1 -1
  177. package/dist/gpu-core/gpu-scan.js +56 -44
  178. package/dist/gpu-core/gpu-scan.js.map +1 -1
  179. package/dist/gpu-core/gpu-segmented-reduction.cjs +12 -9
  180. package/dist/gpu-core/gpu-segmented-reduction.d.ts +1 -1
  181. package/dist/gpu-core/gpu-segmented-reduction.d.ts.map +1 -1
  182. package/dist/gpu-core/gpu-segmented-reduction.js +12 -9
  183. package/dist/gpu-core/gpu-segmented-reduction.js.map +1 -1
  184. package/dist/gpu-core/gpu-segmented-scan.cjs +73 -16
  185. package/dist/gpu-core/gpu-segmented-scan.d.ts.map +1 -1
  186. package/dist/gpu-core/gpu-segmented-scan.js +73 -16
  187. package/dist/gpu-core/gpu-segmented-scan.js.map +1 -1
  188. package/dist/gpu-core/gpu-semantic-aggregation-operation.cjs +112 -0
  189. package/dist/gpu-core/gpu-semantic-aggregation-operation.d.ts +71 -0
  190. package/dist/gpu-core/gpu-semantic-aggregation-operation.d.ts.map +1 -0
  191. package/dist/gpu-core/gpu-semantic-aggregation-operation.js +92 -0
  192. package/dist/gpu-core/gpu-semantic-aggregation-operation.js.map +1 -0
  193. package/dist/gpu-core/gpu-shader-pass-kernel.cjs +267 -0
  194. package/dist/gpu-core/gpu-shader-pass-kernel.d.ts +29 -0
  195. package/dist/gpu-core/gpu-shader-pass-kernel.d.ts.map +1 -0
  196. package/dist/gpu-core/gpu-shader-pass-kernel.js +260 -0
  197. package/dist/gpu-core/gpu-shader-pass-kernel.js.map +1 -0
  198. package/dist/gpu-core/gpu-shader-pass-operation.cjs +85 -0
  199. package/dist/gpu-core/gpu-shader-pass-operation.d.ts +32 -0
  200. package/dist/gpu-core/gpu-shader-pass-operation.d.ts.map +1 -0
  201. package/dist/gpu-core/gpu-shader-pass-operation.js +74 -0
  202. package/dist/gpu-core/gpu-shader-pass-operation.js.map +1 -0
  203. package/dist/gpu-core/gpu-texture-plan.d.ts +3 -2
  204. package/dist/gpu-core/gpu-texture-plan.d.ts.map +1 -1
  205. package/dist/gpu-core/gpu-texture-plan.js.map +1 -1
  206. package/dist/gpu-core/index.cjs +32 -0
  207. package/dist/gpu-core/index.cjs.map +3 -3
  208. package/dist/gpu-core/index.d.ts +21 -1
  209. package/dist/gpu-core/index.d.ts.map +1 -1
  210. package/dist/gpu-core/index.js +10 -0
  211. package/dist/gpu-core/index.js.map +1 -1
  212. package/dist/gpu-data/color-conversion.cjs +105 -0
  213. package/dist/gpu-data/color-conversion.d.ts +30 -0
  214. package/dist/gpu-data/color-conversion.d.ts.map +1 -0
  215. package/dist/gpu-data/color-conversion.js +109 -0
  216. package/dist/gpu-data/color-conversion.js.map +1 -0
  217. package/dist/gpu-data/cpu-data.cjs +60 -0
  218. package/dist/gpu-data/cpu-data.d.ts +28 -0
  219. package/dist/gpu-data/cpu-data.d.ts.map +1 -0
  220. package/dist/gpu-data/cpu-data.js +41 -0
  221. package/dist/gpu-data/cpu-data.js.map +1 -0
  222. package/dist/gpu-data/cpu-gpu-vector-transfer.cjs +98 -0
  223. package/dist/gpu-data/cpu-gpu-vector-transfer.d.ts +9 -0
  224. package/dist/gpu-data/cpu-gpu-vector-transfer.d.ts.map +1 -0
  225. package/dist/gpu-data/cpu-gpu-vector-transfer.js +85 -0
  226. package/dist/gpu-data/cpu-gpu-vector-transfer.js.map +1 -0
  227. package/dist/gpu-data/cpu-vector.cjs +42 -0
  228. package/dist/gpu-data/cpu-vector.d.ts +17 -0
  229. package/dist/gpu-data/cpu-vector.d.ts.map +1 -0
  230. package/dist/gpu-data/cpu-vector.js +21 -0
  231. package/dist/gpu-data/cpu-vector.js.map +1 -0
  232. package/dist/gpu-data/gpu-data-buffer-props.cjs +41 -0
  233. package/dist/gpu-data/gpu-data-buffer-props.d.ts +5 -0
  234. package/dist/gpu-data/gpu-data-buffer-props.d.ts.map +1 -0
  235. package/dist/gpu-data/gpu-data-buffer-props.js +19 -0
  236. package/dist/gpu-data/gpu-data-buffer-props.js.map +1 -0
  237. package/dist/gpu-data/gpu-vector-wgsl-layout.cjs +50 -0
  238. package/dist/gpu-data/gpu-vector-wgsl-layout.d.ts +41 -0
  239. package/dist/gpu-data/gpu-vector-wgsl-layout.d.ts.map +1 -0
  240. package/dist/gpu-data/gpu-vector-wgsl-layout.js +45 -0
  241. package/dist/gpu-data/gpu-vector-wgsl-layout.js.map +1 -0
  242. package/dist/gpu-data/index.cjs +21 -2
  243. package/dist/gpu-data/index.cjs.map +3 -3
  244. package/dist/gpu-data/index.d.ts +6 -0
  245. package/dist/gpu-data/index.d.ts.map +1 -1
  246. package/dist/gpu-data/index.js +5 -0
  247. package/dist/gpu-data/index.js.map +1 -1
  248. package/dist/gpu-dataframe/gpu-data-frame-query.cjs +8 -19
  249. package/dist/gpu-dataframe/gpu-data-frame-query.d.ts.map +1 -1
  250. package/dist/gpu-dataframe/gpu-data-frame-query.js +14 -26
  251. package/dist/gpu-dataframe/gpu-data-frame-query.js.map +1 -1
  252. package/dist/gpu-dataframe/gpu-expression-shader.cjs +87 -5
  253. package/dist/gpu-dataframe/gpu-expression-shader.d.ts +2 -1
  254. package/dist/gpu-dataframe/gpu-expression-shader.d.ts.map +1 -1
  255. package/dist/gpu-dataframe/gpu-expression-shader.js +101 -5
  256. package/dist/gpu-dataframe/gpu-expression-shader.js.map +1 -1
  257. package/dist/gpu-dataframe/gpu-expression.cjs +177 -2
  258. package/dist/gpu-dataframe/gpu-expression.d.ts +60 -2
  259. package/dist/gpu-dataframe/gpu-expression.d.ts.map +1 -1
  260. package/dist/gpu-dataframe/gpu-expression.js +187 -0
  261. package/dist/gpu-dataframe/gpu-expression.js.map +1 -1
  262. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.cjs +0 -1
  263. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts.map +1 -1
  264. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js +0 -1
  265. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js.map +1 -1
  266. package/dist/gpu-dataframe/gpu-global-aggregation-query.cjs +2 -2
  267. package/dist/gpu-dataframe/gpu-global-aggregation-query.d.ts.map +1 -1
  268. package/dist/gpu-dataframe/gpu-global-aggregation-query.js +5 -3
  269. package/dist/gpu-dataframe/gpu-global-aggregation-query.js.map +1 -1
  270. package/dist/gpu-dataframe/gpu-global-sort-compiler.cjs +23 -11
  271. package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts +1 -1
  272. package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts.map +1 -1
  273. package/dist/gpu-dataframe/gpu-global-sort-compiler.js +24 -12
  274. package/dist/gpu-dataframe/gpu-global-sort-compiler.js.map +1 -1
  275. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.cjs +0 -1
  276. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts.map +1 -1
  277. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js +0 -1
  278. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js.map +1 -1
  279. package/dist/gpu-dataframe/gpu-group-by-query.cjs +2 -2
  280. package/dist/gpu-dataframe/gpu-group-by-query.js +5 -3
  281. package/dist/gpu-dataframe/gpu-group-by-query.js.map +1 -1
  282. package/dist/gpu-dataframe/gpu-histogram-compiler.cjs +0 -1
  283. package/dist/gpu-dataframe/gpu-histogram-compiler.d.ts.map +1 -1
  284. package/dist/gpu-dataframe/gpu-histogram-compiler.js +0 -1
  285. package/dist/gpu-dataframe/gpu-histogram-compiler.js.map +1 -1
  286. package/dist/gpu-dataframe/gpu-join-compiler.cjs +0 -2
  287. package/dist/gpu-dataframe/gpu-join-compiler.d.ts.map +1 -1
  288. package/dist/gpu-dataframe/gpu-join-compiler.js +0 -2
  289. package/dist/gpu-dataframe/gpu-join-compiler.js.map +1 -1
  290. package/dist/gpu-dataframe/gpu-query-compiler.cjs +3 -1
  291. package/dist/gpu-dataframe/gpu-query-compiler.d.ts +0 -1
  292. package/dist/gpu-dataframe/gpu-query-compiler.d.ts.map +1 -1
  293. package/dist/gpu-dataframe/gpu-query-compiler.js +3 -1
  294. package/dist/gpu-dataframe/gpu-query-compiler.js.map +1 -1
  295. package/dist/gpu-dataframe/gpu-sort-compiler.cjs +0 -1
  296. package/dist/gpu-dataframe/gpu-sort-compiler.d.ts.map +1 -1
  297. package/dist/gpu-dataframe/gpu-sort-compiler.js +0 -1
  298. package/dist/gpu-dataframe/gpu-sort-compiler.js.map +1 -1
  299. package/dist/gpu-dataframe/gpu-sort-query.cjs +13 -5
  300. package/dist/gpu-dataframe/gpu-sort-query.d.ts +4 -1
  301. package/dist/gpu-dataframe/gpu-sort-query.d.ts.map +1 -1
  302. package/dist/gpu-dataframe/gpu-sort-query.js +14 -5
  303. package/dist/gpu-dataframe/gpu-sort-query.js.map +1 -1
  304. package/dist/gpu-dataframe/index.cjs +20 -2
  305. package/dist/gpu-dataframe/index.cjs.map +3 -3
  306. package/dist/gpu-dataframe/index.d.ts +6 -2
  307. package/dist/gpu-dataframe/index.d.ts.map +1 -1
  308. package/dist/gpu-dataframe/index.js +3 -1
  309. package/dist/gpu-dataframe/index.js.map +1 -1
  310. package/dist/gpu-dataframe/portable-expression.cjs +167 -0
  311. package/dist/gpu-dataframe/portable-expression.d.ts +21 -0
  312. package/dist/gpu-dataframe/portable-expression.d.ts.map +1 -0
  313. package/dist/gpu-dataframe/portable-expression.js +162 -0
  314. package/dist/gpu-dataframe/portable-expression.js.map +1 -0
  315. package/dist/gpu-dggs/benchmarks.cjs.map +1 -1
  316. package/dist/gpu-dggs/index.cjs.map +1 -1
  317. package/dist/gpu-dggs-benchmarks.cjs +21 -0
  318. package/dist/gpu-dggs-benchmarks.d.ts +2 -0
  319. package/dist/gpu-dggs-benchmarks.d.ts.map +1 -0
  320. package/dist/gpu-dggs-benchmarks.js +5 -0
  321. package/dist/gpu-dggs-benchmarks.js.map +1 -0
  322. package/dist/gpu-geometry/index.cjs.map +1 -1
  323. package/dist/gpu-graph/index.cjs +8 -0
  324. package/dist/gpu-graph/index.cjs.map +3 -3
  325. package/dist/gpu-graph/index.d.ts +4 -0
  326. package/dist/gpu-graph/index.d.ts.map +1 -1
  327. package/dist/gpu-graph/index.js +2 -0
  328. package/dist/gpu-graph/index.js.map +1 -1
  329. package/dist/gpu-graph-algorithms/benchmarks.cjs.map +2 -2
  330. package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.cjs +2 -15
  331. package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.d.ts.map +1 -1
  332. package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.js +2 -15
  333. package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.js.map +1 -1
  334. package/dist/gpu-graph-algorithms/index.cjs.map +2 -2
  335. package/dist/gpu-graph-algorithms-benchmarks.cjs +21 -0
  336. package/dist/gpu-graph-algorithms-benchmarks.d.ts +2 -0
  337. package/dist/gpu-graph-algorithms-benchmarks.d.ts.map +1 -0
  338. package/dist/gpu-graph-algorithms-benchmarks.js +5 -0
  339. package/dist/gpu-graph-algorithms-benchmarks.js.map +1 -0
  340. package/dist/gpu-h3/index.cjs.map +1 -1
  341. package/dist/gpu-physics/gpu-physics-ensemble-terrain.cjs +116 -0
  342. package/dist/gpu-physics/gpu-physics-ensemble-terrain.d.ts +42 -0
  343. package/dist/gpu-physics/gpu-physics-ensemble-terrain.d.ts.map +1 -0
  344. package/dist/gpu-physics/gpu-physics-ensemble-terrain.js +90 -0
  345. package/dist/gpu-physics/gpu-physics-ensemble-terrain.js.map +1 -0
  346. package/dist/gpu-physics/gpu-physics-ensemble.cjs +97 -5
  347. package/dist/gpu-physics/gpu-physics-ensemble.d.ts +31 -2
  348. package/dist/gpu-physics/gpu-physics-ensemble.d.ts.map +1 -1
  349. package/dist/gpu-physics/gpu-physics-ensemble.js +99 -3
  350. package/dist/gpu-physics/gpu-physics-ensemble.js.map +1 -1
  351. package/dist/gpu-physics/gpu-rigid-body-world.cjs +568 -77
  352. package/dist/gpu-physics/gpu-rigid-body-world.d.ts +86 -0
  353. package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
  354. package/dist/gpu-physics/gpu-rigid-body-world.js +617 -76
  355. package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
  356. package/dist/gpu-physics/index.cjs +23 -2
  357. package/dist/gpu-physics/index.cjs.map +3 -3
  358. package/dist/gpu-physics/index.d.ts +9 -2
  359. package/dist/gpu-physics/index.d.ts.map +1 -1
  360. package/dist/gpu-physics/index.js +6 -1
  361. package/dist/gpu-physics/index.js.map +1 -1
  362. package/dist/gpu-physics/rigid-body-bounds-shaders.cjs +21 -8
  363. package/dist/gpu-physics/rigid-body-bounds-shaders.d.ts +2 -1
  364. package/dist/gpu-physics/rigid-body-bounds-shaders.d.ts.map +1 -1
  365. package/dist/gpu-physics/rigid-body-bounds-shaders.js +15 -1
  366. package/dist/gpu-physics/rigid-body-bounds-shaders.js.map +1 -1
  367. package/dist/gpu-physics/rigid-body-convex-shaders.cjs +3 -2
  368. package/dist/gpu-physics/rigid-body-convex-shaders.d.ts +1 -1
  369. package/dist/gpu-physics/rigid-body-convex-shaders.d.ts.map +1 -1
  370. package/dist/gpu-physics/rigid-body-convex-shaders.js +3 -2
  371. package/dist/gpu-physics/rigid-body-convex-shaders.js.map +1 -1
  372. package/dist/gpu-physics/rigid-body-ensemble-reset.cjs +36 -7
  373. package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts +1 -1
  374. package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts.map +1 -1
  375. package/dist/gpu-physics/rigid-body-ensemble-reset.js +42 -7
  376. package/dist/gpu-physics/rigid-body-ensemble-reset.js.map +1 -1
  377. package/dist/gpu-physics/rigid-body-ensemble-transaction.cjs +23 -1
  378. package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts +4 -1
  379. package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts.map +1 -1
  380. package/dist/gpu-physics/rigid-body-ensemble-transaction.js +25 -1
  381. package/dist/gpu-physics/rigid-body-ensemble-transaction.js.map +1 -1
  382. package/dist/gpu-physics/rigid-body-geometry.cjs +41 -4
  383. package/dist/gpu-physics/rigid-body-geometry.d.ts +10 -1
  384. package/dist/gpu-physics/rigid-body-geometry.d.ts.map +1 -1
  385. package/dist/gpu-physics/rigid-body-geometry.js +44 -3
  386. package/dist/gpu-physics/rigid-body-geometry.js.map +1 -1
  387. package/dist/gpu-physics/rigid-body-height-field-shader.cjs +80 -0
  388. package/dist/gpu-physics/rigid-body-height-field-shader.d.ts +3 -0
  389. package/dist/gpu-physics/rigid-body-height-field-shader.d.ts.map +1 -0
  390. package/dist/gpu-physics/rigid-body-height-field-shader.js +56 -0
  391. package/dist/gpu-physics/rigid-body-height-field-shader.js.map +1 -0
  392. package/dist/gpu-physics/rigid-body-height-field.cjs +166 -0
  393. package/dist/gpu-physics/rigid-body-height-field.d.ts +55 -0
  394. package/dist/gpu-physics/rigid-body-height-field.d.ts.map +1 -0
  395. package/dist/gpu-physics/rigid-body-height-field.js +184 -0
  396. package/dist/gpu-physics/rigid-body-height-field.js.map +1 -0
  397. package/dist/gpu-physics/rigid-body-mesh-query-shaders.cjs +4 -2
  398. package/dist/gpu-physics/rigid-body-mesh-query-shaders.d.ts +1 -1
  399. package/dist/gpu-physics/rigid-body-mesh-query-shaders.d.ts.map +1 -1
  400. package/dist/gpu-physics/rigid-body-mesh-query-shaders.js +4 -2
  401. package/dist/gpu-physics/rigid-body-mesh-query-shaders.js.map +1 -1
  402. package/dist/gpu-physics/rigid-body-mesh.cjs +72 -17
  403. package/dist/gpu-physics/rigid-body-mesh.d.ts +3 -0
  404. package/dist/gpu-physics/rigid-body-mesh.d.ts.map +1 -1
  405. package/dist/gpu-physics/rigid-body-mesh.js +76 -20
  406. package/dist/gpu-physics/rigid-body-mesh.js.map +1 -1
  407. package/dist/gpu-physics/rigid-body-parallel-shaders.cjs +24 -9
  408. package/dist/gpu-physics/rigid-body-parallel-shaders.d.ts +1 -1
  409. package/dist/gpu-physics/rigid-body-parallel-shaders.d.ts.map +1 -1
  410. package/dist/gpu-physics/rigid-body-parallel-shaders.js +28 -9
  411. package/dist/gpu-physics/rigid-body-parallel-shaders.js.map +1 -1
  412. package/dist/gpu-physics/rigid-body-properties.cjs +4 -4
  413. package/dist/gpu-physics/rigid-body-properties.d.ts +6 -0
  414. package/dist/gpu-physics/rigid-body-properties.d.ts.map +1 -1
  415. package/dist/gpu-physics/rigid-body-properties.js +1 -1
  416. package/dist/gpu-physics/rigid-body-properties.js.map +1 -1
  417. package/dist/gpu-physics/rigid-body-publication.cjs +2 -2
  418. package/dist/gpu-physics/rigid-body-publication.js +1 -1
  419. package/dist/gpu-physics/rigid-body-publication.js.map +1 -1
  420. package/dist/gpu-physics/rigid-body-query-geometry.cjs +22 -4
  421. package/dist/gpu-physics/rigid-body-query-geometry.d.ts +1 -1
  422. package/dist/gpu-physics/rigid-body-query-geometry.d.ts.map +1 -1
  423. package/dist/gpu-physics/rigid-body-query-geometry.js +22 -4
  424. package/dist/gpu-physics/rigid-body-query-geometry.js.map +1 -1
  425. package/dist/gpu-physics/rigid-body-shaders.cjs +12 -6
  426. package/dist/gpu-physics/rigid-body-shaders.d.ts +1 -1
  427. package/dist/gpu-physics/rigid-body-shaders.d.ts.map +1 -1
  428. package/dist/gpu-physics/rigid-body-shaders.js +15 -7
  429. package/dist/gpu-physics/rigid-body-shaders.js.map +1 -1
  430. package/dist/gpu-physics/rigid-body-shape-properties.cjs +2 -0
  431. package/dist/gpu-physics/rigid-body-shape-properties.d.ts.map +1 -1
  432. package/dist/gpu-physics/rigid-body-shape-properties.js +2 -0
  433. package/dist/gpu-physics/rigid-body-shape-properties.js.map +1 -1
  434. package/dist/gpu-physics/rigid-body-terrain-atlas.cjs +287 -0
  435. package/dist/gpu-physics/rigid-body-terrain-atlas.d.ts +87 -0
  436. package/dist/gpu-physics/rigid-body-terrain-atlas.d.ts.map +1 -0
  437. package/dist/gpu-physics/rigid-body-terrain-atlas.js +275 -0
  438. package/dist/gpu-physics/rigid-body-terrain-atlas.js.map +1 -0
  439. package/dist/gpu-physics/rigid-body-terrain-lod.cjs +240 -0
  440. package/dist/gpu-physics/rigid-body-terrain-lod.d.ts +76 -0
  441. package/dist/gpu-physics/rigid-body-terrain-lod.d.ts.map +1 -0
  442. package/dist/gpu-physics/rigid-body-terrain-lod.js +247 -0
  443. package/dist/gpu-physics/rigid-body-terrain-lod.js.map +1 -0
  444. package/dist/gpu-physics/rigid-body-terrain-stitch.cjs +215 -0
  445. package/dist/gpu-physics/rigid-body-terrain-stitch.d.ts +25 -0
  446. package/dist/gpu-physics/rigid-body-terrain-stitch.d.ts.map +1 -0
  447. package/dist/gpu-physics/rigid-body-terrain-stitch.js +218 -0
  448. package/dist/gpu-physics/rigid-body-terrain-stitch.js.map +1 -0
  449. package/dist/gpu-physics/rigid-body-terrain-stream.cjs +263 -0
  450. package/dist/gpu-physics/rigid-body-terrain-stream.d.ts +97 -0
  451. package/dist/gpu-physics/rigid-body-terrain-stream.d.ts.map +1 -0
  452. package/dist/gpu-physics/rigid-body-terrain-stream.js +250 -0
  453. package/dist/gpu-physics/rigid-body-terrain-stream.js.map +1 -0
  454. package/dist/gpu-physics/rigid-body-triggers.cjs +1 -0
  455. package/dist/gpu-physics/rigid-body-triggers.d.ts.map +1 -1
  456. package/dist/gpu-physics/rigid-body-triggers.js +1 -0
  457. package/dist/gpu-physics/rigid-body-triggers.js.map +1 -1
  458. package/dist/gpu-physics/rigid-body-vehicle.cjs +145 -0
  459. package/dist/gpu-physics/rigid-body-vehicle.d.ts +47 -0
  460. package/dist/gpu-physics/rigid-body-vehicle.d.ts.map +1 -0
  461. package/dist/gpu-physics/rigid-body-vehicle.js +119 -0
  462. package/dist/gpu-physics/rigid-body-vehicle.js.map +1 -0
  463. package/dist/gpu-pointcloud/index.cjs.map +1 -1
  464. package/dist/gpu-project/benchmarks.cjs.map +2 -2
  465. package/dist/gpu-project/coordinate-projection-graph.cjs +59 -0
  466. package/dist/gpu-project/coordinate-projection-graph.d.ts +23 -0
  467. package/dist/gpu-project/coordinate-projection-graph.d.ts.map +1 -0
  468. package/dist/gpu-project/coordinate-projection-graph.js +40 -0
  469. package/dist/gpu-project/coordinate-projection-graph.js.map +1 -0
  470. package/dist/gpu-project/cpu-geoarrow.cjs +112 -0
  471. package/dist/gpu-project/cpu-geoarrow.d.ts +10 -0
  472. package/dist/gpu-project/cpu-geoarrow.d.ts.map +1 -0
  473. package/dist/gpu-project/cpu-geoarrow.js +103 -0
  474. package/dist/gpu-project/cpu-geoarrow.js.map +1 -0
  475. package/dist/gpu-project/cpu-geometry-pipelines.cjs +134 -0
  476. package/dist/gpu-project/cpu-geometry-pipelines.d.ts +19 -0
  477. package/dist/gpu-project/cpu-geometry-pipelines.d.ts.map +1 -0
  478. package/dist/gpu-project/cpu-geometry-pipelines.js +114 -0
  479. package/dist/gpu-project/cpu-geometry-pipelines.js.map +1 -0
  480. package/dist/gpu-project/cpu-projection-operation.cjs +54 -0
  481. package/dist/gpu-project/cpu-projection-operation.d.ts +14 -0
  482. package/dist/gpu-project/cpu-projection-operation.d.ts.map +1 -0
  483. package/dist/gpu-project/cpu-projection-operation.js +37 -0
  484. package/dist/gpu-project/cpu-projection-operation.js.map +1 -0
  485. package/dist/gpu-project/crs.cjs.map +3 -3
  486. package/dist/gpu-project/crs.d.ts +1 -1
  487. package/dist/gpu-project/geoarrow.cjs +36 -0
  488. package/dist/gpu-project/geoarrow.cjs.map +6 -0
  489. package/dist/gpu-project/geoarrow.d.ts +3 -0
  490. package/dist/gpu-project/geoarrow.d.ts.map +1 -0
  491. package/dist/gpu-project/geoarrow.js +7 -0
  492. package/dist/gpu-project/geoarrow.js.map +1 -0
  493. package/dist/gpu-project/graph.cjs +27 -0
  494. package/dist/gpu-project/graph.cjs.map +6 -0
  495. package/dist/gpu-project/graph.d.ts +2 -0
  496. package/dist/gpu-project/graph.d.ts.map +1 -0
  497. package/dist/gpu-project/graph.js +6 -0
  498. package/dist/gpu-project/graph.js.map +1 -0
  499. package/dist/gpu-project/index.cjs +3 -0
  500. package/dist/gpu-project/index.cjs.map +3 -3
  501. package/dist/gpu-project/index.d.ts +1 -0
  502. package/dist/gpu-project/index.d.ts.map +1 -1
  503. package/dist/gpu-project/index.js +1 -0
  504. package/dist/gpu-project/index.js.map +1 -1
  505. package/dist/gpu-project/projection-crs-benchmark.cjs +2 -2
  506. package/dist/gpu-project/projection-crs-benchmark.d.ts +1 -1
  507. package/dist/gpu-project/projection-crs-benchmark.js +1 -1
  508. package/dist/gpu-project/projection-crs-input.cjs +7 -7
  509. package/dist/gpu-project/projection-crs-input.d.ts +1 -1
  510. package/dist/gpu-project/projection-crs-input.js +4 -4
  511. package/dist/gpu-project/projection-engine.d.ts +2 -2
  512. package/dist/gpu-project-benchmarks.cjs +21 -0
  513. package/dist/gpu-project-benchmarks.d.ts +2 -0
  514. package/dist/gpu-project-benchmarks.d.ts.map +1 -0
  515. package/dist/gpu-project-benchmarks.js +5 -0
  516. package/dist/gpu-project-benchmarks.js.map +1 -0
  517. package/dist/gpu-project-crs.cjs +21 -0
  518. package/dist/gpu-project-crs.d.ts +2 -0
  519. package/dist/gpu-project-crs.d.ts.map +1 -0
  520. package/dist/gpu-project-crs.js +5 -0
  521. package/dist/gpu-project-crs.js.map +1 -0
  522. package/dist/gpu-project-geoarrow.cjs +21 -0
  523. package/dist/gpu-project-geoarrow.d.ts +2 -0
  524. package/dist/gpu-project-geoarrow.d.ts.map +1 -0
  525. package/dist/gpu-project-geoarrow.js +5 -0
  526. package/dist/gpu-project-geoarrow.js.map +1 -0
  527. package/dist/gpu-project-graph.cjs +21 -0
  528. package/dist/gpu-project-graph.d.ts +2 -0
  529. package/dist/gpu-project-graph.d.ts.map +1 -0
  530. package/dist/gpu-project-graph.js +5 -0
  531. package/dist/gpu-project-graph.js.map +1 -0
  532. package/dist/gpu-simple-graph/compiled-gpu-expression-graph.cjs +75 -5
  533. package/dist/gpu-simple-graph/compiled-gpu-expression-graph.d.ts +5 -1
  534. package/dist/gpu-simple-graph/compiled-gpu-expression-graph.d.ts.map +1 -1
  535. package/dist/gpu-simple-graph/compiled-gpu-expression-graph.js +86 -6
  536. package/dist/gpu-simple-graph/compiled-gpu-expression-graph.js.map +1 -1
  537. package/dist/gpu-simple-graph/gpu-simple-graph-lowering.cjs +9 -0
  538. package/dist/gpu-simple-graph/gpu-simple-graph-lowering.d.ts +2 -0
  539. package/dist/gpu-simple-graph/gpu-simple-graph-lowering.d.ts.map +1 -1
  540. package/dist/gpu-simple-graph/gpu-simple-graph-lowering.js +10 -0
  541. package/dist/gpu-simple-graph/gpu-simple-graph-lowering.js.map +1 -1
  542. package/dist/gpu-simple-graph/gpu-simple-graph-transfer.d.ts +1 -1
  543. package/dist/gpu-simple-graph/gpu-simple-graph-transfer.d.ts.map +1 -1
  544. package/dist/gpu-simple-graph/gpu-simple-graph-value.d.ts +1 -1
  545. package/dist/gpu-simple-graph/gpu-simple-graph-value.d.ts.map +1 -1
  546. package/dist/gpu-simple-graph/gpu-simple-graph.cjs +126 -10
  547. package/dist/gpu-simple-graph/gpu-simple-graph.d.ts +36 -11
  548. package/dist/gpu-simple-graph/gpu-simple-graph.d.ts.map +1 -1
  549. package/dist/gpu-simple-graph/gpu-simple-graph.js +137 -12
  550. package/dist/gpu-simple-graph/gpu-simple-graph.js.map +1 -1
  551. package/dist/gpu-simple-graph/index.cjs.map +3 -3
  552. package/dist/gpu-simple-graph/index.d.ts +1 -1
  553. package/dist/gpu-simple-graph/index.d.ts.map +1 -1
  554. package/dist/gpu-simple-graph/index.js.map +1 -1
  555. package/dist/gpu-simple-graph/operation/gpu-data-evaluator.cjs +25 -0
  556. package/dist/gpu-simple-graph/operation/gpu-data-evaluator.d.ts +7 -1
  557. package/dist/gpu-simple-graph/operation/gpu-data-evaluator.d.ts.map +1 -1
  558. package/dist/gpu-simple-graph/operation/gpu-data-evaluator.js +28 -0
  559. package/dist/gpu-simple-graph/operation/gpu-data-evaluator.js.map +1 -1
  560. package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.cjs +7 -0
  561. package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.d.ts +2 -0
  562. package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.d.ts.map +1 -1
  563. package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.js +7 -0
  564. package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.js.map +1 -1
  565. package/dist/gpu-simple-graph/operation/operation.d.ts +1 -1
  566. package/dist/gpu-simple-graph/operation/operation.d.ts.map +1 -1
  567. package/dist/gpu-simple-graph/operations/convert-colors.cjs +6 -6
  568. package/dist/gpu-simple-graph/operations/convert-colors.d.ts +5 -1
  569. package/dist/gpu-simple-graph/operations/convert-colors.d.ts.map +1 -1
  570. package/dist/gpu-simple-graph/operations/convert-colors.js +12 -7
  571. package/dist/gpu-simple-graph/operations/convert-colors.js.map +1 -1
  572. package/dist/gpu-simple-graph/operations/cpu/convert-colors.cjs +16 -33
  573. package/dist/gpu-simple-graph/operations/cpu/convert-colors.d.ts.map +1 -1
  574. package/dist/gpu-simple-graph/operations/cpu/convert-colors.js +22 -35
  575. package/dist/gpu-simple-graph/operations/cpu/convert-colors.js.map +1 -1
  576. package/dist/gpu-simple-graph/operations/cpu/index.cjs.map +3 -3
  577. package/dist/gpu-simple-graph/operations/webgl/index.cjs.map +3 -3
  578. package/dist/gpu-simple-graph/operations/webgpu/convert-colors.cjs +31 -13
  579. package/dist/gpu-simple-graph/operations/webgpu/convert-colors.d.ts.map +1 -1
  580. package/dist/gpu-simple-graph/operations/webgpu/convert-colors.js +42 -13
  581. package/dist/gpu-simple-graph/operations/webgpu/convert-colors.js.map +1 -1
  582. package/dist/gpu-simple-graph/operations/webgpu/index.cjs.map +1 -1
  583. package/dist/gpu-simple-graph-cpu.cjs +21 -0
  584. package/dist/gpu-simple-graph-cpu.d.ts +2 -0
  585. package/dist/gpu-simple-graph-cpu.d.ts.map +1 -0
  586. package/dist/gpu-simple-graph-cpu.js +5 -0
  587. package/dist/gpu-simple-graph-cpu.js.map +1 -0
  588. package/dist/gpu-simple-graph-webgl.cjs +21 -0
  589. package/dist/gpu-simple-graph-webgl.d.ts +2 -0
  590. package/dist/gpu-simple-graph-webgl.d.ts.map +1 -0
  591. package/dist/gpu-simple-graph-webgl.js +5 -0
  592. package/dist/gpu-simple-graph-webgl.js.map +1 -0
  593. package/dist/gpu-simple-graph-webgpu.cjs +21 -0
  594. package/dist/gpu-simple-graph-webgpu.d.ts +2 -0
  595. package/dist/gpu-simple-graph-webgpu.d.ts.map +1 -0
  596. package/dist/gpu-simple-graph-webgpu.js +5 -0
  597. package/dist/gpu-simple-graph-webgpu.js.map +1 -0
  598. package/dist/gpu-sql/gpu-sql.cjs +159 -328
  599. package/dist/gpu-sql/gpu-sql.d.ts +1 -1
  600. package/dist/gpu-sql/gpu-sql.d.ts.map +1 -1
  601. package/dist/gpu-sql/gpu-sql.js +186 -340
  602. package/dist/gpu-sql/gpu-sql.js.map +1 -1
  603. package/dist/gpu-sql/index.cjs.map +3 -3
  604. package/dist/gpu-tables/index.cjs.map +2 -2
  605. package/dist/gpu-tables/table/gpu-table.cjs +2 -2
  606. package/dist/gpu-tables/table/gpu-table.d.ts.map +1 -1
  607. package/dist/gpu-tables/table/gpu-table.js +2 -2
  608. package/dist/gpu-tables/table/gpu-table.js.map +1 -1
  609. package/dist/gpu-timeseries/index.cjs.map +1 -1
  610. package/dist/index.cjs +11 -0
  611. package/dist/index.cjs.map +3 -3
  612. package/dist/index.d.ts +7 -1
  613. package/dist/index.d.ts.map +1 -1
  614. package/dist/index.js +3 -0
  615. package/dist/index.js.map +1 -1
  616. package/package.json +30 -16
  617. package/src/arrow/arrow-colors.ts +194 -33
  618. package/src/arrow/arrow-utils/arrow-paths.ts +5 -3
  619. package/src/arrow/cpu/arrow-coordinate-projection.ts +18 -0
  620. package/src/arrow/cpu/arrow-cpu-pipelines.ts +9 -0
  621. package/src/arrow/cpu/arrow-cpu-vector-adapters.ts +153 -0
  622. package/src/arrow/geoarrow/arrow-geoarrow-adapter.ts +21 -493
  623. package/src/arrow/geoarrow/arrow-geoarrow-conversion.ts +7 -5
  624. package/src/arrow/geoarrow/arrow-polygon-tessellation.ts +1 -1
  625. package/src/arrow/gpu/arrow-column-gpu-vector.ts +67 -14
  626. package/src/arrow/gpu/arrow-gpu-table-conversion.ts +96 -4
  627. package/src/arrow/gpu/arrow-gpu-vector-adapters.ts +20 -7
  628. package/src/arrow/gpu/arrow-gpu-vector-conversion.ts +49 -6
  629. package/src/arrow/index.ts +14 -0
  630. package/src/experimental-models.ts +5 -0
  631. package/src/experimental-simulation.ts +5 -0
  632. package/src/geospatial/gpu-point-spatial-query.ts +2 -15
  633. package/src/gpu-core/compiled-gpu-graph.ts +73 -1
  634. package/src/gpu-core/gpu-command-graph-compiler.ts +25 -2
  635. package/src/gpu-core/gpu-command-graph-types.ts +20 -0
  636. package/src/gpu-core/gpu-command-graph.ts +48 -11
  637. package/src/gpu-core/gpu-cpu-execution.ts +345 -0
  638. package/src/gpu-core/gpu-cpu-operation.ts +65 -0
  639. package/src/gpu-core/gpu-dispatch-utils.ts +13 -1
  640. package/src/gpu-core/gpu-expression-operation.ts +1 -1
  641. package/src/gpu-core/gpu-expression-plan.ts +11 -3
  642. package/src/gpu-core/gpu-graph-compiler.ts +61 -0
  643. package/src/gpu-core/gpu-graph.ts +3 -3
  644. package/src/gpu-core/gpu-grid-aggregation.ts +2 -5
  645. package/src/gpu-core/gpu-grid-binning.ts +2 -5
  646. package/src/gpu-core/gpu-grid-coordinate.ts +24 -0
  647. package/src/gpu-core/gpu-grid-index-internals.ts +2 -15
  648. package/src/gpu-core/gpu-grid-index-query.ts +2 -16
  649. package/src/gpu-core/gpu-group-aggregation.ts +38 -50
  650. package/src/gpu-core/gpu-operation.ts +9 -7
  651. package/src/gpu-core/gpu-reduction.ts +32 -42
  652. package/src/gpu-core/gpu-render-operation.ts +42 -0
  653. package/src/gpu-core/gpu-scan.ts +59 -45
  654. package/src/gpu-core/gpu-segmented-reduction.ts +20 -10
  655. package/src/gpu-core/gpu-segmented-scan.ts +82 -17
  656. package/src/gpu-core/gpu-semantic-aggregation-operation.ts +150 -0
  657. package/src/gpu-core/gpu-shader-pass-kernel.ts +307 -0
  658. package/src/gpu-core/gpu-shader-pass-operation.ts +103 -0
  659. package/src/gpu-core/gpu-texture-plan.ts +3 -2
  660. package/src/gpu-core/index.ts +39 -0
  661. package/src/gpu-data/color-conversion.ts +158 -0
  662. package/src/gpu-data/cpu-data.ts +62 -0
  663. package/src/gpu-data/cpu-gpu-vector-transfer.ts +110 -0
  664. package/src/gpu-data/cpu-vector.ts +31 -0
  665. package/src/gpu-data/gpu-data-buffer-props.ts +25 -0
  666. package/src/gpu-data/gpu-vector-wgsl-layout.ts +79 -0
  667. package/src/gpu-data/index.ts +15 -0
  668. package/src/gpu-dataframe/gpu-data-frame-query.ts +24 -31
  669. package/src/gpu-dataframe/gpu-expression-shader.ts +128 -7
  670. package/src/gpu-dataframe/gpu-expression.ts +259 -1
  671. package/src/gpu-dataframe/gpu-global-aggregation-compiler.ts +0 -1
  672. package/src/gpu-dataframe/gpu-global-aggregation-query.ts +5 -3
  673. package/src/gpu-dataframe/gpu-global-sort-compiler.ts +26 -12
  674. package/src/gpu-dataframe/gpu-group-aggregation-compiler.ts +0 -1
  675. package/src/gpu-dataframe/gpu-group-by-query.ts +5 -3
  676. package/src/gpu-dataframe/gpu-histogram-compiler.ts +0 -1
  677. package/src/gpu-dataframe/gpu-join-compiler.ts +0 -2
  678. package/src/gpu-dataframe/gpu-query-compiler.ts +3 -3
  679. package/src/gpu-dataframe/gpu-sort-compiler.ts +0 -1
  680. package/src/gpu-dataframe/gpu-sort-query.ts +31 -5
  681. package/src/gpu-dataframe/index.ts +26 -2
  682. package/src/gpu-dataframe/portable-expression.ts +194 -0
  683. package/src/gpu-dggs-benchmarks.ts +5 -0
  684. package/src/gpu-graph/index.ts +17 -0
  685. package/src/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.ts +2 -15
  686. package/src/gpu-graph-algorithms-benchmarks.ts +5 -0
  687. package/src/gpu-physics/gpu-physics-ensemble-terrain.ts +114 -0
  688. package/src/gpu-physics/gpu-physics-ensemble.ts +147 -4
  689. package/src/gpu-physics/gpu-rigid-body-world.ts +797 -102
  690. package/src/gpu-physics/index.ts +38 -0
  691. package/src/gpu-physics/rigid-body-bounds-shaders.ts +16 -1
  692. package/src/gpu-physics/rigid-body-convex-shaders.ts +3 -2
  693. package/src/gpu-physics/rigid-body-ensemble-reset.ts +48 -8
  694. package/src/gpu-physics/rigid-body-ensemble-transaction.ts +34 -1
  695. package/src/gpu-physics/rigid-body-geometry.ts +49 -4
  696. package/src/gpu-physics/rigid-body-height-field-shader.ts +56 -0
  697. package/src/gpu-physics/rigid-body-height-field.ts +257 -0
  698. package/src/gpu-physics/rigid-body-mesh-query-shaders.ts +4 -2
  699. package/src/gpu-physics/rigid-body-mesh.ts +97 -26
  700. package/src/gpu-physics/rigid-body-parallel-shaders.ts +32 -9
  701. package/src/gpu-physics/rigid-body-properties.ts +5 -2
  702. package/src/gpu-physics/rigid-body-publication.ts +1 -1
  703. package/src/gpu-physics/rigid-body-query-geometry.ts +22 -4
  704. package/src/gpu-physics/rigid-body-shaders.ts +19 -7
  705. package/src/gpu-physics/rigid-body-shape-properties.ts +2 -0
  706. package/src/gpu-physics/rigid-body-terrain-atlas.ts +378 -0
  707. package/src/gpu-physics/rigid-body-terrain-lod.ts +332 -0
  708. package/src/gpu-physics/rigid-body-terrain-stitch.ts +286 -0
  709. package/src/gpu-physics/rigid-body-terrain-stream.ts +323 -0
  710. package/src/gpu-physics/rigid-body-triggers.ts +1 -0
  711. package/src/gpu-physics/rigid-body-vehicle.ts +166 -0
  712. package/src/gpu-project/README.md +2 -2
  713. package/src/gpu-project/coordinate-projection-graph.ts +59 -0
  714. package/src/gpu-project/cpu-geoarrow.ts +135 -0
  715. package/src/gpu-project/cpu-geometry-pipelines.ts +159 -0
  716. package/src/gpu-project/cpu-projection-operation.ts +49 -0
  717. package/src/gpu-project/crs.ts +2 -2
  718. package/src/gpu-project/geoarrow.ts +11 -0
  719. package/src/gpu-project/graph.ts +10 -0
  720. package/src/gpu-project/index.ts +2 -0
  721. package/src/gpu-project/projection-crs-benchmark.ts +2 -2
  722. package/src/gpu-project/projection-crs-input.ts +4 -4
  723. package/src/gpu-project/projection-engine.ts +2 -2
  724. package/src/gpu-project-benchmarks.ts +5 -0
  725. package/src/gpu-project-crs.ts +5 -0
  726. package/src/gpu-project-geoarrow.ts +5 -0
  727. package/src/gpu-project-graph.ts +5 -0
  728. package/src/gpu-simple-graph/compiled-gpu-expression-graph.ts +97 -6
  729. package/src/gpu-simple-graph/gpu-simple-graph-lowering.ts +11 -0
  730. package/src/gpu-simple-graph/gpu-simple-graph-transfer.ts +1 -1
  731. package/src/gpu-simple-graph/gpu-simple-graph-value.ts +1 -1
  732. package/src/gpu-simple-graph/gpu-simple-graph.ts +163 -19
  733. package/src/gpu-simple-graph/index.ts +1 -0
  734. package/src/gpu-simple-graph/operation/gpu-data-evaluator.ts +25 -1
  735. package/src/gpu-simple-graph/operation/gpu-vector-evaluator.ts +7 -0
  736. package/src/gpu-simple-graph/operation/operation.ts +1 -1
  737. package/src/gpu-simple-graph/operations/convert-colors.ts +22 -7
  738. package/src/gpu-simple-graph/operations/cpu/convert-colors.ts +31 -48
  739. package/src/gpu-simple-graph/operations/swizzle.ts +1 -1
  740. package/src/gpu-simple-graph/operations/webgpu/convert-colors.ts +47 -13
  741. package/src/gpu-simple-graph-cpu.ts +5 -0
  742. package/src/gpu-simple-graph-webgl.ts +5 -0
  743. package/src/gpu-simple-graph-webgpu.ts +5 -0
  744. package/src/gpu-sql/gpu-sql.ts +238 -354
  745. package/src/gpu-tables/table/gpu-table.ts +2 -1
  746. package/src/index.ts +21 -0
@@ -23,9 +23,11 @@ module.exports = __toCommonJS(gpu_rigid_body_world_exports);
23
23
  var import_bound_kernel = require("../gpu-core/utils/bound-kernel.cjs");
24
24
  var import_core = require("@luma.gl/core");
25
25
  var import_rigid_body_origin = require("./rigid-body-origin.cjs");
26
+ var import_rigid_body_height_field = require("./rigid-body-height-field.cjs");
26
27
  var import_rigid_body_shape_properties = require("./rigid-body-shape-properties.cjs");
27
28
  var import_rigid_body_ensemble_shaders = require("./rigid-body-ensemble-shaders.cjs");
28
29
  var import_rigid_body_ensemble_reset = require("./rigid-body-ensemble-reset.cjs");
30
+ var import_rigid_body_terrain_atlas = require("./rigid-body-terrain-atlas.cjs");
29
31
  var import_rigid_body_geometry = require("./rigid-body-geometry.cjs");
30
32
  var import_rigid_body_properties = require("./rigid-body-properties.cjs");
31
33
  var import_gpu_command_node = require("../gpu-core/gpu-command-node.cjs");
@@ -41,6 +43,7 @@ var import_rigid_body_transaction = require("./rigid-body-transaction.cjs");
41
43
  var import_rigid_body_joints = require("./rigid-body-joints.cjs");
42
44
  var import_rigid_body_publication = require("./rigid-body-publication.cjs");
43
45
  var import_rigid_body_shaders = require("./rigid-body-shaders.cjs");
46
+ var import_rigid_body_vehicle = require("./rigid-body-vehicle.cjs");
44
47
  var import_rigid_body_events = require("./rigid-body-events.cjs");
45
48
  var import_rigid_body_queries = require("./rigid-body-queries.cjs");
46
49
  class GPURigidBodyWorld {
@@ -71,6 +74,13 @@ class GPURigidBodyWorld {
71
74
  eventRead = null;
72
75
  queryComputation = null;
73
76
  queryReduction = null;
77
+ /** Chassis definitions in GPU storage order. */
78
+ vehicles;
79
+ /** Whether any chassis has more than one terrain candidate. */
80
+ multiSurfaceVehicles;
81
+ /** Number of vehicles in each equal-sized ensemble partition, or zero for a standalone world. */
82
+ vehiclesPerInstance;
83
+ vehicleBuffer = null;
74
84
  querySettings = null;
75
85
  querySelection = null;
76
86
  queryOutput = null;
@@ -78,9 +88,23 @@ class GPURigidBodyWorld {
78
88
  targets = null;
79
89
  simulationStatistics = null;
80
90
  colliders;
91
+ bodyColliderStarts;
92
+ ensembleTerrainSlots;
81
93
  props;
82
94
  ownedBuffers = [];
95
+ allocationPlan;
83
96
  ensembleBuffer = null;
97
+ /** Byte offsets of writable fixed-dimension height fields in the world metadata buffer. */
98
+ heightFieldSlots = /* @__PURE__ */ new Map();
99
+ /** Float32-exact edit stamp, restored together with the contact cache. */
100
+ terrainRevision = 1;
101
+ terrainWake = null;
102
+ /** Page ownership and live lease counts for an opt-in fused atlas. */
103
+ terrainAtlas;
104
+ /** Start of the shared atlas in the GPU metadata buffer, measured in 32-bit words. */
105
+ terrainAtlasWord = 0;
106
+ /** Start of the shader geometry region in the GPU metadata buffer, measured in 32-bit words. */
107
+ terrainGeometryWord = 0;
84
108
  ensembleResetOrigin;
85
109
  ensembleReset;
86
110
  initialEnsembleBodies;
@@ -97,7 +121,7 @@ class GPURigidBodyWorld {
97
121
  gpuCheckpoints = /* @__PURE__ */ new Set();
98
122
  broadPhaseCounters = null;
99
123
  constructor(props) {
100
- var _a, _b, _c, _d, _e;
124
+ var _a, _b, _c, _d, _e, _f;
101
125
  for (const damping of [props.linearDamping ?? 0, props.angularDamping ?? 0]) {
102
126
  if (!Number.isFinite(damping) || damping < 0)
103
127
  throw new Error("Invalid damping");
@@ -109,6 +133,8 @@ class GPURigidBodyWorld {
109
133
  this.solver = props.solver ?? "ordered";
110
134
  if (!["ordered", "parallel"].includes(this.solver))
111
135
  throw new Error("Invalid rigid-body solver");
136
+ if (!["scalar", "block"].includes(props.parallelContactSolver ?? "scalar"))
137
+ throw new Error("Invalid parallel contact solver");
112
138
  (0, import_rigid_body_joints.validateRigidBodyJoints)(props.joints ?? [], props.bodies, this.solver);
113
139
  const colliderCount = props.bodies.reduce((sum, body) => {
114
140
  var _a2;
@@ -144,6 +170,8 @@ class GPURigidBodyWorld {
144
170
  throw new Error("Supply shape or colliders");
145
171
  const shapes = body.colliders ?? (body.shape ? [{ shape: body.shape }] : []);
146
172
  for (const collider of shapes) {
173
+ if (collider.shape.type === "height-field" && (body.mode ?? (body.mass === 0 ? "static" : "dynamic")) !== "static")
174
+ throw new Error("Height fields require static bodies");
147
175
  const properties = (0, import_rigid_body_shape_properties.getRigidBodyShapeProperties)(collider.shape);
148
176
  if (!Number.isFinite(properties.volume) || !properties.center.every(Number.isFinite) || !properties.tensor.every(Number.isFinite))
149
177
  throw new Error("Invalid shape properties");
@@ -201,7 +229,7 @@ class GPURigidBodyWorld {
201
229
  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)
202
230
  throw new Error("Invalid rigid-body pair capacity");
203
231
  if (props.continuous) {
204
- 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"].includes(collider.shape.type))))
232
+ 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))))
205
233
  throw new Error("Invalid continuous settings");
206
234
  for (const index of props.continuous.bodies) {
207
235
  const body = props.bodies[index];
@@ -216,14 +244,71 @@ class GPURigidBodyWorld {
216
244
  (0, import_rigid_body_triggers.makeRigidBodyTriggerLayout)(props.triggers, colliders);
217
245
  }
218
246
  const definitions = structuredClone({ colliders, props });
219
- this.colliders = definitions.colliders;
220
247
  this.props = definitions.props;
248
+ this.colliders = definitions.colliders;
249
+ this.ensembleTerrainSlots = new Set(this.props.ensembleTerrainSlots);
250
+ if (this.ensembleTerrainSlots.size && (!this.props.ensembleBodiesPerInstance || [...this.ensembleTerrainSlots].some((index) => {
251
+ var _a2;
252
+ return ((_a2 = this.colliders[index]) == null ? void 0 : _a2.shape.type) !== "height-field";
253
+ })))
254
+ throw new Error("Invalid ensemble terrain slots");
255
+ if (this.props.ensembleTerrainAtlas) {
256
+ this.terrainAtlas = new import_rigid_body_terrain_atlas.RigidBodyTerrainAtlas(this.props.ensembleTerrainAtlas, Array.from(this.ensembleTerrainSlots, (collider) => {
257
+ const shape = this.colliders[collider].shape;
258
+ if (shape.type !== "height-field")
259
+ throw new Error("Invalid ensemble terrain slot");
260
+ return { collider, width: shape.field.width, height: shape.field.height };
261
+ }));
262
+ }
263
+ this.bodyColliderStarts = new Uint32Array(this.count + 1);
264
+ let colliderIndex = 0;
265
+ for (let body = 0; body < this.count; body++) {
266
+ this.bodyColliderStarts[body] = colliderIndex;
267
+ while (((_f = this.colliders[colliderIndex]) == null ? void 0 : _f.body) === body)
268
+ colliderIndex++;
269
+ }
270
+ this.bodyColliderStarts[this.count] = colliderIndex;
271
+ if (this.props.vehicle && this.props.vehicles)
272
+ throw new Error("Choose vehicle or vehicles");
273
+ this.vehicles = this.props.vehicles ?? (this.props.vehicle ? [this.props.vehicle] : []);
274
+ this.multiSurfaceVehicles = this.vehicles.some((vehicle) => {
275
+ var _a2;
276
+ return (_a2 = vehicle.additionalTerrainColliders) == null ? void 0 : _a2.length;
277
+ });
278
+ const bodiesPerInstance = props.ensembleBodiesPerInstance;
279
+ const collidersPerInstance = props.collisionPartitionSize;
280
+ this.vehiclesPerInstance = bodiesPerInstance ? this.vehicles.length / (this.count / bodiesPerInstance) : 0;
281
+ if (!Number.isInteger(this.vehiclesPerInstance))
282
+ throw new Error("Invalid ensemble vehicle layout");
283
+ const vehicleChassis = /* @__PURE__ */ new Set();
284
+ for (const [vehicleIndex, vehicle] of this.vehicles.entries()) {
285
+ const instance = bodiesPerInstance ? Math.floor(vehicleIndex / this.vehiclesPerInstance) : 0;
286
+ const terrainIndices = [
287
+ vehicle.terrainCollider,
288
+ ...vehicle.additionalTerrainColliders ?? []
289
+ ];
290
+ const chassis = this.props.bodies[vehicle.chassis];
291
+ if (!chassis || vehicleChassis.has(vehicle.chassis) || terrainIndices.length > 4 || new Set(terrainIndices).size !== terrainIndices.length || terrainIndices.some((colliderIndex2) => {
292
+ const collider = this.colliders[colliderIndex2];
293
+ const ground = collider && this.props.bodies[collider.body];
294
+ return !ground || collider.isTrigger || this.getBodyMode(collider.body) !== "static" || bodiesPerInstance && Math.floor(colliderIndex2 / collidersPerInstance) !== instance;
295
+ }) || (chassis.mode ?? (chassis.mass === 0 ? "static" : "dynamic")) !== "dynamic" || vehicle.wheels.length !== 4 || bodiesPerInstance && Math.floor(vehicle.chassis / bodiesPerInstance) !== instance || ![vehicle.radius, vehicle.travel, vehicle.springRate, vehicle.wheelInertia].every((value) => Number.isFinite(value) && value > 0) || ![vehicle.damping, vehicle.grip, vehicle.motorTorque, vehicle.brakeTorque].every((value) => Number.isFinite(value) && value >= 0) || vehicle.steeringWheelbase !== void 0 && (!Number.isFinite(Math.fround(vehicle.steeringWheelbase)) || vehicle.steeringWheelbase <= 0) || !Number.isFinite(Math.fround(vehicle.antiRollRate ?? 0)) || (vehicle.antiRollRate ?? 0) < 0 || vehicle.slipGain !== void 0 && (vehicle.slipGain.length !== 2 || !vehicle.slipGain.every((gain) => Number.isFinite(Math.fround(gain)) && gain >= 0)) || vehicle.wheels.some((wheel) => wheel.mount.length !== 3 || !wheel.mount.every(Number.isFinite)))
296
+ throw new Error("Invalid vehicle configuration");
297
+ vehicleChassis.add(vehicle.chassis);
298
+ }
221
299
  if (props.ensembleBodiesPerInstance)
222
300
  this.initialEnsembleBodies = this.props.bodies.slice(0, props.ensembleBodiesPerInstance);
223
301
  }
302
+ /** Allocation size including optional immutable terrain rows after the wheel state. */
303
+ getVehicleByteLength() {
304
+ return this.vehicles.length * (import_rigid_body_vehicle.VEHICLE_STRIDE + (this.multiSurfaceVehicles ? import_rigid_body_vehicle.VEHICLE_TERRAIN_ROW_SIZE : 0));
305
+ }
224
306
  getStorageLayout() {
225
- var _a, _b, _c;
226
- const packed = (0, import_rigid_body_geometry.packRigidBodyShapes)(this.colliders);
307
+ var _a, _b, _c, _d;
308
+ const packed = (0, import_rigid_body_geometry.packRigidBodyShapes)(this.colliders, Boolean(this.props.ensembleBodiesPerInstance), this.ensembleTerrainSlots, Boolean(this.terrainAtlas));
309
+ const geometryWords = packed.geometry.length + (((_a = this.terrainAtlas) == null ? void 0 : _a.wordLength) ?? 0);
310
+ if (this.terrainAtlas && geometryWords >= 2 ** 26)
311
+ throw new Error("Terrain atlas exceeds address capacity");
227
312
  const sparse = this.broadPhase === "hierarchical-grid";
228
313
  const extended = this.colliders.some((collider) => collider.shape.type !== "sphere" && collider.shape.type !== "box" || collider.isTrigger && collider.shape.type !== "sphere");
229
314
  const parallel = this.solver === "parallel";
@@ -232,9 +317,20 @@ class GPURigidBodyWorld {
232
317
  sparse,
233
318
  extended,
234
319
  parallel,
235
- ...(0, import_rigid_body_capacity.getRigidBodyStorageLayout)(this.count, this.colliderStorageCount, this.maximumPairs, packed.geometry.length, sparse, extended, parallel, this.props.eventCapacity ?? 0, this.props.enableQueries ?? false, this.props.failurePolicy === "rollback", Boolean(this.props.continuous), ((_a = this.props.joints) == null ? void 0 : _a.length) ?? 0, this.props.ensembleBodiesPerInstance ? this.count / this.props.ensembleBodiesPerInstance : 0)
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)
236
321
  };
237
- if (((_b = this.props.continuous) == null ? void 0 : _b.mode) === "convex") {
322
+ if (this.vehicles.length) {
323
+ const byteLength = this.getVehicleByteLength();
324
+ storage.buffers.push({ name: "vehicle", byteLength, uniform: false });
325
+ if (this.props.failurePolicy === "rollback") {
326
+ storage.buffers.push({
327
+ name: this.vehiclesPerInstance ? "checkpoint-vehicles" : "checkpoint-7",
328
+ byteLength: this.vehiclesPerInstance ? this.vehicles.length * import_rigid_body_vehicle.VEHICLE_STRIDE : byteLength,
329
+ uniform: false
330
+ });
331
+ }
332
+ }
333
+ if (((_c = this.props.continuous) == null ? void 0 : _c.mode) === "convex") {
238
334
  storage.buffers = storage.buffers.filter((buffer) => buffer.name !== "continuous-previous");
239
335
  storage.buffers.push({ name: "continuous-dispatch", byteLength: 16, uniform: false });
240
336
  storage.buffers.push({
@@ -245,7 +341,7 @@ class GPURigidBodyWorld {
245
341
  }
246
342
  if (this.props.publicationBounds || this.props.publishPoses)
247
343
  storage.buffers.push({ name: "pose-metadata", byteLength: this.count * 48, uniform: false }, { name: "pose-matrices", byteLength: this.count * 64, uniform: false }, { name: "pose-bounds", byteLength: this.count * 32, uniform: false });
248
- const triggerLayout = ((_c = this.props.triggers) == null ? void 0 : _c.length) ? (0, import_rigid_body_triggers.makeRigidBodyTriggerLayout)(this.props.triggers, this.colliders) : void 0;
344
+ const triggerLayout = ((_d = this.props.triggers) == null ? void 0 : _d.length) ? (0, import_rigid_body_triggers.makeRigidBodyTriggerLayout)(this.props.triggers, this.colliders) : void 0;
249
345
  if (triggerLayout)
250
346
  storage.buffers.push({ name: "trigger-previous", byteLength: this.colliderStorageCount * 16, uniform: false }, { name: "trigger-groups", byteLength: triggerLayout.groups.byteLength, uniform: false }, { name: "trigger-pairs", byteLength: triggerLayout.pairs.byteLength, uniform: false }, {
251
347
  name: "trigger-samples",
@@ -278,7 +374,7 @@ class GPURigidBodyWorld {
278
374
  if (!this.device || !this.ensembleBuffer || this.destroyed)
279
375
  throw new Error("World has no ensemble scheduler");
280
376
  this.ensembleResetOrigin ??= this.origin;
281
- 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);
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);
282
378
  return this.ensembleReset.byteLength;
283
379
  }
284
380
  resetEnsembleInstance(instance) {
@@ -289,32 +385,35 @@ class GPURigidBodyWorld {
289
385
  const colliderStart = instance * this.props.collisionPartitionSize;
290
386
  let colliderIndex = colliderStart;
291
387
  const restored = this.initialEnsembleBodies.map((body) => {
292
- if (body.shape) {
293
- const current = this.colliders[colliderIndex++].shape;
388
+ const { shape, colliders, ...properties } = body;
389
+ const resetCollider = (definition) => {
390
+ var _a;
391
+ const index = colliderIndex++;
392
+ const { body: _, ...current } = this.colliders[index];
393
+ if (this.ensembleTerrainSlots.has(index))
394
+ return current;
294
395
  return {
295
- ...body,
296
- shape: body.shape.type === "convex-hull" || body.shape.type === "triangle-mesh" ? current : body.shape
396
+ ...definition,
397
+ shape: definition.shape.type === "convex-hull" || definition.shape.type === "triangle-mesh" ? current.shape : definition.shape,
398
+ excludedColliders: (_a = definition.excludedColliders) == null ? void 0 : _a.map((index2) => index2 + colliderStart)
297
399
  };
298
- }
299
- return {
300
- ...body,
301
- colliders: body.colliders.map((collider) => {
302
- var _a;
303
- const current = this.colliders[colliderIndex++].shape;
304
- return {
305
- ...collider,
306
- shape: collider.shape.type === "convex-hull" || collider.shape.type === "triangle-mesh" ? current : collider.shape,
307
- excludedColliders: (_a = collider.excludedColliders) == null ? void 0 : _a.map((index) => index + colliderStart)
308
- };
309
- })
310
400
  };
401
+ if (shape && !this.ensembleTerrainSlots.has(colliderIndex))
402
+ return { ...body, shape: resetCollider({ shape }).shape };
403
+ return { ...properties, colliders: (colliders ?? [{ shape }]).map(resetCollider) };
311
404
  });
312
- const definitions = [...this.props.bodies];
405
+ const definitions = this.props.bodies;
313
406
  definitions.splice(bodyStart, restored.length, ...restored);
314
- this.props.bodies = definitions;
315
- for (let collider = colliderStart; collider < colliderStart + this.props.collisionPartitionSize; collider++)
316
- this.colliderShapeScales.delete(collider);
317
- this.restoreColliderDefinitions();
407
+ this.restoreColliderDefinitions(bodyStart, bodyStart + restored.length);
408
+ const metadata = this.ownedBuffers.find((buffer) => buffer.id === `${this.id}-bodies`);
409
+ for (let index = colliderStart; index < colliderIndex; index++) {
410
+ this.colliderShapeScales.delete(index);
411
+ if (!this.ensembleTerrainSlots.has(index))
412
+ continue;
413
+ const collider = this.colliders[index];
414
+ const center = definitions[collider.body].centerOfMass ?? [0, 0, 0];
415
+ metadata.write(new Float32Array((collider.position ?? [0, 0, 0]).map((value, axis) => value - center[axis])), this.count * 48 + index * 96 + 16);
416
+ }
318
417
  this.ensembleReset.reset(instance, this.origin.map((value, axis) => value - this.ensembleResetOrigin[axis]));
319
418
  this.ensembleBuffer.write(new Uint32Array([0, 0, 0, 0, 1, 1]), (16 + instance * 8 + 1) * 4);
320
419
  if (this.encodePosePublication) {
@@ -359,6 +458,7 @@ class GPURigidBodyWorld {
359
458
  claimedContacts,
360
459
  journaledContacts,
361
460
  bodySnapshotBytes: activeBodies * 80,
461
+ vehicleSnapshotBytes: activeInstances * this.vehiclesPerInstance * import_rigid_body_vehicle.VEHICLE_STRIDE,
362
462
  contactSnapshotBytes: journaledContacts * 416,
363
463
  allocatorSnapshotBytes: (8 + activeInstances * 2 + journaledContacts * 3) * 4,
364
464
  residentInstances: this.count / this.props.ensembleBodiesPerInstance,
@@ -372,7 +472,7 @@ class GPURigidBodyWorld {
372
472
  }
373
473
  /** Allocation preflight without GPU allocation. Graph scratch and driver overhead are separate. */
374
474
  getCapacityInfo() {
375
- const { buffers } = this.getStorageLayout();
475
+ const buffers = this.allocationPlan ? this.allocationPlan.map((buffer) => ({ ...buffer })) : this.getStorageLayout().buffers;
376
476
  return {
377
477
  bodyCount: this.count,
378
478
  colliderCount: this.colliderCount,
@@ -391,11 +491,14 @@ class GPURigidBodyWorld {
391
491
  throw new Error("Rigid-body pair dispatch exceeds device limits");
392
492
  if (((_a = this.props.continuous) == null ? void 0 : _a.mode) === "convex" && Math.max(Math.ceil((this.props.continuous.maximumCandidates ?? this.maximumPairs) / 64), Math.ceil(2 ** Math.ceil(Math.log2(Math.max(1, this.colliders.length))) / 64)) > graph.device.limits.maxComputeWorkgroupsPerDimension)
393
493
  throw new Error("Continuous candidate dispatch exceeds device limits");
494
+ if (!this.vehiclesPerInstance && this.vehicles.length > graph.device.limits.maxComputeWorkgroupsPerDimension)
495
+ throw new Error("Vehicle dispatch exceeds device limits");
394
496
  for (const buffer of allocationPlan) {
395
497
  const bindingLimit = buffer.uniform ? graph.device.limits.maxUniformBufferBindingSize : graph.device.limits.maxStorageBufferBindingSize;
396
498
  if (buffer.byteLength > Math.min(graph.device.limits.maxBufferSize, bindingLimit))
397
499
  throw new Error(`Rigid-body ${buffer.name} storage exceeds device limits`);
398
500
  }
501
+ this.allocationPlan = allocationPlan;
399
502
  this.device = graph.device;
400
503
  const allocate = (name, data, uniform = false) => {
401
504
  const buffer = graph.device.createBuffer({
@@ -417,6 +520,29 @@ class GPURigidBodyWorld {
417
520
  } : void 0;
418
521
  const metadata = new Float32Array(metadataLength);
419
522
  metadata.set(packed.geometry, geometryOffset);
523
+ if (this.terrainAtlas) {
524
+ this.terrainGeometryWord = geometryOffset;
525
+ this.terrainAtlasWord = geometryOffset + packed.geometry.length;
526
+ const { wordsByCollider, uploads } = this.terrainAtlas.bind(Array.from(packed.atlasFields, ([collider, field]) => ({
527
+ collider,
528
+ data: new Float32Array(field.data)
529
+ })));
530
+ for (const { word, data } of uploads)
531
+ metadata.set(data, this.terrainAtlasWord + word);
532
+ for (const [collider, word] of wordsByCollider) {
533
+ const field = packed.atlasFields.get(collider);
534
+ const address = (packed.geometry.length + word) / 4;
535
+ const shape = packed.shapes[collider];
536
+ shape.padding[0] = address;
537
+ shape.padding[3] = field.triangleCount;
538
+ shape.policies[0] = address + field.nodeOffset;
539
+ shape.policies[1] = field.nodeCount;
540
+ }
541
+ }
542
+ this.heightFieldSlots = new Map(Array.from(packed.heightFields, ([collider, offset]) => [
543
+ collider,
544
+ (geometryOffset + offset * 4) * 4
545
+ ]));
420
546
  const bodyColliders = Array.from({ length: this.count }, () => []);
421
547
  if (this.colliderCount)
422
548
  for (const collider of this.colliders)
@@ -474,7 +600,10 @@ class GPURigidBodyWorld {
474
600
  (material == null ? void 0 : material.restitutionCombine) ? policies.indexOf(material.restitutionCombine) : 4,
475
601
  (material == null ? void 0 : material.frictionCombine) ? policies.indexOf(material.frictionCombine) : 4,
476
602
  ...shape.policies,
477
- ...shape.padding
603
+ shape.padding[0],
604
+ shape.padding[1],
605
+ this.ensembleTerrainSlots.has(index) ? 1 : shape.padding[2],
606
+ shape.padding[3]
478
607
  ], this.count * 12 + index * 24);
479
608
  }
480
609
  const exclusionOffset = this.count * 12 + this.colliderStorageCount * 24;
@@ -572,7 +701,7 @@ class GPURigidBodyWorld {
572
701
  byteLength: objectAttributes.byteLength,
573
702
  usage: import_core.Buffer.STORAGE
574
703
  }, objectAttributes), { format: "uint32", length: this.colliderStorageCount }) : void 0;
575
- 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);
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"));
576
705
  const parallelBindings = {
577
706
  parallelReset: ["parallelState"],
578
707
  parallelResetCounters: ["parallelState"],
@@ -642,29 +771,6 @@ class GPURigidBodyWorld {
642
771
  }
643
772
  this.simulationStatistics = allocate("simulation-statistics", 64);
644
773
  const statisticsResource = graph.importBuffer({ id: `${this.id}-statistics`, byteLength: 64, usage: import_core.Buffer.STORAGE }, this.simulationStatistics);
645
- const checkpointStates = [
646
- "positions",
647
- "orientations",
648
- "velocities",
649
- "angularVelocities",
650
- "sleepStates",
651
- "targets"
652
- ].map((name) => {
653
- const binding = bindings.find((binding2) => binding2.name === name);
654
- return { buffer: binding.buffer, resource: binding.resource };
655
- });
656
- 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) : (0, import_rigid_body_transaction.addRigidBodyCheckpoint)(graph, this.id, [
657
- "positions",
658
- "orientations",
659
- "velocities",
660
- "angularVelocities",
661
- "sleepStates",
662
- "targets",
663
- ...this.ensembleBuffer ? [] : ["manifolds"]
664
- ].map((name) => {
665
- const binding = bindings.find((binding2) => binding2.name === name);
666
- return { buffer: binding.buffer, resource: binding.resource };
667
- }), { buffer: this.simulationStatistics, resource: statisticsResource }, allocate) : void 0;
668
774
  const continuousSelection = new Uint32Array(this.count);
669
775
  for (const body of ((_g = this.props.continuous) == null ? void 0 : _g.bodies) ?? [])
670
776
  continuousSelection[body] = this.colliders.findIndex((collider) => collider.body === body) + 1;
@@ -699,6 +805,142 @@ class GPURigidBodyWorld {
699
805
  parallelMarkSleep: "Identify islands whose bodies are quiet enough to sleep.",
700
806
  parallelSleep: "Put quiet constraint islands to sleep."
701
807
  };
808
+ let vehicleResource;
809
+ let addVehiclePass;
810
+ if (this.vehicles.length) {
811
+ const packed2 = new Float32Array(this.getVehicleByteLength() / 4);
812
+ for (const [vehicleIndex, vehicle] of this.vehicles.entries()) {
813
+ const data = packed2.subarray(vehicleIndex * import_rigid_body_vehicle.VEHICLE_STRIDE / 4, (vehicleIndex + 1) * import_rigid_body_vehicle.VEHICLE_STRIDE / 4);
814
+ data.set([
815
+ vehicle.radius,
816
+ vehicle.travel,
817
+ vehicle.springRate,
818
+ vehicle.damping,
819
+ vehicle.grip,
820
+ vehicle.motorTorque,
821
+ vehicle.brakeTorque,
822
+ vehicle.wheelInertia
823
+ ], 4);
824
+ new Uint32Array(data.buffer, data.byteOffset, data.length).set([vehicle.chassis, vehicle.terrainCollider], 12);
825
+ data.set([vehicle.steeringWheelbase ?? 0, vehicle.antiRollRate ?? 0], 14);
826
+ const [longitudinalGain, lateralGain] = vehicle.slipGain ?? [1.1, 1.5];
827
+ vehicle.wheels.forEach((wheel, index) => {
828
+ const offset = 16 + index * 12;
829
+ data.set([...wheel.mount, longitudinalGain + 1], offset);
830
+ data.set([Number(Boolean(wheel.steer)), Number(Boolean(wheel.drive)), lateralGain + 1], offset + 4);
831
+ data[offset + 10] = vehicle.travel;
832
+ data.set([
833
+ 1,
834
+ 0,
835
+ 0,
836
+ 0,
837
+ 0,
838
+ 1,
839
+ 0,
840
+ 0,
841
+ 0,
842
+ 0,
843
+ 1,
844
+ 0,
845
+ wheel.mount[0],
846
+ wheel.mount[1],
847
+ wheel.mount[2] - vehicle.travel,
848
+ 1
849
+ ], 64 + 16 * index);
850
+ });
851
+ }
852
+ if (this.multiSurfaceVehicles) {
853
+ const terrainRows = new Uint32Array(packed2.buffer, this.vehicles.length * import_rigid_body_vehicle.VEHICLE_STRIDE);
854
+ terrainRows.fill(4294967295);
855
+ for (const [vehicleIndex, vehicle] of this.vehicles.entries())
856
+ terrainRows.set(vehicle.additionalTerrainColliders ?? [], vehicleIndex * (import_rigid_body_vehicle.VEHICLE_TERRAIN_ROW_SIZE / 4));
857
+ }
858
+ this.vehicleBuffer = allocate("vehicle", packed2);
859
+ vehicleResource = {
860
+ buffer: this.vehicleBuffer,
861
+ resource: graph.importBuffer({
862
+ id: this.id + "-vehicle",
863
+ byteLength: packed2.byteLength,
864
+ usage: import_core.Buffer.STORAGE | import_core.Buffer.COPY_SRC
865
+ }, this.vehicleBuffer)
866
+ };
867
+ const ensembleBinding = bindings.find((binding) => binding.name === "ensemble");
868
+ const vehicleBindings = [
869
+ ...bindings.filter((binding) => [
870
+ "settings",
871
+ "positions",
872
+ "orientations",
873
+ "velocities",
874
+ "angularVelocities",
875
+ "bodies",
876
+ "sleepStates",
877
+ "ensemble"
878
+ ].includes(binding.name)),
879
+ { name: "vehicle", location: 12, ...vehicleResource }
880
+ ];
881
+ const properties = {
882
+ id: this.id + "-suspension",
883
+ source: (0, import_rigid_body_ensemble_shaders.readOnlyEnsembleShader)(source) + import_rigid_body_query_geometry.RIGID_BODY_QUERY_GEOMETRY_SHADER + (0, import_rigid_body_vehicle.getVehicleShader)(this.vehicles.length, this.multiSurfaceVehicles, this.vehiclesPerInstance),
884
+ entryPoint: "advanceVehicle",
885
+ shaderLayout: {
886
+ bindings: vehicleBindings.map(({ name, location }) => name === "settings" ? { name, location, group: 0, type: "uniform" } : {
887
+ name,
888
+ location,
889
+ group: 0,
890
+ type: name === "bodies" || name === "ensemble" ? "read-only-storage" : "storage"
891
+ })
892
+ }
893
+ };
894
+ const executable = (computation) => ({
895
+ encode: ({ computePass, getBuffer }) => {
896
+ Object.assign(computation.bindings, Object.fromEntries(vehicleBindings.map((binding) => [binding.name, getBuffer(binding.resource)])));
897
+ if (ensembleBinding)
898
+ computation.kernel.dispatchIndirect(computePass, {
899
+ bindings: computation.bindings,
900
+ indirectBuffer: getBuffer(ensembleBinding.resource),
901
+ indirectOffset: 16
902
+ });
903
+ else
904
+ computation.kernel.dispatch(computePass, {
905
+ bindings: computation.bindings,
906
+ x: this.vehicles.length
907
+ });
908
+ },
909
+ destroy: () => computation.kernel.destroy()
910
+ });
911
+ addVehiclePass = () => graph.addComputePass({
912
+ id: properties.id,
913
+ description: "Sweep four wheels and apply suspension and tire forces per chassis.",
914
+ resources: [
915
+ ...vehicleBindings.map((binding) => ({
916
+ buffer: binding.resource,
917
+ usage: binding.name === "settings" ? "uniform" : binding.name === "bodies" || binding.name === "ensemble" ? "storage-read" : "storage-read-write"
918
+ })),
919
+ ...ensembleBinding ? [{ buffer: ensembleBinding.resource, usage: "indirect" }] : []
920
+ ],
921
+ compile: () => executable((0, import_bound_kernel.createBoundKernel)(graph.device, properties)),
922
+ compileAsync: async () => executable(await (0, import_bound_kernel.createBoundKernelAsync)(graph.device, properties))
923
+ });
924
+ }
925
+ const checkpointStates = [
926
+ "positions",
927
+ "orientations",
928
+ "velocities",
929
+ "angularVelocities",
930
+ "sleepStates",
931
+ "targets"
932
+ ].map((name) => {
933
+ const binding = bindings.find((binding2) => binding2.name === name);
934
+ return { buffer: binding.buffer, resource: binding.resource };
935
+ });
936
+ 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
+ state: vehicleResource,
938
+ vehiclesPerInstance: this.vehiclesPerInstance
939
+ }) : (0, import_rigid_body_transaction.addRigidBodyCheckpoint)(graph, this.id, [
940
+ ...checkpointStates,
941
+ bindings.find((binding) => binding.name === "manifolds"),
942
+ ...vehicleResource ? [vehicleResource] : []
943
+ ], { buffer: this.simulationStatistics, resource: statisticsResource }, allocate) : void 0;
702
944
  for (const entryPoint of [
703
945
  ...this.ensembleBuffer ? ["ensembleClear", "ensembleMark", "ensembleCompact", "ensembleDispatch"] : [],
704
946
  "integrate",
@@ -727,8 +969,10 @@ class GPURigidBodyWorld {
727
969
  "parallelSleep"
728
970
  ] : [...extended && ((_j = this.props.joints) == null ? void 0 : _j.length) ? ["meshCollect"] : [], "solve", "finish"]
729
971
  ]) {
730
- if (entryPoint === "integrate")
972
+ if (entryPoint === "integrate") {
731
973
  (_k = restoreCheckpoint == null ? void 0 : restoreCheckpoint.save) == null ? void 0 : _k.call(restoreCheckpoint);
974
+ addVehiclePass == null ? void 0 : addVehiclePass();
975
+ }
732
976
  if (sparse && entryPoint === "collide") {
733
977
  const bodyBinding = bindings.find((binding) => binding.name === "bodies");
734
978
  const minimumBinding = bindings.find((binding) => binding.name === "minima");
@@ -1188,6 +1432,48 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1188
1432
  },
1189
1433
  bindings: Object.fromEntries(Object.entries(controlProperties.bindings).filter(([name]) => invalidationBindings.includes(name)))
1190
1434
  });
1435
+ if (this.heightFieldSlots.size && !this.ensembleBuffer) {
1436
+ this.terrainWake = (0, import_bound_kernel.createBoundKernel)(graph.device, {
1437
+ id: `${this.id}-terrain-wake`,
1438
+ entryPoint: "wakeTerrain",
1439
+ source: controlProperties.source + /* wgsl */
1440
+ `
1441
+ @group(0) @binding(26) var<storage,read_write> terrainSleep:array<atomic<u32>>;
1442
+ @compute @workgroup_size(64) fn wakeTerrain(@builtin(global_invocation_id) invocation:vec3u) {
1443
+ let collider=invocation.x;if(collider>=COLLIDER_COUNT){return;}
1444
+ let body=colliderBody(collider);if(!dynamic(body)){return;}
1445
+ let tile=command.bodyIndex.x;if(bodies.colliders[tile].padding.w==0.0){return;}
1446
+ if(any(abs(colliderPosition(collider)-colliderPosition(tile))>shapeWorldExtent(collider)+shapeWorldExtent(tile)+vec3f(settings.solver.x))){return;}
1447
+ // Several colliders on one sleeping body may all overlap the tile.
1448
+ for(var axis=0u;axis<4u;axis++){atomicStore(&terrainSleep[body*4u+axis],0u);}
1449
+ }`,
1450
+ shaderLayout: {
1451
+ bindings: [
1452
+ ...shaderLayout.bindings.filter((binding) => ["settings", "positions", "orientations", "bodies"].includes(binding.name)),
1453
+ { name: "command", group: 0, location: 8, type: "uniform" },
1454
+ { name: "terrainSleep", group: 0, location: 26, type: "storage" }
1455
+ ]
1456
+ },
1457
+ bindings: {
1458
+ settings: buffers.settings,
1459
+ positions: buffers.positions,
1460
+ orientations: buffers.orientations,
1461
+ bodies: buffers.bodies,
1462
+ command: this.controlSettings,
1463
+ terrainSleep: this.sleepStates
1464
+ }
1465
+ });
1466
+ }
1467
+ }
1468
+ /** Wake sleeping bodies overlapping one published terrain footprint. */
1469
+ wakeTerrainFootprint(collider) {
1470
+ const { kernel, bindings } = this.terrainWake;
1471
+ this.controlSettings.write(new Uint32Array([collider]), 48);
1472
+ const encoder = this.device.createCommandEncoder();
1473
+ const pass = encoder.beginComputePass();
1474
+ kernel.dispatch(pass, { bindings, x: Math.ceil(this.colliderStorageCount / 64) });
1475
+ pass.end();
1476
+ this.device.submit(encoder.finish());
1191
1477
  }
1192
1478
  invalidateState(pass) {
1193
1479
  var _a, _b;
@@ -1220,6 +1506,80 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1220
1506
  const definition = this.props.bodies[body];
1221
1507
  return definition ? definition.mode ?? ((definition.mass ?? 1) === 0 ? "static" : "dynamic") : void 0;
1222
1508
  }
1509
+ /** Set signed throttle, steering angle in radians and brake fraction for upcoming substeps. */
1510
+ setVehicleControls(throttle, steering, brake, vehicleIndex = 0) {
1511
+ if (!this.vehicleBuffer || this.destroyed || !this.vehicles[vehicleIndex] || ![throttle, steering, brake].every((value) => Number.isFinite(Math.fround(value))))
1512
+ throw new Error("Invalid vehicle controls");
1513
+ this.vehicleBuffer.write(new Float32Array([
1514
+ Math.max(-1, Math.min(1, throttle)),
1515
+ steering,
1516
+ Math.max(0, Math.min(1, brake)),
1517
+ 0
1518
+ ]), vehicleIndex * import_rigid_body_vehicle.VEHICLE_STRIDE);
1519
+ if (this.vehiclesPerInstance) {
1520
+ const instance = Math.floor(vehicleIndex / this.vehiclesPerInstance);
1521
+ this.ensembleBuffer.write(new Uint32Array([1]), (16 + instance * 8 + 6) * 4);
1522
+ }
1523
+ }
1524
+ /** Borrow four column-major wheel transforms relative to the chassis node, ordered by mount. */
1525
+ get vehicleWheelPoses() {
1526
+ return this.getVehicleWheelPoses();
1527
+ }
1528
+ /** Borrow the indexed vehicle’s four chassis-local wheel poses, in mount order. */
1529
+ getVehicleWheelPoses(vehicleIndex = 0) {
1530
+ return this.vehicleBuffer && !this.destroyed && this.vehicles[vehicleIndex] ? {
1531
+ buffer: this.vehicleBuffer,
1532
+ byteOffset: vehicleIndex * import_rigid_body_vehicle.VEHICLE_STRIDE + 256,
1533
+ byteLength: 256
1534
+ } : null;
1535
+ }
1536
+ /** Transfer wheel motion between rebuilt worlds for wheels with matching chassis-local mounts. */
1537
+ copyVehicleMotionFrom(previous, vehicleIndex = 0, previousVehicleIndex = 0) {
1538
+ var _a;
1539
+ const sourceBuffer = previous.vehicleBuffer;
1540
+ const destinationBuffer = this.vehicleBuffer;
1541
+ const previousVehicle = previous.vehicles[previousVehicleIndex];
1542
+ if (!this.device || !sourceBuffer || !destinationBuffer || !previousVehicle)
1543
+ return;
1544
+ const encoder = this.device.createCommandEncoder();
1545
+ (_a = this.vehicles[vehicleIndex]) == null ? void 0 : _a.wheels.forEach((wheel, index) => {
1546
+ const sourceIndex = previousVehicle.wheels.findIndex((source) => source.mount.every((coordinate, axis) => coordinate === wheel.mount[axis]));
1547
+ if (sourceIndex < 0)
1548
+ return;
1549
+ encoder.copyBufferToBuffer({
1550
+ sourceBuffer,
1551
+ destinationBuffer,
1552
+ sourceOffset: previousVehicleIndex * import_rigid_body_vehicle.VEHICLE_STRIDE + 92 + sourceIndex * 48,
1553
+ destinationOffset: vehicleIndex * import_rigid_body_vehicle.VEHICLE_STRIDE + 92 + index * 48,
1554
+ size: 20
1555
+ });
1556
+ encoder.copyBufferToBuffer({
1557
+ sourceBuffer,
1558
+ destinationBuffer,
1559
+ sourceOffset: previousVehicleIndex * import_rigid_body_vehicle.VEHICLE_STRIDE + 256 + sourceIndex * 64,
1560
+ destinationOffset: vehicleIndex * import_rigid_body_vehicle.VEHICLE_STRIDE + 256 + index * 64,
1561
+ size: 64
1562
+ });
1563
+ });
1564
+ this.device.submit(encoder.finish());
1565
+ }
1566
+ /** Read wheel spin, angle, suspension length and normal load after submitted steps. */
1567
+ async readVehicleWheels(vehicleIndex = 0) {
1568
+ if (!this.vehicleBuffer || this.destroyed || !this.vehicles[vehicleIndex])
1569
+ throw new Error("Vehicle unavailable");
1570
+ const bytes = await this.vehicleBuffer.readAsync(vehicleIndex * import_rigid_body_vehicle.VEHICLE_STRIDE, 256);
1571
+ const values = new Float32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4);
1572
+ return Array.from({ length: 4 }, (_, index) => {
1573
+ const offset = 24 + index * 12;
1574
+ return {
1575
+ speed: values[offset],
1576
+ angle: values[offset + 1],
1577
+ length: values[offset + 2],
1578
+ load: values[offset + 3],
1579
+ steering: values[offset - 1]
1580
+ };
1581
+ });
1582
+ }
1223
1583
  /** Submit an impulse at a world-space point, or the current GPU center of mass when omitted. */
1224
1584
  applyImpulse(body, impulse, point) {
1225
1585
  if (!this.control || !this.device || !this.controlSettings || this.destroyed || !Number.isInteger(body) || body < 0 || body >= this.count || ![...impulse, ...point ?? []].every(Number.isFinite))
@@ -1300,7 +1660,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1300
1660
  const shape = structuredClone(edit.shape);
1301
1661
  if (edit.shapeScale && (edit.shapeScale.length !== 3 || edit.shapeScale.some((value) => !Number.isFinite(value) || value <= 0)))
1302
1662
  throw new Error("Invalid collider shape scale");
1303
- if (indices.has(edit.collider) || previous.type !== shape.type || shape.type === "convex-hull" || shape.type === "triangle-mesh")
1663
+ if (indices.has(edit.collider) || previous.type !== shape.type || shape.type === "convex-hull" || shape.type === "triangle-mesh" || shape.type === "height-field")
1304
1664
  throw new Error("Shape edit requires a topology rebuild");
1305
1665
  indices.add(edit.collider);
1306
1666
  const properties = (0, import_rigid_body_shape_properties.getRigidBodyShapeProperties)(shape);
@@ -1333,6 +1693,94 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1333
1693
  this.setBodyParameters(body, {});
1334
1694
  }
1335
1695
  }
1696
+ /**
1697
+ * Replace or evict fixed-dimension height-field tiles between submissions.
1698
+ * Optional positions are in each collider's body-local frame. The caller owns
1699
+ * tile selection and must submit already encoded steps before editing residency.
1700
+ */
1701
+ setHeightFieldTiles(edits) {
1702
+ var _a;
1703
+ if (!edits.length)
1704
+ return;
1705
+ const metadata = this.ownedBuffers.find((buffer) => buffer.id === `${this.id}-bodies`);
1706
+ if (!metadata || this.destroyed || this.queryPending || this.eventRead || this.triggerRead)
1707
+ throw new Error("Terrain streaming requires an idle attached world");
1708
+ const seen = /* @__PURE__ */ new Set();
1709
+ const packedFields = this.terrainAtlas ? /* @__PURE__ */ new Map() : void 0;
1710
+ const replacements = edits.map(({ collider: colliderIndex, field, position }) => {
1711
+ const collider = this.colliders[colliderIndex];
1712
+ const offset = this.heightFieldSlots.get(colliderIndex);
1713
+ if (offset === void 0 && !(this.terrainAtlas && this.ensembleTerrainSlots.has(colliderIndex)) || (collider == null ? void 0 : collider.shape.type) !== "height-field" || seen.has(colliderIndex))
1714
+ throw new Error("Invalid writable height-field slot");
1715
+ seen.add(colliderIndex);
1716
+ const previous = collider.shape.field;
1717
+ if (field && (field.width !== previous.width || field.height !== previous.height))
1718
+ throw new Error("Height-field slot dimensions are fixed");
1719
+ const center = this.props.bodies[collider.body].centerOfMass ?? [0, 0, 0];
1720
+ const localOffset = position == null ? void 0 : position.map((value, axis) => value - center[axis]);
1721
+ if (position && (position.length !== 3 || !(localOffset == null ? void 0 : localOffset.every((value) => Number.isFinite(Math.fround(value))))))
1722
+ throw new Error("Invalid height-field tile position");
1723
+ let payload = field ? packedFields == null ? void 0 : packedFields.get(field) : void 0;
1724
+ if (!payload) {
1725
+ const next = field ? structuredClone(field) : { ...previous, heights: void 0, validity: void 0 };
1726
+ const packed = (0, import_rigid_body_height_field.packRigidBodyHeightField)(next);
1727
+ const data = packedFields && packed.nodeCount ? new Float32Array(packed.data) : null;
1728
+ payload = { field: next, packed, data };
1729
+ if (field)
1730
+ packedFields == null ? void 0 : packedFields.set(field, payload);
1731
+ }
1732
+ return { collider, colliderIndex, offset, position, localOffset, ...payload };
1733
+ });
1734
+ const atlas = (_a = this.terrainAtlas) == null ? void 0 : _a.bind(replacements.map(({ colliderIndex, data }) => ({ collider: colliderIndex, data })));
1735
+ if (this.terrainRevision === 16777215) {
1736
+ this.wake();
1737
+ this.terrainRevision = 1;
1738
+ }
1739
+ const revision = ++this.terrainRevision;
1740
+ for (const { word, data } of (atlas == null ? void 0 : atlas.uploads) ?? [])
1741
+ metadata.write(data, (this.terrainAtlasWord + word) * 4);
1742
+ const changedBodies = /* @__PURE__ */ new Set();
1743
+ const affectedInstances = /* @__PURE__ */ new Set();
1744
+ for (const replacement of replacements) {
1745
+ const { collider, colliderIndex, offset, field, position, localOffset, packed } = replacement;
1746
+ const base = this.count * 48 + colliderIndex * 96;
1747
+ if (this.terrainWake)
1748
+ this.wakeTerrainFootprint(colliderIndex);
1749
+ if (atlas) {
1750
+ const word = atlas.wordsByCollider.get(colliderIndex);
1751
+ const address = word === void 0 ? 0 : (this.terrainAtlasWord - this.terrainGeometryWord + word) / 4;
1752
+ metadata.write(new Float32Array([
1753
+ word === void 0 ? 0 : address + packed.nodeOffset,
1754
+ packed.nodeCount,
1755
+ address
1756
+ ]), base + 72);
1757
+ } else {
1758
+ metadata.write(new Float32Array(packed.data), offset);
1759
+ metadata.write(new Float32Array([packed.nodeCount]), base + 76);
1760
+ }
1761
+ metadata.write(new Float32Array(packed.extent), base);
1762
+ metadata.write(new Float32Array([revision, packed.triangleCount]), base + 88);
1763
+ if (position && localOffset) {
1764
+ metadata.write(new Float32Array(localOffset), base + 16);
1765
+ collider.position = [...position];
1766
+ }
1767
+ collider.shape = { type: "height-field", field };
1768
+ changedBodies.add(collider.body);
1769
+ if (this.terrainWake)
1770
+ this.wakeTerrainFootprint(colliderIndex);
1771
+ if (this.props.ensembleBodiesPerInstance)
1772
+ affectedInstances.add(Math.floor(collider.body / this.props.ensembleBodiesPerInstance));
1773
+ }
1774
+ for (const body of changedBodies)
1775
+ this.updateColliderDefinitions(body);
1776
+ for (const instance of affectedInstances)
1777
+ this.wakeEnsembleInstance(instance);
1778
+ }
1779
+ /** Shared atlas utilization, when the fused layout enabled page sharing. */
1780
+ getTerrainAtlasStats() {
1781
+ var _a;
1782
+ return (_a = this.terrainAtlas) == null ? void 0 : _a.getStats();
1783
+ }
1336
1784
  /** Change an existing collider material between submissions, invalidating cached friction. */
1337
1785
  setColliderMaterial(colliderIndex, material) {
1338
1786
  const collider = this.colliders[colliderIndex];
@@ -1392,10 +1840,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1392
1840
  }
1393
1841
  updateColliderDefinitions(bodyIndex) {
1394
1842
  const { shape, colliders, ...properties } = this.props.bodies[bodyIndex];
1395
- const updated = this.colliders.filter((candidate) => candidate.body === bodyIndex).map(({ body, ...candidate }) => candidate);
1396
- const bodies = [...this.props.bodies];
1397
- bodies[bodyIndex] = { ...properties, colliders: updated };
1398
- this.props.bodies = bodies;
1843
+ const updated = this.colliders.slice(this.bodyColliderStarts[bodyIndex], this.bodyColliderStarts[bodyIndex + 1]).map(({ body, ...candidate }) => candidate);
1844
+ this.props.bodies[bodyIndex] = { ...properties, colliders: updated };
1399
1845
  }
1400
1846
  getColliderMaterial(collider) {
1401
1847
  const definition = this.colliders[collider];
@@ -1403,14 +1849,17 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1403
1849
  throw new Error("Invalid collider");
1404
1850
  return structuredClone(definition.material ?? {});
1405
1851
  }
1406
- restoreColliderDefinitions() {
1407
- const definitions = this.props.bodies.flatMap((body) => body.colliders ?? (body.shape ? [{ shape: body.shape }] : []));
1408
- for (const [index, definition] of definitions.entries()) {
1409
- const collider = this.colliders[index];
1410
- collider.shape = definition.shape;
1411
- collider.material = definition.material;
1412
- collider.position = definition.position;
1413
- collider.orientation = definition.orientation;
1852
+ restoreColliderDefinitions(first = 0, end = this.count) {
1853
+ for (let body = first; body < end; body++) {
1854
+ const definition = this.props.bodies[body];
1855
+ const colliders = definition.colliders ?? (definition.shape ? [{ shape: definition.shape }] : []);
1856
+ for (const [index, source] of colliders.entries()) {
1857
+ const collider = this.colliders[this.bodyColliderStarts[body] + index];
1858
+ collider.shape = source.shape;
1859
+ collider.material = source.material;
1860
+ collider.position = source.position;
1861
+ collider.orientation = source.orientation;
1862
+ }
1414
1863
  }
1415
1864
  }
1416
1865
  /** Update motion properties between submissions; preserve the node pose when its COM changes. */
@@ -1437,9 +1886,12 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1437
1886
  (0, import_rigid_body_joints.validateRigidBodyJoints)(this.props.joints, proposedBodies, this.solver);
1438
1887
  }
1439
1888
  const colliders = this.colliders.filter((collider) => collider.body === bodyIndex);
1440
- for (const collider of colliders)
1889
+ for (const collider of colliders) {
1890
+ if (collider.shape.type === "height-field" && mode !== "static")
1891
+ throw new Error("Height fields require static bodies");
1441
1892
  if ((collider.shape.type === "convex-hull" || collider.shape.type === "triangle-mesh") && mode !== "static" && mass > 0 && (!collider.shape.geometry.closed || !((0, import_rigid_body_shape_properties.getRigidBodyShapeProperties)(collider.shape).volume > 0)))
1442
1893
  throw new Error("Dynamic meshes require closed positive-volume geometry");
1894
+ }
1443
1895
  if (((_b = this.props.continuous) == null ? void 0 : _b.bodies.includes(bodyIndex)) && (mode !== "dynamic" || mass === 0 || this.props.continuous.mode !== "convex" && (colliders[0].position ?? [0, 0, 0]).some((value, axis) => value !== center[axis])))
1444
1896
  throw new Error("Mutation exceeds the continuous body envelope");
1445
1897
  const compound = (0, import_rigid_body_properties.getCompoundBodyInertia)(mass, colliders, center);
@@ -1719,6 +2171,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1719
2171
  }
1720
2172
  /** Reusable same-world GPU checkpoint; copies state without CPU pose or buffer readback. */
1721
2173
  createGPUCheckpoint(options = {}) {
2174
+ var _a;
1722
2175
  if (!this.device || this.destroyed)
1723
2176
  throw new Error("Checkpoint requires an attached world");
1724
2177
  const device = this.device;
@@ -1731,6 +2184,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1731
2184
  let bodyDefinitions = structuredClone(this.props.bodies);
1732
2185
  let contactCursor = 0;
1733
2186
  let triggerCursor = 0;
2187
+ let terrainRevision = this.terrainRevision;
2188
+ let terrainAtlas = (_a = this.terrainAtlas) == null ? void 0 : _a.snapshot();
1734
2189
  try {
1735
2190
  for (const buffer of checkpointBuffers)
1736
2191
  snapshots.push(device.createBuffer({
@@ -1760,6 +2215,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1760
2215
  const checkpoint = {
1761
2216
  byteLength: snapshots.reduce((sum, buffer) => sum + buffer.byteLength, 0),
1762
2217
  save: () => {
2218
+ var _a2;
1763
2219
  copy(false);
1764
2220
  origin = [...this.worldOrigin];
1765
2221
  joints = structuredClone(this.props.joints);
@@ -1768,6 +2224,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1768
2224
  publicationBounds = structuredClone(this.props.publicationBounds);
1769
2225
  contactCursor = this.eventCursor;
1770
2226
  triggerCursor = this.triggerCursor;
2227
+ terrainRevision = this.terrainRevision;
2228
+ terrainAtlas = (_a2 = this.terrainAtlas) == null ? void 0 : _a2.snapshot();
1771
2229
  saved = true;
1772
2230
  },
1773
2231
  restore: () => {
@@ -1782,6 +2240,9 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1782
2240
  this.props.publicationBounds = structuredClone(publicationBounds);
1783
2241
  this.eventCursor = contactCursor;
1784
2242
  this.triggerCursor = triggerCursor;
2243
+ this.terrainRevision = terrainRevision;
2244
+ if (terrainAtlas)
2245
+ this.terrainAtlas.restore(terrainAtlas.leases, (_word, _words, page) => terrainAtlas.payloads.get(page));
1785
2246
  },
1786
2247
  destroy: () => {
1787
2248
  if (released)
@@ -1797,6 +2258,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1797
2258
  }
1798
2259
  /** Stop graph submissions and controls first; includes diagnostics, caches and event history. */
1799
2260
  async captureState(options = {}) {
2261
+ var _a;
1800
2262
  if (!this.device || this.destroyed || this.queryPending || this.eventRead || this.triggerRead)
1801
2263
  throw new Error("Capture requires an idle attached world");
1802
2264
  return {
@@ -1807,6 +2269,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1807
2269
  colliderShapeScales: structuredClone([...this.colliderShapeScales]),
1808
2270
  contactCursor: this.eventCursor,
1809
2271
  triggerCursor: this.triggerCursor,
2272
+ terrainRevision: this.terrainRevision,
2273
+ terrainAtlasLeases: (_a = this.terrainAtlas) == null ? void 0 : _a.getLeases(),
1810
2274
  buffers: await Promise.all(this.getSnapshotBuffers(options.includeRollbackScratch).map(async (buffer) => ({
1811
2275
  name: buffer.id.slice(this.id.length + 1),
1812
2276
  data: new Uint8Array(await buffer.readAsync())
@@ -1816,7 +2280,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1816
2280
  /** Restore between submissions on the same configuration and implementation; no implicit wake. */
1817
2281
  restoreState(capture) {
1818
2282
  const checkpointBuffers = this.getSnapshotBuffers(capture.includeRollbackScratch);
1819
- if (!this.device || this.destroyed || this.queryPending || this.eventRead || this.triggerRead || capture.version !== 1 || 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))
2283
+ 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))
1820
2285
  throw new Error("Incompatible rigid-body capture");
1821
2286
  const shapeScales = new Map(capture.colliderShapeScales ?? []);
1822
2287
  for (const [index, scale] of shapeScales) {
@@ -1829,6 +2294,26 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1829
2294
  if (saved.name !== buffer.id.slice(this.id.length + 1) || !(saved.data instanceof Uint8Array) || saved.data.byteLength !== buffer.byteLength)
1830
2295
  throw new Error("Incompatible rigid-body capture storage");
1831
2296
  }
2297
+ if (this.terrainAtlas && capture.terrainAtlasLeases) {
2298
+ const metadata = capture.buffers.find((buffer) => buffer.name === "bodies").data;
2299
+ const view = new DataView(metadata.buffer, metadata.byteOffset, metadata.byteLength);
2300
+ const colliderBase = this.count * 48;
2301
+ let active = 0;
2302
+ for (const collider of this.ensembleTerrainSlots)
2303
+ if (view.getFloat32(colliderBase + collider * 96 + 76, true) > 0)
2304
+ active++;
2305
+ if (active !== capture.terrainAtlasLeases.length)
2306
+ throw new Error("Incomplete captured terrain atlas leases");
2307
+ this.terrainAtlas.restore(capture.terrainAtlasLeases, (word, words) => {
2308
+ const first = (this.terrainAtlasWord + word) * 4;
2309
+ return new Float32Array(metadata.slice(first, first + words * 4).buffer);
2310
+ }, (collider, word) => {
2311
+ const base = colliderBase + collider * 96;
2312
+ const address = (this.terrainAtlasWord - this.terrainGeometryWord + word) / 4;
2313
+ if (view.getFloat32(base + 76, true) <= 0 || view.getFloat32(base + 80, true) !== address)
2314
+ throw new Error("Captured terrain collider has an invalid page address");
2315
+ });
2316
+ }
1832
2317
  for (const [index, buffer] of checkpointBuffers.entries())
1833
2318
  buffer.write(capture.buffers[index].data);
1834
2319
  this.props.joints = structuredClone(capture.props.joints);
@@ -1839,6 +2324,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1839
2324
  this.worldOrigin = [...capture.origin ?? [0, 0, 0]];
1840
2325
  this.eventCursor = capture.contactCursor;
1841
2326
  this.triggerCursor = capture.triggerCursor;
2327
+ this.terrainRevision = terrainRevision;
1842
2328
  }
1843
2329
  /** Stop submissions first. Reconstruct with these accepted poses and larger budgets after rollback. */
1844
2330
  async getRecoveryProps(overrides = {}) {
@@ -1928,7 +2414,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1928
2414
  }
1929
2415
  /** Destroy the compiled graph and finish readbacks before destroying its world. */
1930
2416
  destroy() {
1931
- var _a, _b, _c, _d, _e;
2417
+ var _a, _b, _c, _d, _e, _f;
1932
2418
  if (this.destroyed)
1933
2419
  return;
1934
2420
  (_a = this.ensembleReset) == null ? void 0 : _a.destroy();
@@ -1937,8 +2423,9 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1937
2423
  this.destroyed = true;
1938
2424
  (_b = this.control) == null ? void 0 : _b.kernel.destroy();
1939
2425
  (_c = this.invalidation) == null ? void 0 : _c.kernel.destroy();
1940
- (_d = this.queryComputation) == null ? void 0 : _d.kernel.destroy();
1941
- (_e = this.queryReduction) == null ? void 0 : _e.kernel.destroy();
2426
+ (_d = this.terrainWake) == null ? void 0 : _d.kernel.destroy();
2427
+ (_e = this.queryComputation) == null ? void 0 : _e.kernel.destroy();
2428
+ (_f = this.queryReduction) == null ? void 0 : _f.kernel.destroy();
1942
2429
  for (const buffer of this.ownedBuffers)
1943
2430
  buffer.destroy();
1944
2431
  this.ownedBuffers.length = 0;
@@ -1954,10 +2441,14 @@ function serializeCaptureProps(props) {
1954
2441
  ...body,
1955
2442
  shape: void 0,
1956
2443
  colliders: (body.colliders ?? [{ shape: body.shape }]).map((collider) => {
1957
- var _a2, _b, _c;
2444
+ var _a2, _b, _c, _d;
1958
2445
  return {
1959
2446
  ...collider,
1960
- shape: ((_a2 = collider.shape) == null ? void 0 : _a2.type) === "convex-hull" || ((_b = collider.shape) == null ? void 0 : _b.type) === "triangle-mesh" ? collider.shape : { type: (_c = collider.shape) == null ? void 0 : _c.type },
2447
+ shape: ((_a2 = collider.shape) == null ? void 0 : _a2.type) === "convex-hull" || ((_b = collider.shape) == null ? void 0 : _b.type) === "triangle-mesh" ? collider.shape : ((_c = collider.shape) == null ? void 0 : _c.type) === "height-field" ? {
2448
+ type: collider.shape.type,
2449
+ width: collider.shape.field.width,
2450
+ height: collider.shape.field.height
2451
+ } : { type: (_d = collider.shape) == null ? void 0 : _d.type },
1961
2452
  material: void 0,
1962
2453
  position: void 0,
1963
2454
  orientation: void 0