@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
@@ -20,12 +20,19 @@ import {
20
20
 
21
21
  import {
22
22
  GPUCommandGraph,
23
- type GPUCommandGraphComputeExecutable
23
+ type GPUCommandGraphComputeExecutable,
24
+ type GraphBufferHandle
24
25
  } from '../gpu-core/gpu-command-graph';
25
26
  import {shiftRigidBodyBuffers} from './rigid-body-origin';
27
+ import {type GPURigidBodyHeightField, packRigidBodyHeightField} from './rigid-body-height-field';
26
28
  import {getRigidBodyShapeProperties} from './rigid-body-shape-properties';
27
29
  import {addEnsembleStatus, readOnlyEnsembleShader} from './rigid-body-ensemble-shaders';
28
30
  import {makeEnsembleReset} from './rigid-body-ensemble-reset';
31
+ import {
32
+ RigidBodyTerrainAtlas,
33
+ type GPUPhysicsTerrainAtlasPool,
34
+ type GPUPhysicsTerrainAtlasStats
35
+ } from './rigid-body-terrain-atlas';
29
36
  import {packRigidBodyShapes} from './rigid-body-geometry';
30
37
  import {
31
38
  getCompoundBodyInertia,
@@ -76,6 +83,13 @@ import {
76
83
  import {addRigidBodyPosePublication, type GPURigidBodyBounds} from './rigid-body-publication';
77
84
  import {getRigidBodyShader} from './rigid-body-shaders';
78
85
 
86
+ import {
87
+ getVehicleShader,
88
+ VEHICLE_STRIDE,
89
+ VEHICLE_TERRAIN_ROW_SIZE,
90
+ type GPURigidBodyVehicle
91
+ } from './rigid-body-vehicle';
92
+
79
93
  type Vector3 = readonly [number, number, number];
80
94
  import {
81
95
  decodeRigidBodyContactEvents,
@@ -90,6 +104,16 @@ import {
90
104
  type GPURigidBodyQueryResult
91
105
  } from './rigid-body-queries';
92
106
 
107
+ /** One fixed-dimension slot update. A null field evicts the current tile. */
108
+ export type GPURigidBodyHeightFieldEdit = {
109
+ /** Stable index of the reserved collider slot. */
110
+ collider: number;
111
+ /** Replacement samples and transform, or null to evict. */
112
+ field: GPURigidBodyHeightField | null;
113
+ /** Optional new placement in the collider's body-local frame. */
114
+ position?: Vector3;
115
+ };
116
+
93
117
  /** In-memory, structured-cloneable debug capture; tied to this implementation's storage layout. */
94
118
  export type GPURigidBodyCapture = {
95
119
  version: 1;
@@ -100,6 +124,10 @@ export type GPURigidBodyCapture = {
100
124
  buffers: {name: string; data: Uint8Array}[];
101
125
  contactCursor: number;
102
126
  triggerCursor: number;
127
+ /** Last issued terrain edit stamp, for restoring into a different world. */
128
+ terrainRevision?: number;
129
+ /** Exact collider-to-page assignments for a captured shared atlas. */
130
+ terrainAtlasLeases?: readonly (readonly [collider: number, page: number])[];
103
131
  colliderShapeScales?: [number, number[]][];
104
132
  };
105
133
 
@@ -128,6 +156,10 @@ export type GPURigidBodyWorldProps = {
128
156
  /** Up to 64 joints. Parallel solving supports static-anchored distance joints only. */
129
157
  joints?: readonly GPURigidBodyJoint[];
130
158
  gravity?: Vector3;
159
+ /** Optional four-wheel suspension evaluated against static terrain each fixed step. */
160
+ vehicle?: GPURigidBodyVehicle;
161
+ /** Four-wheel chassis with distinct dynamic bodies, in vehicle-index order. Supply this or vehicle. */
162
+ vehicles?: readonly GPURigidBodyVehicle[];
131
163
  timeStep?: number;
132
164
  iterations?: number;
133
165
  contactSlop?: number;
@@ -139,11 +171,19 @@ export type GPURigidBodyWorldProps = {
139
171
  maximumRecoverySpeed?: number;
140
172
  /** Additional under-relaxation for the parallel solver, in (0, 1]. Default 1. */
141
173
  parallelRelaxation?: number;
174
+ /** Contact scheduling within a parallel manifold. Block uses two local sweeps before gathering.
175
+ * Default scalar preserves the original per-contact relaxation path.
176
+ */
177
+ parallelContactSolver?: 'scalar' | 'block';
142
178
  /** Small worlds retain the all-pairs numerical oracle; larger worlds use sparse discovery. */
143
179
  /** Independent equal collider blocks; currently excludes joints, CCD and authored triggers. */
144
180
  collisionPartitionSize?: number;
145
181
  /** Equal body ranges for GPU-driven ensemble scheduling; requires parallel sparse partitions. */
146
182
  ensembleBodiesPerInstance?: number;
183
+ /** @internal Global collider indices reserved for writable terrain in a fused ensemble. */
184
+ ensembleTerrainSlots?: readonly number[];
185
+ /** @internal Optional fused atlas page capacity by reserved grid. */
186
+ ensembleTerrainAtlas?: readonly GPUPhysicsTerrainAtlasPool[];
147
187
  broadPhase?: 'all-pairs' | 'hierarchical-grid';
148
188
  /** Parallel block-Jacobi contact solving; ordered impulses remain the numerical oracle. */
149
189
  solver?: 'ordered' | 'parallel';
@@ -224,6 +264,13 @@ export class GPURigidBodyWorld {
224
264
  private eventRead: Promise<GPURigidBodyContactBatch> | null = null;
225
265
  private queryComputation: BoundKernel | null = null;
226
266
  private queryReduction: BoundKernel | null = null;
267
+ /** Chassis definitions in GPU storage order. */
268
+ private readonly vehicles: readonly GPURigidBodyVehicle[];
269
+ /** Whether any chassis has more than one terrain candidate. */
270
+ private readonly multiSurfaceVehicles: boolean;
271
+ /** Number of vehicles in each equal-sized ensemble partition, or zero for a standalone world. */
272
+ private readonly vehiclesPerInstance: number;
273
+ private vehicleBuffer: Buffer | null = null;
227
274
  private querySettings: Buffer | null = null;
228
275
  private querySelection: Buffer | null = null;
229
276
  private queryOutput: Buffer | null = null;
@@ -231,9 +278,23 @@ export class GPURigidBodyWorld {
231
278
  private targets: Buffer | null = null;
232
279
  private simulationStatistics: Buffer | null = null;
233
280
  private readonly colliders: readonly (GPURigidBodyCollider & {body: number})[];
281
+ private readonly bodyColliderStarts: Uint32Array;
282
+ private readonly ensembleTerrainSlots: ReadonlySet<number>;
234
283
  private readonly props: GPURigidBodyWorldProps;
235
284
  private readonly ownedBuffers: Buffer[] = [];
285
+ private allocationPlan?: GPURigidBodyCapacityInfo['buffers'];
236
286
  private ensembleBuffer: Buffer | null = null;
287
+ /** Byte offsets of writable fixed-dimension height fields in the world metadata buffer. */
288
+ private heightFieldSlots = new Map<number, number>();
289
+ /** Float32-exact edit stamp, restored together with the contact cache. */
290
+ private terrainRevision = 1;
291
+ private terrainWake: BoundKernel | null = null;
292
+ /** Page ownership and live lease counts for an opt-in fused atlas. */
293
+ private readonly terrainAtlas?: RigidBodyTerrainAtlas;
294
+ /** Start of the shared atlas in the GPU metadata buffer, measured in 32-bit words. */
295
+ private terrainAtlasWord = 0;
296
+ /** Start of the shader geometry region in the GPU metadata buffer, measured in 32-bit words. */
297
+ private terrainGeometryWord = 0;
237
298
  private ensembleResetOrigin?: readonly number[];
238
299
  private ensembleReset?: ReturnType<typeof makeEnsembleReset>;
239
300
  private initialEnsembleBodies?: readonly GPURigidBody[];
@@ -271,6 +332,8 @@ export class GPURigidBodyWorld {
271
332
  this.solver = props.solver ?? 'ordered';
272
333
  if (!['ordered', 'parallel'].includes(this.solver))
273
334
  throw new Error('Invalid rigid-body solver');
335
+ if (!['scalar', 'block'].includes(props.parallelContactSolver ?? 'scalar'))
336
+ throw new Error('Invalid parallel contact solver');
274
337
  validateRigidBodyJoints(props.joints ?? [], props.bodies, this.solver);
275
338
  const colliderCount = props.bodies.reduce(
276
339
  (sum, body) => sum + (body.colliders?.length ?? 1),
@@ -336,6 +399,11 @@ export class GPURigidBodyWorld {
336
399
  const shapes: readonly GPURigidBodyCollider[] =
337
400
  body.colliders ?? (body.shape ? [{shape: body.shape}] : []);
338
401
  for (const collider of shapes) {
402
+ if (
403
+ collider.shape.type === 'height-field' &&
404
+ (body.mode ?? (body.mass === 0 ? 'static' : 'dynamic')) !== 'static'
405
+ )
406
+ throw new Error('Height fields require static bodies');
339
407
  const properties = getRigidBodyShapeProperties(collider.shape);
340
408
  if (
341
409
  !Number.isFinite(properties.volume) ||
@@ -465,7 +533,9 @@ export class GPURigidBodyWorld {
465
533
  (props.continuous.maximumCandidates ?? this.maximumPairs) > 0x40000000 ||
466
534
  (props.continuous.mode === 'convex' &&
467
535
  (Boolean(props.joints?.length) ||
468
- colliders.some(collider => ['plane', 'triangle-mesh'].includes(collider.shape.type))))
536
+ colliders.some(collider =>
537
+ ['plane', 'triangle-mesh', 'height-field'].includes(collider.shape.type)
538
+ )))
469
539
  )
470
540
  throw new Error('Invalid continuous settings');
471
541
  for (const index of props.continuous.bodies) {
@@ -499,14 +569,116 @@ export class GPURigidBodyWorld {
499
569
  }
500
570
  // Clone together so collider edits preserve geometry identity in captured body definitions.
501
571
  const definitions = structuredClone({colliders, props});
502
- this.colliders = definitions.colliders;
503
572
  this.props = definitions.props;
573
+ this.colliders = definitions.colliders;
574
+ this.ensembleTerrainSlots = new Set(this.props.ensembleTerrainSlots);
575
+ if (
576
+ this.ensembleTerrainSlots.size &&
577
+ (!this.props.ensembleBodiesPerInstance ||
578
+ [...this.ensembleTerrainSlots].some(
579
+ index => this.colliders[index]?.shape.type !== 'height-field'
580
+ ))
581
+ )
582
+ throw new Error('Invalid ensemble terrain slots');
583
+ if (this.props.ensembleTerrainAtlas) {
584
+ this.terrainAtlas = new RigidBodyTerrainAtlas(
585
+ this.props.ensembleTerrainAtlas,
586
+ Array.from(this.ensembleTerrainSlots, collider => {
587
+ const shape = this.colliders[collider].shape;
588
+ if (shape.type !== 'height-field') throw new Error('Invalid ensemble terrain slot');
589
+ return {collider, width: shape.field.width, height: shape.field.height};
590
+ })
591
+ );
592
+ }
593
+ this.bodyColliderStarts = new Uint32Array(this.count + 1);
594
+ let colliderIndex = 0;
595
+ for (let body = 0; body < this.count; body++) {
596
+ this.bodyColliderStarts[body] = colliderIndex;
597
+ while (this.colliders[colliderIndex]?.body === body) colliderIndex++;
598
+ }
599
+ this.bodyColliderStarts[this.count] = colliderIndex;
600
+ if (this.props.vehicle && this.props.vehicles) throw new Error('Choose vehicle or vehicles');
601
+ this.vehicles = this.props.vehicles ?? (this.props.vehicle ? [this.props.vehicle] : []);
602
+ this.multiSurfaceVehicles = this.vehicles.some(
603
+ vehicle => vehicle.additionalTerrainColliders?.length
604
+ );
605
+ const bodiesPerInstance = props.ensembleBodiesPerInstance;
606
+ const collidersPerInstance = props.collisionPartitionSize!;
607
+ this.vehiclesPerInstance = bodiesPerInstance
608
+ ? this.vehicles.length / (this.count / bodiesPerInstance)
609
+ : 0;
610
+ if (!Number.isInteger(this.vehiclesPerInstance))
611
+ throw new Error('Invalid ensemble vehicle layout');
612
+ const vehicleChassis = new Set<number>();
613
+ for (const [vehicleIndex, vehicle] of this.vehicles.entries()) {
614
+ const instance = bodiesPerInstance ? Math.floor(vehicleIndex / this.vehiclesPerInstance) : 0;
615
+ const terrainIndices = [
616
+ vehicle.terrainCollider,
617
+ ...(vehicle.additionalTerrainColliders ?? [])
618
+ ];
619
+ const chassis = this.props.bodies[vehicle.chassis];
620
+ if (
621
+ !chassis ||
622
+ vehicleChassis.has(vehicle.chassis) ||
623
+ terrainIndices.length > 4 ||
624
+ new Set(terrainIndices).size !== terrainIndices.length ||
625
+ terrainIndices.some(colliderIndex => {
626
+ const collider = this.colliders[colliderIndex];
627
+ const ground = collider && this.props.bodies[collider.body];
628
+ return (
629
+ !ground ||
630
+ collider.isTrigger ||
631
+ this.getBodyMode(collider.body) !== 'static' ||
632
+ (bodiesPerInstance && Math.floor(colliderIndex / collidersPerInstance) !== instance)
633
+ );
634
+ }) ||
635
+ (chassis.mode ?? (chassis.mass === 0 ? 'static' : 'dynamic')) !== 'dynamic' ||
636
+ vehicle.wheels.length !== 4 ||
637
+ (bodiesPerInstance && Math.floor(vehicle.chassis / bodiesPerInstance) !== instance) ||
638
+ ![vehicle.radius, vehicle.travel, vehicle.springRate, vehicle.wheelInertia].every(
639
+ value => Number.isFinite(value) && value > 0
640
+ ) ||
641
+ ![vehicle.damping, vehicle.grip, vehicle.motorTorque, vehicle.brakeTorque].every(
642
+ value => Number.isFinite(value) && value >= 0
643
+ ) ||
644
+ (vehicle.steeringWheelbase !== undefined &&
645
+ (!Number.isFinite(Math.fround(vehicle.steeringWheelbase)) ||
646
+ vehicle.steeringWheelbase <= 0)) ||
647
+ !Number.isFinite(Math.fround(vehicle.antiRollRate ?? 0)) ||
648
+ (vehicle.antiRollRate ?? 0) < 0 ||
649
+ (vehicle.slipGain !== undefined &&
650
+ (vehicle.slipGain.length !== 2 ||
651
+ !vehicle.slipGain.every(gain => Number.isFinite(Math.fround(gain)) && gain >= 0))) ||
652
+ vehicle.wheels.some(
653
+ wheel => wheel.mount.length !== 3 || !wheel.mount.every(Number.isFinite)
654
+ )
655
+ )
656
+ throw new Error('Invalid vehicle configuration');
657
+ vehicleChassis.add(vehicle.chassis);
658
+ }
659
+
504
660
  if (props.ensembleBodiesPerInstance)
505
661
  this.initialEnsembleBodies = this.props.bodies.slice(0, props.ensembleBodiesPerInstance);
506
662
  }
507
663
 
664
+ /** Allocation size including optional immutable terrain rows after the wheel state. */
665
+ private getVehicleByteLength(): number {
666
+ return (
667
+ this.vehicles.length *
668
+ (VEHICLE_STRIDE + (this.multiSurfaceVehicles ? VEHICLE_TERRAIN_ROW_SIZE : 0))
669
+ );
670
+ }
671
+
508
672
  private getStorageLayout() {
509
- const packed = packRigidBodyShapes(this.colliders);
673
+ const packed = packRigidBodyShapes(
674
+ this.colliders,
675
+ Boolean(this.props.ensembleBodiesPerInstance),
676
+ this.ensembleTerrainSlots,
677
+ Boolean(this.terrainAtlas)
678
+ );
679
+ const geometryWords = packed.geometry.length + (this.terrainAtlas?.wordLength ?? 0);
680
+ if (this.terrainAtlas && geometryWords >= 2 ** 26)
681
+ throw new Error('Terrain atlas exceeds address capacity');
510
682
  const sparse = this.broadPhase === 'hierarchical-grid';
511
683
  const extended = this.colliders.some(
512
684
  collider =>
@@ -523,7 +695,7 @@ export class GPURigidBodyWorld {
523
695
  this.count,
524
696
  this.colliderStorageCount,
525
697
  this.maximumPairs,
526
- packed.geometry.length,
698
+ geometryWords,
527
699
  sparse,
528
700
  extended,
529
701
  parallel,
@@ -535,6 +707,17 @@ export class GPURigidBodyWorld {
535
707
  this.props.ensembleBodiesPerInstance ? this.count / this.props.ensembleBodiesPerInstance : 0
536
708
  )
537
709
  };
710
+ if (this.vehicles.length) {
711
+ const byteLength = this.getVehicleByteLength();
712
+ storage.buffers.push({name: 'vehicle', byteLength, uniform: false});
713
+ if (this.props.failurePolicy === 'rollback') {
714
+ storage.buffers.push({
715
+ name: this.vehiclesPerInstance ? 'checkpoint-vehicles' : 'checkpoint-7',
716
+ byteLength: this.vehiclesPerInstance ? this.vehicles.length * VEHICLE_STRIDE : byteLength,
717
+ uniform: false
718
+ });
719
+ }
720
+ }
538
721
  if (this.props.continuous?.mode === 'convex') {
539
722
  storage.buffers = storage.buffers.filter(buffer => buffer.name !== 'continuous-previous');
540
723
  storage.buffers.push({name: 'continuous-dispatch', byteLength: 16, uniform: false});
@@ -608,7 +791,9 @@ export class GPURigidBodyWorld {
608
791
  this.count,
609
792
  this.props.ensembleBodiesPerInstance!,
610
793
  this.props.collisionPartitionSize!,
611
- this.maximumPairs
794
+ this.maximumPairs,
795
+ this.vehiclesPerInstance,
796
+ this.ensembleTerrainSlots
612
797
  );
613
798
  return this.ensembleReset.byteLength;
614
799
  }
@@ -620,41 +805,40 @@ export class GPURigidBodyWorld {
620
805
  const colliderStart = instance * this.props.collisionPartitionSize!;
621
806
  let colliderIndex = colliderStart;
622
807
  const restored = this.initialEnsembleBodies!.map(body => {
623
- if (body.shape) {
624
- const current = this.colliders[colliderIndex++].shape;
808
+ const {shape, colliders, ...properties} = body;
809
+ const resetCollider = (definition: GPURigidBodyCollider): GPURigidBodyCollider => {
810
+ const index = colliderIndex++;
811
+ const {body: _, ...current} = this.colliders[index];
812
+ if (this.ensembleTerrainSlots.has(index)) return current;
625
813
  return {
626
- ...body,
814
+ ...definition,
627
815
  shape:
628
- body.shape.type === 'convex-hull' || body.shape.type === 'triangle-mesh'
629
- ? current
630
- : body.shape
816
+ definition.shape.type === 'convex-hull' || definition.shape.type === 'triangle-mesh'
817
+ ? current.shape
818
+ : definition.shape,
819
+ excludedColliders: definition.excludedColliders?.map(index => index + colliderStart)
631
820
  };
632
- }
633
- return {
634
- ...body,
635
- colliders: body.colliders.map(collider => {
636
- const current = this.colliders[colliderIndex++].shape;
637
- return {
638
- ...collider,
639
- shape:
640
- collider.shape.type === 'convex-hull' || collider.shape.type === 'triangle-mesh'
641
- ? current
642
- : collider.shape,
643
- excludedColliders: collider.excludedColliders?.map(index => index + colliderStart)
644
- };
645
- })
646
821
  };
822
+ if (shape && !this.ensembleTerrainSlots.has(colliderIndex))
823
+ return {...body, shape: resetCollider({shape}).shape};
824
+ return {...properties, colliders: (colliders ?? [{shape: shape!}]).map(resetCollider)};
647
825
  });
648
- const definitions = [...this.props.bodies];
826
+ const definitions = this.props.bodies as GPURigidBody[];
649
827
  definitions.splice(bodyStart, restored.length, ...restored);
650
- this.props.bodies = definitions;
651
- for (
652
- let collider = colliderStart;
653
- collider < colliderStart + this.props.collisionPartitionSize!;
654
- collider++
655
- )
656
- this.colliderShapeScales.delete(collider);
657
- this.restoreColliderDefinitions();
828
+ this.restoreColliderDefinitions(bodyStart, bodyStart + restored.length);
829
+ const metadata = this.ownedBuffers.find(buffer => buffer.id === `${this.id}-bodies`)!;
830
+ for (let index = colliderStart; index < colliderIndex; index++) {
831
+ this.colliderShapeScales.delete(index);
832
+ if (!this.ensembleTerrainSlots.has(index)) continue;
833
+ const collider = this.colliders[index];
834
+ const center = definitions[collider.body].centerOfMass ?? [0, 0, 0];
835
+ metadata.write(
836
+ new Float32Array(
837
+ (collider.position ?? [0, 0, 0]).map((value, axis) => value - center[axis])
838
+ ),
839
+ this.count * 48 + index * 96 + 16
840
+ );
841
+ }
658
842
  this.ensembleReset.reset(
659
843
  instance,
660
844
  this.origin.map((value, axis) => value - this.ensembleResetOrigin![axis])
@@ -710,6 +894,7 @@ export class GPURigidBodyWorld {
710
894
  claimedContacts,
711
895
  journaledContacts,
712
896
  bodySnapshotBytes: activeBodies * 80,
897
+ vehicleSnapshotBytes: activeInstances * this.vehiclesPerInstance * VEHICLE_STRIDE,
713
898
  contactSnapshotBytes: journaledContacts * 416,
714
899
  allocatorSnapshotBytes: (8 + activeInstances * 2 + journaledContacts * 3) * 4,
715
900
  residentInstances: this.count / this.props.ensembleBodiesPerInstance!,
@@ -731,7 +916,9 @@ export class GPURigidBodyWorld {
731
916
 
732
917
  /** Allocation preflight without GPU allocation. Graph scratch and driver overhead are separate. */
733
918
  getCapacityInfo(): GPURigidBodyCapacityInfo {
734
- const {buffers} = this.getStorageLayout();
919
+ const buffers = this.allocationPlan
920
+ ? this.allocationPlan.map(buffer => ({...buffer}))
921
+ : this.getStorageLayout().buffers;
735
922
  return {
736
923
  bodyCount: this.count,
737
924
  colliderCount: this.colliderCount,
@@ -768,6 +955,11 @@ export class GPURigidBodyWorld {
768
955
  ) > graph.device.limits.maxComputeWorkgroupsPerDimension
769
956
  )
770
957
  throw new Error('Continuous candidate dispatch exceeds device limits');
958
+ if (
959
+ !this.vehiclesPerInstance &&
960
+ this.vehicles.length > graph.device.limits.maxComputeWorkgroupsPerDimension
961
+ )
962
+ throw new Error('Vehicle dispatch exceeds device limits');
771
963
  for (const buffer of allocationPlan) {
772
964
  const bindingLimit = buffer.uniform
773
965
  ? graph.device.limits.maxUniformBufferBindingSize
@@ -775,6 +967,7 @@ export class GPURigidBodyWorld {
775
967
  if (buffer.byteLength > Math.min(graph.device.limits.maxBufferSize, bindingLimit))
776
968
  throw new Error(`Rigid-body ${buffer.name} storage exceeds device limits`);
777
969
  }
970
+ this.allocationPlan = allocationPlan;
778
971
  this.device = graph.device;
779
972
  const allocate = (name: string, data: Float32Array | Uint32Array | number, uniform = false) => {
780
973
  const buffer = graph.device.createBuffer({
@@ -804,6 +997,32 @@ export class GPURigidBodyWorld {
804
997
  : undefined;
805
998
  const metadata = new Float32Array(metadataLength);
806
999
  metadata.set(packed.geometry, geometryOffset);
1000
+ if (this.terrainAtlas) {
1001
+ this.terrainGeometryWord = geometryOffset;
1002
+ this.terrainAtlasWord = geometryOffset + packed.geometry.length;
1003
+ const {wordsByCollider, uploads} = this.terrainAtlas.bind(
1004
+ Array.from(packed.atlasFields, ([collider, field]) => ({
1005
+ collider,
1006
+ data: new Float32Array(field.data)
1007
+ }))
1008
+ );
1009
+ for (const {word, data} of uploads) metadata.set(data, this.terrainAtlasWord + word);
1010
+ for (const [collider, word] of wordsByCollider) {
1011
+ const field = packed.atlasFields.get(collider)!;
1012
+ const address = (packed.geometry.length + word) / 4;
1013
+ const shape = packed.shapes[collider];
1014
+ shape.padding[0] = address;
1015
+ shape.padding[3] = field.triangleCount;
1016
+ shape.policies[0] = address + field.nodeOffset;
1017
+ shape.policies[1] = field.nodeCount;
1018
+ }
1019
+ }
1020
+ this.heightFieldSlots = new Map(
1021
+ Array.from(packed.heightFields, ([collider, offset]) => [
1022
+ collider,
1023
+ (geometryOffset + offset * 4) * 4
1024
+ ])
1025
+ );
807
1026
  const bodyColliders: GPURigidBodyCollider[][] = Array.from({length: this.count}, () => []);
808
1027
  if (this.colliderCount)
809
1028
  for (const collider of this.colliders) bodyColliders[collider.body].push(collider);
@@ -872,7 +1091,10 @@ export class GPURigidBodyWorld {
872
1091
  material?.restitutionCombine ? policies.indexOf(material.restitutionCombine) : 4,
873
1092
  material?.frictionCombine ? policies.indexOf(material.frictionCombine) : 4,
874
1093
  ...shape.policies,
875
- ...shape.padding
1094
+ shape.padding[0],
1095
+ shape.padding[1],
1096
+ this.ensembleTerrainSlots.has(index) ? 1 : shape.padding[2],
1097
+ shape.padding[3]
876
1098
  ],
877
1099
  this.count * 12 + index * 24
878
1100
  );
@@ -1043,7 +1265,9 @@ export class GPURigidBodyWorld {
1043
1265
  this.props.joints?.length ?? 0,
1044
1266
  this.props.compactContacts ?? true,
1045
1267
  this.props.collisionPartitionSize,
1046
- this.props.ensembleBodiesPerInstance
1268
+ this.props.ensembleBodiesPerInstance,
1269
+ this.props.parallelContactSolver === 'block',
1270
+ this.colliders.some(collider => collider.shape.type === 'height-field')
1047
1271
  );
1048
1272
  const parallelBindings: Record<string, readonly string[]> = {
1049
1273
  parallelReset: ['parallelState'],
@@ -1117,51 +1341,6 @@ export class GPURigidBodyWorld {
1117
1341
  {id: `${this.id}-statistics`, byteLength: 64, usage: Buffer.STORAGE},
1118
1342
  this.simulationStatistics
1119
1343
  );
1120
- const checkpointStates = [
1121
- 'positions',
1122
- 'orientations',
1123
- 'velocities',
1124
- 'angularVelocities',
1125
- 'sleepStates',
1126
- 'targets'
1127
- ].map(name => {
1128
- const binding = bindings.find(binding => binding.name === name)!;
1129
- return {buffer: binding.buffer, resource: binding.resource};
1130
- });
1131
- const restoreCheckpoint =
1132
- this.props.failurePolicy === 'rollback'
1133
- ? this.ensembleBuffer
1134
- ? addEnsembleCheckpoint(
1135
- graph,
1136
- this.id,
1137
- checkpointStates,
1138
- {buffer: this.simulationStatistics, resource: statisticsResource},
1139
- bindings.find(binding => binding.name === 'ensemble')!,
1140
- bindings.find(binding => binding.name === 'manifolds')!,
1141
- this.props.ensembleBodiesPerInstance!,
1142
- this.maximumPairs,
1143
- allocate
1144
- )
1145
- : addRigidBodyCheckpoint(
1146
- graph,
1147
- this.id,
1148
- [
1149
- 'positions',
1150
- 'orientations',
1151
- 'velocities',
1152
- 'angularVelocities',
1153
- 'sleepStates',
1154
- 'targets',
1155
- ...(this.ensembleBuffer ? [] : ['manifolds'])
1156
- ].map(name => {
1157
- const binding = bindings.find(binding => binding.name === name)!;
1158
- return {buffer: binding.buffer, resource: binding.resource};
1159
- }),
1160
- {buffer: this.simulationStatistics, resource: statisticsResource},
1161
- allocate
1162
- )
1163
- : undefined;
1164
-
1165
1344
  const continuousSelection = new Uint32Array(this.count);
1166
1345
  for (const body of this.props.continuous?.bodies ?? [])
1167
1346
  continuousSelection[body] = this.colliders.findIndex(collider => collider.body === body) + 1;
@@ -1228,6 +1407,220 @@ export class GPURigidBodyWorld {
1228
1407
  parallelMarkSleep: 'Identify islands whose bodies are quiet enough to sleep.',
1229
1408
  parallelSleep: 'Put quiet constraint islands to sleep.'
1230
1409
  };
1410
+ let vehicleResource: {buffer: Buffer; resource: GraphBufferHandle} | undefined;
1411
+ let addVehiclePass: (() => void) | undefined;
1412
+ if (this.vehicles.length) {
1413
+ const packed = new Float32Array(this.getVehicleByteLength() / 4);
1414
+ for (const [vehicleIndex, vehicle] of this.vehicles.entries()) {
1415
+ const data = packed.subarray(
1416
+ (vehicleIndex * VEHICLE_STRIDE) / 4,
1417
+ ((vehicleIndex + 1) * VEHICLE_STRIDE) / 4
1418
+ );
1419
+ data.set(
1420
+ [
1421
+ vehicle.radius,
1422
+ vehicle.travel,
1423
+ vehicle.springRate,
1424
+ vehicle.damping,
1425
+ vehicle.grip,
1426
+ vehicle.motorTorque,
1427
+ vehicle.brakeTorque,
1428
+ vehicle.wheelInertia
1429
+ ],
1430
+ 4
1431
+ );
1432
+ new Uint32Array(data.buffer, data.byteOffset, data.length).set(
1433
+ [vehicle.chassis, vehicle.terrainCollider],
1434
+ 12
1435
+ );
1436
+ data.set([vehicle.steeringWheelbase ?? 0, vehicle.antiRollRate ?? 0], 14);
1437
+ const [longitudinalGain, lateralGain] = vehicle.slipGain ?? [1.1, 1.5];
1438
+ vehicle.wheels.forEach((wheel, index) => {
1439
+ const offset = 16 + index * 12;
1440
+ data.set([...wheel.mount, longitudinalGain + 1], offset);
1441
+ data.set(
1442
+ [Number(Boolean(wheel.steer)), Number(Boolean(wheel.drive)), lateralGain + 1],
1443
+ offset + 4
1444
+ );
1445
+ data[offset + 10] = vehicle.travel;
1446
+ data.set(
1447
+ [
1448
+ 1,
1449
+ 0,
1450
+ 0,
1451
+ 0,
1452
+ 0,
1453
+ 1,
1454
+ 0,
1455
+ 0,
1456
+ 0,
1457
+ 0,
1458
+ 1,
1459
+ 0,
1460
+ wheel.mount[0],
1461
+ wheel.mount[1],
1462
+ wheel.mount[2] - vehicle.travel,
1463
+ 1
1464
+ ],
1465
+ 64 + 16 * index
1466
+ );
1467
+ });
1468
+ }
1469
+ if (this.multiSurfaceVehicles) {
1470
+ // Place the immutable terrain rows after the unchanged vehicle pose/telemetry ranges.
1471
+ const terrainRows = new Uint32Array(packed.buffer, this.vehicles.length * VEHICLE_STRIDE);
1472
+ terrainRows.fill(0xffffffff);
1473
+ for (const [vehicleIndex, vehicle] of this.vehicles.entries())
1474
+ terrainRows.set(
1475
+ vehicle.additionalTerrainColliders ?? [],
1476
+ vehicleIndex * (VEHICLE_TERRAIN_ROW_SIZE / 4)
1477
+ );
1478
+ }
1479
+ this.vehicleBuffer = allocate('vehicle', packed);
1480
+ vehicleResource = {
1481
+ buffer: this.vehicleBuffer,
1482
+ resource: graph.importBuffer(
1483
+ {
1484
+ id: this.id + '-vehicle',
1485
+ byteLength: packed.byteLength,
1486
+ usage: Buffer.STORAGE | Buffer.COPY_SRC
1487
+ },
1488
+ this.vehicleBuffer
1489
+ )
1490
+ };
1491
+ const ensembleBinding = bindings.find(binding => binding.name === 'ensemble');
1492
+ const vehicleBindings = [
1493
+ ...bindings.filter(binding =>
1494
+ [
1495
+ 'settings',
1496
+ 'positions',
1497
+ 'orientations',
1498
+ 'velocities',
1499
+ 'angularVelocities',
1500
+ 'bodies',
1501
+ 'sleepStates',
1502
+ 'ensemble'
1503
+ ].includes(binding.name)
1504
+ ),
1505
+ {name: 'vehicle', location: 12, ...vehicleResource}
1506
+ ];
1507
+ const properties: BoundKernelProps = {
1508
+ id: this.id + '-suspension',
1509
+ source:
1510
+ readOnlyEnsembleShader(source) +
1511
+ RIGID_BODY_QUERY_GEOMETRY_SHADER +
1512
+ getVehicleShader(
1513
+ this.vehicles.length,
1514
+ this.multiSurfaceVehicles,
1515
+ this.vehiclesPerInstance
1516
+ ),
1517
+ entryPoint: 'advanceVehicle',
1518
+ shaderLayout: {
1519
+ bindings: vehicleBindings.map(
1520
+ ({name, location}): BindingDeclaration =>
1521
+ name === 'settings'
1522
+ ? {name, location, group: 0, type: 'uniform'}
1523
+ : {
1524
+ name,
1525
+ location,
1526
+ group: 0,
1527
+ type: name === 'bodies' || name === 'ensemble' ? 'read-only-storage' : 'storage'
1528
+ }
1529
+ )
1530
+ }
1531
+ };
1532
+ const executable = (
1533
+ computation: BoundKernel
1534
+ ): GPUCommandGraphComputeExecutable<Parameters> => ({
1535
+ encode: ({computePass, getBuffer}) => {
1536
+ Object.assign(
1537
+ computation.bindings,
1538
+ Object.fromEntries(
1539
+ vehicleBindings.map(binding => [binding.name, getBuffer(binding.resource)])
1540
+ )
1541
+ );
1542
+ if (ensembleBinding)
1543
+ computation.kernel.dispatchIndirect(computePass, {
1544
+ bindings: computation.bindings,
1545
+ indirectBuffer: getBuffer(ensembleBinding.resource),
1546
+ indirectOffset: 16
1547
+ });
1548
+ else
1549
+ computation.kernel.dispatch(computePass, {
1550
+ bindings: computation.bindings,
1551
+ x: this.vehicles.length
1552
+ });
1553
+ },
1554
+ destroy: () => computation.kernel.destroy()
1555
+ });
1556
+ addVehiclePass = () =>
1557
+ graph.addComputePass({
1558
+ id: properties.id!,
1559
+ description: 'Sweep four wheels and apply suspension and tire forces per chassis.',
1560
+ resources: [
1561
+ ...vehicleBindings.map(
1562
+ binding =>
1563
+ ({
1564
+ buffer: binding.resource,
1565
+ usage:
1566
+ binding.name === 'settings'
1567
+ ? 'uniform'
1568
+ : binding.name === 'bodies' || binding.name === 'ensemble'
1569
+ ? 'storage-read'
1570
+ : 'storage-read-write'
1571
+ }) as const
1572
+ ),
1573
+ ...(ensembleBinding
1574
+ ? [{buffer: ensembleBinding.resource, usage: 'indirect' as const}]
1575
+ : [])
1576
+ ],
1577
+ compile: () => executable(createBoundKernel(graph.device, properties)),
1578
+ compileAsync: async () =>
1579
+ executable(await createBoundKernelAsync(graph.device, properties))
1580
+ });
1581
+ }
1582
+ const checkpointStates = [
1583
+ 'positions',
1584
+ 'orientations',
1585
+ 'velocities',
1586
+ 'angularVelocities',
1587
+ 'sleepStates',
1588
+ 'targets'
1589
+ ].map(name => {
1590
+ const binding = bindings.find(binding => binding.name === name)!;
1591
+ return {buffer: binding.buffer, resource: binding.resource};
1592
+ });
1593
+ const restoreCheckpoint =
1594
+ this.props.failurePolicy === 'rollback'
1595
+ ? this.ensembleBuffer
1596
+ ? addEnsembleCheckpoint(
1597
+ graph,
1598
+ this.id,
1599
+ checkpointStates,
1600
+ {buffer: this.simulationStatistics, resource: statisticsResource},
1601
+ bindings.find(binding => binding.name === 'ensemble')!,
1602
+ bindings.find(binding => binding.name === 'manifolds')!,
1603
+ this.props.ensembleBodiesPerInstance!,
1604
+ this.maximumPairs,
1605
+ allocate,
1606
+ vehicleResource && {
1607
+ state: vehicleResource,
1608
+ vehiclesPerInstance: this.vehiclesPerInstance
1609
+ }
1610
+ )
1611
+ : addRigidBodyCheckpoint(
1612
+ graph,
1613
+ this.id,
1614
+ [
1615
+ ...checkpointStates,
1616
+ bindings.find(binding => binding.name === 'manifolds')!,
1617
+ ...(vehicleResource ? [vehicleResource] : [])
1618
+ ],
1619
+ {buffer: this.simulationStatistics, resource: statisticsResource},
1620
+ allocate
1621
+ )
1622
+ : undefined;
1623
+
1231
1624
  for (const entryPoint of [
1232
1625
  ...(this.ensembleBuffer
1233
1626
  ? ['ensembleClear', 'ensembleMark', 'ensembleCompact', 'ensembleDispatch']
@@ -1266,7 +1659,10 @@ export class GPURigidBodyWorld {
1266
1659
  ]
1267
1660
  : [...(extended && this.props.joints?.length ? ['meshCollect'] : []), 'solve', 'finish'])
1268
1661
  ]) {
1269
- if (entryPoint === 'integrate') restoreCheckpoint?.save?.();
1662
+ if (entryPoint === 'integrate') {
1663
+ restoreCheckpoint?.save?.();
1664
+ addVehiclePass?.();
1665
+ }
1270
1666
  if (sparse && entryPoint === 'collide') {
1271
1667
  const bodyBinding = bindings.find(binding => binding.name === 'bodies')!;
1272
1668
  const minimumBinding = bindings.find(binding => binding.name === 'minima')!;
@@ -1924,6 +2320,52 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1924
2320
  )
1925
2321
  )
1926
2322
  });
2323
+ if (this.heightFieldSlots.size && !this.ensembleBuffer) {
2324
+ this.terrainWake = createBoundKernel(graph.device, {
2325
+ id: `${this.id}-terrain-wake`,
2326
+ entryPoint: 'wakeTerrain',
2327
+ source:
2328
+ controlProperties.source +
2329
+ /* wgsl */ `
2330
+ @group(0) @binding(26) var<storage,read_write> terrainSleep:array<atomic<u32>>;
2331
+ @compute @workgroup_size(64) fn wakeTerrain(@builtin(global_invocation_id) invocation:vec3u) {
2332
+ let collider=invocation.x;if(collider>=COLLIDER_COUNT){return;}
2333
+ let body=colliderBody(collider);if(!dynamic(body)){return;}
2334
+ let tile=command.bodyIndex.x;if(bodies.colliders[tile].padding.w==0.0){return;}
2335
+ if(any(abs(colliderPosition(collider)-colliderPosition(tile))>shapeWorldExtent(collider)+shapeWorldExtent(tile)+vec3f(settings.solver.x))){return;}
2336
+ // Several colliders on one sleeping body may all overlap the tile.
2337
+ for(var axis=0u;axis<4u;axis++){atomicStore(&terrainSleep[body*4u+axis],0u);}
2338
+ }`,
2339
+ shaderLayout: {
2340
+ bindings: [
2341
+ ...shaderLayout.bindings!.filter(binding =>
2342
+ ['settings', 'positions', 'orientations', 'bodies'].includes(binding.name)
2343
+ ),
2344
+ {name: 'command', group: 0, location: 8, type: 'uniform'},
2345
+ {name: 'terrainSleep', group: 0, location: 26, type: 'storage'}
2346
+ ]
2347
+ },
2348
+ bindings: {
2349
+ settings: buffers.settings,
2350
+ positions: buffers.positions,
2351
+ orientations: buffers.orientations,
2352
+ bodies: buffers.bodies,
2353
+ command: this.controlSettings,
2354
+ terrainSleep: this.sleepStates!
2355
+ }
2356
+ });
2357
+ }
2358
+ }
2359
+
2360
+ /** Wake sleeping bodies overlapping one published terrain footprint. */
2361
+ private wakeTerrainFootprint(collider: number): void {
2362
+ const {kernel, bindings} = this.terrainWake!;
2363
+ this.controlSettings!.write(new Uint32Array([collider]), 48);
2364
+ const encoder = this.device!.createCommandEncoder();
2365
+ const pass = encoder.beginComputePass();
2366
+ kernel.dispatch(pass, {bindings, x: Math.ceil(this.colliderStorageCount / 64)});
2367
+ pass.end();
2368
+ this.device!.submit(encoder.finish());
1927
2369
  }
1928
2370
 
1929
2371
  private invalidateState(pass: Parameters<BoundKernel['kernel']['dispatch']>[0]): void {
@@ -1981,6 +2423,98 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1981
2423
  : undefined;
1982
2424
  }
1983
2425
 
2426
+ /** Set signed throttle, steering angle in radians and brake fraction for upcoming substeps. */
2427
+ setVehicleControls(throttle: number, steering: number, brake: number, vehicleIndex = 0): void {
2428
+ if (
2429
+ !this.vehicleBuffer ||
2430
+ this.destroyed ||
2431
+ !this.vehicles[vehicleIndex] ||
2432
+ ![throttle, steering, brake].every(value => Number.isFinite(Math.fround(value)))
2433
+ )
2434
+ throw new Error('Invalid vehicle controls');
2435
+ this.vehicleBuffer.write(
2436
+ new Float32Array([
2437
+ Math.max(-1, Math.min(1, throttle)),
2438
+ steering,
2439
+ Math.max(0, Math.min(1, brake)),
2440
+ 0
2441
+ ]),
2442
+ vehicleIndex * VEHICLE_STRIDE
2443
+ );
2444
+ if (this.vehiclesPerInstance) {
2445
+ const instance = Math.floor(vehicleIndex / this.vehiclesPerInstance);
2446
+ this.ensembleBuffer!.write(new Uint32Array([1]), (16 + instance * 8 + 6) * 4);
2447
+ }
2448
+ }
2449
+
2450
+ /** Borrow four column-major wheel transforms relative to the chassis node, ordered by mount. */
2451
+ get vehicleWheelPoses() {
2452
+ return this.getVehicleWheelPoses();
2453
+ }
2454
+
2455
+ /** Borrow the indexed vehicle’s four chassis-local wheel poses, in mount order. */
2456
+ getVehicleWheelPoses(vehicleIndex = 0) {
2457
+ return this.vehicleBuffer && !this.destroyed && this.vehicles[vehicleIndex]
2458
+ ? {
2459
+ buffer: this.vehicleBuffer,
2460
+ byteOffset: vehicleIndex * VEHICLE_STRIDE + 256,
2461
+ byteLength: 256
2462
+ }
2463
+ : null;
2464
+ }
2465
+
2466
+ /** Transfer wheel motion between rebuilt worlds for wheels with matching chassis-local mounts. */
2467
+ copyVehicleMotionFrom(
2468
+ previous: GPURigidBodyWorld,
2469
+ vehicleIndex = 0,
2470
+ previousVehicleIndex = 0
2471
+ ): void {
2472
+ const sourceBuffer = previous.vehicleBuffer;
2473
+ const destinationBuffer = this.vehicleBuffer;
2474
+ const previousVehicle = previous.vehicles[previousVehicleIndex];
2475
+ if (!this.device || !sourceBuffer || !destinationBuffer || !previousVehicle) return;
2476
+ const encoder = this.device.createCommandEncoder();
2477
+ this.vehicles[vehicleIndex]?.wheels.forEach((wheel, index) => {
2478
+ const sourceIndex = previousVehicle.wheels.findIndex(source =>
2479
+ source.mount.every((coordinate, axis) => coordinate === wheel.mount[axis])
2480
+ );
2481
+ if (sourceIndex < 0) return;
2482
+ encoder.copyBufferToBuffer({
2483
+ sourceBuffer,
2484
+ destinationBuffer,
2485
+ sourceOffset: previousVehicleIndex * VEHICLE_STRIDE + 92 + sourceIndex * 48,
2486
+ destinationOffset: vehicleIndex * VEHICLE_STRIDE + 92 + index * 48,
2487
+ size: 20
2488
+ });
2489
+ encoder.copyBufferToBuffer({
2490
+ sourceBuffer,
2491
+ destinationBuffer,
2492
+ sourceOffset: previousVehicleIndex * VEHICLE_STRIDE + 256 + sourceIndex * 64,
2493
+ destinationOffset: vehicleIndex * VEHICLE_STRIDE + 256 + index * 64,
2494
+ size: 64
2495
+ });
2496
+ });
2497
+ this.device.submit(encoder.finish());
2498
+ }
2499
+
2500
+ /** Read wheel spin, angle, suspension length and normal load after submitted steps. */
2501
+ async readVehicleWheels(vehicleIndex = 0) {
2502
+ if (!this.vehicleBuffer || this.destroyed || !this.vehicles[vehicleIndex])
2503
+ throw new Error('Vehicle unavailable');
2504
+ const bytes = await this.vehicleBuffer.readAsync(vehicleIndex * VEHICLE_STRIDE, 256);
2505
+ const values = new Float32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4);
2506
+ return Array.from({length: 4}, (_, index) => {
2507
+ const offset = 24 + index * 12;
2508
+ return {
2509
+ speed: values[offset],
2510
+ angle: values[offset + 1],
2511
+ length: values[offset + 2],
2512
+ load: values[offset + 3],
2513
+ steering: values[offset - 1]
2514
+ };
2515
+ });
2516
+ }
2517
+
1984
2518
  /** Submit an impulse at a world-space point, or the current GPU center of mass when omitted. */
1985
2519
  applyImpulse(body: number, impulse: Vector3, point?: Vector3): void {
1986
2520
  if (
@@ -2115,7 +2649,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2115
2649
  indices.has(edit.collider) ||
2116
2650
  previous.type !== shape.type ||
2117
2651
  shape.type === 'convex-hull' ||
2118
- shape.type === 'triangle-mesh'
2652
+ shape.type === 'triangle-mesh' ||
2653
+ shape.type === 'height-field'
2119
2654
  )
2120
2655
  throw new Error('Shape edit requires a topology rebuild');
2121
2656
  indices.add(edit.collider);
@@ -2151,6 +2686,115 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2151
2686
  }
2152
2687
  }
2153
2688
 
2689
+ /**
2690
+ * Replace or evict fixed-dimension height-field tiles between submissions.
2691
+ * Optional positions are in each collider's body-local frame. The caller owns
2692
+ * tile selection and must submit already encoded steps before editing residency.
2693
+ */
2694
+ setHeightFieldTiles(edits: readonly GPURigidBodyHeightFieldEdit[]): void {
2695
+ if (!edits.length) return;
2696
+ const metadata = this.ownedBuffers.find(buffer => buffer.id === `${this.id}-bodies`);
2697
+ if (!metadata || this.destroyed || this.queryPending || this.eventRead || this.triggerRead)
2698
+ throw new Error('Terrain streaming requires an idle attached world');
2699
+ const seen = new Set<number>();
2700
+ const packedFields = this.terrainAtlas
2701
+ ? new Map<
2702
+ GPURigidBodyHeightField,
2703
+ {
2704
+ field: GPURigidBodyHeightField;
2705
+ packed: ReturnType<typeof packRigidBodyHeightField>;
2706
+ data: Float32Array | null;
2707
+ }
2708
+ >()
2709
+ : undefined;
2710
+ const replacements = edits.map(({collider: colliderIndex, field, position}) => {
2711
+ const collider = this.colliders[colliderIndex];
2712
+ const offset = this.heightFieldSlots.get(colliderIndex);
2713
+ if (
2714
+ (offset === undefined &&
2715
+ !(this.terrainAtlas && this.ensembleTerrainSlots.has(colliderIndex))) ||
2716
+ collider?.shape.type !== 'height-field' ||
2717
+ seen.has(colliderIndex)
2718
+ )
2719
+ throw new Error('Invalid writable height-field slot');
2720
+ seen.add(colliderIndex);
2721
+ const previous = collider.shape.field;
2722
+ if (field && (field.width !== previous.width || field.height !== previous.height))
2723
+ throw new Error('Height-field slot dimensions are fixed');
2724
+ const center = this.props.bodies[collider.body].centerOfMass ?? [0, 0, 0];
2725
+ const localOffset = position?.map((value, axis) => value - center[axis]);
2726
+ if (
2727
+ position &&
2728
+ (position.length !== 3 || !localOffset?.every(value => Number.isFinite(Math.fround(value))))
2729
+ )
2730
+ throw new Error('Invalid height-field tile position');
2731
+ let payload = field ? packedFields?.get(field) : undefined;
2732
+ if (!payload) {
2733
+ const next = field
2734
+ ? structuredClone(field)
2735
+ : {...previous, heights: undefined, validity: undefined};
2736
+ const packed = packRigidBodyHeightField(next);
2737
+ const data = packedFields && packed.nodeCount ? new Float32Array(packed.data) : null;
2738
+ payload = {field: next, packed, data};
2739
+ if (field) packedFields?.set(field, payload);
2740
+ }
2741
+ return {collider, colliderIndex, offset, position, localOffset, ...payload};
2742
+ });
2743
+ const atlas = this.terrainAtlas?.bind(
2744
+ replacements.map(({colliderIndex, data}) => ({collider: colliderIndex, data}))
2745
+ );
2746
+ // Stamp once per validated edit batch. On float32 counter wrap, clear old impulses
2747
+ // so a retained contact cannot confuse a new stamp with a very old revision.
2748
+ if (this.terrainRevision === 0xffffff) {
2749
+ this.wake();
2750
+ this.terrainRevision = 1;
2751
+ }
2752
+ const revision = ++this.terrainRevision;
2753
+ for (const {word, data} of atlas?.uploads ?? [])
2754
+ metadata.write(data, (this.terrainAtlasWord + word) * 4);
2755
+ const changedBodies = new Set<number>();
2756
+ const affectedInstances = new Set<number>();
2757
+ for (const replacement of replacements) {
2758
+ const {collider, colliderIndex, offset, field, position, localOffset, packed} = replacement;
2759
+ const base = this.count * 48 + colliderIndex * 96;
2760
+ if (this.terrainWake) this.wakeTerrainFootprint(colliderIndex);
2761
+ if (atlas) {
2762
+ const word = atlas.wordsByCollider.get(colliderIndex);
2763
+ const address =
2764
+ word === undefined ? 0 : (this.terrainAtlasWord - this.terrainGeometryWord + word) / 4;
2765
+ metadata.write(
2766
+ new Float32Array([
2767
+ word === undefined ? 0 : address + packed.nodeOffset,
2768
+ packed.nodeCount,
2769
+ address
2770
+ ]),
2771
+ base + 72
2772
+ );
2773
+ } else {
2774
+ metadata.write(new Float32Array(packed.data), offset!);
2775
+ metadata.write(new Float32Array([packed.nodeCount]), base + 76);
2776
+ }
2777
+ metadata.write(new Float32Array(packed.extent), base);
2778
+ metadata.write(new Float32Array([revision, packed.triangleCount]), base + 88);
2779
+ if (position && localOffset) {
2780
+ metadata.write(new Float32Array(localOffset), base + 16);
2781
+ collider.position = [...position];
2782
+ }
2783
+ collider.shape = {type: 'height-field', field};
2784
+ changedBodies.add(collider.body);
2785
+ if (this.terrainWake) this.wakeTerrainFootprint(colliderIndex);
2786
+ if (this.props.ensembleBodiesPerInstance)
2787
+ affectedInstances.add(Math.floor(collider.body / this.props.ensembleBodiesPerInstance));
2788
+ }
2789
+ for (const body of changedBodies) this.updateColliderDefinitions(body);
2790
+ for (const instance of affectedInstances) this.wakeEnsembleInstance(instance);
2791
+ }
2792
+
2793
+ /** Shared atlas utilization, when the fused layout enabled page sharing. */
2794
+ getTerrainAtlasStats(): GPUPhysicsTerrainAtlasStats | undefined {
2795
+ return this.terrainAtlas?.getStats();
2796
+ }
2797
+
2154
2798
  /** Change an existing collider material between submissions, invalidating cached friction. */
2155
2799
  setColliderMaterial(colliderIndex: number, material: GPURigidBodyMaterial): void {
2156
2800
  const collider = this.colliders[colliderIndex];
@@ -2238,11 +2882,9 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2238
2882
  private updateColliderDefinitions(bodyIndex: number): void {
2239
2883
  const {shape, colliders, ...properties} = this.props.bodies[bodyIndex];
2240
2884
  const updated = this.colliders
2241
- .filter(candidate => candidate.body === bodyIndex)
2885
+ .slice(this.bodyColliderStarts[bodyIndex], this.bodyColliderStarts[bodyIndex + 1])
2242
2886
  .map(({body, ...candidate}) => candidate);
2243
- const bodies = [...this.props.bodies];
2244
- bodies[bodyIndex] = {...properties, colliders: updated};
2245
- this.props.bodies = bodies;
2887
+ (this.props.bodies as GPURigidBody[])[bodyIndex] = {...properties, colliders: updated};
2246
2888
  }
2247
2889
 
2248
2890
  getColliderMaterial(collider: number): GPURigidBodyMaterial {
@@ -2251,17 +2893,19 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2251
2893
  return structuredClone(definition.material ?? {});
2252
2894
  }
2253
2895
 
2254
- private restoreColliderDefinitions(): void {
2255
- // Body definitions are already world-owned. Keep their shared geometry identities.
2256
- const definitions = this.props.bodies.flatMap(
2257
- body => body.colliders ?? (body.shape ? [{shape: body.shape}] : [])
2258
- );
2259
- for (const [index, definition] of definitions.entries()) {
2260
- const collider = this.colliders[index];
2261
- collider.shape = definition.shape;
2262
- collider.material = definition.material;
2263
- collider.position = definition.position;
2264
- collider.orientation = definition.orientation;
2896
+ private restoreColliderDefinitions(first = 0, end = this.count): void {
2897
+ // Body definitions are world-owned. Keep shared geometry identities.
2898
+ for (let body = first; body < end; body++) {
2899
+ const definition = this.props.bodies[body];
2900
+ const colliders =
2901
+ definition.colliders ?? (definition.shape ? [{shape: definition.shape}] : []);
2902
+ for (const [index, source] of colliders.entries()) {
2903
+ const collider = this.colliders[this.bodyColliderStarts[body] + index];
2904
+ collider.shape = source.shape;
2905
+ collider.material = source.material;
2906
+ collider.position = source.position;
2907
+ collider.orientation = source.orientation;
2908
+ }
2265
2909
  }
2266
2910
  }
2267
2911
 
@@ -2304,7 +2948,9 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2304
2948
  validateRigidBodyJoints(this.props.joints, proposedBodies, this.solver);
2305
2949
  }
2306
2950
  const colliders = this.colliders.filter(collider => collider.body === bodyIndex);
2307
- for (const collider of colliders)
2951
+ for (const collider of colliders) {
2952
+ if (collider.shape.type === 'height-field' && mode !== 'static')
2953
+ throw new Error('Height fields require static bodies');
2308
2954
  if (
2309
2955
  (collider.shape.type === 'convex-hull' || collider.shape.type === 'triangle-mesh') &&
2310
2956
  mode !== 'static' &&
@@ -2313,6 +2959,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2313
2959
  !(getRigidBodyShapeProperties(collider.shape).volume > 0))
2314
2960
  )
2315
2961
  throw new Error('Dynamic meshes require closed positive-volume geometry');
2962
+ }
2316
2963
  if (
2317
2964
  this.props.continuous?.bodies.includes(bodyIndex) &&
2318
2965
  (mode !== 'dynamic' ||
@@ -2745,6 +3392,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2745
3392
  let bodyDefinitions = structuredClone(this.props.bodies);
2746
3393
  let contactCursor = 0;
2747
3394
  let triggerCursor = 0;
3395
+ let terrainRevision = this.terrainRevision;
3396
+ let terrainAtlas = this.terrainAtlas?.snapshot();
2748
3397
  try {
2749
3398
  for (const buffer of checkpointBuffers)
2750
3399
  snapshots.push(
@@ -2783,6 +3432,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2783
3432
  publicationBounds = structuredClone(this.props.publicationBounds);
2784
3433
  contactCursor = this.eventCursor;
2785
3434
  triggerCursor = this.triggerCursor;
3435
+ terrainRevision = this.terrainRevision;
3436
+ terrainAtlas = this.terrainAtlas?.snapshot();
2786
3437
  saved = true;
2787
3438
  },
2788
3439
  restore: () => {
@@ -2796,6 +3447,12 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2796
3447
  this.props.publicationBounds = structuredClone(publicationBounds);
2797
3448
  this.eventCursor = contactCursor;
2798
3449
  this.triggerCursor = triggerCursor;
3450
+ this.terrainRevision = terrainRevision;
3451
+ if (terrainAtlas)
3452
+ this.terrainAtlas!.restore(
3453
+ terrainAtlas.leases,
3454
+ (_word, _words, page) => terrainAtlas!.payloads.get(page)!
3455
+ );
2799
3456
  },
2800
3457
  destroy: () => {
2801
3458
  if (released) return;
@@ -2822,6 +3479,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2822
3479
  colliderShapeScales: structuredClone([...this.colliderShapeScales]),
2823
3480
  contactCursor: this.eventCursor,
2824
3481
  triggerCursor: this.triggerCursor,
3482
+ terrainRevision: this.terrainRevision,
3483
+ terrainAtlasLeases: this.terrainAtlas?.getLeases(),
2825
3484
  buffers: await Promise.all(
2826
3485
  this.getSnapshotBuffers(options.includeRollbackScratch).map(async buffer => ({
2827
3486
  name: buffer.id.slice(this.id.length + 1),
@@ -2834,6 +3493,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2834
3493
  /** Restore between submissions on the same configuration and implementation; no implicit wake. */
2835
3494
  restoreState(capture: GPURigidBodyCapture): void {
2836
3495
  const checkpointBuffers = this.getSnapshotBuffers(capture.includeRollbackScratch);
3496
+ const terrainRevision = capture.terrainRevision ?? 1;
2837
3497
  if (
2838
3498
  !this.device ||
2839
3499
  this.destroyed ||
@@ -2841,6 +3501,10 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2841
3501
  this.eventRead ||
2842
3502
  this.triggerRead ||
2843
3503
  capture.version !== 1 ||
3504
+ Boolean(capture.terrainAtlasLeases) !== Boolean(this.terrainAtlas) ||
3505
+ !Number.isInteger(terrainRevision) ||
3506
+ terrainRevision < 1 ||
3507
+ terrainRevision > 0xffffff ||
2844
3508
  (capture.origin !== undefined &&
2845
3509
  (capture.origin.length !== 3 || !capture.origin.every(Number.isFinite))) ||
2846
3510
  capture.buffers.length !== checkpointBuffers.length ||
@@ -2866,6 +3530,29 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2866
3530
  )
2867
3531
  throw new Error('Incompatible rigid-body capture storage');
2868
3532
  }
3533
+ if (this.terrainAtlas && capture.terrainAtlasLeases) {
3534
+ const metadata = capture.buffers.find(buffer => buffer.name === 'bodies')!.data;
3535
+ const view = new DataView(metadata.buffer, metadata.byteOffset, metadata.byteLength);
3536
+ const colliderBase = this.count * 48;
3537
+ let active = 0;
3538
+ for (const collider of this.ensembleTerrainSlots)
3539
+ if (view.getFloat32(colliderBase + collider * 96 + 76, true) > 0) active++;
3540
+ if (active !== capture.terrainAtlasLeases.length)
3541
+ throw new Error('Incomplete captured terrain atlas leases');
3542
+ this.terrainAtlas.restore(
3543
+ capture.terrainAtlasLeases,
3544
+ (word, words) => {
3545
+ const first = (this.terrainAtlasWord + word) * 4;
3546
+ return new Float32Array(metadata.slice(first, first + words * 4).buffer);
3547
+ },
3548
+ (collider, word) => {
3549
+ const base = colliderBase + collider * 96;
3550
+ const address = (this.terrainAtlasWord - this.terrainGeometryWord + word) / 4;
3551
+ if (view.getFloat32(base + 76, true) <= 0 || view.getFloat32(base + 80, true) !== address)
3552
+ throw new Error('Captured terrain collider has an invalid page address');
3553
+ }
3554
+ );
3555
+ }
2869
3556
  for (const [index, buffer] of checkpointBuffers.entries())
2870
3557
  buffer.write(capture.buffers[index].data);
2871
3558
  this.props.joints = structuredClone(capture.props.joints);
@@ -2876,6 +3563,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2876
3563
  this.worldOrigin = [...(capture.origin ?? [0, 0, 0])];
2877
3564
  this.eventCursor = capture.contactCursor;
2878
3565
  this.triggerCursor = capture.triggerCursor;
3566
+ this.terrainRevision = terrainRevision;
2879
3567
  }
2880
3568
 
2881
3569
  /** Stop submissions first. Reconstruct with these accepted poses and larger budgets after rollback. */
@@ -3022,6 +3710,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
3022
3710
  this.destroyed = true;
3023
3711
  this.control?.kernel.destroy();
3024
3712
  this.invalidation?.kernel.destroy();
3713
+ this.terrainWake?.kernel.destroy();
3025
3714
  this.queryComputation?.kernel.destroy();
3026
3715
  this.queryReduction?.kernel.destroy();
3027
3716
  for (const buffer of this.ownedBuffers) buffer.destroy();
@@ -3046,7 +3735,13 @@ function serializeCaptureProps(props: GPURigidBodyWorldProps): string {
3046
3735
  shape:
3047
3736
  collider.shape?.type === 'convex-hull' || collider.shape?.type === 'triangle-mesh'
3048
3737
  ? collider.shape
3049
- : {type: collider.shape?.type},
3738
+ : collider.shape?.type === 'height-field'
3739
+ ? {
3740
+ type: collider.shape.type,
3741
+ width: collider.shape.field.width,
3742
+ height: collider.shape.field.height
3743
+ }
3744
+ : {type: collider.shape?.type},
3050
3745
  material: undefined,
3051
3746
  position: undefined,
3052
3747
  orientation: undefined