@luma.gl/graph 10.0.0-alpha.9 → 10.0.0-beta.1
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/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 +1 -16
- package/dist/gpu-dataframe/gpu-data-frame-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame-query.js +1 -23
- package/dist/gpu-dataframe/gpu-data-frame-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.cjs +91 -2
- package/dist/gpu-dataframe/gpu-expression.d.ts +37 -0
- package/dist/gpu-dataframe/gpu-expression.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.js +106 -0
- package/dist/gpu-dataframe/gpu-expression.js.map +1 -1
- package/dist/gpu-dataframe/index.cjs +12 -2
- package/dist/gpu-dataframe/index.cjs.map +3 -3
- package/dist/gpu-dataframe/index.d.ts +4 -0
- package/dist/gpu-dataframe/index.d.ts.map +1 -1
- package/dist/gpu-dataframe/index.js +2 -0
- package/dist/gpu-dataframe/index.js.map +1 -1
- package/dist/gpu-dataframe/portable-expression.cjs +103 -0
- package/dist/gpu-dataframe/portable-expression.d.ts +19 -0
- package/dist/gpu-dataframe/portable-expression.d.ts.map +1 -0
- package/dist/gpu-dataframe/portable-expression.js +98 -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-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-h3/index.cjs.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.cjs +162 -2
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts +25 -0
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.js +181 -2
- package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
- package/dist/gpu-physics/index.cjs.map +2 -2
- package/dist/gpu-physics/index.d.ts +1 -0
- package/dist/gpu-physics/index.d.ts.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-shaders.cjs +2 -2
- 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 +2 -2
- package/dist/gpu-physics/rigid-body-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-vehicle.cjs +90 -0
- package/dist/gpu-physics/rigid-body-vehicle.d.ts +35 -0
- package/dist/gpu-physics/rigid-body-vehicle.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-vehicle.js +66 -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 +2 -2
- 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-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.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 +6 -0
- 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/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-sql/gpu-sql.cjs +157 -280
- 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 +168 -291
- 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 +21 -7
- 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/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 +6 -26
- package/src/gpu-dataframe/gpu-expression.ts +135 -0
- package/src/gpu-dataframe/index.ts +11 -0
- package/src/gpu-dataframe/portable-expression.ts +117 -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-physics/gpu-rigid-body-world.ts +227 -2
- package/src/gpu-physics/index.ts +1 -0
- package/src/gpu-physics/rigid-body-parallel-shaders.ts +32 -9
- package/src/gpu-physics/rigid-body-shaders.ts +3 -2
- package/src/gpu-physics/rigid-body-vehicle.ts +99 -0
- 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/geoarrow.ts +11 -0
- package/src/gpu-project/graph.ts +10 -0
- package/src/gpu-project/index.ts +2 -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.ts +163 -19
- package/src/gpu-simple-graph/index.ts +1 -0
- package/src/gpu-simple-graph/operation/gpu-data-evaluator.ts +24 -0
- package/src/gpu-simple-graph/operation/gpu-vector-evaluator.ts +7 -0
- 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/webgpu/convert-colors.ts +47 -13
- package/src/gpu-sql/gpu-sql.ts +179 -293
- package/src/gpu-tables/table/gpu-table.ts +2 -1
- package/src/index.ts +21 -0
|
@@ -25,4 +25,5 @@ export { GPUPhysicsEnsemble, type GPUPhysicsEnsembleProps } from "./gpu-physics-
|
|
|
25
25
|
export type { GPURigidBodyJointLimit, GPURigidBodyJointDrive } from "./joint-types.js";
|
|
26
26
|
export { rotateRigidBodyVector, normalizeRigidBodyRotation } from "./rigid-body-properties.js";
|
|
27
27
|
export type { GPURigidBodyGeneralConstraint } from "./rigid-body-general-joints.js";
|
|
28
|
+
export type { GPURigidBodyVehicle } from "./rigid-body-vehicle.js";
|
|
28
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gpu-physics/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,+BAA+B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,8BAA2B;AAE5B,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,2BAAwB;AACzB,OAAO,EAAC,mBAAmB,EAAE,cAAc,EAAE,KAAK,YAAY,EAAC,2BAAwB;AACvF,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,KAAK,qBAAqB,EAC3B,6BAA0B;AAC3B,OAAO,EAAC,2BAA2B,EAAC,yCAAsC;AAC1E,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,KAAK,oBAAoB,EAC1B,gCAA6B;AAC9B,OAAO,EACL,oBAAoB,EACpB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC7B,gCAA6B;AAE9B,OAAO,EACL,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC5B,kCAA+B;AAEhC,OAAO,EACL,oCAAoC,EACpC,KAAK,iCAAiC,EACvC,oCAAiC;AAClC,YAAY,EAAC,wBAAwB,EAAC,iCAA8B;AAEpE,OAAO,EACL,4BAA4B,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC9B,+BAA4B;AAC7B,YAAY,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACxB,gCAA6B;AAE9B,YAAY,EAAC,6BAA6B,EAAC,mCAAgC;AAE3E,YAAY,EACV,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACzB,iCAA8B;AAC/B,OAAO,EAAC,4BAA4B,EAAC,iCAA8B;AAEnE,YAAY,EAAC,iBAAiB,EAAE,sBAAsB,EAAC,+BAA4B;AAEnF,YAAY,EACV,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACvB,kCAA+B;AAEhC,YAAY,EAAC,kBAAkB,EAAC,oCAAiC;AAEjE,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,gCAA6B;AAE9B,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAChC,iCAA8B;AAE/B,OAAO,EAAC,mBAAmB,EAAC,yBAAsB;AAElD,OAAO,EAAC,eAAe,EAAC,+BAA4B;AACpD,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACxB,+BAA4B;AAE7B,OAAO,EAAC,kBAAkB,EAAE,KAAK,uBAAuB,EAAC,kCAA+B;AAExF,YAAY,EAAC,sBAAsB,EAAE,sBAAsB,EAAC,yBAAsB;AAElF,OAAO,EAAC,qBAAqB,EAAE,0BAA0B,EAAC,mCAAgC;AAC1F,YAAY,EAAC,6BAA6B,EAAC,uCAAoC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gpu-physics/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,+BAA+B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,8BAA2B;AAE5B,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,2BAAwB;AACzB,OAAO,EAAC,mBAAmB,EAAE,cAAc,EAAE,KAAK,YAAY,EAAC,2BAAwB;AACvF,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,KAAK,qBAAqB,EAC3B,6BAA0B;AAC3B,OAAO,EAAC,2BAA2B,EAAC,yCAAsC;AAC1E,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,KAAK,oBAAoB,EAC1B,gCAA6B;AAC9B,OAAO,EACL,oBAAoB,EACpB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC7B,gCAA6B;AAE9B,OAAO,EACL,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC5B,kCAA+B;AAEhC,OAAO,EACL,oCAAoC,EACpC,KAAK,iCAAiC,EACvC,oCAAiC;AAClC,YAAY,EAAC,wBAAwB,EAAC,iCAA8B;AAEpE,OAAO,EACL,4BAA4B,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC9B,+BAA4B;AAC7B,YAAY,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACxB,gCAA6B;AAE9B,YAAY,EAAC,6BAA6B,EAAC,mCAAgC;AAE3E,YAAY,EACV,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACzB,iCAA8B;AAC/B,OAAO,EAAC,4BAA4B,EAAC,iCAA8B;AAEnE,YAAY,EAAC,iBAAiB,EAAE,sBAAsB,EAAC,+BAA4B;AAEnF,YAAY,EACV,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACvB,kCAA+B;AAEhC,YAAY,EAAC,kBAAkB,EAAC,oCAAiC;AAEjE,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,gCAA6B;AAE9B,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAChC,iCAA8B;AAE/B,OAAO,EAAC,mBAAmB,EAAC,yBAAsB;AAElD,OAAO,EAAC,eAAe,EAAC,+BAA4B;AACpD,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACxB,+BAA4B;AAE7B,OAAO,EAAC,kBAAkB,EAAE,KAAK,uBAAuB,EAAC,kCAA+B;AAExF,YAAY,EAAC,sBAAsB,EAAE,sBAAsB,EAAC,yBAAsB;AAElF,OAAO,EAAC,qBAAqB,EAAE,0BAA0B,EAAC,mCAAgC;AAC1F,YAAY,EAAC,6BAA6B,EAAC,uCAAoC;AAC/E,YAAY,EAAC,mBAAmB,EAAC,gCAA6B"}
|
|
@@ -20,7 +20,7 @@ __export(rigid_body_parallel_shaders_exports, {
|
|
|
20
20
|
getRigidBodyParallelShader: () => getRigidBodyParallelShader
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(rigid_body_parallel_shaders_exports);
|
|
23
|
-
function getRigidBodyParallelShader(ensemble) {
|
|
23
|
+
function getRigidBodyParallelShader(ensemble, blockContacts = false) {
|
|
24
24
|
return (
|
|
25
25
|
/* wgsl */
|
|
26
26
|
`
|
|
@@ -188,32 +188,47 @@ fn writePairDeltas(pair:u32,first:u32,second:u32,impulse:vec3f,firstTorque:vec3f
|
|
|
188
188
|
let relaxation=settings.stability.w/f32(max(1u,max(atomicLoad(¶llelState.degrees[first]),atomicLoad(¶llelState.degrees[second]))));
|
|
189
189
|
var firstLinear=velocities[first].xyz;var secondLinear=velocities[second].xyz;
|
|
190
190
|
var firstAngular=angularVelocities[first].xyz;var secondAngular=angularVelocities[second].xyz;
|
|
191
|
+
${blockContacts ? `
|
|
192
|
+
// Solve the contact patch locally, then relax the whole block once. No extra dispatches.
|
|
193
|
+
var contacts:array<Contact,4>;
|
|
194
|
+
for(var slot=0u;slot<manifolds[pair].count;slot++){contacts[slot]=manifolds[pair].contacts[slot];}
|
|
195
|
+
for(var sweep=0u;sweep<2u;sweep++){
|
|
196
|
+
` : ""}
|
|
191
197
|
for(var slot=0u;slot<manifolds[pair].count;slot++){
|
|
192
|
-
var contact
|
|
198
|
+
var contact=${blockContacts ? "contacts[slot]" : "manifolds[pair].contacts[slot]"};let point=contact.point.xyz;let normal=contact.normal.xyz;
|
|
193
199
|
let firstLever=point-positions[first].xyz;let secondLever=point-positions[second].xyz;
|
|
194
200
|
let relative=secondLinear+cross(secondAngular,secondLever)-firstLinear-cross(firstAngular,firstLever);
|
|
195
201
|
let normalMass=effectiveMass(first,second,point,normal);if(normalMass<=0.0){continue;}
|
|
196
202
|
let bias=min(settings.stability.z,settings.stability.y*max(0.0,contact.point.w-settings.solver.x)/settings.gravity.w);
|
|
197
203
|
let desiredImpulse=max(0.0,contact.impulse.x+(max(bias,contact.normal.w)-dot(relative,normal))/normalMass);
|
|
198
|
-
let change=(desiredImpulse-contact.impulse.x)
|
|
204
|
+
let change=(desiredImpulse-contact.impulse.x)*${blockContacts ? "1.0" : "relaxation"};contact.impulse.x+=change;
|
|
199
205
|
var impulse=normal*change;
|
|
200
206
|
if(dynamic(first)){firstLinear-=impulse*velocities[first].w;firstAngular-=inverseInertia(first,cross(firstLever,impulse));}
|
|
201
207
|
if(dynamic(second)){secondLinear+=impulse*velocities[second].w;secondAngular+=inverseInertia(second,cross(secondLever,impulse));}
|
|
202
208
|
let after=secondLinear+cross(secondAngular,secondLever)-firstLinear-cross(firstAngular,firstLever);
|
|
203
209
|
let tangent=solveFriction(firstCollider,secondCollider,contact,after);
|
|
204
|
-
var relaxedTangent=contact.tangent.xyz+(tangent-contact.tangent.xyz)
|
|
210
|
+
var relaxedTangent=contact.tangent.xyz+(tangent-contact.tangent.xyz)*${blockContacts ? "1.0" : "relaxation"};
|
|
205
211
|
// A falling normal impulse must shrink the cone even when under-relaxing.
|
|
206
212
|
let staticLimit=frictionCoefficient(firstCollider,secondCollider,false)*contact.impulse.x;
|
|
207
213
|
if(length(relaxedTangent)>staticLimit){relaxedTangent*=staticLimit/max(1e-30,length(relaxedTangent));}
|
|
208
214
|
impulse=relaxedTangent-contact.tangent.xyz;contact.tangent=vec4f(relaxedTangent,0);
|
|
209
215
|
if(dynamic(first)){firstLinear-=impulse*velocities[first].w;firstAngular-=inverseInertia(first,cross(firstLever,impulse));}
|
|
210
216
|
if(dynamic(second)){secondLinear+=impulse*velocities[second].w;secondAngular+=inverseInertia(second,cross(secondLever,impulse));}
|
|
211
|
-
manifolds[pair].contacts[slot]=contact;
|
|
217
|
+
${blockContacts ? "contacts[slot]" : "manifolds[pair].contacts[slot]"}=contact;
|
|
212
218
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
219
|
+
${blockContacts ? `
|
|
220
|
+
}
|
|
221
|
+
// Interpolation of feasible impulses preserves the friction cone, including unloading.
|
|
222
|
+
for(var slot=0u;slot<manifolds[pair].count;slot++){
|
|
223
|
+
let previous=manifolds[pair].contacts[slot];
|
|
224
|
+
manifolds[pair].contacts[slot].impulse.x=mix(previous.impulse.x,contacts[slot].impulse.x,relaxation);
|
|
225
|
+
manifolds[pair].contacts[slot].tangent=mix(previous.tangent,contacts[slot].tangent,relaxation);
|
|
226
|
+
}
|
|
227
|
+
` : ""}
|
|
228
|
+
parallelState.deltas[pair*4u]=vec4f((firstLinear-velocities[first].xyz)*${blockContacts ? "relaxation" : "1.0"},0);
|
|
229
|
+
parallelState.deltas[pair*4u+1u]=vec4f((firstAngular-angularVelocities[first].xyz)*${blockContacts ? "relaxation" : "1.0"},0);
|
|
230
|
+
parallelState.deltas[pair*4u+2u]=vec4f((secondLinear-velocities[second].xyz)*${blockContacts ? "relaxation" : "1.0"},0);
|
|
231
|
+
parallelState.deltas[pair*4u+3u]=vec4f((secondAngular-angularVelocities[second].xyz)*${blockContacts ? "relaxation" : "1.0"},0);
|
|
217
232
|
}
|
|
218
233
|
@compute @workgroup_size(64) fn parallelGather(@builtin(global_invocation_id) invocation:vec3u){
|
|
219
234
|
var body=invocation.x;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Sparse contact adjacency and block-Jacobi impulses; each dispatch has exclusive output owners. */
|
|
2
|
-
export declare function getRigidBodyParallelShader(ensemble: boolean): string;
|
|
2
|
+
export declare function getRigidBodyParallelShader(ensemble: boolean, blockContacts?: boolean): string;
|
|
3
3
|
//# sourceMappingURL=rigid-body-parallel-shaders.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rigid-body-parallel-shaders.d.ts","sourceRoot":"","sources":["../../src/gpu-physics/rigid-body-parallel-shaders.ts"],"names":[],"mappings":"AAIA,qGAAqG;AACrG,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"rigid-body-parallel-shaders.d.ts","sourceRoot":"","sources":["../../src/gpu-physics/rigid-body-parallel-shaders.ts"],"names":[],"mappings":"AAIA,qGAAqG;AACrG,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,OAAO,EAAE,aAAa,UAAQ,GAAG,MAAM,CAoP3F"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
/** Sparse contact adjacency and block-Jacobi impulses; each dispatch has exclusive output owners. */
|
|
5
|
-
export function getRigidBodyParallelShader(ensemble) {
|
|
5
|
+
export function getRigidBodyParallelShader(ensemble, blockContacts = false) {
|
|
6
6
|
return /* wgsl */ `
|
|
7
7
|
struct ParallelState {
|
|
8
8
|
diagnostics:array<atomic<u32>,4>,
|
|
@@ -170,32 +170,51 @@ fn writePairDeltas(pair:u32,first:u32,second:u32,impulse:vec3f,firstTorque:vec3f
|
|
|
170
170
|
let relaxation=settings.stability.w/f32(max(1u,max(atomicLoad(¶llelState.degrees[first]),atomicLoad(¶llelState.degrees[second]))));
|
|
171
171
|
var firstLinear=velocities[first].xyz;var secondLinear=velocities[second].xyz;
|
|
172
172
|
var firstAngular=angularVelocities[first].xyz;var secondAngular=angularVelocities[second].xyz;
|
|
173
|
+
${blockContacts
|
|
174
|
+
? `
|
|
175
|
+
// Solve the contact patch locally, then relax the whole block once. No extra dispatches.
|
|
176
|
+
var contacts:array<Contact,4>;
|
|
177
|
+
for(var slot=0u;slot<manifolds[pair].count;slot++){contacts[slot]=manifolds[pair].contacts[slot];}
|
|
178
|
+
for(var sweep=0u;sweep<2u;sweep++){
|
|
179
|
+
`
|
|
180
|
+
: ''}
|
|
173
181
|
for(var slot=0u;slot<manifolds[pair].count;slot++){
|
|
174
|
-
var contact
|
|
182
|
+
var contact=${blockContacts ? 'contacts[slot]' : 'manifolds[pair].contacts[slot]'};let point=contact.point.xyz;let normal=contact.normal.xyz;
|
|
175
183
|
let firstLever=point-positions[first].xyz;let secondLever=point-positions[second].xyz;
|
|
176
184
|
let relative=secondLinear+cross(secondAngular,secondLever)-firstLinear-cross(firstAngular,firstLever);
|
|
177
185
|
let normalMass=effectiveMass(first,second,point,normal);if(normalMass<=0.0){continue;}
|
|
178
186
|
let bias=min(settings.stability.z,settings.stability.y*max(0.0,contact.point.w-settings.solver.x)/settings.gravity.w);
|
|
179
187
|
let desiredImpulse=max(0.0,contact.impulse.x+(max(bias,contact.normal.w)-dot(relative,normal))/normalMass);
|
|
180
|
-
let change=(desiredImpulse-contact.impulse.x)
|
|
188
|
+
let change=(desiredImpulse-contact.impulse.x)*${blockContacts ? '1.0' : 'relaxation'};contact.impulse.x+=change;
|
|
181
189
|
var impulse=normal*change;
|
|
182
190
|
if(dynamic(first)){firstLinear-=impulse*velocities[first].w;firstAngular-=inverseInertia(first,cross(firstLever,impulse));}
|
|
183
191
|
if(dynamic(second)){secondLinear+=impulse*velocities[second].w;secondAngular+=inverseInertia(second,cross(secondLever,impulse));}
|
|
184
192
|
let after=secondLinear+cross(secondAngular,secondLever)-firstLinear-cross(firstAngular,firstLever);
|
|
185
193
|
let tangent=solveFriction(firstCollider,secondCollider,contact,after);
|
|
186
|
-
var relaxedTangent=contact.tangent.xyz+(tangent-contact.tangent.xyz)
|
|
194
|
+
var relaxedTangent=contact.tangent.xyz+(tangent-contact.tangent.xyz)*${blockContacts ? '1.0' : 'relaxation'};
|
|
187
195
|
// A falling normal impulse must shrink the cone even when under-relaxing.
|
|
188
196
|
let staticLimit=frictionCoefficient(firstCollider,secondCollider,false)*contact.impulse.x;
|
|
189
197
|
if(length(relaxedTangent)>staticLimit){relaxedTangent*=staticLimit/max(1e-30,length(relaxedTangent));}
|
|
190
198
|
impulse=relaxedTangent-contact.tangent.xyz;contact.tangent=vec4f(relaxedTangent,0);
|
|
191
199
|
if(dynamic(first)){firstLinear-=impulse*velocities[first].w;firstAngular-=inverseInertia(first,cross(firstLever,impulse));}
|
|
192
200
|
if(dynamic(second)){secondLinear+=impulse*velocities[second].w;secondAngular+=inverseInertia(second,cross(secondLever,impulse));}
|
|
193
|
-
manifolds[pair].contacts[slot]=contact;
|
|
201
|
+
${blockContacts ? 'contacts[slot]' : 'manifolds[pair].contacts[slot]'}=contact;
|
|
202
|
+
}
|
|
203
|
+
${blockContacts
|
|
204
|
+
? `
|
|
205
|
+
}
|
|
206
|
+
// Interpolation of feasible impulses preserves the friction cone, including unloading.
|
|
207
|
+
for(var slot=0u;slot<manifolds[pair].count;slot++){
|
|
208
|
+
let previous=manifolds[pair].contacts[slot];
|
|
209
|
+
manifolds[pair].contacts[slot].impulse.x=mix(previous.impulse.x,contacts[slot].impulse.x,relaxation);
|
|
210
|
+
manifolds[pair].contacts[slot].tangent=mix(previous.tangent,contacts[slot].tangent,relaxation);
|
|
194
211
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
parallelState.deltas[pair*4u
|
|
198
|
-
parallelState.deltas[pair*4u+
|
|
212
|
+
`
|
|
213
|
+
: ''}
|
|
214
|
+
parallelState.deltas[pair*4u]=vec4f((firstLinear-velocities[first].xyz)*${blockContacts ? 'relaxation' : '1.0'},0);
|
|
215
|
+
parallelState.deltas[pair*4u+1u]=vec4f((firstAngular-angularVelocities[first].xyz)*${blockContacts ? 'relaxation' : '1.0'},0);
|
|
216
|
+
parallelState.deltas[pair*4u+2u]=vec4f((secondLinear-velocities[second].xyz)*${blockContacts ? 'relaxation' : '1.0'},0);
|
|
217
|
+
parallelState.deltas[pair*4u+3u]=vec4f((secondAngular-angularVelocities[second].xyz)*${blockContacts ? 'relaxation' : '1.0'},0);
|
|
199
218
|
}
|
|
200
219
|
@compute @workgroup_size(64) fn parallelGather(@builtin(global_invocation_id) invocation:vec3u){
|
|
201
220
|
var body=invocation.x;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rigid-body-parallel-shaders.js","sourceRoot":"","sources":["../../src/gpu-physics/rigid-body-parallel-shaders.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,qGAAqG;AACrG,MAAM,UAAU,0BAA0B,CAAC,QAAiB;
|
|
1
|
+
{"version":3,"file":"rigid-body-parallel-shaders.js","sourceRoot":"","sources":["../../src/gpu-physics/rigid-body-parallel-shaders.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,qGAAqG;AACrG,MAAM,UAAU,0BAA0B,CAAC,QAAiB,EAAE,aAAa,GAAG,KAAK;IACjF,OAAO,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;GA0BjB,QAAQ;QACN,CAAC,CAAC;;;;;;GAMJ;QACE,CAAC,CAAC;;4FAGN;;;;;;;;;;OAUM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CAgD2B,QAAQ;QAC1C,QAAQ;yBACS,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyE9B,aAAa;QACX,CAAC,CAAC;;;;;EAKL;QACG,CAAC,CAAC,EACN;;gBAEe,aAAa,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,gCAAgC;;;;;;kDAMjC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY;;;;;;yEAMb,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY;;;;;;;IAOzG,aAAa,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,gCAAgC;;GAGpE,aAAa;QACX,CAAC,CAAC;;;;;;;;EAQL;QACG,CAAC,CAAC,EACN;2EAC0E,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK;sFACzB,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK;gFAC1C,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK;wFAC5B,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK;;;;;;;;;;;;8GAYd,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,6CAA6C;;;;;;;;;;;;;CAa1K,CAAC;AACF,CAAC"}
|
|
@@ -25,7 +25,7 @@ var import_rigid_body_bounds_shaders = require("./rigid-body-bounds-shaders.cjs"
|
|
|
25
25
|
var import_rigid_body_parallel_shaders = require("./rigid-body-parallel-shaders.cjs");
|
|
26
26
|
var import_rigid_body_convex_shaders = require("./rigid-body-convex-shaders.cjs");
|
|
27
27
|
var import_rigid_body_cache_shaders = require("./rigid-body-cache-shaders.cjs");
|
|
28
|
-
function getRigidBodyShader(count, iterations, colliderCount = count, extended = false, sparse, parallel = false, maximumMeshTraversalTestsPerPair = 65536, jointShader = "fn jointActive(body:u32)->bool{return false;} fn jointExcluded(first:u32,second:u32)->bool{return false;}", hasJoints = false, linearDamping = 0, angularDamping = 0, jointCount = 0, compactContacts = true, collisionPartitionSize, ensembleBodiesPerInstance) {
|
|
28
|
+
function getRigidBodyShader(count, iterations, colliderCount = count, extended = false, sparse, parallel = false, maximumMeshTraversalTestsPerPair = 65536, jointShader = "fn jointActive(body:u32)->bool{return false;} fn jointExcluded(first:u32,second:u32)->bool{return false;}", hasJoints = false, linearDamping = 0, angularDamping = 0, jointCount = 0, compactContacts = true, collisionPartitionSize, ensembleBodiesPerInstance, blockContacts = false) {
|
|
29
29
|
return (
|
|
30
30
|
/* wgsl */
|
|
31
31
|
`
|
|
@@ -373,7 +373,7 @@ ${extended ? ensembleBodiesPerInstance ? import_rigid_body_convex_shaders.RIGID_
|
|
|
373
373
|
}
|
|
374
374
|
manifolds[pair].count=contactCount;
|
|
375
375
|
}
|
|
376
|
-
${parallel ? (0, import_rigid_body_parallel_shaders.getRigidBodyParallelShader)(Boolean(ensembleBodiesPerInstance)) : ""}
|
|
376
|
+
${parallel ? (0, import_rigid_body_parallel_shaders.getRigidBodyParallelShader)(Boolean(ensembleBodiesPerInstance), blockContacts) : ""}
|
|
377
377
|
${(parallel || hasJoints) && extended ? "@compute @workgroup_size(1) fn meshCollect(){collectMeshContacts();}" : ""}
|
|
378
378
|
${jointShader}
|
|
379
379
|
${parallel && hasJoints ? "@compute @workgroup_size(1) fn parallelJointWarm(){solveJoints(true);} @compute @workgroup_size(1) fn parallelJointSolve(){solveJoints(false);}" : ""}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type RigidBodySparseShaderLayout } from "./rigid-body-cache-shaders.js";
|
|
2
|
-
export declare function getRigidBodyShader(count: number, iterations: number, colliderCount?: number, extended?: boolean, sparse?: RigidBodySparseShaderLayout, parallel?: boolean, maximumMeshTraversalTestsPerPair?: number, jointShader?: string, hasJoints?: boolean, linearDamping?: number, angularDamping?: number, jointCount?: number, compactContacts?: boolean, collisionPartitionSize?: number, ensembleBodiesPerInstance?: number): string;
|
|
2
|
+
export declare function getRigidBodyShader(count: number, iterations: number, colliderCount?: number, extended?: boolean, sparse?: RigidBodySparseShaderLayout, parallel?: boolean, maximumMeshTraversalTestsPerPair?: number, jointShader?: string, hasJoints?: boolean, linearDamping?: number, angularDamping?: number, jointCount?: number, compactContacts?: boolean, collisionPartitionSize?: number, ensembleBodiesPerInstance?: number, blockContacts?: boolean): string;
|
|
3
3
|
//# sourceMappingURL=rigid-body-shaders.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rigid-body-shaders.d.ts","sourceRoot":"","sources":["../../src/gpu-physics/rigid-body-shaders.ts"],"names":[],"mappings":"AAYA,OAAO,EAEL,KAAK,2BAA2B,EACjC,sCAAmC;AACpC,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,aAAa,SAAQ,EACrB,QAAQ,UAAQ,EAChB,MAAM,CAAC,EAAE,2BAA2B,EACpC,QAAQ,UAAQ,EAChB,gCAAgC,SAAQ,EACxC,WAAW,SAA8G,EACzH,SAAS,UAAQ,EACjB,aAAa,SAAI,EACjB,cAAc,SAAI,EAClB,UAAU,SAAI,EACd,eAAe,UAAO,EACtB,sBAAsB,CAAC,EAAE,MAAM,EAC/B,yBAAyB,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"rigid-body-shaders.d.ts","sourceRoot":"","sources":["../../src/gpu-physics/rigid-body-shaders.ts"],"names":[],"mappings":"AAYA,OAAO,EAEL,KAAK,2BAA2B,EACjC,sCAAmC;AACpC,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,aAAa,SAAQ,EACrB,QAAQ,UAAQ,EAChB,MAAM,CAAC,EAAE,2BAA2B,EACpC,QAAQ,UAAQ,EAChB,gCAAgC,SAAQ,EACxC,WAAW,SAA8G,EACzH,SAAS,UAAQ,EACjB,aAAa,SAAI,EACjB,cAAc,SAAI,EAClB,UAAU,SAAI,EACd,eAAe,UAAO,EACtB,sBAAsB,CAAC,EAAE,MAAM,EAC/B,yBAAyB,CAAC,EAAE,MAAM,EAClC,aAAa,UAAQ,GACpB,MAAM,CAicR"}
|
|
@@ -7,7 +7,7 @@ import { RIGID_BODY_BOUNDS_SHADER, RIGID_BODY_BOUND_PUBLICATION_SHADER } from ".
|
|
|
7
7
|
import { getRigidBodyParallelShader } from "./rigid-body-parallel-shaders.js";
|
|
8
8
|
import { RIGID_BODY_CONVEX_SHADER } from "./rigid-body-convex-shaders.js";
|
|
9
9
|
import { getRigidBodyCacheShader } from "./rigid-body-cache-shaders.js";
|
|
10
|
-
export function getRigidBodyShader(count, iterations, colliderCount = count, extended = false, sparse, parallel = false, maximumMeshTraversalTestsPerPair = 65536, jointShader = 'fn jointActive(body:u32)->bool{return false;} fn jointExcluded(first:u32,second:u32)->bool{return false;}', hasJoints = false, linearDamping = 0, angularDamping = 0, jointCount = 0, compactContacts = true, collisionPartitionSize, ensembleBodiesPerInstance) {
|
|
10
|
+
export function getRigidBodyShader(count, iterations, colliderCount = count, extended = false, sparse, parallel = false, maximumMeshTraversalTestsPerPair = 65536, jointShader = 'fn jointActive(body:u32)->bool{return false;} fn jointExcluded(first:u32,second:u32)->bool{return false;}', hasJoints = false, linearDamping = 0, angularDamping = 0, jointCount = 0, compactContacts = true, collisionPartitionSize, ensembleBodiesPerInstance, blockContacts = false) {
|
|
11
11
|
return /* wgsl */ `
|
|
12
12
|
const COMPACT_CONTACTS:bool=${compactContacts};
|
|
13
13
|
const BODY_COUNT: u32 = ${count}u;
|
|
@@ -359,7 +359,7 @@ ${extended
|
|
|
359
359
|
}
|
|
360
360
|
manifolds[pair].count=contactCount;
|
|
361
361
|
}
|
|
362
|
-
${parallel ? getRigidBodyParallelShader(Boolean(ensembleBodiesPerInstance)) : ''}
|
|
362
|
+
${parallel ? getRigidBodyParallelShader(Boolean(ensembleBodiesPerInstance), blockContacts) : ''}
|
|
363
363
|
${(parallel || hasJoints) && extended ? '@compute @workgroup_size(1) fn meshCollect(){collectMeshContacts();}' : ''}
|
|
364
364
|
${jointShader}
|
|
365
365
|
${parallel && hasJoints ? '@compute @workgroup_size(1) fn parallelJointWarm(){solveJoints(true);} @compute @workgroup_size(1) fn parallelJointSolve(){solveJoints(false);}' : ''}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rigid-body-shaders.js","sourceRoot":"","sources":["../../src/gpu-physics/rigid-body-shaders.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,kGAAkG;AAClG,OAAO,EAAC,iBAAiB,EAAC,yCAAsC;AAChE,OAAO,EACL,wBAAwB,EACxB,mCAAmC,EACpC,uCAAoC;AACrC,OAAO,EAAC,0BAA0B,EAAC,yCAAsC;AACzE,OAAO,EAAC,wBAAwB,EAAC,uCAAoC;AACrE,OAAO,EACL,uBAAuB,EAExB,sCAAmC;AACpC,MAAM,UAAU,kBAAkB,CAChC,KAAa,EACb,UAAkB,EAClB,aAAa,GAAG,KAAK,EACrB,QAAQ,GAAG,KAAK,EAChB,MAAoC,EACpC,QAAQ,GAAG,KAAK,EAChB,gCAAgC,GAAG,KAAK,EACxC,WAAW,GAAG,2GAA2G,EACzH,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,CAAC,EACjB,cAAc,GAAG,CAAC,EAClB,UAAU,GAAG,CAAC,EACd,eAAe,GAAG,IAAI,EACtB,sBAA+B,EAC/B,yBAAkC;
|
|
1
|
+
{"version":3,"file":"rigid-body-shaders.js","sourceRoot":"","sources":["../../src/gpu-physics/rigid-body-shaders.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,kGAAkG;AAClG,OAAO,EAAC,iBAAiB,EAAC,yCAAsC;AAChE,OAAO,EACL,wBAAwB,EACxB,mCAAmC,EACpC,uCAAoC;AACrC,OAAO,EAAC,0BAA0B,EAAC,yCAAsC;AACzE,OAAO,EAAC,wBAAwB,EAAC,uCAAoC;AACrE,OAAO,EACL,uBAAuB,EAExB,sCAAmC;AACpC,MAAM,UAAU,kBAAkB,CAChC,KAAa,EACb,UAAkB,EAClB,aAAa,GAAG,KAAK,EACrB,QAAQ,GAAG,KAAK,EAChB,MAAoC,EACpC,QAAQ,GAAG,KAAK,EAChB,gCAAgC,GAAG,KAAK,EACxC,WAAW,GAAG,2GAA2G,EACzH,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,CAAC,EACjB,cAAc,GAAG,CAAC,EAClB,UAAU,GAAG,CAAC,EACd,eAAe,GAAG,IAAI,EACtB,sBAA+B,EAC/B,yBAAkC,EAClC,aAAa,GAAG,KAAK;IAErB,OAAO,UAAU,CAAC;8BACU,eAAe;0BACnB,KAAK;8BACD,aAAa;0BACjB,UAAU;kCACF,gCAAgC;0BACxC,MAAM,EAAE,YAAY,IAAI,aAAa,GAAG,aAAa;;;;;;;;mGAQoB,MAAM,CAAC,CAAC,CAAC,oDAAoD,yBAAyB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,eAAe,yBAAyB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,eAAe,yBAAyB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,sCAAsC,CAAC,CAAC,CAAC,EAAE,GAAG,yBAAyB,CAAC,CAAC,CAAC,qCAAqC,KAAK,GAAG,yBAAyB,+BAA+B,KAAK,GAAG,yBAAyB,wNAAwN,KAAK,GAAG,yBAAyB,4BAA4B,KAAK,GAAG,yBAAyB,6EAA6E,CAAC,CAAC,CAAC,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,6BAA6B,UAAU,GAAG,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;EAat+B,iBAAiB,CAAC,KAAK,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,QAAQ,CAAC;EAErF,MAAM;QACJ,CAAC,CAAC,uBAAuB,CAAC,MAAM,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;QACrE,CAAC,CAAC;;;CAIN;;;;;;;;;;;;;GAaG,sBAAsB,CAAC,CAAC,CAAC,YAAY,sBAAsB,aAAa,sBAAsB,kBAAkB,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFrH,QAAQ,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,gPAAgP,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;wDAazO,aAAa;sEACC,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2GlF,wBAAwB;EACxB,MAAM,CAAC,CAAC,CAAC,mCAAmC,CAAC,CAAC,CAAC,EAAE;EAEjD,QAAQ;QACN,CAAC,CAAC,yBAAyB;YACzB,CAAC,CAAC,wBAAwB,CAAC,OAAO,CAC9B,6CAA6C;YAC7C,kGAAkG;YAClG,kJAAkJ,CACnJ;YACH,CAAC,CAAC,wBAAwB;QAC5B,CAAC,CAAC,EACN;;;GAIG,MAAM;QACJ,CAAC,CAAC;;;;;EAKL;QACG,CAAC,CAAC;;;EAIN;iCACgC,MAAM,CAAC,CAAC,CAAC,wCAAwC,CAAC,CAAC,CAAC,EAAE;GACpF,QAAQ,CAAC,CAAC,CAAC,mCAAmC,CAAC,CAAC,CAAC,EAAE;;;GAGnD,QAAQ,CAAC,CAAC,CAAC,0KAA0K,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0E3L,QAAQ,CAAC,CAAC,CAAC,0BAA0B,CAAC,OAAO,CAAC,yBAAyB,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE;EAC7F,CAAC,QAAQ,IAAI,SAAS,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,sEAAsE,CAAC,CAAC,CAAC,EAAE;EACjH,WAAW;EACX,QAAQ,IAAI,SAAS,CAAC,CAAC,CAAC,iJAAiJ,CAAC,CAAC,CAAC,EAAE;;;GAG7K,QAAQ,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE;;;;;;;;;GAStD,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;GAanC,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE;;IAEpC,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DzC,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var rigid_body_vehicle_exports = {};
|
|
19
|
+
__export(rigid_body_vehicle_exports, {
|
|
20
|
+
VEHICLE_SHADER: () => VEHICLE_SHADER
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(rigid_body_vehicle_exports);
|
|
23
|
+
const VEHICLE_SHADER = (
|
|
24
|
+
/* wgsl */
|
|
25
|
+
`
|
|
26
|
+
struct Wheel { mount:vec4f, flags:vec4f, state:vec4f }
|
|
27
|
+
struct Vehicle { controls:vec4f, geometry:vec4f, tire:vec4f, indices:vec4u, wheels:array<Wheel,4>, poses:array<mat4x4f,4> }
|
|
28
|
+
@group(0) @binding(12) var<storage,read_write> vehicle:Vehicle;
|
|
29
|
+
@compute @workgroup_size(1) fn advanceVehicle() {
|
|
30
|
+
let chassis=vehicle.indices.x;
|
|
31
|
+
let terrain=vehicle.indices.y;
|
|
32
|
+
let rotation=orientations[chassis];
|
|
33
|
+
let center=positions[chassis].xyz;
|
|
34
|
+
let down=rotate(rotation,vec3f(0,0,-1));
|
|
35
|
+
let radius=vehicle.geometry.x;
|
|
36
|
+
let travel=vehicle.geometry.y;
|
|
37
|
+
let timestep=settings.gravity.w;
|
|
38
|
+
var impulse=vec3f(0);
|
|
39
|
+
var torque=vec3f(0);
|
|
40
|
+
for(var index=0u;index<4u;index++){
|
|
41
|
+
let wheel=vehicle.wheels[index];
|
|
42
|
+
let mount=center+rotate(rotation,wheel.mount.xyz-bodyCenter(chassis));
|
|
43
|
+
let hit=sweepSphere(terrain,colliderLocal(terrain,mount-colliderPosition(terrain)),colliderLocal(terrain,down),travel,radius,false);
|
|
44
|
+
var speed=wheel.state.x+vehicle.controls.x*vehicle.tire.y*wheel.flags.y*timestep/vehicle.tire.w;
|
|
45
|
+
speed-=sign(speed)*min(abs(speed),vehicle.controls.z*vehicle.tire.z*timestep/vehicle.tire.w);
|
|
46
|
+
let steering=vehicle.controls.y*wheel.flags.x;
|
|
47
|
+
var lengthNow=travel;
|
|
48
|
+
var load=0.0;
|
|
49
|
+
if(hit.hit!=0u && hit.complete!=0u){
|
|
50
|
+
let normal=rotate(colliderRotation(terrain),hit.normal);
|
|
51
|
+
let support=dot(normal,-down);
|
|
52
|
+
if(support>0.15){
|
|
53
|
+
lengthNow=hit.distance;
|
|
54
|
+
let lever=colliderPosition(terrain)+rotate(colliderRotation(terrain),hit.point)-center;
|
|
55
|
+
let velocity=velocities[chassis].xyz+cross(angularVelocities[chassis].xyz,lever);
|
|
56
|
+
load=max(0.0,(travel-lengthNow)*vehicle.geometry.z-vehicle.geometry.w*dot(velocity,normal)/support);
|
|
57
|
+
let heading=rotate(rotation,vec3f(cos(steering),sin(steering),0));
|
|
58
|
+
let side=normalize(cross(normal,heading));
|
|
59
|
+
let forward=cross(side,normal);
|
|
60
|
+
let slip=vec2f(speed*radius-dot(velocity,forward),-dot(velocity,side));
|
|
61
|
+
let demand=slip*load*vec2f(1.1,1.5);
|
|
62
|
+
var friction=demand*min(1.0,vehicle.tire.x*load/max(length(demand),0.0001));
|
|
63
|
+
// Bound tire feedback so a light wheel cannot overshoot rolling speed in one step.
|
|
64
|
+
let longitudinalLimit=abs(slip.x)*vehicle.tire.w/(radius*radius*timestep);
|
|
65
|
+
friction.x=clamp(friction.x,-longitudinalLimit,longitudinalLimit);
|
|
66
|
+
let change=(normal*load+forward*friction.x+side*friction.y)*timestep;
|
|
67
|
+
impulse+=change;
|
|
68
|
+
torque+=cross(lever,change);
|
|
69
|
+
speed-=friction.x*radius*timestep/vehicle.tire.w;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
let angle=wheel.state.y+speed*timestep;
|
|
73
|
+
vehicle.wheels[index].state=vec4f(speed,angle,lengthNow,load);
|
|
74
|
+
let heading=vec3f(cos(steering),sin(steering),0);
|
|
75
|
+
let axle=vec3f(-sin(steering),cos(steering),0);
|
|
76
|
+
let vertical=vec3f(0,0,1);
|
|
77
|
+
let hub=wheel.mount.xyz-vertical*lengthNow;
|
|
78
|
+
vehicle.poses[index]=mat4x4f(vec4f(heading*cos(angle)-vertical*sin(angle),0),
|
|
79
|
+
vec4f(axle,0),vec4f(heading*sin(angle)+vertical*cos(angle),0),vec4f(hub,1));
|
|
80
|
+
}
|
|
81
|
+
velocities[chassis]=vec4f(velocities[chassis].xyz+impulse*velocities[chassis].w,velocities[chassis].w);
|
|
82
|
+
angularVelocities[chassis]=vec4f(angularVelocities[chassis].xyz+inverseInertia(chassis,torque),0);
|
|
83
|
+
sleepStates[chassis]=vec4f(0);
|
|
84
|
+
}
|
|
85
|
+
`
|
|
86
|
+
);
|
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
+
0 && (module.exports = {
|
|
89
|
+
VEHICLE_SHADER
|
|
90
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Four independently sprung wheels in a chassis frame with +X forward and +Z up. */
|
|
2
|
+
export type GPURigidBodyVehicle = {
|
|
3
|
+
/** Index of the dynamic chassis body. */
|
|
4
|
+
chassis: number;
|
|
5
|
+
/** Index of the static collider sampled by all wheels. */
|
|
6
|
+
terrainCollider: number;
|
|
7
|
+
/** Four independently suspended wheels, in rendering and telemetry order. */
|
|
8
|
+
wheels: readonly {
|
|
9
|
+
/** At full compression the wheel center is here, in chassis node coordinates (meters). */
|
|
10
|
+
mount: readonly [number, number, number];
|
|
11
|
+
/** Turn this wheel about chassis +Z by the commanded steering angle. */
|
|
12
|
+
steer?: boolean;
|
|
13
|
+
/** Apply the commanded drive torque to this wheel. */
|
|
14
|
+
drive?: boolean;
|
|
15
|
+
}[];
|
|
16
|
+
/** Wheel contact sphere radius in meters. */
|
|
17
|
+
radius: number;
|
|
18
|
+
/** Maximum downward distance of the wheel center from its mount in meters. */
|
|
19
|
+
travel: number;
|
|
20
|
+
/** Per-wheel spring stiffness in newtons per meter. */
|
|
21
|
+
springRate: number;
|
|
22
|
+
/** Per-wheel damping coefficient in newton seconds per meter. */
|
|
23
|
+
damping: number;
|
|
24
|
+
/** Dimensionless tire friction coefficient limiting combined longitudinal and lateral force. */
|
|
25
|
+
grip: number;
|
|
26
|
+
/** Torque per driven wheel in N m. */
|
|
27
|
+
motorTorque: number;
|
|
28
|
+
/** Maximum braking torque per wheel in newton meters. */
|
|
29
|
+
brakeTorque: number;
|
|
30
|
+
/** Rotational inertia of one wheel in kilogram meters squared. */
|
|
31
|
+
wheelInertia: number;
|
|
32
|
+
};
|
|
33
|
+
/** One invocation owns the chassis. All wheels sample the same pre-step velocity. */
|
|
34
|
+
export declare const VEHICLE_SHADER = "\nstruct Wheel { mount:vec4f, flags:vec4f, state:vec4f }\nstruct Vehicle { controls:vec4f, geometry:vec4f, tire:vec4f, indices:vec4u, wheels:array<Wheel,4>, poses:array<mat4x4f,4> }\n@group(0) @binding(12) var<storage,read_write> vehicle:Vehicle;\n@compute @workgroup_size(1) fn advanceVehicle() {\n let chassis=vehicle.indices.x;\n let terrain=vehicle.indices.y;\n let rotation=orientations[chassis];\n let center=positions[chassis].xyz;\n let down=rotate(rotation,vec3f(0,0,-1));\n let radius=vehicle.geometry.x;\n let travel=vehicle.geometry.y;\n let timestep=settings.gravity.w;\n var impulse=vec3f(0);\n var torque=vec3f(0);\n for(var index=0u;index<4u;index++){\n let wheel=vehicle.wheels[index];\n let mount=center+rotate(rotation,wheel.mount.xyz-bodyCenter(chassis));\n let hit=sweepSphere(terrain,colliderLocal(terrain,mount-colliderPosition(terrain)),colliderLocal(terrain,down),travel,radius,false);\n var speed=wheel.state.x+vehicle.controls.x*vehicle.tire.y*wheel.flags.y*timestep/vehicle.tire.w;\n speed-=sign(speed)*min(abs(speed),vehicle.controls.z*vehicle.tire.z*timestep/vehicle.tire.w);\n let steering=vehicle.controls.y*wheel.flags.x;\n var lengthNow=travel;\n var load=0.0;\n if(hit.hit!=0u && hit.complete!=0u){\n let normal=rotate(colliderRotation(terrain),hit.normal);\n let support=dot(normal,-down);\n if(support>0.15){\n lengthNow=hit.distance;\n let lever=colliderPosition(terrain)+rotate(colliderRotation(terrain),hit.point)-center;\n let velocity=velocities[chassis].xyz+cross(angularVelocities[chassis].xyz,lever);\n load=max(0.0,(travel-lengthNow)*vehicle.geometry.z-vehicle.geometry.w*dot(velocity,normal)/support);\n let heading=rotate(rotation,vec3f(cos(steering),sin(steering),0));\n let side=normalize(cross(normal,heading));\n let forward=cross(side,normal);\n let slip=vec2f(speed*radius-dot(velocity,forward),-dot(velocity,side));\n let demand=slip*load*vec2f(1.1,1.5);\n var friction=demand*min(1.0,vehicle.tire.x*load/max(length(demand),0.0001));\n // Bound tire feedback so a light wheel cannot overshoot rolling speed in one step.\n let longitudinalLimit=abs(slip.x)*vehicle.tire.w/(radius*radius*timestep);\n friction.x=clamp(friction.x,-longitudinalLimit,longitudinalLimit);\n let change=(normal*load+forward*friction.x+side*friction.y)*timestep;\n impulse+=change;\n torque+=cross(lever,change);\n speed-=friction.x*radius*timestep/vehicle.tire.w;\n }\n }\n let angle=wheel.state.y+speed*timestep;\n vehicle.wheels[index].state=vec4f(speed,angle,lengthNow,load);\n let heading=vec3f(cos(steering),sin(steering),0);\n let axle=vec3f(-sin(steering),cos(steering),0);\n let vertical=vec3f(0,0,1);\n let hub=wheel.mount.xyz-vertical*lengthNow;\n vehicle.poses[index]=mat4x4f(vec4f(heading*cos(angle)-vertical*sin(angle),0),\n vec4f(axle,0),vec4f(heading*sin(angle)+vertical*cos(angle),0),vec4f(hub,1));\n }\n velocities[chassis]=vec4f(velocities[chassis].xyz+impulse*velocities[chassis].w,velocities[chassis].w);\n angularVelocities[chassis]=vec4f(angularVelocities[chassis].xyz+inverseInertia(chassis,torque),0);\n sleepStates[chassis]=vec4f(0);\n}\n";
|
|
35
|
+
//# sourceMappingURL=rigid-body-vehicle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rigid-body-vehicle.d.ts","sourceRoot":"","sources":["../../src/gpu-physics/rigid-body-vehicle.ts"],"names":[],"mappings":"AAIA,qFAAqF;AACrF,MAAM,MAAM,mBAAmB,GAAG;IAChC,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,eAAe,EAAE,MAAM,CAAC;IACxB,6EAA6E;IAC7E,MAAM,EAAE,SAAS;QACf,0FAA0F;QAC1F,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACzC,wEAAwE;QACxE,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,sDAAsD;QACtD,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,EAAE,CAAC;IACJ,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,gGAAgG;IAChG,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,cAAc,6uGA4D1B,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
/** One invocation owns the chassis. All wheels sample the same pre-step velocity. */
|
|
5
|
+
export const VEHICLE_SHADER = /* wgsl */ `
|
|
6
|
+
struct Wheel { mount:vec4f, flags:vec4f, state:vec4f }
|
|
7
|
+
struct Vehicle { controls:vec4f, geometry:vec4f, tire:vec4f, indices:vec4u, wheels:array<Wheel,4>, poses:array<mat4x4f,4> }
|
|
8
|
+
@group(0) @binding(12) var<storage,read_write> vehicle:Vehicle;
|
|
9
|
+
@compute @workgroup_size(1) fn advanceVehicle() {
|
|
10
|
+
let chassis=vehicle.indices.x;
|
|
11
|
+
let terrain=vehicle.indices.y;
|
|
12
|
+
let rotation=orientations[chassis];
|
|
13
|
+
let center=positions[chassis].xyz;
|
|
14
|
+
let down=rotate(rotation,vec3f(0,0,-1));
|
|
15
|
+
let radius=vehicle.geometry.x;
|
|
16
|
+
let travel=vehicle.geometry.y;
|
|
17
|
+
let timestep=settings.gravity.w;
|
|
18
|
+
var impulse=vec3f(0);
|
|
19
|
+
var torque=vec3f(0);
|
|
20
|
+
for(var index=0u;index<4u;index++){
|
|
21
|
+
let wheel=vehicle.wheels[index];
|
|
22
|
+
let mount=center+rotate(rotation,wheel.mount.xyz-bodyCenter(chassis));
|
|
23
|
+
let hit=sweepSphere(terrain,colliderLocal(terrain,mount-colliderPosition(terrain)),colliderLocal(terrain,down),travel,radius,false);
|
|
24
|
+
var speed=wheel.state.x+vehicle.controls.x*vehicle.tire.y*wheel.flags.y*timestep/vehicle.tire.w;
|
|
25
|
+
speed-=sign(speed)*min(abs(speed),vehicle.controls.z*vehicle.tire.z*timestep/vehicle.tire.w);
|
|
26
|
+
let steering=vehicle.controls.y*wheel.flags.x;
|
|
27
|
+
var lengthNow=travel;
|
|
28
|
+
var load=0.0;
|
|
29
|
+
if(hit.hit!=0u && hit.complete!=0u){
|
|
30
|
+
let normal=rotate(colliderRotation(terrain),hit.normal);
|
|
31
|
+
let support=dot(normal,-down);
|
|
32
|
+
if(support>0.15){
|
|
33
|
+
lengthNow=hit.distance;
|
|
34
|
+
let lever=colliderPosition(terrain)+rotate(colliderRotation(terrain),hit.point)-center;
|
|
35
|
+
let velocity=velocities[chassis].xyz+cross(angularVelocities[chassis].xyz,lever);
|
|
36
|
+
load=max(0.0,(travel-lengthNow)*vehicle.geometry.z-vehicle.geometry.w*dot(velocity,normal)/support);
|
|
37
|
+
let heading=rotate(rotation,vec3f(cos(steering),sin(steering),0));
|
|
38
|
+
let side=normalize(cross(normal,heading));
|
|
39
|
+
let forward=cross(side,normal);
|
|
40
|
+
let slip=vec2f(speed*radius-dot(velocity,forward),-dot(velocity,side));
|
|
41
|
+
let demand=slip*load*vec2f(1.1,1.5);
|
|
42
|
+
var friction=demand*min(1.0,vehicle.tire.x*load/max(length(demand),0.0001));
|
|
43
|
+
// Bound tire feedback so a light wheel cannot overshoot rolling speed in one step.
|
|
44
|
+
let longitudinalLimit=abs(slip.x)*vehicle.tire.w/(radius*radius*timestep);
|
|
45
|
+
friction.x=clamp(friction.x,-longitudinalLimit,longitudinalLimit);
|
|
46
|
+
let change=(normal*load+forward*friction.x+side*friction.y)*timestep;
|
|
47
|
+
impulse+=change;
|
|
48
|
+
torque+=cross(lever,change);
|
|
49
|
+
speed-=friction.x*radius*timestep/vehicle.tire.w;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
let angle=wheel.state.y+speed*timestep;
|
|
53
|
+
vehicle.wheels[index].state=vec4f(speed,angle,lengthNow,load);
|
|
54
|
+
let heading=vec3f(cos(steering),sin(steering),0);
|
|
55
|
+
let axle=vec3f(-sin(steering),cos(steering),0);
|
|
56
|
+
let vertical=vec3f(0,0,1);
|
|
57
|
+
let hub=wheel.mount.xyz-vertical*lengthNow;
|
|
58
|
+
vehicle.poses[index]=mat4x4f(vec4f(heading*cos(angle)-vertical*sin(angle),0),
|
|
59
|
+
vec4f(axle,0),vec4f(heading*sin(angle)+vertical*cos(angle),0),vec4f(hub,1));
|
|
60
|
+
}
|
|
61
|
+
velocities[chassis]=vec4f(velocities[chassis].xyz+impulse*velocities[chassis].w,velocities[chassis].w);
|
|
62
|
+
angularVelocities[chassis]=vec4f(angularVelocities[chassis].xyz+inverseInertia(chassis,torque),0);
|
|
63
|
+
sleepStates[chassis]=vec4f(0);
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
//# sourceMappingURL=rigid-body-vehicle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rigid-body-vehicle.js","sourceRoot":"","sources":["../../src/gpu-physics/rigid-body-vehicle.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAmC5D,qFAAqF;AACrF,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DxC,CAAC"}
|