@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
@@ -4,9 +4,11 @@
4
4
  import { createBoundKernel, createBoundKernelAsync } from "../gpu-core/utils/bound-kernel.js";
5
5
  import { Buffer } from '@luma.gl/core';
6
6
  import { shiftRigidBodyBuffers } from "./rigid-body-origin.js";
7
+ import { packRigidBodyHeightField } from "./rigid-body-height-field.js";
7
8
  import { getRigidBodyShapeProperties } from "./rigid-body-shape-properties.js";
8
9
  import { addEnsembleStatus, readOnlyEnsembleShader } from "./rigid-body-ensemble-shaders.js";
9
10
  import { makeEnsembleReset } from "./rigid-body-ensemble-reset.js";
11
+ import { RigidBodyTerrainAtlas } from "./rigid-body-terrain-atlas.js";
10
12
  import { packRigidBodyShapes } from "./rigid-body-geometry.js";
11
13
  import { getCompoundBodyInertia, normalizeRigidBodyRotation, rotateRigidBodyVector } from "./rigid-body-properties.js";
12
14
  import { addGPUCommandNodes } from "../gpu-core/gpu-command-node.js";
@@ -22,6 +24,7 @@ import { addRigidBodyCheckpoint } from "./rigid-body-transaction.js";
22
24
  import { getRigidBodyJointShader, packRigidBodyJointState, RIGID_BODY_JOINT_STATE_BYTES, validateRigidBodyJoints } from "./rigid-body-joints.js";
23
25
  import { addRigidBodyPosePublication } from "./rigid-body-publication.js";
24
26
  import { getRigidBodyShader } from "./rigid-body-shaders.js";
27
+ import { getVehicleShader, VEHICLE_STRIDE, VEHICLE_TERRAIN_ROW_SIZE } from "./rigid-body-vehicle.js";
25
28
  import { decodeRigidBodyContactEvents, getRigidBodyEventShader } from "./rigid-body-events.js";
26
29
  import { RIGID_BODY_QUERY_SHADER } from "./rigid-body-queries.js";
27
30
  export class GPURigidBodyWorld {
@@ -52,6 +55,13 @@ export class GPURigidBodyWorld {
52
55
  eventRead = null;
53
56
  queryComputation = null;
54
57
  queryReduction = null;
58
+ /** Chassis definitions in GPU storage order. */
59
+ vehicles;
60
+ /** Whether any chassis has more than one terrain candidate. */
61
+ multiSurfaceVehicles;
62
+ /** Number of vehicles in each equal-sized ensemble partition, or zero for a standalone world. */
63
+ vehiclesPerInstance;
64
+ vehicleBuffer = null;
55
65
  querySettings = null;
56
66
  querySelection = null;
57
67
  queryOutput = null;
@@ -59,9 +69,23 @@ export class GPURigidBodyWorld {
59
69
  targets = null;
60
70
  simulationStatistics = null;
61
71
  colliders;
72
+ bodyColliderStarts;
73
+ ensembleTerrainSlots;
62
74
  props;
63
75
  ownedBuffers = [];
76
+ allocationPlan;
64
77
  ensembleBuffer = null;
78
+ /** Byte offsets of writable fixed-dimension height fields in the world metadata buffer. */
79
+ heightFieldSlots = new Map();
80
+ /** Float32-exact edit stamp, restored together with the contact cache. */
81
+ terrainRevision = 1;
82
+ terrainWake = null;
83
+ /** Page ownership and live lease counts for an opt-in fused atlas. */
84
+ terrainAtlas;
85
+ /** Start of the shared atlas in the GPU metadata buffer, measured in 32-bit words. */
86
+ terrainAtlasWord = 0;
87
+ /** Start of the shader geometry region in the GPU metadata buffer, measured in 32-bit words. */
88
+ terrainGeometryWord = 0;
65
89
  ensembleResetOrigin;
66
90
  ensembleReset;
67
91
  initialEnsembleBodies;
@@ -91,6 +115,8 @@ export class GPURigidBodyWorld {
91
115
  this.solver = props.solver ?? 'ordered';
92
116
  if (!['ordered', 'parallel'].includes(this.solver))
93
117
  throw new Error('Invalid rigid-body solver');
118
+ if (!['scalar', 'block'].includes(props.parallelContactSolver ?? 'scalar'))
119
+ throw new Error('Invalid parallel contact solver');
94
120
  validateRigidBodyJoints(props.joints ?? [], props.bodies, this.solver);
95
121
  const colliderCount = props.bodies.reduce((sum, body) => sum + (body.colliders?.length ?? 1), 0);
96
122
  this.broadPhase =
@@ -142,6 +168,9 @@ export class GPURigidBodyWorld {
142
168
  throw new Error('Supply shape or colliders');
143
169
  const shapes = body.colliders ?? (body.shape ? [{ shape: body.shape }] : []);
144
170
  for (const collider of shapes) {
171
+ if (collider.shape.type === 'height-field' &&
172
+ (body.mode ?? (body.mass === 0 ? 'static' : 'dynamic')) !== 'static')
173
+ throw new Error('Height fields require static bodies');
145
174
  const properties = getRigidBodyShapeProperties(collider.shape);
146
175
  if (!Number.isFinite(properties.volume) ||
147
176
  !properties.center.every(Number.isFinite) ||
@@ -249,7 +278,7 @@ export class GPURigidBodyWorld {
249
278
  (props.continuous.maximumCandidates ?? this.maximumPairs) > 0x40000000 ||
250
279
  (props.continuous.mode === 'convex' &&
251
280
  (Boolean(props.joints?.length) ||
252
- colliders.some(collider => ['plane', 'triangle-mesh'].includes(collider.shape.type)))))
281
+ colliders.some(collider => ['plane', 'triangle-mesh', 'height-field'].includes(collider.shape.type)))))
253
282
  throw new Error('Invalid continuous settings');
254
283
  for (const index of props.continuous.bodies) {
255
284
  const body = props.bodies[index];
@@ -276,13 +305,90 @@ export class GPURigidBodyWorld {
276
305
  }
277
306
  // Clone together so collider edits preserve geometry identity in captured body definitions.
278
307
  const definitions = structuredClone({ colliders, props });
279
- this.colliders = definitions.colliders;
280
308
  this.props = definitions.props;
309
+ this.colliders = definitions.colliders;
310
+ this.ensembleTerrainSlots = new Set(this.props.ensembleTerrainSlots);
311
+ if (this.ensembleTerrainSlots.size &&
312
+ (!this.props.ensembleBodiesPerInstance ||
313
+ [...this.ensembleTerrainSlots].some(index => this.colliders[index]?.shape.type !== 'height-field')))
314
+ throw new Error('Invalid ensemble terrain slots');
315
+ if (this.props.ensembleTerrainAtlas) {
316
+ this.terrainAtlas = new RigidBodyTerrainAtlas(this.props.ensembleTerrainAtlas, Array.from(this.ensembleTerrainSlots, collider => {
317
+ const shape = this.colliders[collider].shape;
318
+ if (shape.type !== 'height-field')
319
+ throw new Error('Invalid ensemble terrain slot');
320
+ return { collider, width: shape.field.width, height: shape.field.height };
321
+ }));
322
+ }
323
+ this.bodyColliderStarts = new Uint32Array(this.count + 1);
324
+ let colliderIndex = 0;
325
+ for (let body = 0; body < this.count; body++) {
326
+ this.bodyColliderStarts[body] = colliderIndex;
327
+ while (this.colliders[colliderIndex]?.body === body)
328
+ colliderIndex++;
329
+ }
330
+ this.bodyColliderStarts[this.count] = colliderIndex;
331
+ if (this.props.vehicle && this.props.vehicles)
332
+ throw new Error('Choose vehicle or vehicles');
333
+ this.vehicles = this.props.vehicles ?? (this.props.vehicle ? [this.props.vehicle] : []);
334
+ this.multiSurfaceVehicles = this.vehicles.some(vehicle => vehicle.additionalTerrainColliders?.length);
335
+ const bodiesPerInstance = props.ensembleBodiesPerInstance;
336
+ const collidersPerInstance = props.collisionPartitionSize;
337
+ this.vehiclesPerInstance = bodiesPerInstance
338
+ ? this.vehicles.length / (this.count / bodiesPerInstance)
339
+ : 0;
340
+ if (!Number.isInteger(this.vehiclesPerInstance))
341
+ throw new Error('Invalid ensemble vehicle layout');
342
+ const vehicleChassis = new Set();
343
+ for (const [vehicleIndex, vehicle] of this.vehicles.entries()) {
344
+ const instance = bodiesPerInstance ? Math.floor(vehicleIndex / this.vehiclesPerInstance) : 0;
345
+ const terrainIndices = [
346
+ vehicle.terrainCollider,
347
+ ...(vehicle.additionalTerrainColliders ?? [])
348
+ ];
349
+ const chassis = this.props.bodies[vehicle.chassis];
350
+ if (!chassis ||
351
+ vehicleChassis.has(vehicle.chassis) ||
352
+ terrainIndices.length > 4 ||
353
+ new Set(terrainIndices).size !== terrainIndices.length ||
354
+ terrainIndices.some(colliderIndex => {
355
+ const collider = this.colliders[colliderIndex];
356
+ const ground = collider && this.props.bodies[collider.body];
357
+ return (!ground ||
358
+ collider.isTrigger ||
359
+ this.getBodyMode(collider.body) !== 'static' ||
360
+ (bodiesPerInstance && Math.floor(colliderIndex / collidersPerInstance) !== instance));
361
+ }) ||
362
+ (chassis.mode ?? (chassis.mass === 0 ? 'static' : 'dynamic')) !== 'dynamic' ||
363
+ vehicle.wheels.length !== 4 ||
364
+ (bodiesPerInstance && Math.floor(vehicle.chassis / bodiesPerInstance) !== instance) ||
365
+ ![vehicle.radius, vehicle.travel, vehicle.springRate, vehicle.wheelInertia].every(value => Number.isFinite(value) && value > 0) ||
366
+ ![vehicle.damping, vehicle.grip, vehicle.motorTorque, vehicle.brakeTorque].every(value => Number.isFinite(value) && value >= 0) ||
367
+ (vehicle.steeringWheelbase !== undefined &&
368
+ (!Number.isFinite(Math.fround(vehicle.steeringWheelbase)) ||
369
+ vehicle.steeringWheelbase <= 0)) ||
370
+ !Number.isFinite(Math.fround(vehicle.antiRollRate ?? 0)) ||
371
+ (vehicle.antiRollRate ?? 0) < 0 ||
372
+ (vehicle.slipGain !== undefined &&
373
+ (vehicle.slipGain.length !== 2 ||
374
+ !vehicle.slipGain.every(gain => Number.isFinite(Math.fround(gain)) && gain >= 0))) ||
375
+ vehicle.wheels.some(wheel => wheel.mount.length !== 3 || !wheel.mount.every(Number.isFinite)))
376
+ throw new Error('Invalid vehicle configuration');
377
+ vehicleChassis.add(vehicle.chassis);
378
+ }
281
379
  if (props.ensembleBodiesPerInstance)
282
380
  this.initialEnsembleBodies = this.props.bodies.slice(0, props.ensembleBodiesPerInstance);
283
381
  }
382
+ /** Allocation size including optional immutable terrain rows after the wheel state. */
383
+ getVehicleByteLength() {
384
+ return (this.vehicles.length *
385
+ (VEHICLE_STRIDE + (this.multiSurfaceVehicles ? VEHICLE_TERRAIN_ROW_SIZE : 0)));
386
+ }
284
387
  getStorageLayout() {
285
- const packed = packRigidBodyShapes(this.colliders);
388
+ const packed = packRigidBodyShapes(this.colliders, Boolean(this.props.ensembleBodiesPerInstance), this.ensembleTerrainSlots, Boolean(this.terrainAtlas));
389
+ const geometryWords = packed.geometry.length + (this.terrainAtlas?.wordLength ?? 0);
390
+ if (this.terrainAtlas && geometryWords >= 2 ** 26)
391
+ throw new Error('Terrain atlas exceeds address capacity');
286
392
  const sparse = this.broadPhase === 'hierarchical-grid';
287
393
  const extended = this.colliders.some(collider => (collider.shape.type !== 'sphere' && collider.shape.type !== 'box') ||
288
394
  (collider.isTrigger && collider.shape.type !== 'sphere'));
@@ -292,8 +398,19 @@ export class GPURigidBodyWorld {
292
398
  sparse,
293
399
  extended,
294
400
  parallel,
295
- ...getRigidBodyStorageLayout(this.count, this.colliderStorageCount, this.maximumPairs, packed.geometry.length, sparse, extended, parallel, this.props.eventCapacity ?? 0, this.props.enableQueries ?? false, this.props.failurePolicy === 'rollback', Boolean(this.props.continuous), this.props.joints?.length ?? 0, this.props.ensembleBodiesPerInstance ? this.count / this.props.ensembleBodiesPerInstance : 0)
401
+ ...getRigidBodyStorageLayout(this.count, this.colliderStorageCount, this.maximumPairs, geometryWords, sparse, extended, parallel, this.props.eventCapacity ?? 0, this.props.enableQueries ?? false, this.props.failurePolicy === 'rollback', Boolean(this.props.continuous), this.props.joints?.length ?? 0, this.props.ensembleBodiesPerInstance ? this.count / this.props.ensembleBodiesPerInstance : 0)
296
402
  };
403
+ if (this.vehicles.length) {
404
+ const byteLength = this.getVehicleByteLength();
405
+ storage.buffers.push({ name: 'vehicle', byteLength, uniform: false });
406
+ if (this.props.failurePolicy === 'rollback') {
407
+ storage.buffers.push({
408
+ name: this.vehiclesPerInstance ? 'checkpoint-vehicles' : 'checkpoint-7',
409
+ byteLength: this.vehiclesPerInstance ? this.vehicles.length * VEHICLE_STRIDE : byteLength,
410
+ uniform: false
411
+ });
412
+ }
413
+ }
297
414
  if (this.props.continuous?.mode === 'convex') {
298
415
  storage.buffers = storage.buffers.filter(buffer => buffer.name !== 'continuous-previous');
299
416
  storage.buffers.push({ name: 'continuous-dispatch', byteLength: 16, uniform: false });
@@ -346,7 +463,7 @@ export class GPURigidBodyWorld {
346
463
  if (!this.device || !this.ensembleBuffer || this.destroyed)
347
464
  throw new Error('World has no ensemble scheduler');
348
465
  this.ensembleResetOrigin ??= this.origin;
349
- this.ensembleReset ??= makeEnsembleReset(this.device, this.id, this.ownedBuffers, this.count, this.props.ensembleBodiesPerInstance, this.props.collisionPartitionSize, this.maximumPairs);
466
+ this.ensembleReset ??= makeEnsembleReset(this.device, this.id, this.ownedBuffers, this.count, this.props.ensembleBodiesPerInstance, this.props.collisionPartitionSize, this.maximumPairs, this.vehiclesPerInstance, this.ensembleTerrainSlots);
350
467
  return this.ensembleReset.byteLength;
351
468
  }
352
469
  resetEnsembleInstance(instance) {
@@ -357,35 +474,36 @@ export class GPURigidBodyWorld {
357
474
  const colliderStart = instance * this.props.collisionPartitionSize;
358
475
  let colliderIndex = colliderStart;
359
476
  const restored = this.initialEnsembleBodies.map(body => {
360
- if (body.shape) {
361
- const current = this.colliders[colliderIndex++].shape;
477
+ const { shape, colliders, ...properties } = body;
478
+ const resetCollider = (definition) => {
479
+ const index = colliderIndex++;
480
+ const { body: _, ...current } = this.colliders[index];
481
+ if (this.ensembleTerrainSlots.has(index))
482
+ return current;
362
483
  return {
363
- ...body,
364
- shape: body.shape.type === 'convex-hull' || body.shape.type === 'triangle-mesh'
365
- ? current
366
- : body.shape
484
+ ...definition,
485
+ shape: definition.shape.type === 'convex-hull' || definition.shape.type === 'triangle-mesh'
486
+ ? current.shape
487
+ : definition.shape,
488
+ excludedColliders: definition.excludedColliders?.map(index => index + colliderStart)
367
489
  };
368
- }
369
- return {
370
- ...body,
371
- colliders: body.colliders.map(collider => {
372
- const current = this.colliders[colliderIndex++].shape;
373
- return {
374
- ...collider,
375
- shape: collider.shape.type === 'convex-hull' || collider.shape.type === 'triangle-mesh'
376
- ? current
377
- : collider.shape,
378
- excludedColliders: collider.excludedColliders?.map(index => index + colliderStart)
379
- };
380
- })
381
490
  };
491
+ if (shape && !this.ensembleTerrainSlots.has(colliderIndex))
492
+ return { ...body, shape: resetCollider({ shape }).shape };
493
+ return { ...properties, colliders: (colliders ?? [{ shape: shape }]).map(resetCollider) };
382
494
  });
383
- const definitions = [...this.props.bodies];
495
+ const definitions = this.props.bodies;
384
496
  definitions.splice(bodyStart, restored.length, ...restored);
385
- this.props.bodies = definitions;
386
- for (let collider = colliderStart; collider < colliderStart + this.props.collisionPartitionSize; collider++)
387
- this.colliderShapeScales.delete(collider);
388
- this.restoreColliderDefinitions();
497
+ this.restoreColliderDefinitions(bodyStart, bodyStart + restored.length);
498
+ const metadata = this.ownedBuffers.find(buffer => buffer.id === `${this.id}-bodies`);
499
+ for (let index = colliderStart; index < colliderIndex; index++) {
500
+ this.colliderShapeScales.delete(index);
501
+ if (!this.ensembleTerrainSlots.has(index))
502
+ continue;
503
+ const collider = this.colliders[index];
504
+ const center = definitions[collider.body].centerOfMass ?? [0, 0, 0];
505
+ metadata.write(new Float32Array((collider.position ?? [0, 0, 0]).map((value, axis) => value - center[axis])), this.count * 48 + index * 96 + 16);
506
+ }
389
507
  this.ensembleReset.reset(instance, this.origin.map((value, axis) => value - this.ensembleResetOrigin[axis]));
390
508
  this.ensembleBuffer.write(new Uint32Array([0, 0, 0, 0, 1, 1]), (16 + instance * 8 + 1) * 4);
391
509
  if (this.encodePosePublication) {
@@ -430,6 +548,7 @@ export class GPURigidBodyWorld {
430
548
  claimedContacts,
431
549
  journaledContacts,
432
550
  bodySnapshotBytes: activeBodies * 80,
551
+ vehicleSnapshotBytes: activeInstances * this.vehiclesPerInstance * VEHICLE_STRIDE,
433
552
  contactSnapshotBytes: journaledContacts * 416,
434
553
  allocatorSnapshotBytes: (8 + activeInstances * 2 + journaledContacts * 3) * 4,
435
554
  residentInstances: this.count / this.props.ensembleBodiesPerInstance,
@@ -447,7 +566,9 @@ export class GPURigidBodyWorld {
447
566
  }
448
567
  /** Allocation preflight without GPU allocation. Graph scratch and driver overhead are separate. */
449
568
  getCapacityInfo() {
450
- const { buffers } = this.getStorageLayout();
569
+ const buffers = this.allocationPlan
570
+ ? this.allocationPlan.map(buffer => ({ ...buffer }))
571
+ : this.getStorageLayout().buffers;
451
572
  return {
452
573
  bodyCount: this.count,
453
574
  colliderCount: this.colliderCount,
@@ -466,6 +587,9 @@ export class GPURigidBodyWorld {
466
587
  if (this.props.continuous?.mode === 'convex' &&
467
588
  Math.max(Math.ceil((this.props.continuous.maximumCandidates ?? this.maximumPairs) / 64), Math.ceil(2 ** Math.ceil(Math.log2(Math.max(1, this.colliders.length))) / 64)) > graph.device.limits.maxComputeWorkgroupsPerDimension)
468
589
  throw new Error('Continuous candidate dispatch exceeds device limits');
590
+ if (!this.vehiclesPerInstance &&
591
+ this.vehicles.length > graph.device.limits.maxComputeWorkgroupsPerDimension)
592
+ throw new Error('Vehicle dispatch exceeds device limits');
469
593
  for (const buffer of allocationPlan) {
470
594
  const bindingLimit = buffer.uniform
471
595
  ? graph.device.limits.maxUniformBufferBindingSize
@@ -473,6 +597,7 @@ export class GPURigidBodyWorld {
473
597
  if (buffer.byteLength > Math.min(graph.device.limits.maxBufferSize, bindingLimit))
474
598
  throw new Error(`Rigid-body ${buffer.name} storage exceeds device limits`);
475
599
  }
600
+ this.allocationPlan = allocationPlan;
476
601
  this.device = graph.device;
477
602
  const allocate = (name, data, uniform = false) => {
478
603
  const buffer = graph.device.createBuffer({
@@ -501,6 +626,29 @@ export class GPURigidBodyWorld {
501
626
  : undefined;
502
627
  const metadata = new Float32Array(metadataLength);
503
628
  metadata.set(packed.geometry, geometryOffset);
629
+ if (this.terrainAtlas) {
630
+ this.terrainGeometryWord = geometryOffset;
631
+ this.terrainAtlasWord = geometryOffset + packed.geometry.length;
632
+ const { wordsByCollider, uploads } = this.terrainAtlas.bind(Array.from(packed.atlasFields, ([collider, field]) => ({
633
+ collider,
634
+ data: new Float32Array(field.data)
635
+ })));
636
+ for (const { word, data } of uploads)
637
+ metadata.set(data, this.terrainAtlasWord + word);
638
+ for (const [collider, word] of wordsByCollider) {
639
+ const field = packed.atlasFields.get(collider);
640
+ const address = (packed.geometry.length + word) / 4;
641
+ const shape = packed.shapes[collider];
642
+ shape.padding[0] = address;
643
+ shape.padding[3] = field.triangleCount;
644
+ shape.policies[0] = address + field.nodeOffset;
645
+ shape.policies[1] = field.nodeCount;
646
+ }
647
+ }
648
+ this.heightFieldSlots = new Map(Array.from(packed.heightFields, ([collider, offset]) => [
649
+ collider,
650
+ (geometryOffset + offset * 4) * 4
651
+ ]));
504
652
  const bodyColliders = Array.from({ length: this.count }, () => []);
505
653
  if (this.colliderCount)
506
654
  for (const collider of this.colliders)
@@ -558,7 +706,10 @@ export class GPURigidBodyWorld {
558
706
  material?.restitutionCombine ? policies.indexOf(material.restitutionCombine) : 4,
559
707
  material?.frictionCombine ? policies.indexOf(material.frictionCombine) : 4,
560
708
  ...shape.policies,
561
- ...shape.padding
709
+ shape.padding[0],
710
+ shape.padding[1],
711
+ this.ensembleTerrainSlots.has(index) ? 1 : shape.padding[2],
712
+ shape.padding[3]
562
713
  ], this.count * 12 + index * 24);
563
714
  }
564
715
  const exclusionOffset = this.count * 12 + this.colliderStorageCount * 24;
@@ -686,7 +837,7 @@ export class GPURigidBodyWorld {
686
837
  usage: Buffer.STORAGE
687
838
  }, objectAttributes), { format: 'uint32', length: this.colliderStorageCount })
688
839
  : undefined;
689
- const source = getRigidBodyShader(this.count, this.props.iterations ?? 16, this.colliderStorageCount, extended, sparseLayout, parallel, this.props.maximumMeshTraversalTestsPerPair ?? 65536, getRigidBodyJointShader(this.props.joints ?? [], this.props.bodies), Boolean(this.props.joints?.length), this.props.linearDamping ?? 0, this.props.angularDamping ?? 0, this.props.joints?.length ?? 0, this.props.compactContacts ?? true, this.props.collisionPartitionSize, this.props.ensembleBodiesPerInstance);
840
+ const source = getRigidBodyShader(this.count, this.props.iterations ?? 16, this.colliderStorageCount, extended, sparseLayout, parallel, this.props.maximumMeshTraversalTestsPerPair ?? 65536, getRigidBodyJointShader(this.props.joints ?? [], this.props.bodies), Boolean(this.props.joints?.length), this.props.linearDamping ?? 0, this.props.angularDamping ?? 0, this.props.joints?.length ?? 0, this.props.compactContacts ?? true, this.props.collisionPartitionSize, this.props.ensembleBodiesPerInstance, this.props.parallelContactSolver === 'block', this.colliders.some(collider => collider.shape.type === 'height-field'));
690
841
  const parallelBindings = {
691
842
  parallelReset: ['parallelState'],
692
843
  parallelResetCounters: ['parallelState'],
@@ -756,33 +907,6 @@ export class GPURigidBodyWorld {
756
907
  }
757
908
  this.simulationStatistics = allocate('simulation-statistics', 64);
758
909
  const statisticsResource = graph.importBuffer({ id: `${this.id}-statistics`, byteLength: 64, usage: Buffer.STORAGE }, this.simulationStatistics);
759
- const checkpointStates = [
760
- 'positions',
761
- 'orientations',
762
- 'velocities',
763
- 'angularVelocities',
764
- 'sleepStates',
765
- 'targets'
766
- ].map(name => {
767
- const binding = bindings.find(binding => binding.name === name);
768
- return { buffer: binding.buffer, resource: binding.resource };
769
- });
770
- const restoreCheckpoint = this.props.failurePolicy === 'rollback'
771
- ? this.ensembleBuffer
772
- ? addEnsembleCheckpoint(graph, this.id, checkpointStates, { buffer: this.simulationStatistics, resource: statisticsResource }, bindings.find(binding => binding.name === 'ensemble'), bindings.find(binding => binding.name === 'manifolds'), this.props.ensembleBodiesPerInstance, this.maximumPairs, allocate)
773
- : addRigidBodyCheckpoint(graph, this.id, [
774
- 'positions',
775
- 'orientations',
776
- 'velocities',
777
- 'angularVelocities',
778
- 'sleepStates',
779
- 'targets',
780
- ...(this.ensembleBuffer ? [] : ['manifolds'])
781
- ].map(name => {
782
- const binding = bindings.find(binding => binding.name === name);
783
- return { buffer: binding.buffer, resource: binding.resource };
784
- }), { buffer: this.simulationStatistics, resource: statisticsResource }, allocate)
785
- : undefined;
786
910
  const continuousSelection = new Uint32Array(this.count);
787
911
  for (const body of this.props.continuous?.bodies ?? [])
788
912
  continuousSelection[body] = this.colliders.findIndex(collider => collider.body === body) + 1;
@@ -823,6 +947,157 @@ export class GPURigidBodyWorld {
823
947
  parallelMarkSleep: 'Identify islands whose bodies are quiet enough to sleep.',
824
948
  parallelSleep: 'Put quiet constraint islands to sleep.'
825
949
  };
950
+ let vehicleResource;
951
+ let addVehiclePass;
952
+ if (this.vehicles.length) {
953
+ const packed = new Float32Array(this.getVehicleByteLength() / 4);
954
+ for (const [vehicleIndex, vehicle] of this.vehicles.entries()) {
955
+ const data = packed.subarray((vehicleIndex * VEHICLE_STRIDE) / 4, ((vehicleIndex + 1) * VEHICLE_STRIDE) / 4);
956
+ data.set([
957
+ vehicle.radius,
958
+ vehicle.travel,
959
+ vehicle.springRate,
960
+ vehicle.damping,
961
+ vehicle.grip,
962
+ vehicle.motorTorque,
963
+ vehicle.brakeTorque,
964
+ vehicle.wheelInertia
965
+ ], 4);
966
+ new Uint32Array(data.buffer, data.byteOffset, data.length).set([vehicle.chassis, vehicle.terrainCollider], 12);
967
+ data.set([vehicle.steeringWheelbase ?? 0, vehicle.antiRollRate ?? 0], 14);
968
+ const [longitudinalGain, lateralGain] = vehicle.slipGain ?? [1.1, 1.5];
969
+ vehicle.wheels.forEach((wheel, index) => {
970
+ const offset = 16 + index * 12;
971
+ data.set([...wheel.mount, longitudinalGain + 1], offset);
972
+ data.set([Number(Boolean(wheel.steer)), Number(Boolean(wheel.drive)), lateralGain + 1], offset + 4);
973
+ data[offset + 10] = vehicle.travel;
974
+ data.set([
975
+ 1,
976
+ 0,
977
+ 0,
978
+ 0,
979
+ 0,
980
+ 1,
981
+ 0,
982
+ 0,
983
+ 0,
984
+ 0,
985
+ 1,
986
+ 0,
987
+ wheel.mount[0],
988
+ wheel.mount[1],
989
+ wheel.mount[2] - vehicle.travel,
990
+ 1
991
+ ], 64 + 16 * index);
992
+ });
993
+ }
994
+ if (this.multiSurfaceVehicles) {
995
+ // Place the immutable terrain rows after the unchanged vehicle pose/telemetry ranges.
996
+ const terrainRows = new Uint32Array(packed.buffer, this.vehicles.length * VEHICLE_STRIDE);
997
+ terrainRows.fill(0xffffffff);
998
+ for (const [vehicleIndex, vehicle] of this.vehicles.entries())
999
+ terrainRows.set(vehicle.additionalTerrainColliders ?? [], vehicleIndex * (VEHICLE_TERRAIN_ROW_SIZE / 4));
1000
+ }
1001
+ this.vehicleBuffer = allocate('vehicle', packed);
1002
+ vehicleResource = {
1003
+ buffer: this.vehicleBuffer,
1004
+ resource: graph.importBuffer({
1005
+ id: this.id + '-vehicle',
1006
+ byteLength: packed.byteLength,
1007
+ usage: Buffer.STORAGE | Buffer.COPY_SRC
1008
+ }, this.vehicleBuffer)
1009
+ };
1010
+ const ensembleBinding = bindings.find(binding => binding.name === 'ensemble');
1011
+ const vehicleBindings = [
1012
+ ...bindings.filter(binding => [
1013
+ 'settings',
1014
+ 'positions',
1015
+ 'orientations',
1016
+ 'velocities',
1017
+ 'angularVelocities',
1018
+ 'bodies',
1019
+ 'sleepStates',
1020
+ 'ensemble'
1021
+ ].includes(binding.name)),
1022
+ { name: 'vehicle', location: 12, ...vehicleResource }
1023
+ ];
1024
+ const properties = {
1025
+ id: this.id + '-suspension',
1026
+ source: readOnlyEnsembleShader(source) +
1027
+ RIGID_BODY_QUERY_GEOMETRY_SHADER +
1028
+ getVehicleShader(this.vehicles.length, this.multiSurfaceVehicles, this.vehiclesPerInstance),
1029
+ entryPoint: 'advanceVehicle',
1030
+ shaderLayout: {
1031
+ bindings: vehicleBindings.map(({ name, location }) => name === 'settings'
1032
+ ? { name, location, group: 0, type: 'uniform' }
1033
+ : {
1034
+ name,
1035
+ location,
1036
+ group: 0,
1037
+ type: name === 'bodies' || name === 'ensemble' ? 'read-only-storage' : 'storage'
1038
+ })
1039
+ }
1040
+ };
1041
+ const executable = (computation) => ({
1042
+ encode: ({ computePass, getBuffer }) => {
1043
+ Object.assign(computation.bindings, Object.fromEntries(vehicleBindings.map(binding => [binding.name, getBuffer(binding.resource)])));
1044
+ if (ensembleBinding)
1045
+ computation.kernel.dispatchIndirect(computePass, {
1046
+ bindings: computation.bindings,
1047
+ indirectBuffer: getBuffer(ensembleBinding.resource),
1048
+ indirectOffset: 16
1049
+ });
1050
+ else
1051
+ computation.kernel.dispatch(computePass, {
1052
+ bindings: computation.bindings,
1053
+ x: this.vehicles.length
1054
+ });
1055
+ },
1056
+ destroy: () => computation.kernel.destroy()
1057
+ });
1058
+ addVehiclePass = () => graph.addComputePass({
1059
+ id: properties.id,
1060
+ description: 'Sweep four wheels and apply suspension and tire forces per chassis.',
1061
+ resources: [
1062
+ ...vehicleBindings.map(binding => ({
1063
+ buffer: binding.resource,
1064
+ usage: binding.name === 'settings'
1065
+ ? 'uniform'
1066
+ : binding.name === 'bodies' || binding.name === 'ensemble'
1067
+ ? 'storage-read'
1068
+ : 'storage-read-write'
1069
+ })),
1070
+ ...(ensembleBinding
1071
+ ? [{ buffer: ensembleBinding.resource, usage: 'indirect' }]
1072
+ : [])
1073
+ ],
1074
+ compile: () => executable(createBoundKernel(graph.device, properties)),
1075
+ compileAsync: async () => executable(await createBoundKernelAsync(graph.device, properties))
1076
+ });
1077
+ }
1078
+ const checkpointStates = [
1079
+ 'positions',
1080
+ 'orientations',
1081
+ 'velocities',
1082
+ 'angularVelocities',
1083
+ 'sleepStates',
1084
+ 'targets'
1085
+ ].map(name => {
1086
+ const binding = bindings.find(binding => binding.name === name);
1087
+ return { buffer: binding.buffer, resource: binding.resource };
1088
+ });
1089
+ const restoreCheckpoint = this.props.failurePolicy === 'rollback'
1090
+ ? this.ensembleBuffer
1091
+ ? addEnsembleCheckpoint(graph, this.id, checkpointStates, { buffer: this.simulationStatistics, resource: statisticsResource }, bindings.find(binding => binding.name === 'ensemble'), bindings.find(binding => binding.name === 'manifolds'), this.props.ensembleBodiesPerInstance, this.maximumPairs, allocate, vehicleResource && {
1092
+ state: vehicleResource,
1093
+ vehiclesPerInstance: this.vehiclesPerInstance
1094
+ })
1095
+ : addRigidBodyCheckpoint(graph, this.id, [
1096
+ ...checkpointStates,
1097
+ bindings.find(binding => binding.name === 'manifolds'),
1098
+ ...(vehicleResource ? [vehicleResource] : [])
1099
+ ], { buffer: this.simulationStatistics, resource: statisticsResource }, allocate)
1100
+ : undefined;
826
1101
  for (const entryPoint of [
827
1102
  ...(this.ensembleBuffer
828
1103
  ? ['ensembleClear', 'ensembleMark', 'ensembleCompact', 'ensembleDispatch']
@@ -861,8 +1136,10 @@ export class GPURigidBodyWorld {
861
1136
  ]
862
1137
  : [...(extended && this.props.joints?.length ? ['meshCollect'] : []), 'solve', 'finish'])
863
1138
  ]) {
864
- if (entryPoint === 'integrate')
1139
+ if (entryPoint === 'integrate') {
865
1140
  restoreCheckpoint?.save?.();
1141
+ addVehiclePass?.();
1142
+ }
866
1143
  if (sparse && entryPoint === 'collide') {
867
1144
  const bodyBinding = bindings.find(binding => binding.name === 'bodies');
868
1145
  const minimumBinding = bindings.find(binding => binding.name === 'minima');
@@ -1417,6 +1694,48 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1417
1694
  },
1418
1695
  bindings: Object.fromEntries(Object.entries(controlProperties.bindings).filter(([name]) => invalidationBindings.includes(name)))
1419
1696
  });
1697
+ if (this.heightFieldSlots.size && !this.ensembleBuffer) {
1698
+ this.terrainWake = createBoundKernel(graph.device, {
1699
+ id: `${this.id}-terrain-wake`,
1700
+ entryPoint: 'wakeTerrain',
1701
+ source: controlProperties.source +
1702
+ /* wgsl */ `
1703
+ @group(0) @binding(26) var<storage,read_write> terrainSleep:array<atomic<u32>>;
1704
+ @compute @workgroup_size(64) fn wakeTerrain(@builtin(global_invocation_id) invocation:vec3u) {
1705
+ let collider=invocation.x;if(collider>=COLLIDER_COUNT){return;}
1706
+ let body=colliderBody(collider);if(!dynamic(body)){return;}
1707
+ let tile=command.bodyIndex.x;if(bodies.colliders[tile].padding.w==0.0){return;}
1708
+ if(any(abs(colliderPosition(collider)-colliderPosition(tile))>shapeWorldExtent(collider)+shapeWorldExtent(tile)+vec3f(settings.solver.x))){return;}
1709
+ // Several colliders on one sleeping body may all overlap the tile.
1710
+ for(var axis=0u;axis<4u;axis++){atomicStore(&terrainSleep[body*4u+axis],0u);}
1711
+ }`,
1712
+ shaderLayout: {
1713
+ bindings: [
1714
+ ...shaderLayout.bindings.filter(binding => ['settings', 'positions', 'orientations', 'bodies'].includes(binding.name)),
1715
+ { name: 'command', group: 0, location: 8, type: 'uniform' },
1716
+ { name: 'terrainSleep', group: 0, location: 26, type: 'storage' }
1717
+ ]
1718
+ },
1719
+ bindings: {
1720
+ settings: buffers.settings,
1721
+ positions: buffers.positions,
1722
+ orientations: buffers.orientations,
1723
+ bodies: buffers.bodies,
1724
+ command: this.controlSettings,
1725
+ terrainSleep: this.sleepStates
1726
+ }
1727
+ });
1728
+ }
1729
+ }
1730
+ /** Wake sleeping bodies overlapping one published terrain footprint. */
1731
+ wakeTerrainFootprint(collider) {
1732
+ const { kernel, bindings } = this.terrainWake;
1733
+ this.controlSettings.write(new Uint32Array([collider]), 48);
1734
+ const encoder = this.device.createCommandEncoder();
1735
+ const pass = encoder.beginComputePass();
1736
+ kernel.dispatch(pass, { bindings, x: Math.ceil(this.colliderStorageCount / 64) });
1737
+ pass.end();
1738
+ this.device.submit(encoder.finish());
1420
1739
  }
1421
1740
  invalidateState(pass) {
1422
1741
  // Controls may wake any island; reclassify enabled instances on the next GPU step.
@@ -1453,6 +1772,84 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1453
1772
  ? (definition.mode ?? ((definition.mass ?? 1) === 0 ? 'static' : 'dynamic'))
1454
1773
  : undefined;
1455
1774
  }
1775
+ /** Set signed throttle, steering angle in radians and brake fraction for upcoming substeps. */
1776
+ setVehicleControls(throttle, steering, brake, vehicleIndex = 0) {
1777
+ if (!this.vehicleBuffer ||
1778
+ this.destroyed ||
1779
+ !this.vehicles[vehicleIndex] ||
1780
+ ![throttle, steering, brake].every(value => Number.isFinite(Math.fround(value))))
1781
+ throw new Error('Invalid vehicle controls');
1782
+ this.vehicleBuffer.write(new Float32Array([
1783
+ Math.max(-1, Math.min(1, throttle)),
1784
+ steering,
1785
+ Math.max(0, Math.min(1, brake)),
1786
+ 0
1787
+ ]), vehicleIndex * VEHICLE_STRIDE);
1788
+ if (this.vehiclesPerInstance) {
1789
+ const instance = Math.floor(vehicleIndex / this.vehiclesPerInstance);
1790
+ this.ensembleBuffer.write(new Uint32Array([1]), (16 + instance * 8 + 6) * 4);
1791
+ }
1792
+ }
1793
+ /** Borrow four column-major wheel transforms relative to the chassis node, ordered by mount. */
1794
+ get vehicleWheelPoses() {
1795
+ return this.getVehicleWheelPoses();
1796
+ }
1797
+ /** Borrow the indexed vehicle’s four chassis-local wheel poses, in mount order. */
1798
+ getVehicleWheelPoses(vehicleIndex = 0) {
1799
+ return this.vehicleBuffer && !this.destroyed && this.vehicles[vehicleIndex]
1800
+ ? {
1801
+ buffer: this.vehicleBuffer,
1802
+ byteOffset: vehicleIndex * VEHICLE_STRIDE + 256,
1803
+ byteLength: 256
1804
+ }
1805
+ : null;
1806
+ }
1807
+ /** Transfer wheel motion between rebuilt worlds for wheels with matching chassis-local mounts. */
1808
+ copyVehicleMotionFrom(previous, vehicleIndex = 0, previousVehicleIndex = 0) {
1809
+ const sourceBuffer = previous.vehicleBuffer;
1810
+ const destinationBuffer = this.vehicleBuffer;
1811
+ const previousVehicle = previous.vehicles[previousVehicleIndex];
1812
+ if (!this.device || !sourceBuffer || !destinationBuffer || !previousVehicle)
1813
+ return;
1814
+ const encoder = this.device.createCommandEncoder();
1815
+ this.vehicles[vehicleIndex]?.wheels.forEach((wheel, index) => {
1816
+ const sourceIndex = previousVehicle.wheels.findIndex(source => source.mount.every((coordinate, axis) => coordinate === wheel.mount[axis]));
1817
+ if (sourceIndex < 0)
1818
+ return;
1819
+ encoder.copyBufferToBuffer({
1820
+ sourceBuffer,
1821
+ destinationBuffer,
1822
+ sourceOffset: previousVehicleIndex * VEHICLE_STRIDE + 92 + sourceIndex * 48,
1823
+ destinationOffset: vehicleIndex * VEHICLE_STRIDE + 92 + index * 48,
1824
+ size: 20
1825
+ });
1826
+ encoder.copyBufferToBuffer({
1827
+ sourceBuffer,
1828
+ destinationBuffer,
1829
+ sourceOffset: previousVehicleIndex * VEHICLE_STRIDE + 256 + sourceIndex * 64,
1830
+ destinationOffset: vehicleIndex * VEHICLE_STRIDE + 256 + index * 64,
1831
+ size: 64
1832
+ });
1833
+ });
1834
+ this.device.submit(encoder.finish());
1835
+ }
1836
+ /** Read wheel spin, angle, suspension length and normal load after submitted steps. */
1837
+ async readVehicleWheels(vehicleIndex = 0) {
1838
+ if (!this.vehicleBuffer || this.destroyed || !this.vehicles[vehicleIndex])
1839
+ throw new Error('Vehicle unavailable');
1840
+ const bytes = await this.vehicleBuffer.readAsync(vehicleIndex * VEHICLE_STRIDE, 256);
1841
+ const values = new Float32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4);
1842
+ return Array.from({ length: 4 }, (_, index) => {
1843
+ const offset = 24 + index * 12;
1844
+ return {
1845
+ speed: values[offset],
1846
+ angle: values[offset + 1],
1847
+ length: values[offset + 2],
1848
+ load: values[offset + 3],
1849
+ steering: values[offset - 1]
1850
+ };
1851
+ });
1852
+ }
1456
1853
  /** Submit an impulse at a world-space point, or the current GPU center of mass when omitted. */
1457
1854
  applyImpulse(body, impulse, point) {
1458
1855
  if (!this.control ||
@@ -1550,7 +1947,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1550
1947
  if (indices.has(edit.collider) ||
1551
1948
  previous.type !== shape.type ||
1552
1949
  shape.type === 'convex-hull' ||
1553
- shape.type === 'triangle-mesh')
1950
+ shape.type === 'triangle-mesh' ||
1951
+ shape.type === 'height-field')
1554
1952
  throw new Error('Shape edit requires a topology rebuild');
1555
1953
  indices.add(edit.collider);
1556
1954
  const properties = getRigidBodyShapeProperties(shape);
@@ -1584,6 +1982,103 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1584
1982
  this.setBodyParameters(body, {});
1585
1983
  }
1586
1984
  }
1985
+ /**
1986
+ * Replace or evict fixed-dimension height-field tiles between submissions.
1987
+ * Optional positions are in each collider's body-local frame. The caller owns
1988
+ * tile selection and must submit already encoded steps before editing residency.
1989
+ */
1990
+ setHeightFieldTiles(edits) {
1991
+ if (!edits.length)
1992
+ return;
1993
+ const metadata = this.ownedBuffers.find(buffer => buffer.id === `${this.id}-bodies`);
1994
+ if (!metadata || this.destroyed || this.queryPending || this.eventRead || this.triggerRead)
1995
+ throw new Error('Terrain streaming requires an idle attached world');
1996
+ const seen = new Set();
1997
+ const packedFields = this.terrainAtlas
1998
+ ? new Map()
1999
+ : undefined;
2000
+ const replacements = edits.map(({ collider: colliderIndex, field, position }) => {
2001
+ const collider = this.colliders[colliderIndex];
2002
+ const offset = this.heightFieldSlots.get(colliderIndex);
2003
+ if ((offset === undefined &&
2004
+ !(this.terrainAtlas && this.ensembleTerrainSlots.has(colliderIndex))) ||
2005
+ collider?.shape.type !== 'height-field' ||
2006
+ seen.has(colliderIndex))
2007
+ throw new Error('Invalid writable height-field slot');
2008
+ seen.add(colliderIndex);
2009
+ const previous = collider.shape.field;
2010
+ if (field && (field.width !== previous.width || field.height !== previous.height))
2011
+ throw new Error('Height-field slot dimensions are fixed');
2012
+ const center = this.props.bodies[collider.body].centerOfMass ?? [0, 0, 0];
2013
+ const localOffset = position?.map((value, axis) => value - center[axis]);
2014
+ if (position &&
2015
+ (position.length !== 3 || !localOffset?.every(value => Number.isFinite(Math.fround(value)))))
2016
+ throw new Error('Invalid height-field tile position');
2017
+ let payload = field ? packedFields?.get(field) : undefined;
2018
+ if (!payload) {
2019
+ const next = field
2020
+ ? structuredClone(field)
2021
+ : { ...previous, heights: undefined, validity: undefined };
2022
+ const packed = packRigidBodyHeightField(next);
2023
+ const data = packedFields && packed.nodeCount ? new Float32Array(packed.data) : null;
2024
+ payload = { field: next, packed, data };
2025
+ if (field)
2026
+ packedFields?.set(field, payload);
2027
+ }
2028
+ return { collider, colliderIndex, offset, position, localOffset, ...payload };
2029
+ });
2030
+ const atlas = this.terrainAtlas?.bind(replacements.map(({ colliderIndex, data }) => ({ collider: colliderIndex, data })));
2031
+ // Stamp once per validated edit batch. On float32 counter wrap, clear old impulses
2032
+ // so a retained contact cannot confuse a new stamp with a very old revision.
2033
+ if (this.terrainRevision === 0xffffff) {
2034
+ this.wake();
2035
+ this.terrainRevision = 1;
2036
+ }
2037
+ const revision = ++this.terrainRevision;
2038
+ for (const { word, data } of atlas?.uploads ?? [])
2039
+ metadata.write(data, (this.terrainAtlasWord + word) * 4);
2040
+ const changedBodies = new Set();
2041
+ const affectedInstances = new Set();
2042
+ for (const replacement of replacements) {
2043
+ const { collider, colliderIndex, offset, field, position, localOffset, packed } = replacement;
2044
+ const base = this.count * 48 + colliderIndex * 96;
2045
+ if (this.terrainWake)
2046
+ this.wakeTerrainFootprint(colliderIndex);
2047
+ if (atlas) {
2048
+ const word = atlas.wordsByCollider.get(colliderIndex);
2049
+ const address = word === undefined ? 0 : (this.terrainAtlasWord - this.terrainGeometryWord + word) / 4;
2050
+ metadata.write(new Float32Array([
2051
+ word === undefined ? 0 : address + packed.nodeOffset,
2052
+ packed.nodeCount,
2053
+ address
2054
+ ]), base + 72);
2055
+ }
2056
+ else {
2057
+ metadata.write(new Float32Array(packed.data), offset);
2058
+ metadata.write(new Float32Array([packed.nodeCount]), base + 76);
2059
+ }
2060
+ metadata.write(new Float32Array(packed.extent), base);
2061
+ metadata.write(new Float32Array([revision, packed.triangleCount]), base + 88);
2062
+ if (position && localOffset) {
2063
+ metadata.write(new Float32Array(localOffset), base + 16);
2064
+ collider.position = [...position];
2065
+ }
2066
+ collider.shape = { type: 'height-field', field };
2067
+ changedBodies.add(collider.body);
2068
+ if (this.terrainWake)
2069
+ this.wakeTerrainFootprint(colliderIndex);
2070
+ if (this.props.ensembleBodiesPerInstance)
2071
+ affectedInstances.add(Math.floor(collider.body / this.props.ensembleBodiesPerInstance));
2072
+ }
2073
+ for (const body of changedBodies)
2074
+ this.updateColliderDefinitions(body);
2075
+ for (const instance of affectedInstances)
2076
+ this.wakeEnsembleInstance(instance);
2077
+ }
2078
+ /** Shared atlas utilization, when the fused layout enabled page sharing. */
2079
+ getTerrainAtlasStats() {
2080
+ return this.terrainAtlas?.getStats();
2081
+ }
1587
2082
  /** Change an existing collider material between submissions, invalidating cached friction. */
1588
2083
  setColliderMaterial(colliderIndex, material) {
1589
2084
  const collider = this.colliders[colliderIndex];
@@ -1650,11 +2145,9 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1650
2145
  updateColliderDefinitions(bodyIndex) {
1651
2146
  const { shape, colliders, ...properties } = this.props.bodies[bodyIndex];
1652
2147
  const updated = this.colliders
1653
- .filter(candidate => candidate.body === bodyIndex)
2148
+ .slice(this.bodyColliderStarts[bodyIndex], this.bodyColliderStarts[bodyIndex + 1])
1654
2149
  .map(({ body, ...candidate }) => candidate);
1655
- const bodies = [...this.props.bodies];
1656
- bodies[bodyIndex] = { ...properties, colliders: updated };
1657
- this.props.bodies = bodies;
2150
+ this.props.bodies[bodyIndex] = { ...properties, colliders: updated };
1658
2151
  }
1659
2152
  getColliderMaterial(collider) {
1660
2153
  const definition = this.colliders[collider];
@@ -1662,15 +2155,18 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1662
2155
  throw new Error('Invalid collider');
1663
2156
  return structuredClone(definition.material ?? {});
1664
2157
  }
1665
- restoreColliderDefinitions() {
1666
- // Body definitions are already world-owned. Keep their shared geometry identities.
1667
- const definitions = this.props.bodies.flatMap(body => body.colliders ?? (body.shape ? [{ shape: body.shape }] : []));
1668
- for (const [index, definition] of definitions.entries()) {
1669
- const collider = this.colliders[index];
1670
- collider.shape = definition.shape;
1671
- collider.material = definition.material;
1672
- collider.position = definition.position;
1673
- collider.orientation = definition.orientation;
2158
+ restoreColliderDefinitions(first = 0, end = this.count) {
2159
+ // Body definitions are world-owned. Keep shared geometry identities.
2160
+ for (let body = first; body < end; body++) {
2161
+ const definition = this.props.bodies[body];
2162
+ const colliders = definition.colliders ?? (definition.shape ? [{ shape: definition.shape }] : []);
2163
+ for (const [index, source] of colliders.entries()) {
2164
+ const collider = this.colliders[this.bodyColliderStarts[body] + index];
2165
+ collider.shape = source.shape;
2166
+ collider.material = source.material;
2167
+ collider.position = source.position;
2168
+ collider.orientation = source.orientation;
2169
+ }
1674
2170
  }
1675
2171
  }
1676
2172
  /** Update motion properties between submissions; preserve the node pose when its COM changes. */
@@ -1706,13 +2202,16 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
1706
2202
  validateRigidBodyJoints(this.props.joints, proposedBodies, this.solver);
1707
2203
  }
1708
2204
  const colliders = this.colliders.filter(collider => collider.body === bodyIndex);
1709
- for (const collider of colliders)
2205
+ for (const collider of colliders) {
2206
+ if (collider.shape.type === 'height-field' && mode !== 'static')
2207
+ throw new Error('Height fields require static bodies');
1710
2208
  if ((collider.shape.type === 'convex-hull' || collider.shape.type === 'triangle-mesh') &&
1711
2209
  mode !== 'static' &&
1712
2210
  mass > 0 &&
1713
2211
  (!collider.shape.geometry.closed ||
1714
2212
  !(getRigidBodyShapeProperties(collider.shape).volume > 0)))
1715
2213
  throw new Error('Dynamic meshes require closed positive-volume geometry');
2214
+ }
1716
2215
  if (this.props.continuous?.bodies.includes(bodyIndex) &&
1717
2216
  (mode !== 'dynamic' ||
1718
2217
  mass === 0 ||
@@ -2069,6 +2568,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2069
2568
  let bodyDefinitions = structuredClone(this.props.bodies);
2070
2569
  let contactCursor = 0;
2071
2570
  let triggerCursor = 0;
2571
+ let terrainRevision = this.terrainRevision;
2572
+ let terrainAtlas = this.terrainAtlas?.snapshot();
2072
2573
  try {
2073
2574
  for (const buffer of checkpointBuffers)
2074
2575
  snapshots.push(device.createBuffer({
@@ -2107,6 +2608,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2107
2608
  publicationBounds = structuredClone(this.props.publicationBounds);
2108
2609
  contactCursor = this.eventCursor;
2109
2610
  triggerCursor = this.triggerCursor;
2611
+ terrainRevision = this.terrainRevision;
2612
+ terrainAtlas = this.terrainAtlas?.snapshot();
2110
2613
  saved = true;
2111
2614
  },
2112
2615
  restore: () => {
@@ -2121,6 +2624,9 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2121
2624
  this.props.publicationBounds = structuredClone(publicationBounds);
2122
2625
  this.eventCursor = contactCursor;
2123
2626
  this.triggerCursor = triggerCursor;
2627
+ this.terrainRevision = terrainRevision;
2628
+ if (terrainAtlas)
2629
+ this.terrainAtlas.restore(terrainAtlas.leases, (_word, _words, page) => terrainAtlas.payloads.get(page));
2124
2630
  },
2125
2631
  destroy: () => {
2126
2632
  if (released)
@@ -2146,6 +2652,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2146
2652
  colliderShapeScales: structuredClone([...this.colliderShapeScales]),
2147
2653
  contactCursor: this.eventCursor,
2148
2654
  triggerCursor: this.triggerCursor,
2655
+ terrainRevision: this.terrainRevision,
2656
+ terrainAtlasLeases: this.terrainAtlas?.getLeases(),
2149
2657
  buffers: await Promise.all(this.getSnapshotBuffers(options.includeRollbackScratch).map(async (buffer) => ({
2150
2658
  name: buffer.id.slice(this.id.length + 1),
2151
2659
  data: new Uint8Array(await buffer.readAsync())
@@ -2155,12 +2663,17 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2155
2663
  /** Restore between submissions on the same configuration and implementation; no implicit wake. */
2156
2664
  restoreState(capture) {
2157
2665
  const checkpointBuffers = this.getSnapshotBuffers(capture.includeRollbackScratch);
2666
+ const terrainRevision = capture.terrainRevision ?? 1;
2158
2667
  if (!this.device ||
2159
2668
  this.destroyed ||
2160
2669
  this.queryPending ||
2161
2670
  this.eventRead ||
2162
2671
  this.triggerRead ||
2163
2672
  capture.version !== 1 ||
2673
+ Boolean(capture.terrainAtlasLeases) !== Boolean(this.terrainAtlas) ||
2674
+ !Number.isInteger(terrainRevision) ||
2675
+ terrainRevision < 1 ||
2676
+ terrainRevision > 0xffffff ||
2164
2677
  (capture.origin !== undefined &&
2165
2678
  (capture.origin.length !== 3 || !capture.origin.every(Number.isFinite))) ||
2166
2679
  capture.buffers.length !== checkpointBuffers.length ||
@@ -2181,6 +2694,26 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2181
2694
  saved.data.byteLength !== buffer.byteLength)
2182
2695
  throw new Error('Incompatible rigid-body capture storage');
2183
2696
  }
2697
+ if (this.terrainAtlas && capture.terrainAtlasLeases) {
2698
+ const metadata = capture.buffers.find(buffer => buffer.name === 'bodies').data;
2699
+ const view = new DataView(metadata.buffer, metadata.byteOffset, metadata.byteLength);
2700
+ const colliderBase = this.count * 48;
2701
+ let active = 0;
2702
+ for (const collider of this.ensembleTerrainSlots)
2703
+ if (view.getFloat32(colliderBase + collider * 96 + 76, true) > 0)
2704
+ active++;
2705
+ if (active !== capture.terrainAtlasLeases.length)
2706
+ throw new Error('Incomplete captured terrain atlas leases');
2707
+ this.terrainAtlas.restore(capture.terrainAtlasLeases, (word, words) => {
2708
+ const first = (this.terrainAtlasWord + word) * 4;
2709
+ return new Float32Array(metadata.slice(first, first + words * 4).buffer);
2710
+ }, (collider, word) => {
2711
+ const base = colliderBase + collider * 96;
2712
+ const address = (this.terrainAtlasWord - this.terrainGeometryWord + word) / 4;
2713
+ if (view.getFloat32(base + 76, true) <= 0 || view.getFloat32(base + 80, true) !== address)
2714
+ throw new Error('Captured terrain collider has an invalid page address');
2715
+ });
2716
+ }
2184
2717
  for (const [index, buffer] of checkpointBuffers.entries())
2185
2718
  buffer.write(capture.buffers[index].data);
2186
2719
  this.props.joints = structuredClone(capture.props.joints);
@@ -2191,6 +2724,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2191
2724
  this.worldOrigin = [...(capture.origin ?? [0, 0, 0])];
2192
2725
  this.eventCursor = capture.contactCursor;
2193
2726
  this.triggerCursor = capture.triggerCursor;
2727
+ this.terrainRevision = terrainRevision;
2194
2728
  }
2195
2729
  /** Stop submissions first. Reconstruct with these accepted poses and larger budgets after rollback. */
2196
2730
  async getRecoveryProps(overrides = {}) {
@@ -2296,6 +2830,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
2296
2830
  this.destroyed = true;
2297
2831
  this.control?.kernel.destroy();
2298
2832
  this.invalidation?.kernel.destroy();
2833
+ this.terrainWake?.kernel.destroy();
2299
2834
  this.queryComputation?.kernel.destroy();
2300
2835
  this.queryReduction?.kernel.destroy();
2301
2836
  for (const buffer of this.ownedBuffers)
@@ -2318,7 +2853,13 @@ function serializeCaptureProps(props) {
2318
2853
  ...collider,
2319
2854
  shape: collider.shape?.type === 'convex-hull' || collider.shape?.type === 'triangle-mesh'
2320
2855
  ? collider.shape
2321
- : { type: collider.shape?.type },
2856
+ : collider.shape?.type === 'height-field'
2857
+ ? {
2858
+ type: collider.shape.type,
2859
+ width: collider.shape.field.width,
2860
+ height: collider.shape.field.height
2861
+ }
2862
+ : { type: collider.shape?.type },
2322
2863
  material: undefined,
2323
2864
  position: undefined,
2324
2865
  orientation: undefined