@luma.gl/graph 10.0.0-beta.1 → 10.0.0-beta.3

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 (477) hide show
  1. package/dist/arrow/gpu/arrow-gpu-analytics-adapters.cjs +22 -9
  2. package/dist/arrow/gpu/arrow-gpu-analytics-adapters.d.ts +11 -2
  3. package/dist/arrow/gpu/arrow-gpu-analytics-adapters.d.ts.map +1 -1
  4. package/dist/arrow/gpu/arrow-gpu-analytics-adapters.js +27 -10
  5. package/dist/arrow/gpu/arrow-gpu-analytics-adapters.js.map +1 -1
  6. package/dist/arrow/gpu/arrow-gpu-analytics-readback.cjs +24 -13
  7. package/dist/arrow/gpu/arrow-gpu-analytics-readback.d.ts +9 -1
  8. package/dist/arrow/gpu/arrow-gpu-analytics-readback.d.ts.map +1 -1
  9. package/dist/arrow/gpu/arrow-gpu-analytics-readback.js +41 -14
  10. package/dist/arrow/gpu/arrow-gpu-analytics-readback.js.map +1 -1
  11. package/dist/arrow/gpu/arrow-gpu-table-conversion.cjs +24 -1
  12. package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts +10 -1
  13. package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts.map +1 -1
  14. package/dist/arrow/gpu/arrow-gpu-table-conversion.js +29 -1
  15. package/dist/arrow/gpu/arrow-gpu-table-conversion.js.map +1 -1
  16. package/dist/arrow/index.cjs +2 -0
  17. package/dist/arrow/index.cjs.map +3 -3
  18. package/dist/arrow/index.d.ts +1 -1
  19. package/dist/arrow/index.d.ts.map +1 -1
  20. package/dist/arrow/index.js +1 -1
  21. package/dist/arrow/index.js.map +1 -1
  22. package/dist/experimental-models.cjs +21 -0
  23. package/dist/experimental-models.d.ts +2 -0
  24. package/dist/experimental-models.d.ts.map +1 -0
  25. package/dist/experimental-models.js +5 -0
  26. package/dist/experimental-models.js.map +1 -0
  27. package/dist/experimental-simulation.cjs +21 -0
  28. package/dist/experimental-simulation.d.ts +2 -0
  29. package/dist/experimental-simulation.d.ts.map +1 -0
  30. package/dist/experimental-simulation.js +5 -0
  31. package/dist/experimental-simulation.js.map +1 -0
  32. package/dist/gpu-core/gpu-bvh-bounds.cjs +63 -0
  33. package/dist/gpu-core/gpu-bvh-bounds.d.ts +32 -0
  34. package/dist/gpu-core/gpu-bvh-bounds.d.ts.map +1 -0
  35. package/dist/gpu-core/gpu-bvh-bounds.js +56 -0
  36. package/dist/gpu-core/gpu-bvh-bounds.js.map +1 -0
  37. package/dist/gpu-core/gpu-command-graph-submission-pacer.cjs +92 -0
  38. package/dist/gpu-core/gpu-command-graph-submission-pacer.d.ts +41 -0
  39. package/dist/gpu-core/gpu-command-graph-submission-pacer.d.ts.map +1 -0
  40. package/dist/gpu-core/gpu-command-graph-submission-pacer.js +85 -0
  41. package/dist/gpu-core/gpu-command-graph-submission-pacer.js.map +1 -0
  42. package/dist/gpu-core/index.cjs +6 -0
  43. package/dist/gpu-core/index.cjs.map +3 -3
  44. package/dist/gpu-core/index.d.ts +4 -0
  45. package/dist/gpu-core/index.d.ts.map +1 -1
  46. package/dist/gpu-core/index.js +2 -0
  47. package/dist/gpu-core/index.js.map +1 -1
  48. package/dist/gpu-dataframe/gpu-analytics-compiler-utils.cjs +6 -6
  49. package/dist/gpu-dataframe/gpu-analytics-compiler-utils.d.ts +1 -1
  50. package/dist/gpu-dataframe/gpu-analytics-compiler-utils.d.ts.map +1 -1
  51. package/dist/gpu-dataframe/gpu-analytics-compiler-utils.js +6 -6
  52. package/dist/gpu-dataframe/gpu-analytics-compiler-utils.js.map +1 -1
  53. package/dist/gpu-dataframe/gpu-data-frame-query.cjs +60 -15
  54. package/dist/gpu-dataframe/gpu-data-frame-query.d.ts +13 -2
  55. package/dist/gpu-dataframe/gpu-data-frame-query.d.ts.map +1 -1
  56. package/dist/gpu-dataframe/gpu-data-frame-query.js +69 -18
  57. package/dist/gpu-dataframe/gpu-data-frame-query.js.map +1 -1
  58. package/dist/gpu-dataframe/gpu-data-frame.cjs +1 -3
  59. package/dist/gpu-dataframe/gpu-data-frame.d.ts +10 -0
  60. package/dist/gpu-dataframe/gpu-data-frame.d.ts.map +1 -1
  61. package/dist/gpu-dataframe/gpu-data-frame.js +1 -3
  62. package/dist/gpu-dataframe/gpu-data-frame.js.map +1 -1
  63. package/dist/gpu-dataframe/gpu-expression-shader.cjs +157 -25
  64. package/dist/gpu-dataframe/gpu-expression-shader.d.ts +9 -5
  65. package/dist/gpu-dataframe/gpu-expression-shader.d.ts.map +1 -1
  66. package/dist/gpu-dataframe/gpu-expression-shader.js +184 -25
  67. package/dist/gpu-dataframe/gpu-expression-shader.js.map +1 -1
  68. package/dist/gpu-dataframe/gpu-expression.cjs +100 -8
  69. package/dist/gpu-dataframe/gpu-expression.d.ts +35 -3
  70. package/dist/gpu-dataframe/gpu-expression.d.ts.map +1 -1
  71. package/dist/gpu-dataframe/gpu-expression.js +92 -6
  72. package/dist/gpu-dataframe/gpu-expression.js.map +1 -1
  73. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.cjs +2 -3
  74. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts.map +1 -1
  75. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js +4 -3
  76. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js.map +1 -1
  77. package/dist/gpu-dataframe/gpu-global-aggregation-query.cjs +4 -4
  78. package/dist/gpu-dataframe/gpu-global-aggregation-query.d.ts +5 -1
  79. package/dist/gpu-dataframe/gpu-global-aggregation-query.d.ts.map +1 -1
  80. package/dist/gpu-dataframe/gpu-global-aggregation-query.js +11 -5
  81. package/dist/gpu-dataframe/gpu-global-aggregation-query.js.map +1 -1
  82. package/dist/gpu-dataframe/gpu-global-sort-compiler.cjs +136 -99
  83. package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts +7 -2
  84. package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts.map +1 -1
  85. package/dist/gpu-dataframe/gpu-global-sort-compiler.js +135 -97
  86. package/dist/gpu-dataframe/gpu-global-sort-compiler.js.map +1 -1
  87. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.cjs +286 -49
  88. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts +17 -2
  89. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts.map +1 -1
  90. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js +290 -40
  91. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js.map +1 -1
  92. package/dist/gpu-dataframe/gpu-group-by-query.cjs +10 -8
  93. package/dist/gpu-dataframe/gpu-group-by-query.d.ts +7 -1
  94. package/dist/gpu-dataframe/gpu-group-by-query.d.ts.map +1 -1
  95. package/dist/gpu-dataframe/gpu-group-by-query.js +14 -8
  96. package/dist/gpu-dataframe/gpu-group-by-query.js.map +1 -1
  97. package/dist/gpu-dataframe/gpu-histogram-compiler.cjs +0 -1
  98. package/dist/gpu-dataframe/gpu-histogram-compiler.d.ts.map +1 -1
  99. package/dist/gpu-dataframe/gpu-histogram-compiler.js +0 -1
  100. package/dist/gpu-dataframe/gpu-histogram-compiler.js.map +1 -1
  101. package/dist/gpu-dataframe/gpu-join-compiler.cjs +8 -8
  102. package/dist/gpu-dataframe/gpu-join-compiler.d.ts +1 -1
  103. package/dist/gpu-dataframe/gpu-join-compiler.d.ts.map +1 -1
  104. package/dist/gpu-dataframe/gpu-join-compiler.js +9 -9
  105. package/dist/gpu-dataframe/gpu-join-compiler.js.map +1 -1
  106. package/dist/gpu-dataframe/gpu-query-compiler.cjs +38 -10
  107. package/dist/gpu-dataframe/gpu-query-compiler.d.ts +3 -2
  108. package/dist/gpu-dataframe/gpu-query-compiler.d.ts.map +1 -1
  109. package/dist/gpu-dataframe/gpu-query-compiler.js +37 -9
  110. package/dist/gpu-dataframe/gpu-query-compiler.js.map +1 -1
  111. package/dist/gpu-dataframe/gpu-sort-compiler.cjs +0 -1
  112. package/dist/gpu-dataframe/gpu-sort-compiler.d.ts.map +1 -1
  113. package/dist/gpu-dataframe/gpu-sort-compiler.js +0 -1
  114. package/dist/gpu-dataframe/gpu-sort-compiler.js.map +1 -1
  115. package/dist/gpu-dataframe/gpu-sort-query.cjs +13 -5
  116. package/dist/gpu-dataframe/gpu-sort-query.d.ts +4 -1
  117. package/dist/gpu-dataframe/gpu-sort-query.d.ts.map +1 -1
  118. package/dist/gpu-dataframe/gpu-sort-query.js +14 -5
  119. package/dist/gpu-dataframe/gpu-sort-query.js.map +1 -1
  120. package/dist/gpu-dataframe/index.cjs +12 -2
  121. package/dist/gpu-dataframe/index.cjs.map +3 -3
  122. package/dist/gpu-dataframe/index.d.ts +3 -3
  123. package/dist/gpu-dataframe/index.d.ts.map +1 -1
  124. package/dist/gpu-dataframe/index.js +2 -2
  125. package/dist/gpu-dataframe/index.js.map +1 -1
  126. package/dist/gpu-dataframe/portable-expression.cjs +68 -4
  127. package/dist/gpu-dataframe/portable-expression.d.ts +3 -1
  128. package/dist/gpu-dataframe/portable-expression.d.ts.map +1 -1
  129. package/dist/gpu-dataframe/portable-expression.js +69 -5
  130. package/dist/gpu-dataframe/portable-expression.js.map +1 -1
  131. package/dist/gpu-dggs-benchmarks.cjs +21 -0
  132. package/dist/gpu-dggs-benchmarks.d.ts +2 -0
  133. package/dist/gpu-dggs-benchmarks.d.ts.map +1 -0
  134. package/dist/gpu-dggs-benchmarks.js +5 -0
  135. package/dist/gpu-dggs-benchmarks.js.map +1 -0
  136. package/dist/gpu-graph-algorithms-benchmarks.cjs +21 -0
  137. package/dist/gpu-graph-algorithms-benchmarks.d.ts +2 -0
  138. package/dist/gpu-graph-algorithms-benchmarks.d.ts.map +1 -0
  139. package/dist/gpu-graph-algorithms-benchmarks.js +5 -0
  140. package/dist/gpu-graph-algorithms-benchmarks.js.map +1 -0
  141. package/dist/gpu-physics/gpu-physics-batch.cjs +11 -10
  142. package/dist/gpu-physics/gpu-physics-batch.d.ts +1 -0
  143. package/dist/gpu-physics/gpu-physics-batch.d.ts.map +1 -1
  144. package/dist/gpu-physics/gpu-physics-batch.js +14 -10
  145. package/dist/gpu-physics/gpu-physics-batch.js.map +1 -1
  146. package/dist/gpu-physics/gpu-physics-ensemble-terrain.cjs +116 -0
  147. package/dist/gpu-physics/gpu-physics-ensemble-terrain.d.ts +42 -0
  148. package/dist/gpu-physics/gpu-physics-ensemble-terrain.d.ts.map +1 -0
  149. package/dist/gpu-physics/gpu-physics-ensemble-terrain.js +90 -0
  150. package/dist/gpu-physics/gpu-physics-ensemble-terrain.js.map +1 -0
  151. package/dist/gpu-physics/gpu-physics-ensemble.cjs +105 -8
  152. package/dist/gpu-physics/gpu-physics-ensemble.d.ts +40 -2
  153. package/dist/gpu-physics/gpu-physics-ensemble.d.ts.map +1 -1
  154. package/dist/gpu-physics/gpu-physics-ensemble.js +109 -6
  155. package/dist/gpu-physics/gpu-physics-ensemble.js.map +1 -1
  156. package/dist/gpu-physics/gpu-rigid-body-world.cjs +737 -213
  157. package/dist/gpu-physics/gpu-rigid-body-world.d.ts +111 -5
  158. package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
  159. package/dist/gpu-physics/gpu-rigid-body-world.js +842 -231
  160. package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
  161. package/dist/gpu-physics/index.cjs +23 -2
  162. package/dist/gpu-physics/index.cjs.map +3 -3
  163. package/dist/gpu-physics/index.d.ts +10 -3
  164. package/dist/gpu-physics/index.d.ts.map +1 -1
  165. package/dist/gpu-physics/index.js +6 -1
  166. package/dist/gpu-physics/index.js.map +1 -1
  167. package/dist/gpu-physics/rigid-body-bounds-shaders.cjs +21 -8
  168. package/dist/gpu-physics/rigid-body-bounds-shaders.d.ts +2 -1
  169. package/dist/gpu-physics/rigid-body-bounds-shaders.d.ts.map +1 -1
  170. package/dist/gpu-physics/rigid-body-bounds-shaders.js +15 -1
  171. package/dist/gpu-physics/rigid-body-bounds-shaders.js.map +1 -1
  172. package/dist/gpu-physics/rigid-body-cache-shaders.cjs +10 -6
  173. package/dist/gpu-physics/rigid-body-cache-shaders.d.ts +2 -1
  174. package/dist/gpu-physics/rigid-body-cache-shaders.d.ts.map +1 -1
  175. package/dist/gpu-physics/rigid-body-cache-shaders.js +15 -6
  176. package/dist/gpu-physics/rigid-body-cache-shaders.js.map +1 -1
  177. package/dist/gpu-physics/rigid-body-capacity.cjs +15 -2
  178. package/dist/gpu-physics/rigid-body-capacity.d.ts +3 -1
  179. package/dist/gpu-physics/rigid-body-capacity.d.ts.map +1 -1
  180. package/dist/gpu-physics/rigid-body-capacity.js +21 -2
  181. package/dist/gpu-physics/rigid-body-capacity.js.map +1 -1
  182. package/dist/gpu-physics/rigid-body-cast-index.cjs +192 -0
  183. package/dist/gpu-physics/rigid-body-cast-index.d.ts +44 -0
  184. package/dist/gpu-physics/rigid-body-cast-index.d.ts.map +1 -0
  185. package/dist/gpu-physics/rigid-body-cast-index.js +194 -0
  186. package/dist/gpu-physics/rigid-body-cast-index.js.map +1 -0
  187. package/dist/gpu-physics/rigid-body-convex-shaders.cjs +3 -2
  188. package/dist/gpu-physics/rigid-body-convex-shaders.d.ts +1 -1
  189. package/dist/gpu-physics/rigid-body-convex-shaders.d.ts.map +1 -1
  190. package/dist/gpu-physics/rigid-body-convex-shaders.js +3 -2
  191. package/dist/gpu-physics/rigid-body-convex-shaders.js.map +1 -1
  192. package/dist/gpu-physics/rigid-body-ensemble-layout.cjs +4 -2
  193. package/dist/gpu-physics/rigid-body-ensemble-layout.d.ts +2 -1
  194. package/dist/gpu-physics/rigid-body-ensemble-layout.d.ts.map +1 -1
  195. package/dist/gpu-physics/rigid-body-ensemble-layout.js +5 -2
  196. package/dist/gpu-physics/rigid-body-ensemble-layout.js.map +1 -1
  197. package/dist/gpu-physics/rigid-body-ensemble-reset.cjs +45 -14
  198. package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts +1 -1
  199. package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts.map +1 -1
  200. package/dist/gpu-physics/rigid-body-ensemble-reset.js +53 -14
  201. package/dist/gpu-physics/rigid-body-ensemble-reset.js.map +1 -1
  202. package/dist/gpu-physics/rigid-body-ensemble-shaders.cjs +14 -7
  203. package/dist/gpu-physics/rigid-body-ensemble-shaders.d.ts +5 -0
  204. package/dist/gpu-physics/rigid-body-ensemble-shaders.d.ts.map +1 -1
  205. package/dist/gpu-physics/rigid-body-ensemble-shaders.js +17 -7
  206. package/dist/gpu-physics/rigid-body-ensemble-shaders.js.map +1 -1
  207. package/dist/gpu-physics/rigid-body-ensemble-transaction.cjs +40 -8
  208. package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts +5 -2
  209. package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts.map +1 -1
  210. package/dist/gpu-physics/rigid-body-ensemble-transaction.js +49 -9
  211. package/dist/gpu-physics/rigid-body-ensemble-transaction.js.map +1 -1
  212. package/dist/gpu-physics/rigid-body-event-compaction.cjs +184 -0
  213. package/dist/gpu-physics/rigid-body-event-compaction.d.ts +35 -0
  214. package/dist/gpu-physics/rigid-body-event-compaction.d.ts.map +1 -0
  215. package/dist/gpu-physics/rigid-body-event-compaction.js +168 -0
  216. package/dist/gpu-physics/rigid-body-event-compaction.js.map +1 -0
  217. package/dist/gpu-physics/rigid-body-event-snapshot.cjs +51 -0
  218. package/dist/gpu-physics/rigid-body-event-snapshot.d.ts +33 -0
  219. package/dist/gpu-physics/rigid-body-event-snapshot.d.ts.map +1 -0
  220. package/dist/gpu-physics/rigid-body-event-snapshot.js +34 -0
  221. package/dist/gpu-physics/rigid-body-event-snapshot.js.map +1 -0
  222. package/dist/gpu-physics/rigid-body-events.cjs +57 -25
  223. package/dist/gpu-physics/rigid-body-events.d.ts +2 -1
  224. package/dist/gpu-physics/rigid-body-events.d.ts.map +1 -1
  225. package/dist/gpu-physics/rigid-body-events.js +60 -25
  226. package/dist/gpu-physics/rigid-body-events.js.map +1 -1
  227. package/dist/gpu-physics/rigid-body-geometry.cjs +41 -4
  228. package/dist/gpu-physics/rigid-body-geometry.d.ts +10 -1
  229. package/dist/gpu-physics/rigid-body-geometry.d.ts.map +1 -1
  230. package/dist/gpu-physics/rigid-body-geometry.js +44 -3
  231. package/dist/gpu-physics/rigid-body-geometry.js.map +1 -1
  232. package/dist/gpu-physics/rigid-body-height-field-shader.cjs +80 -0
  233. package/dist/gpu-physics/rigid-body-height-field-shader.d.ts +3 -0
  234. package/dist/gpu-physics/rigid-body-height-field-shader.d.ts.map +1 -0
  235. package/dist/gpu-physics/rigid-body-height-field-shader.js +56 -0
  236. package/dist/gpu-physics/rigid-body-height-field-shader.js.map +1 -0
  237. package/dist/gpu-physics/rigid-body-height-field.cjs +166 -0
  238. package/dist/gpu-physics/rigid-body-height-field.d.ts +55 -0
  239. package/dist/gpu-physics/rigid-body-height-field.d.ts.map +1 -0
  240. package/dist/gpu-physics/rigid-body-height-field.js +184 -0
  241. package/dist/gpu-physics/rigid-body-height-field.js.map +1 -0
  242. package/dist/gpu-physics/rigid-body-joints.cjs +8 -3
  243. package/dist/gpu-physics/rigid-body-joints.d.ts.map +1 -1
  244. package/dist/gpu-physics/rigid-body-joints.js +10 -6
  245. package/dist/gpu-physics/rigid-body-joints.js.map +1 -1
  246. package/dist/gpu-physics/rigid-body-mesh-query-shaders.cjs +4 -2
  247. package/dist/gpu-physics/rigid-body-mesh-query-shaders.d.ts +1 -1
  248. package/dist/gpu-physics/rigid-body-mesh-query-shaders.d.ts.map +1 -1
  249. package/dist/gpu-physics/rigid-body-mesh-query-shaders.js +4 -2
  250. package/dist/gpu-physics/rigid-body-mesh-query-shaders.js.map +1 -1
  251. package/dist/gpu-physics/rigid-body-mesh.cjs +72 -17
  252. package/dist/gpu-physics/rigid-body-mesh.d.ts +3 -0
  253. package/dist/gpu-physics/rigid-body-mesh.d.ts.map +1 -1
  254. package/dist/gpu-physics/rigid-body-mesh.js +76 -20
  255. package/dist/gpu-physics/rigid-body-mesh.js.map +1 -1
  256. package/dist/gpu-physics/rigid-body-properties.cjs +4 -4
  257. package/dist/gpu-physics/rigid-body-properties.d.ts +6 -0
  258. package/dist/gpu-physics/rigid-body-properties.d.ts.map +1 -1
  259. package/dist/gpu-physics/rigid-body-properties.js +1 -1
  260. package/dist/gpu-physics/rigid-body-properties.js.map +1 -1
  261. package/dist/gpu-physics/rigid-body-publication.cjs +2 -2
  262. package/dist/gpu-physics/rigid-body-publication.js +1 -1
  263. package/dist/gpu-physics/rigid-body-publication.js.map +1 -1
  264. package/dist/gpu-physics/rigid-body-queries.cjs +159 -16
  265. package/dist/gpu-physics/rigid-body-queries.d.ts +24 -1
  266. package/dist/gpu-physics/rigid-body-queries.d.ts.map +1 -1
  267. package/dist/gpu-physics/rigid-body-queries.js +166 -14
  268. package/dist/gpu-physics/rigid-body-queries.js.map +1 -1
  269. package/dist/gpu-physics/rigid-body-query-geometry.cjs +22 -4
  270. package/dist/gpu-physics/rigid-body-query-geometry.d.ts +1 -1
  271. package/dist/gpu-physics/rigid-body-query-geometry.d.ts.map +1 -1
  272. package/dist/gpu-physics/rigid-body-query-geometry.js +22 -4
  273. package/dist/gpu-physics/rigid-body-query-geometry.js.map +1 -1
  274. package/dist/gpu-physics/rigid-body-shaders.cjs +13 -7
  275. package/dist/gpu-physics/rigid-body-shaders.d.ts +1 -1
  276. package/dist/gpu-physics/rigid-body-shaders.d.ts.map +1 -1
  277. package/dist/gpu-physics/rigid-body-shaders.js +16 -8
  278. package/dist/gpu-physics/rigid-body-shaders.js.map +1 -1
  279. package/dist/gpu-physics/rigid-body-shape-properties.cjs +2 -0
  280. package/dist/gpu-physics/rigid-body-shape-properties.d.ts.map +1 -1
  281. package/dist/gpu-physics/rigid-body-shape-properties.js +2 -0
  282. package/dist/gpu-physics/rigid-body-shape-properties.js.map +1 -1
  283. package/dist/gpu-physics/rigid-body-terrain-atlas.cjs +287 -0
  284. package/dist/gpu-physics/rigid-body-terrain-atlas.d.ts +87 -0
  285. package/dist/gpu-physics/rigid-body-terrain-atlas.d.ts.map +1 -0
  286. package/dist/gpu-physics/rigid-body-terrain-atlas.js +275 -0
  287. package/dist/gpu-physics/rigid-body-terrain-atlas.js.map +1 -0
  288. package/dist/gpu-physics/rigid-body-terrain-lod.cjs +240 -0
  289. package/dist/gpu-physics/rigid-body-terrain-lod.d.ts +76 -0
  290. package/dist/gpu-physics/rigid-body-terrain-lod.d.ts.map +1 -0
  291. package/dist/gpu-physics/rigid-body-terrain-lod.js +247 -0
  292. package/dist/gpu-physics/rigid-body-terrain-lod.js.map +1 -0
  293. package/dist/gpu-physics/rigid-body-terrain-stitch.cjs +215 -0
  294. package/dist/gpu-physics/rigid-body-terrain-stitch.d.ts +25 -0
  295. package/dist/gpu-physics/rigid-body-terrain-stitch.d.ts.map +1 -0
  296. package/dist/gpu-physics/rigid-body-terrain-stitch.js +218 -0
  297. package/dist/gpu-physics/rigid-body-terrain-stitch.js.map +1 -0
  298. package/dist/gpu-physics/rigid-body-terrain-stream.cjs +263 -0
  299. package/dist/gpu-physics/rigid-body-terrain-stream.d.ts +97 -0
  300. package/dist/gpu-physics/rigid-body-terrain-stream.d.ts.map +1 -0
  301. package/dist/gpu-physics/rigid-body-terrain-stream.js +250 -0
  302. package/dist/gpu-physics/rigid-body-terrain-stream.js.map +1 -0
  303. package/dist/gpu-physics/rigid-body-triggers.cjs +54 -15
  304. package/dist/gpu-physics/rigid-body-triggers.d.ts +1 -0
  305. package/dist/gpu-physics/rigid-body-triggers.d.ts.map +1 -1
  306. package/dist/gpu-physics/rigid-body-triggers.js +56 -15
  307. package/dist/gpu-physics/rigid-body-triggers.js.map +1 -1
  308. package/dist/gpu-physics/rigid-body-vehicle.cjs +99 -44
  309. package/dist/gpu-physics/rigid-body-vehicle.d.ts +15 -3
  310. package/dist/gpu-physics/rigid-body-vehicle.d.ts.map +1 -1
  311. package/dist/gpu-physics/rigid-body-vehicle.js +93 -40
  312. package/dist/gpu-physics/rigid-body-vehicle.js.map +1 -1
  313. package/dist/gpu-physics/sphere-world-shaders.cjs +48 -20
  314. package/dist/gpu-physics/sphere-world-shaders.d.ts.map +1 -1
  315. package/dist/gpu-physics/sphere-world-shaders.js +51 -21
  316. package/dist/gpu-physics/sphere-world-shaders.js.map +1 -1
  317. package/dist/gpu-project/benchmarks.cjs.map +2 -2
  318. package/dist/gpu-project/cpu-geometry-pipelines.d.ts +1 -1
  319. package/dist/gpu-project/cpu-projection-operation.d.ts +1 -1
  320. package/dist/gpu-project/crs.cjs.map +3 -3
  321. package/dist/gpu-project/crs.d.ts +1 -1
  322. package/dist/gpu-project/index.cjs.map +2 -2
  323. package/dist/gpu-project/projection-crs-benchmark.cjs +2 -2
  324. package/dist/gpu-project/projection-crs-benchmark.d.ts +1 -1
  325. package/dist/gpu-project/projection-crs-benchmark.js +1 -1
  326. package/dist/gpu-project/projection-crs-input.cjs +7 -7
  327. package/dist/gpu-project/projection-crs-input.d.ts +1 -1
  328. package/dist/gpu-project/projection-crs-input.js +4 -4
  329. package/dist/gpu-project/projection-engine.d.ts +2 -2
  330. package/dist/gpu-project/projection-program.cjs +2 -9
  331. package/dist/gpu-project/projection-program.d.ts.map +1 -1
  332. package/dist/gpu-project/projection-program.js +1 -8
  333. package/dist/gpu-project/projection-program.js.map +1 -1
  334. package/dist/gpu-project-benchmarks.cjs +21 -0
  335. package/dist/gpu-project-benchmarks.d.ts +2 -0
  336. package/dist/gpu-project-benchmarks.d.ts.map +1 -0
  337. package/dist/gpu-project-benchmarks.js +5 -0
  338. package/dist/gpu-project-benchmarks.js.map +1 -0
  339. package/dist/gpu-project-crs.cjs +21 -0
  340. package/dist/gpu-project-crs.d.ts +2 -0
  341. package/dist/gpu-project-crs.d.ts.map +1 -0
  342. package/dist/gpu-project-crs.js +5 -0
  343. package/dist/gpu-project-crs.js.map +1 -0
  344. package/dist/gpu-project-geoarrow.cjs +21 -0
  345. package/dist/gpu-project-geoarrow.d.ts +2 -0
  346. package/dist/gpu-project-geoarrow.d.ts.map +1 -0
  347. package/dist/gpu-project-geoarrow.js +5 -0
  348. package/dist/gpu-project-geoarrow.js.map +1 -0
  349. package/dist/gpu-project-graph.cjs +21 -0
  350. package/dist/gpu-project-graph.d.ts +2 -0
  351. package/dist/gpu-project-graph.d.ts.map +1 -0
  352. package/dist/gpu-project-graph.js +5 -0
  353. package/dist/gpu-project-graph.js.map +1 -0
  354. package/dist/gpu-simple-graph/gpu-simple-graph-transfer.d.ts +1 -1
  355. package/dist/gpu-simple-graph/gpu-simple-graph-transfer.d.ts.map +1 -1
  356. package/dist/gpu-simple-graph/gpu-simple-graph-value.d.ts +1 -1
  357. package/dist/gpu-simple-graph/gpu-simple-graph-value.d.ts.map +1 -1
  358. package/dist/gpu-simple-graph/operation/gpu-data-evaluator.d.ts +1 -1
  359. package/dist/gpu-simple-graph/operation/gpu-data-evaluator.d.ts.map +1 -1
  360. package/dist/gpu-simple-graph/operation/operation.d.ts +1 -1
  361. package/dist/gpu-simple-graph/operation/operation.d.ts.map +1 -1
  362. package/dist/gpu-simple-graph-cpu.cjs +21 -0
  363. package/dist/gpu-simple-graph-cpu.d.ts +2 -0
  364. package/dist/gpu-simple-graph-cpu.d.ts.map +1 -0
  365. package/dist/gpu-simple-graph-cpu.js +5 -0
  366. package/dist/gpu-simple-graph-cpu.js.map +1 -0
  367. package/dist/gpu-simple-graph-webgl.cjs +21 -0
  368. package/dist/gpu-simple-graph-webgl.d.ts +2 -0
  369. package/dist/gpu-simple-graph-webgl.d.ts.map +1 -0
  370. package/dist/gpu-simple-graph-webgl.js +5 -0
  371. package/dist/gpu-simple-graph-webgl.js.map +1 -0
  372. package/dist/gpu-simple-graph-webgpu.cjs +21 -0
  373. package/dist/gpu-simple-graph-webgpu.d.ts +2 -0
  374. package/dist/gpu-simple-graph-webgpu.d.ts.map +1 -0
  375. package/dist/gpu-simple-graph-webgpu.js +5 -0
  376. package/dist/gpu-simple-graph-webgpu.js.map +1 -0
  377. package/dist/gpu-sql/gpu-sql.cjs +269 -171
  378. package/dist/gpu-sql/gpu-sql.d.ts +36 -1
  379. package/dist/gpu-sql/gpu-sql.d.ts.map +1 -1
  380. package/dist/gpu-sql/gpu-sql.js +313 -181
  381. package/dist/gpu-sql/gpu-sql.js.map +1 -1
  382. package/dist/gpu-sql/index.cjs.map +3 -3
  383. package/dist/gpu-sql/index.d.ts +1 -1
  384. package/dist/gpu-sql/index.d.ts.map +1 -1
  385. package/dist/utils/float32.cjs +35 -0
  386. package/dist/utils/float32.d.ts +3 -0
  387. package/dist/utils/float32.d.ts.map +1 -0
  388. package/dist/utils/float32.js +16 -0
  389. package/dist/utils/float32.js.map +1 -0
  390. package/package.json +19 -19
  391. package/src/arrow/gpu/arrow-gpu-analytics-adapters.ts +77 -25
  392. package/src/arrow/gpu/arrow-gpu-analytics-readback.ts +52 -16
  393. package/src/arrow/gpu/arrow-gpu-table-conversion.ts +46 -1
  394. package/src/arrow/index.ts +1 -0
  395. package/src/experimental-models.ts +5 -0
  396. package/src/experimental-simulation.ts +5 -0
  397. package/src/gpu-core/gpu-bvh-bounds.ts +84 -0
  398. package/src/gpu-core/gpu-command-graph-submission-pacer.ts +102 -0
  399. package/src/gpu-core/index.ts +5 -0
  400. package/src/gpu-dataframe/gpu-analytics-compiler-utils.ts +7 -10
  401. package/src/gpu-dataframe/gpu-data-frame-query.ts +119 -25
  402. package/src/gpu-dataframe/gpu-data-frame.ts +35 -2
  403. package/src/gpu-dataframe/gpu-expression-shader.ts +267 -32
  404. package/src/gpu-dataframe/gpu-expression.ts +186 -10
  405. package/src/gpu-dataframe/gpu-global-aggregation-compiler.ts +6 -3
  406. package/src/gpu-dataframe/gpu-global-aggregation-query.ts +17 -6
  407. package/src/gpu-dataframe/gpu-global-sort-compiler.ts +177 -105
  408. package/src/gpu-dataframe/gpu-group-aggregation-compiler.ts +469 -53
  409. package/src/gpu-dataframe/gpu-group-by-query.ts +29 -13
  410. package/src/gpu-dataframe/gpu-histogram-compiler.ts +0 -1
  411. package/src/gpu-dataframe/gpu-join-compiler.ts +12 -8
  412. package/src/gpu-dataframe/gpu-query-compiler.ts +61 -19
  413. package/src/gpu-dataframe/gpu-sort-compiler.ts +0 -1
  414. package/src/gpu-dataframe/gpu-sort-query.ts +31 -5
  415. package/src/gpu-dataframe/index.ts +16 -3
  416. package/src/gpu-dataframe/portable-expression.ts +81 -4
  417. package/src/gpu-dggs-benchmarks.ts +5 -0
  418. package/src/gpu-graph-algorithms-benchmarks.ts +5 -0
  419. package/src/gpu-physics/gpu-physics-batch.ts +19 -13
  420. package/src/gpu-physics/gpu-physics-ensemble-terrain.ts +114 -0
  421. package/src/gpu-physics/gpu-physics-ensemble.ts +166 -7
  422. package/src/gpu-physics/gpu-rigid-body-world.ts +1085 -287
  423. package/src/gpu-physics/index.ts +46 -0
  424. package/src/gpu-physics/rigid-body-bounds-shaders.ts +16 -1
  425. package/src/gpu-physics/rigid-body-cache-shaders.ts +18 -6
  426. package/src/gpu-physics/rigid-body-capacity.ts +25 -4
  427. package/src/gpu-physics/rigid-body-cast-index.ts +277 -0
  428. package/src/gpu-physics/rigid-body-convex-shaders.ts +3 -2
  429. package/src/gpu-physics/rigid-body-ensemble-layout.ts +6 -2
  430. package/src/gpu-physics/rigid-body-ensemble-reset.ts +67 -15
  431. package/src/gpu-physics/rigid-body-ensemble-shaders.ts +18 -7
  432. package/src/gpu-physics/rigid-body-ensemble-transaction.ts +61 -10
  433. package/src/gpu-physics/rigid-body-event-compaction.ts +252 -0
  434. package/src/gpu-physics/rigid-body-event-snapshot.ts +76 -0
  435. package/src/gpu-physics/rigid-body-events.ts +63 -25
  436. package/src/gpu-physics/rigid-body-geometry.ts +49 -4
  437. package/src/gpu-physics/rigid-body-height-field-shader.ts +56 -0
  438. package/src/gpu-physics/rigid-body-height-field.ts +257 -0
  439. package/src/gpu-physics/rigid-body-joints.ts +9 -11
  440. package/src/gpu-physics/rigid-body-mesh-query-shaders.ts +4 -2
  441. package/src/gpu-physics/rigid-body-mesh.ts +97 -26
  442. package/src/gpu-physics/rigid-body-properties.ts +5 -2
  443. package/src/gpu-physics/rigid-body-publication.ts +1 -1
  444. package/src/gpu-physics/rigid-body-queries.ts +202 -14
  445. package/src/gpu-physics/rigid-body-query-geometry.ts +22 -4
  446. package/src/gpu-physics/rigid-body-shaders.ts +20 -8
  447. package/src/gpu-physics/rigid-body-shape-properties.ts +2 -0
  448. package/src/gpu-physics/rigid-body-terrain-atlas.ts +378 -0
  449. package/src/gpu-physics/rigid-body-terrain-lod.ts +332 -0
  450. package/src/gpu-physics/rigid-body-terrain-stitch.ts +286 -0
  451. package/src/gpu-physics/rigid-body-terrain-stream.ts +323 -0
  452. package/src/gpu-physics/rigid-body-triggers.ts +65 -20
  453. package/src/gpu-physics/rigid-body-vehicle.ts +108 -41
  454. package/src/gpu-physics/sphere-world-shaders.ts +53 -21
  455. package/src/gpu-project/README.md +2 -2
  456. package/src/gpu-project/cpu-geometry-pipelines.ts +1 -1
  457. package/src/gpu-project/cpu-projection-operation.ts +1 -1
  458. package/src/gpu-project/crs.ts +2 -2
  459. package/src/gpu-project/projection-crs-benchmark.ts +2 -2
  460. package/src/gpu-project/projection-crs-input.ts +4 -4
  461. package/src/gpu-project/projection-engine.ts +2 -2
  462. package/src/gpu-project/projection-program.ts +1 -9
  463. package/src/gpu-project-benchmarks.ts +5 -0
  464. package/src/gpu-project-crs.ts +5 -0
  465. package/src/gpu-project-geoarrow.ts +5 -0
  466. package/src/gpu-project-graph.ts +5 -0
  467. package/src/gpu-simple-graph/gpu-simple-graph-transfer.ts +1 -1
  468. package/src/gpu-simple-graph/gpu-simple-graph-value.ts +1 -1
  469. package/src/gpu-simple-graph/operation/gpu-data-evaluator.ts +1 -1
  470. package/src/gpu-simple-graph/operation/operation.ts +1 -1
  471. package/src/gpu-simple-graph/operations/swizzle.ts +1 -1
  472. package/src/gpu-simple-graph-cpu.ts +5 -0
  473. package/src/gpu-simple-graph-webgl.ts +5 -0
  474. package/src/gpu-simple-graph-webgpu.ts +5 -0
  475. package/src/gpu-sql/gpu-sql.ts +535 -223
  476. package/src/gpu-sql/index.ts +1 -1
  477. package/src/utils/float32.ts +16 -0
@@ -0,0 +1,247 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ /** Relative offsets, and the matching grid-index edges of a neighbor. */
5
+ const DIRECTIONS = [
6
+ { column: -1, row: 0, edge: 'first-column', opposite: 'last-column' },
7
+ { column: 1, row: 0, edge: 'last-column', opposite: 'first-column' },
8
+ { column: 0, row: -1, edge: 'first-row', opposite: 'last-row' },
9
+ { column: 0, row: 1, edge: 'last-row', opposite: 'first-row' }
10
+ ];
11
+ /** Resolve the sampling domain of a quadtree address from the root extent. */
12
+ export function getRigidBodyTerrainTileBounds(bounds, address) {
13
+ const divisions = 2 ** address.level;
14
+ const east = (bounds[2] - bounds[0]) / divisions;
15
+ const north = (bounds[3] - bounds[1]) / divisions;
16
+ return [
17
+ bounds[0] + address.column * east,
18
+ bounds[1] + address.row * north,
19
+ bounds[0] + (address.column + 1) * east,
20
+ bounds[1] + (address.row + 1) * north
21
+ ];
22
+ }
23
+ /** Select a bounded collision window with 2:1 neighboring LODs and automatic seam declarations. */
24
+ export class GPURigidBodyTerrainSelector {
25
+ props;
26
+ /** A detached copy of the dataset extent. */
27
+ bounds;
28
+ /** Stable slot order used to break ties. */
29
+ slots;
30
+ /** Per-tile distance threshold multiplier. */
31
+ refinementDistance;
32
+ /** LOD and residency dead band. */
33
+ hysteresis;
34
+ /** Collider assignment from the last selected window. */
35
+ previous = new Map();
36
+ /** Previously split ancestors, used to retain detail near the threshold. */
37
+ previousSplits = new Set();
38
+ /** Establish the provider topology and fixed collider budget. */
39
+ constructor(props) {
40
+ this.props = props;
41
+ const { bounds, maximumLevel, slots } = props;
42
+ this.refinementDistance = props.refinementDistance ?? 1;
43
+ this.hysteresis = props.hysteresis ?? 0.2;
44
+ if (bounds.length !== 4 ||
45
+ !bounds.every(Number.isFinite) ||
46
+ !Number.isFinite(bounds[2] - bounds[0]) ||
47
+ !Number.isFinite(bounds[3] - bounds[1]) ||
48
+ bounds[2] <= bounds[0] ||
49
+ bounds[3] <= bounds[1] ||
50
+ !Number.isSafeInteger(maximumLevel) ||
51
+ maximumLevel < 0 ||
52
+ maximumLevel > 24 ||
53
+ !slots.length ||
54
+ new Set(slots).size !== slots.length ||
55
+ slots.some(slot => !Number.isSafeInteger(slot) || slot < 0) ||
56
+ !Number.isFinite(this.refinementDistance) ||
57
+ this.refinementDistance < 0 ||
58
+ !Number.isFinite(this.hysteresis) ||
59
+ this.hysteresis < 0 ||
60
+ this.hysteresis >= 1)
61
+ throw new Error('Invalid terrain selection policy');
62
+ this.bounds = [...bounds];
63
+ this.slots = [...slots];
64
+ }
65
+ /** Forget LOD hysteresis and previous slot choices after teleporting or resetting the app. */
66
+ reset() {
67
+ this.previous.clear();
68
+ this.previousSplits.clear();
69
+ }
70
+ /** Select leaves near the focus. Missing children or exhausted slots retain their parent. */
71
+ select(focus) {
72
+ const { position, radius = Infinity } = focus;
73
+ if (position.length !== 2 || !position.every(Number.isFinite) || !(radius >= 0))
74
+ throw new Error('Invalid terrain focus');
75
+ const leaves = new Map();
76
+ const split = new Set();
77
+ const queue = [];
78
+ let slotLimitReached = false;
79
+ /** Calculate proximity and consult the catalog only for the active residency footprint. */
80
+ const getCandidate = (address, bounds) => {
81
+ const id = addressKey(address);
82
+ const distance = Math.hypot(Math.max(0, bounds[0] - position[0], position[0] - bounds[2]), Math.max(0, bounds[1] - position[1], position[1] - bounds[3]));
83
+ const retained = this.previous.has(id) || this.previousSplits.has(id);
84
+ if (distance > radius * (retained ? 1 + this.hysteresis : 1))
85
+ return null;
86
+ const key = this.props.getTileKey ? this.props.getTileKey(address) : id;
87
+ if (!key)
88
+ return undefined;
89
+ const priority = distance / Math.min(bounds[2] - bounds[0], bounds[3] - bounds[1]);
90
+ return { id, key, address, bounds, priority };
91
+ };
92
+ /** Register a leaf and enqueue it if the focus requires a finer resolution. */
93
+ const add = (tile) => {
94
+ leaves.set(tile.id, tile);
95
+ const retained = this.previousSplits.has(tile.id);
96
+ const threshold = this.refinementDistance * (retained ? 1 + this.hysteresis : 1 - this.hysteresis);
97
+ if (tile.address.level < this.props.maximumLevel && tile.priority <= threshold)
98
+ pushCandidate(queue, tile);
99
+ };
100
+ const root = getCandidate({ level: 0, column: 0, row: 0 }, this.bounds);
101
+ if (root)
102
+ add(root);
103
+ while (queue.length) {
104
+ const tile = popCandidate(queue);
105
+ if (!leaves.has(tile.id))
106
+ continue;
107
+ const refinements = new Map();
108
+ let slotCost = 0;
109
+ /** Stage the requested split and any coarser neighbor splits needed to preserve 2:1. */
110
+ const planSplit = (parent) => {
111
+ if (refinements.has(parent))
112
+ return true;
113
+ const children = [];
114
+ const { level, column, row } = parent.address;
115
+ for (let child = 0; child < 4; child++) {
116
+ const address = {
117
+ level: level + 1,
118
+ column: column * 2 + (child % 2),
119
+ row: row * 2 + Math.floor(child / 2)
120
+ };
121
+ const candidate = getCandidate(address, getRigidBodyTerrainTileBounds(this.bounds, address));
122
+ if (candidate === undefined)
123
+ return false;
124
+ if (candidate)
125
+ children.push(candidate);
126
+ }
127
+ if (!children.length)
128
+ return false;
129
+ refinements.set(parent, children);
130
+ slotCost += children.length - 1;
131
+ if (leaves.size + slotCost > this.slots.length) {
132
+ slotLimitReached = true;
133
+ return false;
134
+ }
135
+ for (const direction of DIRECTIONS) {
136
+ const neighbor = getNeighbor(leaves, parent.address, direction);
137
+ if (neighbor && neighbor.address.level < level && !planSplit(neighbor))
138
+ return false;
139
+ }
140
+ return true;
141
+ };
142
+ if (!planSplit(tile))
143
+ continue;
144
+ for (const [parent, children] of refinements) {
145
+ leaves.delete(parent.id);
146
+ split.add(parent.id);
147
+ for (const child of children)
148
+ add(child);
149
+ }
150
+ }
151
+ const assignments = new Map();
152
+ for (const id of leaves.keys()) {
153
+ const slot = this.previous.get(id);
154
+ if (slot !== undefined)
155
+ assignments.set(id, slot);
156
+ }
157
+ const taken = new Set(assignments.values());
158
+ const vacancies = this.slots.filter(slot => !taken.has(slot));
159
+ let nextSlot = 0;
160
+ const tiles = Array.from(leaves.values(), ({ id, key, address, bounds }) => {
161
+ const collider = assignments.get(id) ?? vacancies[nextSlot++];
162
+ assignments.set(id, collider);
163
+ return { collider, key, address, bounds };
164
+ });
165
+ const seams = [];
166
+ for (const tile of tiles) {
167
+ for (const direction of DIRECTIONS) {
168
+ const neighbor = getNeighbor(leaves, tile.address, direction);
169
+ if (!neighbor)
170
+ continue;
171
+ const collider = assignments.get(neighbor.id);
172
+ // A fine tile finds its coarse neighbor by walking ancestors. Equal levels only emit once.
173
+ if (neighbor.address.level === tile.address.level && collider < tile.collider)
174
+ continue;
175
+ seams.push({
176
+ first: tile.collider,
177
+ firstEdge: direction.edge,
178
+ second: collider,
179
+ secondEdge: direction.opposite
180
+ });
181
+ }
182
+ }
183
+ this.previous = assignments;
184
+ this.previousSplits = split;
185
+ return { tiles, seams, slotLimitReached };
186
+ }
187
+ }
188
+ /** Encode a dyadic tile address as its default provider key. */
189
+ function addressKey(address) {
190
+ return `${address.level}/${address.column}/${address.row}`;
191
+ }
192
+ /** Find a same-level or coarser leaf across an edge. Fine neighbors emit their own seam. */
193
+ function getNeighbor(leaves, address, direction) {
194
+ let column = address.column + direction.column;
195
+ let row = address.row + direction.row;
196
+ const count = 2 ** address.level;
197
+ if (column < 0 || row < 0 || column >= count || row >= count)
198
+ return undefined;
199
+ for (let level = address.level; level >= 0; level--) {
200
+ const tile = leaves.get(addressKey({ level, column, row }));
201
+ if (tile)
202
+ return tile;
203
+ column = Math.floor(column / 2);
204
+ row = Math.floor(row / 2);
205
+ }
206
+ return undefined;
207
+ }
208
+ /** Prefer nearby tiles and resolve equal priorities deterministically. */
209
+ function compareCandidates(first, second) {
210
+ return (first.priority - second.priority ||
211
+ first.address.level - second.address.level ||
212
+ first.address.row - second.address.row ||
213
+ first.address.column - second.address.column);
214
+ }
215
+ /** Insert a refinement candidate in the priority heap. */
216
+ function pushCandidate(queue, candidate) {
217
+ let index = queue.length;
218
+ queue.push(candidate);
219
+ while (index > 0) {
220
+ const parent = Math.floor((index - 1) / 2);
221
+ if (compareCandidates(queue[parent], candidate) <= 0)
222
+ break;
223
+ queue[index] = queue[parent];
224
+ index = parent;
225
+ }
226
+ queue[index] = candidate;
227
+ }
228
+ /** Remove the highest-priority refinement candidate. */
229
+ function popCandidate(queue) {
230
+ const first = queue[0];
231
+ const last = queue.pop();
232
+ if (!queue.length)
233
+ return first;
234
+ let index = 0;
235
+ while (index * 2 + 1 < queue.length) {
236
+ let child = index * 2 + 1;
237
+ if (child + 1 < queue.length && compareCandidates(queue[child + 1], queue[child]) < 0)
238
+ child++;
239
+ if (compareCandidates(last, queue[child]) <= 0)
240
+ break;
241
+ queue[index] = queue[child];
242
+ index = child;
243
+ }
244
+ queue[index] = last;
245
+ return first;
246
+ }
247
+ //# sourceMappingURL=rigid-body-terrain-lod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rigid-body-terrain-lod.js","sourceRoot":"","sources":["../../src/gpu-physics/rigid-body-terrain-lod.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAqE5D,yEAAyE;AACzE,MAAM,UAAU,GAAG;IACjB,EAAC,MAAM,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAC;IACnE,EAAC,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAC;IAClE,EAAC,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAC;IAC7D,EAAC,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAC;CAM3D,CAAC;AAEJ,8EAA8E;AAC9E,MAAM,UAAU,6BAA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ACxD,SAAS,YAAY,CAAC,KAAkB;IACtC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,EAAG,CAAC;IAC1B,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAChC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,OAAO,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QACpC,IAAI,KAAK,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,IAAI,iBAAiB,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;YAAE,KAAK,EAAE,CAAC;QAC/F,IAAI,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;YAAE,MAAM;QACtD,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5B,KAAK,GAAG,KAAK,CAAC;IAChB,CAAC;IACD,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IACpB,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,215 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var rigid_body_terrain_stitch_exports = {};
19
+ __export(rigid_body_terrain_stitch_exports, {
20
+ stitchRigidBodyTerrainTiles: () => stitchRigidBodyTerrainTiles
21
+ });
22
+ module.exports = __toCommonJS(rigid_body_terrain_stitch_exports);
23
+ function stitchRigidBodyTerrainTiles(tiles, seams) {
24
+ if (!seams.length)
25
+ return tiles;
26
+ const samples = /* @__PURE__ */ new Map();
27
+ const constraints = [];
28
+ const aliases = [];
29
+ const getSample = (boundary, edgeIndex) => {
30
+ var _a, _b;
31
+ let tileSamples = samples.get(boundary.slot);
32
+ if (!tileSamples) {
33
+ tileSamples = /* @__PURE__ */ new Map();
34
+ samples.set(boundary.slot, tileSamples);
35
+ }
36
+ const index = boundary.index(edgeIndex);
37
+ const { field, position } = boundary.tile;
38
+ const sourceHeight = ((_a = field.heights) == null ? void 0 : _a[index]) ?? NaN;
39
+ const spacing = Math.hypot(...boundary.step);
40
+ let sample = tileSamples.get(index);
41
+ if (!sample) {
42
+ sample = {
43
+ parent: null,
44
+ value: sourceHeight + position[2],
45
+ valid: Number.isFinite(sourceHeight) && ((_b = field.validity) == null ? void 0 : _b[index]) !== 0,
46
+ spacing,
47
+ slot: boundary.slot,
48
+ index
49
+ };
50
+ tileSamples.set(index, sample);
51
+ } else {
52
+ sample.spacing = Math.max(sample.spacing, spacing);
53
+ }
54
+ return sample;
55
+ };
56
+ for (const seam of seams) {
57
+ const first = makeBoundary(tiles, seam.first, seam.firstEdge);
58
+ const second = makeBoundary(tiles, seam.second, seam.secondEdge);
59
+ if (first.slot === second.slot)
60
+ throw new Error("Terrain seam requires distinct tiles");
61
+ const firstSpacing = Math.hypot(...first.step);
62
+ const secondSpacing = Math.hypot(...second.step);
63
+ const firstIsCoarse = firstSpacing >= secondSpacing;
64
+ const coarse = firstIsCoarse ? first : second;
65
+ const fine = firstIsCoarse ? second : first;
66
+ const spacing = Math.max(firstSpacing, secondSpacing);
67
+ const spacingRatio = Math.min(firstSpacing, secondSpacing) / spacing;
68
+ if (!Number.isFinite(spacingRatio) || spacingRatio <= 0)
69
+ throw new Error("Invalid terrain edge spacing");
70
+ const direction = coarse.step.map((value) => value / spacing);
71
+ const offset = fine.origin.map((value, axis) => value - coarse.origin[axis]);
72
+ const projectedStart = (offset[0] * direction[0] + offset[1] * direction[1]) / spacing;
73
+ const projectedStep = (fine.step[0] * direction[0] + fine.step[1] * direction[1]) / spacing;
74
+ const tolerance = 16 * Number.EPSILON * Math.max(1, coarse.count, fine.count, ...coarse.origin.map((value) => Math.abs(value) / spacing), ...fine.origin.map((value) => Math.abs(value) / spacing));
75
+ const lateralStart = (offset[0] * direction[1] - offset[1] * direction[0]) / spacing;
76
+ const lateralStep = (fine.step[0] * direction[1] - fine.step[1] * direction[0]) / spacing;
77
+ const subdivision = Math.round(1 / spacingRatio);
78
+ if (tolerance >= spacingRatio * 0.01 || Math.max(Math.abs(lateralStart), Math.abs(lateralStart + lateralStep * (fine.count - 1))) > tolerance || Math.abs(Math.abs(projectedStep) - 1 / subdivision) * (fine.count - 1) > tolerance || Math.abs(projectedStart * subdivision - Math.round(projectedStart * subdivision)) > tolerance * subdivision)
79
+ throw new Error("Terrain seam requires collinear nested sample lattices");
80
+ const start = Math.round(projectedStart * subdivision);
81
+ const directionSign = Math.sign(projectedStep);
82
+ const end = start + directionSign * (fine.count - 1);
83
+ const lower = Math.max(0, Math.min(start, end));
84
+ const upper = Math.min((coarse.count - 1) * subdivision, Math.max(start, end));
85
+ if (upper <= lower || lower % subdivision !== 0 || upper % subdivision !== 0)
86
+ throw new Error("Terrain seam overlap must start and end at common sample knots");
87
+ for (let knot = lower; knot <= upper; knot++) {
88
+ const fineSample = getSample(fine, (knot - start) * directionSign);
89
+ const lowerIndex = Math.floor(knot / subdivision);
90
+ const lowerSample = getSample(coarse, lowerIndex);
91
+ const remainder = knot % subdivision;
92
+ if (remainder === 0) {
93
+ aliases.push([fineSample, lowerSample]);
94
+ } else {
95
+ constraints.push({
96
+ fine: fineSample,
97
+ lower: lowerSample,
98
+ upper: getSample(coarse, lowerIndex + 1),
99
+ fraction: remainder / subdivision
100
+ });
101
+ }
102
+ }
103
+ }
104
+ for (const [first, second] of aliases)
105
+ uniteSamples(first, second);
106
+ const bySample = /* @__PURE__ */ new Map();
107
+ for (const constraint of constraints) {
108
+ const root = getRoot(constraint.fine);
109
+ const existing = bySample.get(root) ?? [];
110
+ existing.push(constraint);
111
+ bySample.set(root, existing);
112
+ }
113
+ const resolved = /* @__PURE__ */ new Map();
114
+ const resolving = /* @__PURE__ */ new Set();
115
+ const resolve = (sample) => {
116
+ const root = getRoot(sample);
117
+ const cached = resolved.get(root);
118
+ if (cached !== void 0)
119
+ return cached;
120
+ if (resolving.has(root))
121
+ throw new Error("Cyclic terrain seam constraints");
122
+ resolving.add(root);
123
+ const rules = bySample.get(root);
124
+ let value = root.valid ? root.value : NaN;
125
+ if (root.valid && rules) {
126
+ let previous;
127
+ for (const rule of rules) {
128
+ const lower = resolve(rule.lower);
129
+ const upper = resolve(rule.upper);
130
+ const interpolated = lower + (upper - lower) * rule.fraction;
131
+ if (!Number.isFinite(interpolated)) {
132
+ previous = NaN;
133
+ break;
134
+ }
135
+ if (previous !== void 0 && Math.abs(previous - interpolated) > 16 * Number.EPSILON * Math.max(1, Math.abs(previous), Math.abs(interpolated)))
136
+ throw new Error("Incompatible terrain junction heights");
137
+ previous = interpolated;
138
+ }
139
+ value = previous;
140
+ }
141
+ resolving.delete(root);
142
+ resolved.set(root, value);
143
+ return value;
144
+ };
145
+ const result = new Map(tiles);
146
+ for (const [slot, tileSamples] of samples) {
147
+ const tile = tiles.get(slot);
148
+ const { field, position } = tile;
149
+ if (!field.heights)
150
+ continue;
151
+ let heights;
152
+ for (const sample of tileSamples.values()) {
153
+ const height = resolve(sample) - position[2];
154
+ if (!heights && Object.is(height, field.heights[sample.index]))
155
+ continue;
156
+ heights ??= Float64Array.from(field.heights);
157
+ heights[sample.index] = height;
158
+ }
159
+ if (heights)
160
+ result.set(slot, { ...tile, field: { ...field, heights } });
161
+ }
162
+ return result;
163
+ }
164
+ function makeBoundary(tiles, slot, edge) {
165
+ var _a;
166
+ const tile = tiles.get(slot);
167
+ if (!tile || !tile.field.heights)
168
+ throw new Error("Terrain seam requires two loaded height fields");
169
+ const { field, position } = tile;
170
+ if (!Number.isSafeInteger(field.width) || !Number.isSafeInteger(field.height) || field.width < 2 || field.height < 2 || field.width * field.height > 1e6 || ((_a = field.heights) == null ? void 0 : _a.length) !== field.width * field.height || !position.every(Number.isFinite))
171
+ throw new Error("Invalid terrain seam tile");
172
+ const origin = field.origin ?? [0, 0];
173
+ const columnStep = field.columnStep ?? [1, 0];
174
+ const rowStep = field.rowStep ?? [0, 1];
175
+ const rowEdge = edge === "first-row" || edge === "last-row";
176
+ const row = edge === "last-row" ? field.height - 1 : 0;
177
+ const column = edge === "last-column" ? field.width - 1 : 0;
178
+ return {
179
+ slot,
180
+ tile,
181
+ origin: [
182
+ position[0] + origin[0] + column * columnStep[0] + row * rowStep[0],
183
+ position[1] + origin[1] + column * columnStep[1] + row * rowStep[1]
184
+ ],
185
+ step: rowEdge ? columnStep : rowStep,
186
+ count: rowEdge ? field.width : field.height,
187
+ index: rowEdge ? (sample) => row * field.width + sample : (sample) => sample * field.width + column
188
+ };
189
+ }
190
+ function getRoot(sample) {
191
+ let root = sample;
192
+ while (root.parent)
193
+ root = root.parent;
194
+ while (sample.parent) {
195
+ const previous = sample.parent;
196
+ sample.parent = root;
197
+ sample = previous;
198
+ }
199
+ return root;
200
+ }
201
+ function uniteSamples(first, second) {
202
+ const firstRoot = getRoot(first);
203
+ const secondRoot = getRoot(second);
204
+ if (firstRoot === secondRoot)
205
+ return;
206
+ const firstWins = firstRoot.spacing > secondRoot.spacing || firstRoot.spacing === secondRoot.spacing && firstRoot.slot < secondRoot.slot;
207
+ const authority = firstWins ? firstRoot : secondRoot;
208
+ const dependent = firstWins ? secondRoot : firstRoot;
209
+ authority.valid &&= dependent.valid;
210
+ dependent.parent = authority;
211
+ }
212
+ // Annotate the CommonJS export names for ESM import in node:
213
+ 0 && (module.exports = {
214
+ stitchRigidBodyTerrainTiles
215
+ });
@@ -0,0 +1,25 @@
1
+ import type { GPURigidBodyHeightField } from "./rigid-body-height-field.js";
2
+ import type { RigidBodyVector } from "./rigid-body-properties.js";
3
+ /** A source tile in the common metric frame shared by the receiving collider slots. */
4
+ export type GPURigidBodyTerrainTile = {
5
+ /** Source samples and affine grid transform. */
6
+ field: GPURigidBodyHeightField;
7
+ /** Placement of the tile in the common frame. */
8
+ position: RigidBodyVector;
9
+ };
10
+ /** Grid-index boundary, independent of the compass direction of its affine transform. */
11
+ export type GPURigidBodyTerrainEdge = 'first-column' | 'last-column' | 'first-row' | 'last-row';
12
+ /** Two declared adjacent edges indexed by collider slot in a terrain window. */
13
+ export type GPURigidBodyTerrainSeam = {
14
+ /** First collider slot. */
15
+ first: number;
16
+ /** Edge of the first tile. */
17
+ firstEdge: GPURigidBodyTerrainEdge;
18
+ /** Second collider slot. */
19
+ second: number;
20
+ /** Edge of the second tile. */
21
+ secondEdge: GPURigidBodyTerrainEdge;
22
+ };
23
+ /** Match aligned mixed-resolution edges without mutating any provider tile. */
24
+ export declare function stitchRigidBodyTerrainTiles(tiles: ReadonlyMap<number, GPURigidBodyTerrainTile>, seams: readonly GPURigidBodyTerrainSeam[]): ReadonlyMap<number, GPURigidBodyTerrainTile>;
25
+ //# sourceMappingURL=rigid-body-terrain-stitch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rigid-body-terrain-stitch.d.ts","sourceRoot":"","sources":["../../src/gpu-physics/rigid-body-terrain-stitch.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,uBAAuB,EAAC,qCAAkC;AACvE,OAAO,KAAK,EAAC,eAAe,EAAC,mCAAgC;AAE7D,uFAAuF;AACvF,MAAM,MAAM,uBAAuB,GAAG;IACpC,gDAAgD;IAChD,KAAK,EAAE,uBAAuB,CAAC;IAC/B,iDAAiD;IACjD,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC;AAEF,yFAAyF;AACzF,MAAM,MAAM,uBAAuB,GAAG,cAAc,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAC;AAEhG,gFAAgF;AAChF,MAAM,MAAM,uBAAuB,GAAG;IACpC,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,SAAS,EAAE,uBAAuB,CAAC;IACnC,4BAA4B;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,UAAU,EAAE,uBAAuB,CAAC;CACrC,CAAC;AAyBF,+EAA+E;AAC/E,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,uBAAuB,CAAC,EACnD,KAAK,EAAE,SAAS,uBAAuB,EAAE,GACxC,WAAW,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAkK9C"}