@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.
- package/LICENSE +4 -4
- package/THIRD-PARTY-NOTICES.md +19 -0
- package/dist/arrow/arrow-colors.cjs +99 -18
- package/dist/arrow/arrow-colors.d.ts +27 -10
- package/dist/arrow/arrow-colors.d.ts.map +1 -1
- package/dist/arrow/arrow-colors.js +107 -24
- package/dist/arrow/arrow-colors.js.map +1 -1
- package/dist/arrow/arrow-utils/arrow-paths.cjs +4 -3
- package/dist/arrow/arrow-utils/arrow-paths.d.ts.map +1 -1
- package/dist/arrow/arrow-utils/arrow-paths.js +5 -4
- package/dist/arrow/arrow-utils/arrow-paths.js.map +1 -1
- package/dist/arrow/cpu/arrow-coordinate-projection.cjs +30 -0
- package/dist/arrow/cpu/arrow-coordinate-projection.d.ts +5 -0
- package/dist/arrow/cpu/arrow-coordinate-projection.d.ts.map +1 -0
- package/dist/arrow/cpu/arrow-coordinate-projection.js +9 -0
- package/dist/arrow/cpu/arrow-coordinate-projection.js.map +1 -0
- package/dist/arrow/cpu/arrow-cpu-pipelines.cjs +31 -0
- package/dist/arrow/cpu/arrow-cpu-pipelines.d.ts +2 -0
- package/dist/arrow/cpu/arrow-cpu-pipelines.d.ts.map +1 -0
- package/dist/arrow/cpu/arrow-cpu-pipelines.js +5 -0
- package/dist/arrow/cpu/arrow-cpu-pipelines.js.map +1 -0
- package/dist/arrow/cpu/arrow-cpu-vector-adapters.cjs +99 -0
- package/dist/arrow/cpu/arrow-cpu-vector-adapters.d.ts +9 -0
- package/dist/arrow/cpu/arrow-cpu-vector-adapters.d.ts.map +1 -0
- package/dist/arrow/cpu/arrow-cpu-vector-adapters.js +100 -0
- package/dist/arrow/cpu/arrow-cpu-vector-adapters.js.map +1 -0
- package/dist/arrow/geoarrow/arrow-geoarrow-adapter.cjs +9 -371
- package/dist/arrow/geoarrow/arrow-geoarrow-adapter.d.ts +8 -28
- package/dist/arrow/geoarrow/arrow-geoarrow-adapter.d.ts.map +1 -1
- package/dist/arrow/geoarrow/arrow-geoarrow-adapter.js +4 -381
- package/dist/arrow/geoarrow/arrow-geoarrow-adapter.js.map +1 -1
- package/dist/arrow/geoarrow/arrow-geoarrow-conversion.cjs +11 -11
- package/dist/arrow/geoarrow/arrow-geoarrow-conversion.d.ts +2 -0
- package/dist/arrow/geoarrow/arrow-geoarrow-conversion.d.ts.map +1 -1
- package/dist/arrow/geoarrow/arrow-geoarrow-conversion.js +4 -4
- package/dist/arrow/geoarrow/arrow-geoarrow-conversion.js.map +1 -1
- package/dist/arrow/geoarrow/arrow-polygon-tessellation.cjs +2 -2
- package/dist/arrow/geoarrow/arrow-polygon-tessellation.js +1 -1
- package/dist/arrow/geoarrow/arrow-polygon-tessellation.js.map +1 -1
- package/dist/arrow/gpu/arrow-column-gpu-vector.cjs +27 -8
- package/dist/arrow/gpu/arrow-column-gpu-vector.d.ts +11 -1
- package/dist/arrow/gpu/arrow-column-gpu-vector.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-column-gpu-vector.js +33 -8
- package/dist/arrow/gpu/arrow-column-gpu-vector.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.cjs +68 -3
- package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts +9 -2
- package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.js +76 -3
- package/dist/arrow/gpu/arrow-gpu-table-conversion.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.cjs +8 -6
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.d.ts +1 -0
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.js +17 -7
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.cjs +35 -5
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts +6 -1
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.js +40 -5
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.js.map +1 -1
- package/dist/arrow/index.cjs +19 -2
- package/dist/arrow/index.cjs.map +3 -3
- package/dist/arrow/index.d.ts +5 -2
- package/dist/arrow/index.d.ts.map +1 -1
- package/dist/arrow/index.js +4 -1
- package/dist/arrow/index.js.map +1 -1
- package/dist/arrow/internal.cjs.map +2 -2
- package/dist/dist.dev.js +3820 -1646
- package/dist/dist.min.js +450 -136
- package/dist/experimental/index.cjs.map +1 -1
- package/dist/experimental/simulation/index.cjs.map +1 -1
- package/dist/experimental-models.cjs +21 -0
- package/dist/experimental-models.d.ts +2 -0
- package/dist/experimental-models.d.ts.map +1 -0
- package/dist/experimental-models.js +5 -0
- package/dist/experimental-models.js.map +1 -0
- package/dist/experimental-simulation.cjs +21 -0
- package/dist/experimental-simulation.d.ts +2 -0
- package/dist/experimental-simulation.d.ts.map +1 -0
- package/dist/experimental-simulation.js +5 -0
- package/dist/experimental-simulation.js.map +1 -0
- package/dist/geospatial/gpu-point-spatial-query.cjs +2 -15
- package/dist/geospatial/gpu-point-spatial-query.d.ts.map +1 -1
- package/dist/geospatial/gpu-point-spatial-query.js +2 -15
- package/dist/geospatial/gpu-point-spatial-query.js.map +1 -1
- package/dist/geospatial/index.cjs.map +2 -2
- package/dist/gpu-a5/index.cjs.map +1 -1
- package/dist/gpu-core/compiled-gpu-graph.cjs +47 -0
- package/dist/gpu-core/compiled-gpu-graph.d.ts +5 -0
- package/dist/gpu-core/compiled-gpu-graph.d.ts.map +1 -1
- package/dist/gpu-core/compiled-gpu-graph.js +54 -1
- package/dist/gpu-core/compiled-gpu-graph.js.map +1 -1
- package/dist/gpu-core/gpu-command-graph-compiler.cjs +11 -2
- package/dist/gpu-core/gpu-command-graph-compiler.d.ts +2 -1
- package/dist/gpu-core/gpu-command-graph-compiler.d.ts.map +1 -1
- package/dist/gpu-core/gpu-command-graph-compiler.js +13 -2
- package/dist/gpu-core/gpu-command-graph-compiler.js.map +1 -1
- package/dist/gpu-core/gpu-command-graph-types.d.ts +16 -1
- package/dist/gpu-core/gpu-command-graph-types.d.ts.map +1 -1
- package/dist/gpu-core/gpu-command-graph-types.js.map +1 -1
- package/dist/gpu-core/gpu-command-graph.cjs +34 -11
- package/dist/gpu-core/gpu-command-graph.d.ts +17 -8
- package/dist/gpu-core/gpu-command-graph.d.ts.map +1 -1
- package/dist/gpu-core/gpu-command-graph.js +39 -11
- package/dist/gpu-core/gpu-command-graph.js.map +1 -1
- package/dist/gpu-core/gpu-cpu-execution.cjs +279 -0
- package/dist/gpu-core/gpu-cpu-execution.d.ts +22 -0
- package/dist/gpu-core/gpu-cpu-execution.d.ts.map +1 -0
- package/dist/gpu-core/gpu-cpu-execution.js +294 -0
- package/dist/gpu-core/gpu-cpu-execution.js.map +1 -0
- package/dist/gpu-core/gpu-cpu-operation.cjs +54 -0
- package/dist/gpu-core/gpu-cpu-operation.d.ts +40 -0
- package/dist/gpu-core/gpu-cpu-operation.d.ts.map +1 -0
- package/dist/gpu-core/gpu-cpu-operation.js +35 -0
- package/dist/gpu-core/gpu-cpu-operation.js.map +1 -0
- package/dist/gpu-core/gpu-dispatch-utils.cjs +7 -3
- package/dist/gpu-core/gpu-dispatch-utils.d.ts +2 -0
- package/dist/gpu-core/gpu-dispatch-utils.d.ts.map +1 -1
- package/dist/gpu-core/gpu-dispatch-utils.js +4 -1
- package/dist/gpu-core/gpu-dispatch-utils.js.map +1 -1
- package/dist/gpu-core/gpu-expression-operation.cjs +2 -2
- package/dist/gpu-core/gpu-expression-operation.d.ts +1 -1
- package/dist/gpu-core/gpu-expression-operation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-expression-operation.js +1 -1
- package/dist/gpu-core/gpu-expression-operation.js.map +1 -1
- package/dist/gpu-core/gpu-expression-plan.cjs +5 -1
- package/dist/gpu-core/gpu-expression-plan.d.ts +3 -2
- package/dist/gpu-core/gpu-expression-plan.d.ts.map +1 -1
- package/dist/gpu-core/gpu-expression-plan.js +7 -1
- package/dist/gpu-core/gpu-expression-plan.js.map +1 -1
- package/dist/gpu-core/gpu-graph-compiler.cjs +48 -0
- package/dist/gpu-core/gpu-graph-compiler.d.ts +1 -0
- package/dist/gpu-core/gpu-graph-compiler.d.ts.map +1 -1
- package/dist/gpu-core/gpu-graph-compiler.js +50 -0
- package/dist/gpu-core/gpu-graph-compiler.js.map +1 -1
- package/dist/gpu-core/gpu-graph.d.ts +2 -2
- package/dist/gpu-core/gpu-graph.d.ts.map +1 -1
- package/dist/gpu-core/gpu-graph.js.map +1 -1
- package/dist/gpu-core/gpu-grid-aggregation.cjs +2 -5
- package/dist/gpu-core/gpu-grid-aggregation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-grid-aggregation.js +2 -5
- package/dist/gpu-core/gpu-grid-aggregation.js.map +1 -1
- package/dist/gpu-core/gpu-grid-binning.cjs +2 -5
- package/dist/gpu-core/gpu-grid-binning.d.ts.map +1 -1
- package/dist/gpu-core/gpu-grid-binning.js +2 -5
- package/dist/gpu-core/gpu-grid-binning.js.map +1 -1
- package/dist/gpu-core/gpu-grid-coordinate.cjs +41 -0
- package/dist/gpu-core/gpu-grid-coordinate.d.ts +7 -0
- package/dist/gpu-core/gpu-grid-coordinate.d.ts.map +1 -0
- package/dist/gpu-core/gpu-grid-coordinate.js +24 -0
- package/dist/gpu-core/gpu-grid-coordinate.js.map +1 -0
- package/dist/gpu-core/gpu-grid-index-internals.cjs +2 -15
- package/dist/gpu-core/gpu-grid-index-internals.d.ts.map +1 -1
- package/dist/gpu-core/gpu-grid-index-internals.js +2 -15
- package/dist/gpu-core/gpu-grid-index-internals.js.map +1 -1
- package/dist/gpu-core/gpu-grid-index-query.cjs +2 -16
- package/dist/gpu-core/gpu-grid-index-query.d.ts.map +1 -1
- package/dist/gpu-core/gpu-grid-index-query.js +2 -16
- package/dist/gpu-core/gpu-grid-index-query.js.map +1 -1
- package/dist/gpu-core/gpu-group-aggregation.cjs +7 -15
- package/dist/gpu-core/gpu-group-aggregation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-group-aggregation.js +7 -18
- package/dist/gpu-core/gpu-group-aggregation.js.map +1 -1
- package/dist/gpu-core/gpu-operation.d.ts +4 -4
- package/dist/gpu-core/gpu-operation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-operation.js.map +1 -1
- package/dist/gpu-core/gpu-reduction.cjs +6 -14
- package/dist/gpu-core/gpu-reduction.d.ts.map +1 -1
- package/dist/gpu-core/gpu-reduction.js +6 -15
- package/dist/gpu-core/gpu-reduction.js.map +1 -1
- package/dist/gpu-core/gpu-render-operation.cjs +39 -0
- package/dist/gpu-core/gpu-render-operation.d.ts +21 -0
- package/dist/gpu-core/gpu-render-operation.d.ts.map +1 -0
- package/dist/gpu-core/gpu-render-operation.js +22 -0
- package/dist/gpu-core/gpu-render-operation.js.map +1 -0
- package/dist/gpu-core/gpu-scan.cjs +46 -32
- package/dist/gpu-core/gpu-scan.d.ts.map +1 -1
- package/dist/gpu-core/gpu-scan.js +56 -44
- package/dist/gpu-core/gpu-scan.js.map +1 -1
- package/dist/gpu-core/gpu-segmented-reduction.cjs +12 -9
- package/dist/gpu-core/gpu-segmented-reduction.d.ts +1 -1
- package/dist/gpu-core/gpu-segmented-reduction.d.ts.map +1 -1
- package/dist/gpu-core/gpu-segmented-reduction.js +12 -9
- package/dist/gpu-core/gpu-segmented-reduction.js.map +1 -1
- package/dist/gpu-core/gpu-segmented-scan.cjs +73 -16
- package/dist/gpu-core/gpu-segmented-scan.d.ts.map +1 -1
- package/dist/gpu-core/gpu-segmented-scan.js +73 -16
- package/dist/gpu-core/gpu-segmented-scan.js.map +1 -1
- package/dist/gpu-core/gpu-semantic-aggregation-operation.cjs +112 -0
- package/dist/gpu-core/gpu-semantic-aggregation-operation.d.ts +71 -0
- package/dist/gpu-core/gpu-semantic-aggregation-operation.d.ts.map +1 -0
- package/dist/gpu-core/gpu-semantic-aggregation-operation.js +92 -0
- package/dist/gpu-core/gpu-semantic-aggregation-operation.js.map +1 -0
- package/dist/gpu-core/gpu-shader-pass-kernel.cjs +267 -0
- package/dist/gpu-core/gpu-shader-pass-kernel.d.ts +29 -0
- package/dist/gpu-core/gpu-shader-pass-kernel.d.ts.map +1 -0
- package/dist/gpu-core/gpu-shader-pass-kernel.js +260 -0
- package/dist/gpu-core/gpu-shader-pass-kernel.js.map +1 -0
- package/dist/gpu-core/gpu-shader-pass-operation.cjs +85 -0
- package/dist/gpu-core/gpu-shader-pass-operation.d.ts +32 -0
- package/dist/gpu-core/gpu-shader-pass-operation.d.ts.map +1 -0
- package/dist/gpu-core/gpu-shader-pass-operation.js +74 -0
- package/dist/gpu-core/gpu-shader-pass-operation.js.map +1 -0
- package/dist/gpu-core/gpu-texture-plan.d.ts +3 -2
- package/dist/gpu-core/gpu-texture-plan.d.ts.map +1 -1
- package/dist/gpu-core/gpu-texture-plan.js.map +1 -1
- package/dist/gpu-core/index.cjs +32 -0
- package/dist/gpu-core/index.cjs.map +3 -3
- package/dist/gpu-core/index.d.ts +21 -1
- package/dist/gpu-core/index.d.ts.map +1 -1
- package/dist/gpu-core/index.js +10 -0
- package/dist/gpu-core/index.js.map +1 -1
- package/dist/gpu-data/color-conversion.cjs +105 -0
- package/dist/gpu-data/color-conversion.d.ts +30 -0
- package/dist/gpu-data/color-conversion.d.ts.map +1 -0
- package/dist/gpu-data/color-conversion.js +109 -0
- package/dist/gpu-data/color-conversion.js.map +1 -0
- package/dist/gpu-data/cpu-data.cjs +60 -0
- package/dist/gpu-data/cpu-data.d.ts +28 -0
- package/dist/gpu-data/cpu-data.d.ts.map +1 -0
- package/dist/gpu-data/cpu-data.js +41 -0
- package/dist/gpu-data/cpu-data.js.map +1 -0
- package/dist/gpu-data/cpu-gpu-vector-transfer.cjs +98 -0
- package/dist/gpu-data/cpu-gpu-vector-transfer.d.ts +9 -0
- package/dist/gpu-data/cpu-gpu-vector-transfer.d.ts.map +1 -0
- package/dist/gpu-data/cpu-gpu-vector-transfer.js +85 -0
- package/dist/gpu-data/cpu-gpu-vector-transfer.js.map +1 -0
- package/dist/gpu-data/cpu-vector.cjs +42 -0
- package/dist/gpu-data/cpu-vector.d.ts +17 -0
- package/dist/gpu-data/cpu-vector.d.ts.map +1 -0
- package/dist/gpu-data/cpu-vector.js +21 -0
- package/dist/gpu-data/cpu-vector.js.map +1 -0
- package/dist/gpu-data/gpu-data-buffer-props.cjs +41 -0
- package/dist/gpu-data/gpu-data-buffer-props.d.ts +5 -0
- package/dist/gpu-data/gpu-data-buffer-props.d.ts.map +1 -0
- package/dist/gpu-data/gpu-data-buffer-props.js +19 -0
- package/dist/gpu-data/gpu-data-buffer-props.js.map +1 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.cjs +50 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.d.ts +41 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.d.ts.map +1 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.js +45 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.js.map +1 -0
- package/dist/gpu-data/index.cjs +21 -2
- package/dist/gpu-data/index.cjs.map +3 -3
- package/dist/gpu-data/index.d.ts +6 -0
- package/dist/gpu-data/index.d.ts.map +1 -1
- package/dist/gpu-data/index.js +5 -0
- package/dist/gpu-data/index.js.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame-query.cjs +8 -19
- package/dist/gpu-dataframe/gpu-data-frame-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame-query.js +14 -26
- package/dist/gpu-dataframe/gpu-data-frame-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-expression-shader.cjs +87 -5
- package/dist/gpu-dataframe/gpu-expression-shader.d.ts +2 -1
- package/dist/gpu-dataframe/gpu-expression-shader.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-expression-shader.js +101 -5
- package/dist/gpu-dataframe/gpu-expression-shader.js.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.cjs +177 -2
- package/dist/gpu-dataframe/gpu-expression.d.ts +60 -2
- package/dist/gpu-dataframe/gpu-expression.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.js +187 -0
- package/dist/gpu-dataframe/gpu-expression.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.cjs +0 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js +0 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-query.cjs +2 -2
- package/dist/gpu-dataframe/gpu-global-aggregation-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-query.js +5 -3
- package/dist/gpu-dataframe/gpu-global-aggregation-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-sort-compiler.cjs +23 -11
- package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts +1 -1
- package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-sort-compiler.js +24 -12
- package/dist/gpu-dataframe/gpu-global-sort-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.cjs +0 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js +0 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-group-by-query.cjs +2 -2
- package/dist/gpu-dataframe/gpu-group-by-query.js +5 -3
- package/dist/gpu-dataframe/gpu-group-by-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-histogram-compiler.cjs +0 -1
- package/dist/gpu-dataframe/gpu-histogram-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-histogram-compiler.js +0 -1
- package/dist/gpu-dataframe/gpu-histogram-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-join-compiler.cjs +0 -2
- package/dist/gpu-dataframe/gpu-join-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-join-compiler.js +0 -2
- package/dist/gpu-dataframe/gpu-join-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-query-compiler.cjs +3 -1
- package/dist/gpu-dataframe/gpu-query-compiler.d.ts +0 -1
- package/dist/gpu-dataframe/gpu-query-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-query-compiler.js +3 -1
- package/dist/gpu-dataframe/gpu-query-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-sort-compiler.cjs +0 -1
- package/dist/gpu-dataframe/gpu-sort-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-sort-compiler.js +0 -1
- package/dist/gpu-dataframe/gpu-sort-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-sort-query.cjs +13 -5
- package/dist/gpu-dataframe/gpu-sort-query.d.ts +4 -1
- package/dist/gpu-dataframe/gpu-sort-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-sort-query.js +14 -5
- package/dist/gpu-dataframe/gpu-sort-query.js.map +1 -1
- package/dist/gpu-dataframe/index.cjs +20 -2
- package/dist/gpu-dataframe/index.cjs.map +3 -3
- package/dist/gpu-dataframe/index.d.ts +6 -2
- package/dist/gpu-dataframe/index.d.ts.map +1 -1
- package/dist/gpu-dataframe/index.js +3 -1
- package/dist/gpu-dataframe/index.js.map +1 -1
- package/dist/gpu-dataframe/portable-expression.cjs +167 -0
- package/dist/gpu-dataframe/portable-expression.d.ts +21 -0
- package/dist/gpu-dataframe/portable-expression.d.ts.map +1 -0
- package/dist/gpu-dataframe/portable-expression.js +162 -0
- package/dist/gpu-dataframe/portable-expression.js.map +1 -0
- package/dist/gpu-dggs/benchmarks.cjs.map +1 -1
- package/dist/gpu-dggs/index.cjs.map +1 -1
- package/dist/gpu-dggs-benchmarks.cjs +21 -0
- package/dist/gpu-dggs-benchmarks.d.ts +2 -0
- package/dist/gpu-dggs-benchmarks.d.ts.map +1 -0
- package/dist/gpu-dggs-benchmarks.js +5 -0
- package/dist/gpu-dggs-benchmarks.js.map +1 -0
- package/dist/gpu-geometry/index.cjs.map +1 -1
- package/dist/gpu-graph/index.cjs +8 -0
- package/dist/gpu-graph/index.cjs.map +3 -3
- package/dist/gpu-graph/index.d.ts +4 -0
- package/dist/gpu-graph/index.d.ts.map +1 -1
- package/dist/gpu-graph/index.js +2 -0
- package/dist/gpu-graph/index.js.map +1 -1
- package/dist/gpu-graph-algorithms/benchmarks.cjs.map +2 -2
- package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.cjs +2 -15
- package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.d.ts.map +1 -1
- package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.js +2 -15
- package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.js.map +1 -1
- package/dist/gpu-graph-algorithms/index.cjs.map +2 -2
- package/dist/gpu-graph-algorithms-benchmarks.cjs +21 -0
- package/dist/gpu-graph-algorithms-benchmarks.d.ts +2 -0
- package/dist/gpu-graph-algorithms-benchmarks.d.ts.map +1 -0
- package/dist/gpu-graph-algorithms-benchmarks.js +5 -0
- package/dist/gpu-graph-algorithms-benchmarks.js.map +1 -0
- package/dist/gpu-h3/index.cjs.map +1 -1
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.cjs +116 -0
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.d.ts +42 -0
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.d.ts.map +1 -0
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.js +90 -0
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.js.map +1 -0
- package/dist/gpu-physics/gpu-physics-ensemble.cjs +97 -5
- package/dist/gpu-physics/gpu-physics-ensemble.d.ts +31 -2
- package/dist/gpu-physics/gpu-physics-ensemble.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-physics-ensemble.js +99 -3
- package/dist/gpu-physics/gpu-physics-ensemble.js.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.cjs +568 -77
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts +86 -0
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.js +617 -76
- package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
- package/dist/gpu-physics/index.cjs +23 -2
- package/dist/gpu-physics/index.cjs.map +3 -3
- package/dist/gpu-physics/index.d.ts +9 -2
- package/dist/gpu-physics/index.d.ts.map +1 -1
- package/dist/gpu-physics/index.js +6 -1
- package/dist/gpu-physics/index.js.map +1 -1
- package/dist/gpu-physics/rigid-body-bounds-shaders.cjs +21 -8
- package/dist/gpu-physics/rigid-body-bounds-shaders.d.ts +2 -1
- package/dist/gpu-physics/rigid-body-bounds-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-bounds-shaders.js +15 -1
- package/dist/gpu-physics/rigid-body-bounds-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-convex-shaders.cjs +3 -2
- package/dist/gpu-physics/rigid-body-convex-shaders.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-convex-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-convex-shaders.js +3 -2
- package/dist/gpu-physics/rigid-body-convex-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-reset.cjs +36 -7
- package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-reset.js +42 -7
- package/dist/gpu-physics/rigid-body-ensemble-reset.js.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-transaction.cjs +23 -1
- package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts +4 -1
- package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-transaction.js +25 -1
- package/dist/gpu-physics/rigid-body-ensemble-transaction.js.map +1 -1
- package/dist/gpu-physics/rigid-body-geometry.cjs +41 -4
- package/dist/gpu-physics/rigid-body-geometry.d.ts +10 -1
- package/dist/gpu-physics/rigid-body-geometry.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-geometry.js +44 -3
- package/dist/gpu-physics/rigid-body-geometry.js.map +1 -1
- package/dist/gpu-physics/rigid-body-height-field-shader.cjs +80 -0
- package/dist/gpu-physics/rigid-body-height-field-shader.d.ts +3 -0
- package/dist/gpu-physics/rigid-body-height-field-shader.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-height-field-shader.js +56 -0
- package/dist/gpu-physics/rigid-body-height-field-shader.js.map +1 -0
- package/dist/gpu-physics/rigid-body-height-field.cjs +166 -0
- package/dist/gpu-physics/rigid-body-height-field.d.ts +55 -0
- package/dist/gpu-physics/rigid-body-height-field.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-height-field.js +184 -0
- package/dist/gpu-physics/rigid-body-height-field.js.map +1 -0
- package/dist/gpu-physics/rigid-body-mesh-query-shaders.cjs +4 -2
- package/dist/gpu-physics/rigid-body-mesh-query-shaders.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-mesh-query-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-mesh-query-shaders.js +4 -2
- package/dist/gpu-physics/rigid-body-mesh-query-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-mesh.cjs +72 -17
- package/dist/gpu-physics/rigid-body-mesh.d.ts +3 -0
- package/dist/gpu-physics/rigid-body-mesh.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-mesh.js +76 -20
- package/dist/gpu-physics/rigid-body-mesh.js.map +1 -1
- package/dist/gpu-physics/rigid-body-parallel-shaders.cjs +24 -9
- package/dist/gpu-physics/rigid-body-parallel-shaders.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-parallel-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-parallel-shaders.js +28 -9
- package/dist/gpu-physics/rigid-body-parallel-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-properties.cjs +4 -4
- package/dist/gpu-physics/rigid-body-properties.d.ts +6 -0
- package/dist/gpu-physics/rigid-body-properties.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-properties.js +1 -1
- package/dist/gpu-physics/rigid-body-properties.js.map +1 -1
- package/dist/gpu-physics/rigid-body-publication.cjs +2 -2
- package/dist/gpu-physics/rigid-body-publication.js +1 -1
- package/dist/gpu-physics/rigid-body-publication.js.map +1 -1
- package/dist/gpu-physics/rigid-body-query-geometry.cjs +22 -4
- package/dist/gpu-physics/rigid-body-query-geometry.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-query-geometry.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-query-geometry.js +22 -4
- package/dist/gpu-physics/rigid-body-query-geometry.js.map +1 -1
- package/dist/gpu-physics/rigid-body-shaders.cjs +12 -6
- package/dist/gpu-physics/rigid-body-shaders.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-shaders.js +15 -7
- package/dist/gpu-physics/rigid-body-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-shape-properties.cjs +2 -0
- package/dist/gpu-physics/rigid-body-shape-properties.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-shape-properties.js +2 -0
- package/dist/gpu-physics/rigid-body-shape-properties.js.map +1 -1
- package/dist/gpu-physics/rigid-body-terrain-atlas.cjs +287 -0
- package/dist/gpu-physics/rigid-body-terrain-atlas.d.ts +87 -0
- package/dist/gpu-physics/rigid-body-terrain-atlas.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-atlas.js +275 -0
- package/dist/gpu-physics/rigid-body-terrain-atlas.js.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-lod.cjs +240 -0
- package/dist/gpu-physics/rigid-body-terrain-lod.d.ts +76 -0
- package/dist/gpu-physics/rigid-body-terrain-lod.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-lod.js +247 -0
- package/dist/gpu-physics/rigid-body-terrain-lod.js.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-stitch.cjs +215 -0
- package/dist/gpu-physics/rigid-body-terrain-stitch.d.ts +25 -0
- package/dist/gpu-physics/rigid-body-terrain-stitch.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-stitch.js +218 -0
- package/dist/gpu-physics/rigid-body-terrain-stitch.js.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-stream.cjs +263 -0
- package/dist/gpu-physics/rigid-body-terrain-stream.d.ts +97 -0
- package/dist/gpu-physics/rigid-body-terrain-stream.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-stream.js +250 -0
- package/dist/gpu-physics/rigid-body-terrain-stream.js.map +1 -0
- package/dist/gpu-physics/rigid-body-triggers.cjs +1 -0
- package/dist/gpu-physics/rigid-body-triggers.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-triggers.js +1 -0
- package/dist/gpu-physics/rigid-body-triggers.js.map +1 -1
- package/dist/gpu-physics/rigid-body-vehicle.cjs +145 -0
- package/dist/gpu-physics/rigid-body-vehicle.d.ts +47 -0
- package/dist/gpu-physics/rigid-body-vehicle.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-vehicle.js +119 -0
- package/dist/gpu-physics/rigid-body-vehicle.js.map +1 -0
- package/dist/gpu-pointcloud/index.cjs.map +1 -1
- package/dist/gpu-project/benchmarks.cjs.map +2 -2
- package/dist/gpu-project/coordinate-projection-graph.cjs +59 -0
- package/dist/gpu-project/coordinate-projection-graph.d.ts +23 -0
- package/dist/gpu-project/coordinate-projection-graph.d.ts.map +1 -0
- package/dist/gpu-project/coordinate-projection-graph.js +40 -0
- package/dist/gpu-project/coordinate-projection-graph.js.map +1 -0
- package/dist/gpu-project/cpu-geoarrow.cjs +112 -0
- package/dist/gpu-project/cpu-geoarrow.d.ts +10 -0
- package/dist/gpu-project/cpu-geoarrow.d.ts.map +1 -0
- package/dist/gpu-project/cpu-geoarrow.js +103 -0
- package/dist/gpu-project/cpu-geoarrow.js.map +1 -0
- package/dist/gpu-project/cpu-geometry-pipelines.cjs +134 -0
- package/dist/gpu-project/cpu-geometry-pipelines.d.ts +19 -0
- package/dist/gpu-project/cpu-geometry-pipelines.d.ts.map +1 -0
- package/dist/gpu-project/cpu-geometry-pipelines.js +114 -0
- package/dist/gpu-project/cpu-geometry-pipelines.js.map +1 -0
- package/dist/gpu-project/cpu-projection-operation.cjs +54 -0
- package/dist/gpu-project/cpu-projection-operation.d.ts +14 -0
- package/dist/gpu-project/cpu-projection-operation.d.ts.map +1 -0
- package/dist/gpu-project/cpu-projection-operation.js +37 -0
- package/dist/gpu-project/cpu-projection-operation.js.map +1 -0
- package/dist/gpu-project/crs.cjs.map +3 -3
- package/dist/gpu-project/crs.d.ts +1 -1
- package/dist/gpu-project/geoarrow.cjs +36 -0
- package/dist/gpu-project/geoarrow.cjs.map +6 -0
- package/dist/gpu-project/geoarrow.d.ts +3 -0
- package/dist/gpu-project/geoarrow.d.ts.map +1 -0
- package/dist/gpu-project/geoarrow.js +7 -0
- package/dist/gpu-project/geoarrow.js.map +1 -0
- package/dist/gpu-project/graph.cjs +27 -0
- package/dist/gpu-project/graph.cjs.map +6 -0
- package/dist/gpu-project/graph.d.ts +2 -0
- package/dist/gpu-project/graph.d.ts.map +1 -0
- package/dist/gpu-project/graph.js +6 -0
- package/dist/gpu-project/graph.js.map +1 -0
- package/dist/gpu-project/index.cjs +3 -0
- package/dist/gpu-project/index.cjs.map +3 -3
- package/dist/gpu-project/index.d.ts +1 -0
- package/dist/gpu-project/index.d.ts.map +1 -1
- package/dist/gpu-project/index.js +1 -0
- package/dist/gpu-project/index.js.map +1 -1
- package/dist/gpu-project/projection-crs-benchmark.cjs +2 -2
- package/dist/gpu-project/projection-crs-benchmark.d.ts +1 -1
- package/dist/gpu-project/projection-crs-benchmark.js +1 -1
- package/dist/gpu-project/projection-crs-input.cjs +7 -7
- package/dist/gpu-project/projection-crs-input.d.ts +1 -1
- package/dist/gpu-project/projection-crs-input.js +4 -4
- package/dist/gpu-project/projection-engine.d.ts +2 -2
- package/dist/gpu-project-benchmarks.cjs +21 -0
- package/dist/gpu-project-benchmarks.d.ts +2 -0
- package/dist/gpu-project-benchmarks.d.ts.map +1 -0
- package/dist/gpu-project-benchmarks.js +5 -0
- package/dist/gpu-project-benchmarks.js.map +1 -0
- package/dist/gpu-project-crs.cjs +21 -0
- package/dist/gpu-project-crs.d.ts +2 -0
- package/dist/gpu-project-crs.d.ts.map +1 -0
- package/dist/gpu-project-crs.js +5 -0
- package/dist/gpu-project-crs.js.map +1 -0
- package/dist/gpu-project-geoarrow.cjs +21 -0
- package/dist/gpu-project-geoarrow.d.ts +2 -0
- package/dist/gpu-project-geoarrow.d.ts.map +1 -0
- package/dist/gpu-project-geoarrow.js +5 -0
- package/dist/gpu-project-geoarrow.js.map +1 -0
- package/dist/gpu-project-graph.cjs +21 -0
- package/dist/gpu-project-graph.d.ts +2 -0
- package/dist/gpu-project-graph.d.ts.map +1 -0
- package/dist/gpu-project-graph.js +5 -0
- package/dist/gpu-project-graph.js.map +1 -0
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.cjs +75 -5
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.d.ts +5 -1
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.d.ts.map +1 -1
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.js +86 -6
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.js.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph-lowering.cjs +9 -0
- package/dist/gpu-simple-graph/gpu-simple-graph-lowering.d.ts +2 -0
- package/dist/gpu-simple-graph/gpu-simple-graph-lowering.d.ts.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph-lowering.js +10 -0
- package/dist/gpu-simple-graph/gpu-simple-graph-lowering.js.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph-transfer.d.ts +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph-transfer.d.ts.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph-value.d.ts +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph-value.d.ts.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph.cjs +126 -10
- package/dist/gpu-simple-graph/gpu-simple-graph.d.ts +36 -11
- package/dist/gpu-simple-graph/gpu-simple-graph.d.ts.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph.js +137 -12
- package/dist/gpu-simple-graph/gpu-simple-graph.js.map +1 -1
- package/dist/gpu-simple-graph/index.cjs.map +3 -3
- package/dist/gpu-simple-graph/index.d.ts +1 -1
- package/dist/gpu-simple-graph/index.d.ts.map +1 -1
- package/dist/gpu-simple-graph/index.js.map +1 -1
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.cjs +25 -0
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.d.ts +7 -1
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.js +28 -0
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.js.map +1 -1
- package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.cjs +7 -0
- package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.d.ts +2 -0
- package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.js +7 -0
- package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.js.map +1 -1
- package/dist/gpu-simple-graph/operation/operation.d.ts +1 -1
- package/dist/gpu-simple-graph/operation/operation.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operations/convert-colors.cjs +6 -6
- package/dist/gpu-simple-graph/operations/convert-colors.d.ts +5 -1
- package/dist/gpu-simple-graph/operations/convert-colors.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operations/convert-colors.js +12 -7
- package/dist/gpu-simple-graph/operations/convert-colors.js.map +1 -1
- package/dist/gpu-simple-graph/operations/cpu/convert-colors.cjs +16 -33
- package/dist/gpu-simple-graph/operations/cpu/convert-colors.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operations/cpu/convert-colors.js +22 -35
- package/dist/gpu-simple-graph/operations/cpu/convert-colors.js.map +1 -1
- package/dist/gpu-simple-graph/operations/cpu/index.cjs.map +3 -3
- package/dist/gpu-simple-graph/operations/webgl/index.cjs.map +3 -3
- package/dist/gpu-simple-graph/operations/webgpu/convert-colors.cjs +31 -13
- package/dist/gpu-simple-graph/operations/webgpu/convert-colors.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operations/webgpu/convert-colors.js +42 -13
- package/dist/gpu-simple-graph/operations/webgpu/convert-colors.js.map +1 -1
- package/dist/gpu-simple-graph/operations/webgpu/index.cjs.map +1 -1
- package/dist/gpu-simple-graph-cpu.cjs +21 -0
- package/dist/gpu-simple-graph-cpu.d.ts +2 -0
- package/dist/gpu-simple-graph-cpu.d.ts.map +1 -0
- package/dist/gpu-simple-graph-cpu.js +5 -0
- package/dist/gpu-simple-graph-cpu.js.map +1 -0
- package/dist/gpu-simple-graph-webgl.cjs +21 -0
- package/dist/gpu-simple-graph-webgl.d.ts +2 -0
- package/dist/gpu-simple-graph-webgl.d.ts.map +1 -0
- package/dist/gpu-simple-graph-webgl.js +5 -0
- package/dist/gpu-simple-graph-webgl.js.map +1 -0
- package/dist/gpu-simple-graph-webgpu.cjs +21 -0
- package/dist/gpu-simple-graph-webgpu.d.ts +2 -0
- package/dist/gpu-simple-graph-webgpu.d.ts.map +1 -0
- package/dist/gpu-simple-graph-webgpu.js +5 -0
- package/dist/gpu-simple-graph-webgpu.js.map +1 -0
- package/dist/gpu-sql/gpu-sql.cjs +159 -328
- package/dist/gpu-sql/gpu-sql.d.ts +1 -1
- package/dist/gpu-sql/gpu-sql.d.ts.map +1 -1
- package/dist/gpu-sql/gpu-sql.js +186 -340
- package/dist/gpu-sql/gpu-sql.js.map +1 -1
- package/dist/gpu-sql/index.cjs.map +3 -3
- package/dist/gpu-tables/index.cjs.map +2 -2
- package/dist/gpu-tables/table/gpu-table.cjs +2 -2
- package/dist/gpu-tables/table/gpu-table.d.ts.map +1 -1
- package/dist/gpu-tables/table/gpu-table.js +2 -2
- package/dist/gpu-tables/table/gpu-table.js.map +1 -1
- package/dist/gpu-timeseries/index.cjs.map +1 -1
- package/dist/index.cjs +11 -0
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +30 -16
- package/src/arrow/arrow-colors.ts +194 -33
- package/src/arrow/arrow-utils/arrow-paths.ts +5 -3
- package/src/arrow/cpu/arrow-coordinate-projection.ts +18 -0
- package/src/arrow/cpu/arrow-cpu-pipelines.ts +9 -0
- package/src/arrow/cpu/arrow-cpu-vector-adapters.ts +153 -0
- package/src/arrow/geoarrow/arrow-geoarrow-adapter.ts +21 -493
- package/src/arrow/geoarrow/arrow-geoarrow-conversion.ts +7 -5
- package/src/arrow/geoarrow/arrow-polygon-tessellation.ts +1 -1
- package/src/arrow/gpu/arrow-column-gpu-vector.ts +67 -14
- package/src/arrow/gpu/arrow-gpu-table-conversion.ts +96 -4
- package/src/arrow/gpu/arrow-gpu-vector-adapters.ts +20 -7
- package/src/arrow/gpu/arrow-gpu-vector-conversion.ts +49 -6
- package/src/arrow/index.ts +14 -0
- package/src/experimental-models.ts +5 -0
- package/src/experimental-simulation.ts +5 -0
- package/src/geospatial/gpu-point-spatial-query.ts +2 -15
- package/src/gpu-core/compiled-gpu-graph.ts +73 -1
- package/src/gpu-core/gpu-command-graph-compiler.ts +25 -2
- package/src/gpu-core/gpu-command-graph-types.ts +20 -0
- package/src/gpu-core/gpu-command-graph.ts +48 -11
- package/src/gpu-core/gpu-cpu-execution.ts +345 -0
- package/src/gpu-core/gpu-cpu-operation.ts +65 -0
- package/src/gpu-core/gpu-dispatch-utils.ts +13 -1
- package/src/gpu-core/gpu-expression-operation.ts +1 -1
- package/src/gpu-core/gpu-expression-plan.ts +11 -3
- package/src/gpu-core/gpu-graph-compiler.ts +61 -0
- package/src/gpu-core/gpu-graph.ts +3 -3
- package/src/gpu-core/gpu-grid-aggregation.ts +2 -5
- package/src/gpu-core/gpu-grid-binning.ts +2 -5
- package/src/gpu-core/gpu-grid-coordinate.ts +24 -0
- package/src/gpu-core/gpu-grid-index-internals.ts +2 -15
- package/src/gpu-core/gpu-grid-index-query.ts +2 -16
- package/src/gpu-core/gpu-group-aggregation.ts +38 -50
- package/src/gpu-core/gpu-operation.ts +9 -7
- package/src/gpu-core/gpu-reduction.ts +32 -42
- package/src/gpu-core/gpu-render-operation.ts +42 -0
- package/src/gpu-core/gpu-scan.ts +59 -45
- package/src/gpu-core/gpu-segmented-reduction.ts +20 -10
- package/src/gpu-core/gpu-segmented-scan.ts +82 -17
- package/src/gpu-core/gpu-semantic-aggregation-operation.ts +150 -0
- package/src/gpu-core/gpu-shader-pass-kernel.ts +307 -0
- package/src/gpu-core/gpu-shader-pass-operation.ts +103 -0
- package/src/gpu-core/gpu-texture-plan.ts +3 -2
- package/src/gpu-core/index.ts +39 -0
- package/src/gpu-data/color-conversion.ts +158 -0
- package/src/gpu-data/cpu-data.ts +62 -0
- package/src/gpu-data/cpu-gpu-vector-transfer.ts +110 -0
- package/src/gpu-data/cpu-vector.ts +31 -0
- package/src/gpu-data/gpu-data-buffer-props.ts +25 -0
- package/src/gpu-data/gpu-vector-wgsl-layout.ts +79 -0
- package/src/gpu-data/index.ts +15 -0
- package/src/gpu-dataframe/gpu-data-frame-query.ts +24 -31
- package/src/gpu-dataframe/gpu-expression-shader.ts +128 -7
- package/src/gpu-dataframe/gpu-expression.ts +259 -1
- package/src/gpu-dataframe/gpu-global-aggregation-compiler.ts +0 -1
- package/src/gpu-dataframe/gpu-global-aggregation-query.ts +5 -3
- package/src/gpu-dataframe/gpu-global-sort-compiler.ts +26 -12
- package/src/gpu-dataframe/gpu-group-aggregation-compiler.ts +0 -1
- package/src/gpu-dataframe/gpu-group-by-query.ts +5 -3
- package/src/gpu-dataframe/gpu-histogram-compiler.ts +0 -1
- package/src/gpu-dataframe/gpu-join-compiler.ts +0 -2
- package/src/gpu-dataframe/gpu-query-compiler.ts +3 -3
- package/src/gpu-dataframe/gpu-sort-compiler.ts +0 -1
- package/src/gpu-dataframe/gpu-sort-query.ts +31 -5
- package/src/gpu-dataframe/index.ts +26 -2
- package/src/gpu-dataframe/portable-expression.ts +194 -0
- package/src/gpu-dggs-benchmarks.ts +5 -0
- package/src/gpu-graph/index.ts +17 -0
- package/src/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.ts +2 -15
- package/src/gpu-graph-algorithms-benchmarks.ts +5 -0
- package/src/gpu-physics/gpu-physics-ensemble-terrain.ts +114 -0
- package/src/gpu-physics/gpu-physics-ensemble.ts +147 -4
- package/src/gpu-physics/gpu-rigid-body-world.ts +797 -102
- package/src/gpu-physics/index.ts +38 -0
- package/src/gpu-physics/rigid-body-bounds-shaders.ts +16 -1
- package/src/gpu-physics/rigid-body-convex-shaders.ts +3 -2
- package/src/gpu-physics/rigid-body-ensemble-reset.ts +48 -8
- package/src/gpu-physics/rigid-body-ensemble-transaction.ts +34 -1
- package/src/gpu-physics/rigid-body-geometry.ts +49 -4
- package/src/gpu-physics/rigid-body-height-field-shader.ts +56 -0
- package/src/gpu-physics/rigid-body-height-field.ts +257 -0
- package/src/gpu-physics/rigid-body-mesh-query-shaders.ts +4 -2
- package/src/gpu-physics/rigid-body-mesh.ts +97 -26
- package/src/gpu-physics/rigid-body-parallel-shaders.ts +32 -9
- package/src/gpu-physics/rigid-body-properties.ts +5 -2
- package/src/gpu-physics/rigid-body-publication.ts +1 -1
- package/src/gpu-physics/rigid-body-query-geometry.ts +22 -4
- package/src/gpu-physics/rigid-body-shaders.ts +19 -7
- package/src/gpu-physics/rigid-body-shape-properties.ts +2 -0
- package/src/gpu-physics/rigid-body-terrain-atlas.ts +378 -0
- package/src/gpu-physics/rigid-body-terrain-lod.ts +332 -0
- package/src/gpu-physics/rigid-body-terrain-stitch.ts +286 -0
- package/src/gpu-physics/rigid-body-terrain-stream.ts +323 -0
- package/src/gpu-physics/rigid-body-triggers.ts +1 -0
- package/src/gpu-physics/rigid-body-vehicle.ts +166 -0
- package/src/gpu-project/README.md +2 -2
- package/src/gpu-project/coordinate-projection-graph.ts +59 -0
- package/src/gpu-project/cpu-geoarrow.ts +135 -0
- package/src/gpu-project/cpu-geometry-pipelines.ts +159 -0
- package/src/gpu-project/cpu-projection-operation.ts +49 -0
- package/src/gpu-project/crs.ts +2 -2
- package/src/gpu-project/geoarrow.ts +11 -0
- package/src/gpu-project/graph.ts +10 -0
- package/src/gpu-project/index.ts +2 -0
- package/src/gpu-project/projection-crs-benchmark.ts +2 -2
- package/src/gpu-project/projection-crs-input.ts +4 -4
- package/src/gpu-project/projection-engine.ts +2 -2
- package/src/gpu-project-benchmarks.ts +5 -0
- package/src/gpu-project-crs.ts +5 -0
- package/src/gpu-project-geoarrow.ts +5 -0
- package/src/gpu-project-graph.ts +5 -0
- package/src/gpu-simple-graph/compiled-gpu-expression-graph.ts +97 -6
- package/src/gpu-simple-graph/gpu-simple-graph-lowering.ts +11 -0
- package/src/gpu-simple-graph/gpu-simple-graph-transfer.ts +1 -1
- package/src/gpu-simple-graph/gpu-simple-graph-value.ts +1 -1
- package/src/gpu-simple-graph/gpu-simple-graph.ts +163 -19
- package/src/gpu-simple-graph/index.ts +1 -0
- package/src/gpu-simple-graph/operation/gpu-data-evaluator.ts +25 -1
- package/src/gpu-simple-graph/operation/gpu-vector-evaluator.ts +7 -0
- package/src/gpu-simple-graph/operation/operation.ts +1 -1
- package/src/gpu-simple-graph/operations/convert-colors.ts +22 -7
- package/src/gpu-simple-graph/operations/cpu/convert-colors.ts +31 -48
- package/src/gpu-simple-graph/operations/swizzle.ts +1 -1
- package/src/gpu-simple-graph/operations/webgpu/convert-colors.ts +47 -13
- package/src/gpu-simple-graph-cpu.ts +5 -0
- package/src/gpu-simple-graph-webgl.ts +5 -0
- package/src/gpu-simple-graph-webgpu.ts +5 -0
- package/src/gpu-sql/gpu-sql.ts +238 -354
- package/src/gpu-tables/table/gpu-table.ts +2 -1
- 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,
|
|
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
|
-
|
|
361
|
-
|
|
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
|
-
...
|
|
364
|
-
shape:
|
|
365
|
-
? current
|
|
366
|
-
:
|
|
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 =
|
|
495
|
+
const definitions = this.props.bodies;
|
|
384
496
|
definitions.splice(bodyStart, restored.length, ...restored);
|
|
385
|
-
this.
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
.
|
|
2148
|
+
.slice(this.bodyColliderStarts[bodyIndex], this.bodyColliderStarts[bodyIndex + 1])
|
|
1654
2149
|
.map(({ body, ...candidate }) => candidate);
|
|
1655
|
-
|
|
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
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
const
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
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
|
-
:
|
|
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
|