@luma.gl/graph 10.0.0-beta.1 → 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/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/gpu-dataframe/gpu-data-frame-query.cjs +7 -3
- package/dist/gpu-dataframe/gpu-data-frame-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame-query.js +14 -4
- 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 +86 -0
- package/dist/gpu-dataframe/gpu-expression.d.ts +23 -2
- package/dist/gpu-dataframe/gpu-expression.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.js +81 -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 +8 -0
- package/dist/gpu-dataframe/index.cjs.map +2 -2
- package/dist/gpu-dataframe/index.d.ts +2 -2
- package/dist/gpu-dataframe/index.d.ts.map +1 -1
- package/dist/gpu-dataframe/index.js +1 -1
- package/dist/gpu-dataframe/index.js.map +1 -1
- package/dist/gpu-dataframe/portable-expression.cjs +68 -4
- package/dist/gpu-dataframe/portable-expression.d.ts +3 -1
- package/dist/gpu-dataframe/portable-expression.d.ts.map +1 -1
- package/dist/gpu-dataframe/portable-expression.js +69 -5
- package/dist/gpu-dataframe/portable-expression.js.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-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-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 +483 -152
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts +64 -3
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.js +523 -161
- 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 +8 -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-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 +11 -5
- 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 +14 -6
- 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 +99 -44
- package/dist/gpu-physics/rigid-body-vehicle.d.ts +15 -3
- package/dist/gpu-physics/rigid-body-vehicle.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-vehicle.js +93 -40
- package/dist/gpu-physics/rigid-body-vehicle.js.map +1 -1
- package/dist/gpu-project/cpu-geometry-pipelines.d.ts +1 -1
- package/dist/gpu-project/cpu-projection-operation.d.ts +1 -1
- package/dist/gpu-project/crs.cjs.map +2 -2
- package/dist/gpu-project/crs.d.ts +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/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/operation/gpu-data-evaluator.d.ts +1 -1
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.d.ts.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-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 +76 -122
- package/dist/gpu-sql/gpu-sql.d.ts.map +1 -1
- package/dist/gpu-sql/gpu-sql.js +99 -130
- package/dist/gpu-sql/gpu-sql.js.map +1 -1
- package/dist/gpu-sql/index.cjs.map +2 -2
- package/package.json +19 -19
- package/src/experimental-models.ts +5 -0
- package/src/experimental-simulation.ts +5 -0
- package/src/gpu-dataframe/gpu-data-frame-query.ts +18 -5
- package/src/gpu-dataframe/gpu-expression-shader.ts +128 -7
- package/src/gpu-dataframe/gpu-expression.ts +124 -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 +15 -2
- package/src/gpu-dataframe/portable-expression.ts +81 -4
- package/src/gpu-dggs-benchmarks.ts +5 -0
- 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 +668 -198
- package/src/gpu-physics/index.ts +37 -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-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 +17 -6
- 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 +108 -41
- package/src/gpu-project/README.md +2 -2
- package/src/gpu-project/cpu-geometry-pipelines.ts +1 -1
- package/src/gpu-project/cpu-projection-operation.ts +1 -1
- package/src/gpu-project/crs.ts +2 -2
- 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/gpu-simple-graph-transfer.ts +1 -1
- package/src/gpu-simple-graph/gpu-simple-graph-value.ts +1 -1
- package/src/gpu-simple-graph/operation/gpu-data-evaluator.ts +1 -1
- package/src/gpu-simple-graph/operation/operation.ts +1 -1
- package/src/gpu-simple-graph/operations/swizzle.ts +1 -1
- 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 +150 -152
package/src/gpu-physics/index.ts
CHANGED
|
@@ -23,8 +23,39 @@ export {makeSphereBoxPlanes, getBodyInertia, type GPUSphereBox} from './sphere-s
|
|
|
23
23
|
export {
|
|
24
24
|
makeConvexHullGeometry,
|
|
25
25
|
makeTriangleMeshGeometry,
|
|
26
|
+
makeStaticTriangleMeshGeometry,
|
|
26
27
|
type RigidBodyMeshGeometry
|
|
27
28
|
} from './rigid-body-mesh';
|
|
29
|
+
export {
|
|
30
|
+
makeRigidBodyHeightField,
|
|
31
|
+
type GPURigidBodyHeightField,
|
|
32
|
+
type GPURigidBodyHeightFieldSource
|
|
33
|
+
} from './rigid-body-height-field';
|
|
34
|
+
export {
|
|
35
|
+
stitchRigidBodyTerrainTiles,
|
|
36
|
+
type GPURigidBodyTerrainEdge,
|
|
37
|
+
type GPURigidBodyTerrainSeam,
|
|
38
|
+
type GPURigidBodyTerrainTile
|
|
39
|
+
} from './rigid-body-terrain-stitch';
|
|
40
|
+
export {
|
|
41
|
+
GPURigidBodyTerrainStream,
|
|
42
|
+
makeRigidBodyTerrainFetchProvider,
|
|
43
|
+
type GPURigidBodyTerrainFetchProps,
|
|
44
|
+
type GPURigidBodyTerrainProvider,
|
|
45
|
+
type GPURigidBodyTerrainSlot,
|
|
46
|
+
type GPURigidBodyTerrainStreamProps,
|
|
47
|
+
type GPURigidBodyTerrainWindow
|
|
48
|
+
} from './rigid-body-terrain-stream';
|
|
49
|
+
export {
|
|
50
|
+
GPURigidBodyTerrainSelector,
|
|
51
|
+
getRigidBodyTerrainTileBounds,
|
|
52
|
+
type GPURigidBodyTerrainAddress,
|
|
53
|
+
type GPURigidBodyTerrainBounds,
|
|
54
|
+
type GPURigidBodySelectedTerrainTile,
|
|
55
|
+
type GPURigidBodyTerrainFocus,
|
|
56
|
+
type GPURigidBodyTerrainSelection,
|
|
57
|
+
type GPURigidBodyTerrainSelectorProps
|
|
58
|
+
} from './rigid-body-terrain-lod';
|
|
28
59
|
export {getRigidBodyShapeProperties} from './rigid-body-shape-properties';
|
|
29
60
|
export {
|
|
30
61
|
getSphereClothReference,
|
|
@@ -81,6 +112,7 @@ export type {GPURigidBodyJoint, GPURigidBodyJointFrame} from './rigid-body-joint
|
|
|
81
112
|
export type {
|
|
82
113
|
GPURigidBodyCapture,
|
|
83
114
|
GPURigidBodyGPUCheckpoint,
|
|
115
|
+
GPURigidBodyHeightFieldEdit,
|
|
84
116
|
GPURigidBodyParameters
|
|
85
117
|
} from './gpu-rigid-body-world';
|
|
86
118
|
|
|
@@ -111,6 +143,11 @@ export type {
|
|
|
111
143
|
} from './gpu-physics-batch';
|
|
112
144
|
|
|
113
145
|
export {GPUPhysicsEnsemble, type GPUPhysicsEnsembleProps} from './gpu-physics-ensemble';
|
|
146
|
+
export type {
|
|
147
|
+
GPUPhysicsTerrainAtlasPool,
|
|
148
|
+
GPUPhysicsTerrainAtlasStats
|
|
149
|
+
} from './rigid-body-terrain-atlas';
|
|
150
|
+
export {GPUPhysicsEnsembleTerrain} from './gpu-physics-ensemble-terrain';
|
|
114
151
|
|
|
115
152
|
export type {GPURigidBodyJointLimit, GPURigidBodyJointDrive} from './joint-types';
|
|
116
153
|
|
|
@@ -2,8 +2,22 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import {RIGID_BODY_HEIGHT_FIELD_SHADER} from './rigid-body-height-field-shader';
|
|
6
|
+
|
|
7
|
+
/** Common mesh surface helpers, with height-field decoding only in worlds using it. */
|
|
8
|
+
export function getRigidBodyBoundsShader(heightFields: boolean): string {
|
|
9
|
+
return /* wgsl */ `
|
|
10
|
+
${heightFields ? RIGID_BODY_HEIGHT_FIELD_SHADER : ''}
|
|
11
|
+
fn meshTriangleActive(collider:u32,triangle:u32)->bool{
|
|
12
|
+
${heightFields ? 'if(bodies.colliders[collider].padding.y<0.0){return heightFieldTriangleActive(collider,triangle);}' : ''}
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
fn meshTriangleData(collider:u32,triangle:u32)->u32{
|
|
16
|
+
${heightFields ? 'if(bodies.colliders[collider].padding.y<0.0){return heightFieldTriangleData(collider,triangle);}' : ''}
|
|
17
|
+
return u32(readGeometry(u32(bodies.colliders[collider].padding.z)+triangle).w);
|
|
18
|
+
}
|
|
6
19
|
fn triangleVertex(collider:u32, triangle:u32, corner:u32)->vec3f {
|
|
20
|
+
${heightFields ? 'if(bodies.colliders[collider].padding.y<0.0){return heightFieldTriangleVertex(collider,triangle,corner);}' : ''}
|
|
7
21
|
let indices=readGeometry(u32(bodies.colliders[collider].padding.z)+triangle);
|
|
8
22
|
return readGeometry(u32(bodies.colliders[collider].padding.x)+u32(indices[corner])).xyz;
|
|
9
23
|
}
|
|
@@ -35,6 +49,7 @@ fn shapeWorldExtent(collider:u32)->vec3f {
|
|
|
35
49
|
return abs(axis(collider,0u))*extent.x+abs(axis(collider,1u))*extent.y+abs(axis(collider,2u))*extent.z;
|
|
36
50
|
}
|
|
37
51
|
`;
|
|
52
|
+
}
|
|
38
53
|
|
|
39
54
|
export const RIGID_BODY_BOUND_PUBLICATION_SHADER = /* wgsl */ `
|
|
40
55
|
@group(0) @binding(24) var<storage,read_write> minima:array<f32>;
|
|
@@ -97,7 +97,7 @@ fn convexContact(first:u32,second:u32,firstTriangle:i32,secondTriangle:i32)->Con
|
|
|
97
97
|
let faceNormal=normalize(cross(firstEdge,secondEdge));
|
|
98
98
|
let delta=center-closest;let magnitude=length(delta);let radius=bodies.colliders[sphere].shape.x;
|
|
99
99
|
var hit:ConvexHit;if(magnitude>radius+settings.solver.x){return hit;}
|
|
100
|
-
let internalEdges=
|
|
100
|
+
let internalEdges=meshTriangleData(mesh,triangle)%8u;
|
|
101
101
|
// Opposite barycentric coordinate identifies an edge. Internal coplanar edges are
|
|
102
102
|
// not collision ridges: their adjacent triangle owns the face witness instead.
|
|
103
103
|
for(var edge=0u;edge<3u;edge++){
|
|
@@ -185,9 +185,10 @@ fn collideExtended(pair:u32,first:u32,second:u32,previous:Manifold){
|
|
|
185
185
|
for(var traversal=0u;traversal<2u;traversal++){
|
|
186
186
|
var node=0u;var work=0u;var exhausted=false;
|
|
187
187
|
loop{if(node>=count){break;}if(work>=MESH_TRAVERSAL_BUDGET){exhausted=true;break;}work++;let minimum=readGeometry(offset+node*3u);let maximum=readGeometry(offset+node*3u+1u);
|
|
188
|
-
if(any(maximum.xyz<lower)||any(minimum.xyz>upper)){node=u32(minimum.w);continue;}
|
|
188
|
+
if(any(minimum.xyz>maximum.xyz)||any(maximum.xyz<lower)||any(minimum.xyz>upper)){node=u32(minimum.w);continue;}
|
|
189
189
|
if(maximum.w>0.0){let start=u32(readGeometry(offset+node*3u+2u).x);for(var index=0u;index<u32(maximum.w);index++){
|
|
190
190
|
if(work>=MESH_TRAVERSAL_BUDGET){exhausted=true;break;}work++;
|
|
191
|
+
if(!meshTriangleActive(mesh,start+index)){continue;}
|
|
191
192
|
let firstPoint=triangleVertex(mesh,start+index,0u);let secondPoint=triangleVertex(mesh,start+index,1u);let thirdPoint=triangleVertex(mesh,start+index,2u);
|
|
192
193
|
if(any(max(firstPoint,max(secondPoint,thirdPoint))<lower)||any(min(firstPoint,min(secondPoint,thirdPoint))>upper)){continue;}
|
|
193
194
|
if(traversal==0u){candidates++;}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import {type BoundKernel, createBoundKernel} from '../gpu-core/utils/bound-kernel';
|
|
6
6
|
import {Buffer, type Device} from '@luma.gl/core';
|
|
7
|
+
import {VEHICLE_STRIDE} from './rigid-body-vehicle';
|
|
7
8
|
|
|
8
9
|
/** One template-sized GPU reset image; no per-instance snapshots or pose readback. */
|
|
9
10
|
export function makeEnsembleReset(
|
|
@@ -13,10 +14,27 @@ export function makeEnsembleReset(
|
|
|
13
14
|
bodyCount: number,
|
|
14
15
|
bodiesPerInstance: number,
|
|
15
16
|
collidersPerInstance: number,
|
|
16
|
-
maximumPairs: number
|
|
17
|
+
maximumPairs: number,
|
|
18
|
+
vehiclesPerInstance: number,
|
|
19
|
+
terrainSlots: ReadonlySet<number>
|
|
17
20
|
) {
|
|
18
21
|
const find = (name: string) => buffers.find(buffer => buffer.id === `${id}-${name}`)!;
|
|
19
|
-
|
|
22
|
+
// A streamed collider row contains a private atlas address, revision and placement.
|
|
23
|
+
// Snapshot only the template rows that reset with the body state.
|
|
24
|
+
const colliderRanges: {name: string; offset: number; size: number; stride: number}[] = [];
|
|
25
|
+
let first = 0;
|
|
26
|
+
for (let collider = 0; collider <= collidersPerInstance; collider++) {
|
|
27
|
+
if (collider < collidersPerInstance && !terrainSlots.has(collider)) continue;
|
|
28
|
+
if (first < collider)
|
|
29
|
+
colliderRanges.push({
|
|
30
|
+
name: 'bodies',
|
|
31
|
+
offset: bodyCount * 48 + first * 96,
|
|
32
|
+
size: (collider - first) * 96,
|
|
33
|
+
stride: collidersPerInstance * 96
|
|
34
|
+
});
|
|
35
|
+
first = collider + 1;
|
|
36
|
+
}
|
|
37
|
+
const plans: {name: string; offset: number; size: number; stride?: number}[] = [
|
|
20
38
|
...['positions', 'orientations', 'velocities', 'angular-velocities', 'sleep'].map(name => ({
|
|
21
39
|
name,
|
|
22
40
|
offset: 0,
|
|
@@ -24,9 +42,12 @@ export function makeEnsembleReset(
|
|
|
24
42
|
})),
|
|
25
43
|
{name: 'targets', offset: 0, size: bodiesPerInstance * 32},
|
|
26
44
|
{name: 'bodies', offset: 0, size: bodiesPerInstance * 48},
|
|
27
|
-
|
|
45
|
+
...colliderRanges,
|
|
28
46
|
{name: 'object-attributes', offset: 0, size: collidersPerInstance * 4},
|
|
29
|
-
{name: 'pose-metadata', offset: 0, size: bodiesPerInstance * 48}
|
|
47
|
+
{name: 'pose-metadata', offset: 0, size: bodiesPerInstance * 48},
|
|
48
|
+
...(vehiclesPerInstance
|
|
49
|
+
? [{name: 'vehicle', offset: 0, size: vehiclesPerInstance * VEHICLE_STRIDE}]
|
|
50
|
+
: [])
|
|
30
51
|
].filter(plan => find(plan.name));
|
|
31
52
|
const snapshots: Buffer[] = [];
|
|
32
53
|
const settings = device.createBuffer({byteLength: 32, usage: Buffer.UNIFORM | Buffer.COPY_DST});
|
|
@@ -48,6 +69,7 @@ export function makeEnsembleReset(
|
|
|
48
69
|
}
|
|
49
70
|
device.submit(encoder.finish());
|
|
50
71
|
const history = find('contact-history');
|
|
72
|
+
const vehicle = vehiclesPerInstance ? find('vehicle') : null;
|
|
51
73
|
computation = createBoundKernel(device, {
|
|
52
74
|
source: /* wgsl */ `
|
|
53
75
|
@group(0) @binding(0) var<uniform> settings:Settings;
|
|
@@ -58,8 +80,9 @@ struct Settings {selection:vec4u, shift:vec4f}
|
|
|
58
80
|
@group(0) @binding(3) var<storage,read_write> manifolds:array<u32>;
|
|
59
81
|
@group(0) @binding(4) var<storage,read_write> targets:array<u32>;
|
|
60
82
|
${history ? '@group(0) @binding(5) var<storage,read_write> history:array<u32>;' : ''}
|
|
83
|
+
${vehicle ? '@group(0) @binding(7) var<storage,read_write> vehicle:array<u32>;' : ''}
|
|
61
84
|
@compute @workgroup_size(64) fn main(@builtin(global_invocation_id) invocation:vec3u){
|
|
62
|
-
let index=invocation.x;let selection=settings.selection;
|
|
85
|
+
let index=invocation.x+invocation.y*4194240u;let selection=settings.selection;
|
|
63
86
|
if(index==0u){targets[${bodyCount * 8 + 8 + maximumPairs * 2}u+selection.x/${bodiesPerInstance}u]=0u;}
|
|
64
87
|
if(index<${bodiesPerInstance}u){
|
|
65
88
|
let body=selection.x+index;positions[body]=vec4f(positions[body].xyz-settings.shift.xyz,positions[body].w);
|
|
@@ -67,9 +90,20 @@ ${history ? '@group(0) @binding(5) var<storage,read_write> history:array<u32>;'
|
|
|
67
90
|
}
|
|
68
91
|
if(index<${collidersPerInstance}u){
|
|
69
92
|
let collider=selection.y+index;let address=${bodyCount * 12}u+collider*24u+7u;
|
|
93
|
+
${terrainSlots.size ? 'if(!(bitcast<f32>(metadata[address+14u])<0.0&&metadata[address+15u]!=0u)){' : ''}
|
|
70
94
|
metadata[address]=bitcast<u32>(bitcast<f32>(metadata[address])+f32(selection.x));
|
|
95
|
+
${terrainSlots.size ? '}' : ''}
|
|
71
96
|
attributes[collider]=(attributes[collider]&0xffff0000u)|((attributes[collider]&0xffffu)+selection.x);
|
|
72
97
|
}
|
|
98
|
+
${
|
|
99
|
+
vehicle
|
|
100
|
+
? `if(index<${vehiclesPerInstance}u){
|
|
101
|
+
let address=(selection.x/${bodiesPerInstance}u*${vehiclesPerInstance}u+index)*${VEHICLE_STRIDE / 4}u;
|
|
102
|
+
vehicle[address+12u]+=selection.x;
|
|
103
|
+
vehicle[address+13u]+=selection.y;
|
|
104
|
+
}`
|
|
105
|
+
: ''
|
|
106
|
+
}
|
|
73
107
|
if(index>=${maximumPairs}u){return;}
|
|
74
108
|
let key=targets[${bodyCount * 8 + 8}u+index*2u];
|
|
75
109
|
if(key==0u||key==0xffffffffu){return;}
|
|
@@ -84,6 +118,7 @@ ${history ? '@group(0) @binding(5) var<storage,read_write> history:array<u32>;'
|
|
|
84
118
|
bindings: [
|
|
85
119
|
{name: 'settings', group: 0, location: 0, type: 'uniform'},
|
|
86
120
|
{name: 'positions', group: 0, location: 6, type: 'storage'},
|
|
121
|
+
...(vehicle ? [{name: 'vehicle', group: 0, location: 7, type: 'storage' as const}] : []),
|
|
87
122
|
...[
|
|
88
123
|
'metadata',
|
|
89
124
|
'attributes',
|
|
@@ -100,7 +135,8 @@ ${history ? '@group(0) @binding(5) var<storage,read_write> history:array<u32>;'
|
|
|
100
135
|
attributes: find('object-attributes'),
|
|
101
136
|
manifolds: find('manifolds'),
|
|
102
137
|
targets: find('targets'),
|
|
103
|
-
...(history ? {history} : {})
|
|
138
|
+
...(history ? {history} : {}),
|
|
139
|
+
...(vehicle ? {vehicle} : {})
|
|
104
140
|
}
|
|
105
141
|
});
|
|
106
142
|
} catch (error) {
|
|
@@ -121,13 +157,17 @@ ${history ? '@group(0) @binding(5) var<storage,read_write> history:array<u32>;'
|
|
|
121
157
|
encoder.copyBufferToBuffer({
|
|
122
158
|
sourceBuffer: snapshots[index],
|
|
123
159
|
destinationBuffer: find(plan.name),
|
|
124
|
-
destinationOffset: plan.offset + instance * plan.size,
|
|
160
|
+
destinationOffset: plan.offset + instance * (plan.stride ?? plan.size),
|
|
125
161
|
size: plan.size
|
|
126
162
|
});
|
|
127
163
|
const pass = encoder.beginComputePass();
|
|
164
|
+
const groups = Math.ceil(
|
|
165
|
+
Math.max(maximumPairs, collidersPerInstance, bodiesPerInstance, vehiclesPerInstance) / 64
|
|
166
|
+
);
|
|
128
167
|
computation!.kernel.dispatch(pass, {
|
|
129
168
|
bindings: computation!.bindings,
|
|
130
|
-
x: Math.
|
|
169
|
+
x: Math.min(65535, groups),
|
|
170
|
+
y: Math.ceil(groups / 65535)
|
|
131
171
|
});
|
|
132
172
|
pass.end();
|
|
133
173
|
device.submit(encoder.finish());
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
import {Buffer} from '@luma.gl/core';
|
|
12
12
|
|
|
13
|
+
import {VEHICLE_STRIDE} from './rigid-body-vehicle';
|
|
13
14
|
import {getEnsembleContactLayout} from './rigid-body-ensemble-layout';
|
|
14
15
|
import type {GPUCommandGraph, GraphBufferHandle} from '../gpu-core/gpu-command-graph';
|
|
15
16
|
|
|
@@ -25,7 +26,8 @@ export function addEnsembleCheckpoint<GraphParameters>(
|
|
|
25
26
|
manifolds: Resource,
|
|
26
27
|
bodiesPerInstance: number,
|
|
27
28
|
maximumPairs: number,
|
|
28
|
-
allocate: (name: string, byteLength: number) => Buffer
|
|
29
|
+
allocate: (name: string, byteLength: number) => Buffer,
|
|
30
|
+
vehicles?: {state: Resource; vehiclesPerInstance: number}
|
|
29
31
|
) {
|
|
30
32
|
const bodyCount = states[0].buffer.byteLength / 16;
|
|
31
33
|
const instances = bodyCount / bodiesPerInstance;
|
|
@@ -53,6 +55,12 @@ export function addEnsembleCheckpoint<GraphParameters>(
|
|
|
53
55
|
const snapshots = states
|
|
54
56
|
.slice(0, 5)
|
|
55
57
|
.map((state, index) => importAllocation(`checkpoint-${index}`, state.buffer.byteLength));
|
|
58
|
+
const vehicleSnapshot =
|
|
59
|
+
vehicles &&
|
|
60
|
+
importAllocation(
|
|
61
|
+
'checkpoint-vehicles',
|
|
62
|
+
instances * vehicles.vehiclesPerInstance * VEHICLE_STRIDE
|
|
63
|
+
);
|
|
56
64
|
const validity = importAllocation('state-validity', bodyCount * 4);
|
|
57
65
|
type Input = Resource & {name: string; writable?: boolean; atomic?: boolean};
|
|
58
66
|
const addCompute = (name: string, inputs: Input[], source: string, indirect = false) => {
|
|
@@ -98,6 +106,29 @@ export function addEnsembleCheckpoint<GraphParameters>(
|
|
|
98
106
|
};
|
|
99
107
|
const bodyAddress = `let work=invocation.x;if(work>=ensemble[0]*${bodiesPerInstance}u){return;}
|
|
100
108
|
let body=ensemble[${16 + instances * 8}u+work/${bodiesPerInstance}u]*${bodiesPerInstance}u+work%${bodiesPerInstance}u;`;
|
|
109
|
+
/** Journal or restore contiguous vehicle rows for the scheduled instances. */
|
|
110
|
+
const copyVehicleState = (restore: boolean) => {
|
|
111
|
+
if (!vehicles || !vehicleSnapshot) return;
|
|
112
|
+
const count = vehicles.vehiclesPerInstance;
|
|
113
|
+
addCompute(
|
|
114
|
+
restore ? 'rollback-vehicles' : 'checkpoint-vehicles',
|
|
115
|
+
[
|
|
116
|
+
{...vehicles.state, name: 'vehicle', writable: restore},
|
|
117
|
+
{...vehicleSnapshot, name: 'snapshot', writable: !restore},
|
|
118
|
+
{...ensemble, name: 'ensemble'},
|
|
119
|
+
...(restore ? [{...statistics, name: 'statistics'}] : [])
|
|
120
|
+
],
|
|
121
|
+
`@compute @workgroup_size(64) fn main(@builtin(global_invocation_id) invocation:vec3u){
|
|
122
|
+
${restore ? 'if(statistics[1]==0u&&statistics[15]==0u){return;}' : ''}
|
|
123
|
+
let work=invocation.x;if(work>=ensemble[0]*${count}u){return;}
|
|
124
|
+
let row=(ensemble[${16 + instances * 8}u+work/${count}u]*${count}u+work%${count}u)*${VEHICLE_STRIDE / 4}u;
|
|
125
|
+
for(var word=0u;word<${VEHICLE_STRIDE / 4}u;word++){
|
|
126
|
+
${restore ? 'vehicle[row+word]=snapshot[row+word];' : 'snapshot[row+word]=vehicle[row+word];'}
|
|
127
|
+
}
|
|
128
|
+
}`,
|
|
129
|
+
true
|
|
130
|
+
);
|
|
131
|
+
};
|
|
101
132
|
const save = () => {
|
|
102
133
|
addCompute(
|
|
103
134
|
'checkpoint-metadata',
|
|
@@ -117,6 +148,7 @@ export function addEnsembleCheckpoint<GraphParameters>(
|
|
|
117
148
|
}
|
|
118
149
|
}`
|
|
119
150
|
);
|
|
151
|
+
copyVehicleState(false);
|
|
120
152
|
states.slice(0, 5).forEach((state, index) =>
|
|
121
153
|
addCompute(
|
|
122
154
|
`checkpoint-${index}`,
|
|
@@ -177,6 +209,7 @@ export function addEnsembleCheckpoint<GraphParameters>(
|
|
|
177
209
|
if(invocation.x<5u){targets[${bodyCount * 8}u+invocation.x]=targets[${savedHeaderOffset}u+invocation.x];}
|
|
178
210
|
}`
|
|
179
211
|
);
|
|
212
|
+
copyVehicleState(true);
|
|
180
213
|
states.slice(0, 5).forEach((state, index) =>
|
|
181
214
|
addCompute(
|
|
182
215
|
`rollback-${index}`,
|
|
@@ -3,13 +3,30 @@
|
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {makeCoplanarFeatures} from './rigid-body-contact-features';
|
|
6
|
+
import {packRigidBodyHeightField, type GPURigidBodyHeightField} from './rigid-body-height-field';
|
|
6
7
|
import type {RigidBodyMeshGeometry} from './rigid-body-mesh';
|
|
7
8
|
import type {GPURigidBodyCollider} from './rigid-body-properties';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
/** Pack collider metadata and its contiguous GPU geometry uploads. */
|
|
11
|
+
export function packRigidBodyShapes(
|
|
12
|
+
colliders: readonly GPURigidBodyCollider[],
|
|
13
|
+
shareHeightFields = false,
|
|
14
|
+
writableHeightFields?: ReadonlySet<number>,
|
|
15
|
+
useTerrainAtlas = false
|
|
16
|
+
) {
|
|
10
17
|
const geometry: number[] = [];
|
|
11
18
|
const packedMeshes = new Map<RigidBodyMeshGeometry, {padding: number[]; policies: number[]}>();
|
|
12
|
-
const
|
|
19
|
+
const sharedHeightFields = new Map<
|
|
20
|
+
GPURigidBodyHeightField,
|
|
21
|
+
{padding: number[]; policies: number[]; extent: number[]}
|
|
22
|
+
>();
|
|
23
|
+
const heightFields = new Map<number, number>();
|
|
24
|
+
const atlasFields = new Map<number, ReturnType<typeof packRigidBodyHeightField>>();
|
|
25
|
+
const writablePayloads = new Map<
|
|
26
|
+
GPURigidBodyHeightField,
|
|
27
|
+
ReturnType<typeof packRigidBodyHeightField>
|
|
28
|
+
>();
|
|
29
|
+
const shapes = colliders.map(({shape}, colliderIndex) => {
|
|
13
30
|
const policies = [0, 0];
|
|
14
31
|
const padding = [0, 0, 0, 0];
|
|
15
32
|
let dimensions: number[];
|
|
@@ -24,7 +41,35 @@ export function packRigidBodyShapes(colliders: readonly GPURigidBodyCollider[])
|
|
|
24
41
|
shape.height,
|
|
25
42
|
shape.type === 'capsule' ? 4 : 5
|
|
26
43
|
];
|
|
27
|
-
else {
|
|
44
|
+
else if (shape.type === 'height-field') {
|
|
45
|
+
const writable = !shareHeightFields || writableHeightFields?.has(colliderIndex);
|
|
46
|
+
const shared = writable ? undefined : sharedHeightFields.get(shape.field);
|
|
47
|
+
if (shared) {
|
|
48
|
+
padding.splice(0, padding.length, ...shared.padding);
|
|
49
|
+
policies.splice(0, policies.length, ...shared.policies);
|
|
50
|
+
dimensions = [...shared.extent, 3];
|
|
51
|
+
} else {
|
|
52
|
+
const packed = writablePayloads.get(shape.field) ?? packRigidBodyHeightField(shape.field);
|
|
53
|
+
if (shareHeightFields && writable) writablePayloads.set(shape.field, packed);
|
|
54
|
+
if (useTerrainAtlas && writable) {
|
|
55
|
+
padding[1] = -shape.field.width;
|
|
56
|
+
dimensions = [...packed.extent, 3];
|
|
57
|
+
if (packed.nodeCount) atlasFields.set(colliderIndex, packed);
|
|
58
|
+
return {dimensions, policies, padding};
|
|
59
|
+
}
|
|
60
|
+
const offset = geometry.length / 4;
|
|
61
|
+
padding[0] = offset;
|
|
62
|
+
// Negative vertex count distinguishes implicit height-field triangles in the mesh kernels.
|
|
63
|
+
padding[1] = -shape.field.width;
|
|
64
|
+
padding[3] = packed.triangleCount;
|
|
65
|
+
policies[0] = offset + packed.nodeOffset;
|
|
66
|
+
policies[1] = packed.nodeCount;
|
|
67
|
+
dimensions = [...packed.extent, 3];
|
|
68
|
+
for (const value of packed.data) geometry.push(value);
|
|
69
|
+
if (writable) heightFields.set(colliderIndex, offset);
|
|
70
|
+
else sharedHeightFields.set(shape.field, {padding, policies, extent: packed.extent});
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
28
73
|
const mesh = shape.geometry;
|
|
29
74
|
const shared = packedMeshes.get(mesh);
|
|
30
75
|
if (shared) {
|
|
@@ -75,5 +120,5 @@ export function packRigidBodyShapes(colliders: readonly GPURigidBodyCollider[])
|
|
|
75
120
|
while (geometry.length % 4) geometry.push(0);
|
|
76
121
|
return [start, excluded.length] as const;
|
|
77
122
|
});
|
|
78
|
-
return {shapes, geometry, filters};
|
|
123
|
+
return {shapes, geometry, filters, heightFields, atlasFields};
|
|
79
124
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
/** Reconstruct the same upward-oriented grid triangles used by CPU terrain meshing. */
|
|
6
|
+
export const RIGID_BODY_HEIGHT_FIELD_SHADER = /* wgsl */ `
|
|
7
|
+
fn heightFieldSample(base:u32,index:u32)->f32{return readGeometry(base+2u+index/4u)[index%4u];}
|
|
8
|
+
fn heightFieldCell(width:u32,triangle:u32)->vec2u{
|
|
9
|
+
let cell=triangle/2u;
|
|
10
|
+
return vec2u(cell%(width-1u),cell/(width-1u));
|
|
11
|
+
}
|
|
12
|
+
fn heightFieldCorners(flags:u32,triangle:u32)->vec3u{
|
|
13
|
+
let second=(triangle&1u)!=0u;
|
|
14
|
+
var corners=select(vec3u(0,1,3),vec3u(0,3,2),second);
|
|
15
|
+
if((flags&1u)!=0u){corners=select(vec3u(0,1,2),vec3u(1,3,2),second);}
|
|
16
|
+
if((flags&2u)!=0u){corners=corners.xzy;}
|
|
17
|
+
return corners;
|
|
18
|
+
}
|
|
19
|
+
fn heightFieldTriangleIndices(base:u32,triangle:u32)->vec3u{
|
|
20
|
+
let header=readGeometry(base+1u);
|
|
21
|
+
let width=u32(header.z);
|
|
22
|
+
let cell=heightFieldCell(width,triangle);
|
|
23
|
+
let corners=heightFieldCorners(u32(header.w),triangle);
|
|
24
|
+
return vec3u(cell.y*width+cell.x)+(corners/2u)*width+(corners%2u);
|
|
25
|
+
}
|
|
26
|
+
fn heightFieldTriangleVertex(collider:u32,triangle:u32,corner:u32)->vec3f{
|
|
27
|
+
let base=u32(bodies.colliders[collider].padding.x);
|
|
28
|
+
let steps=readGeometry(base);let header=readGeometry(base+1u);let width=u32(header.z);
|
|
29
|
+
let index=heightFieldTriangleIndices(base,triangle)[corner];
|
|
30
|
+
let position=header.xy+f32(index%width)*steps.xy+f32(index/width)*steps.zw;
|
|
31
|
+
return vec3f(position,heightFieldSample(base,index));
|
|
32
|
+
}
|
|
33
|
+
fn heightFieldTriangleActive(collider:u32,triangle:u32)->bool{
|
|
34
|
+
let base=u32(bodies.colliders[collider].padding.x);
|
|
35
|
+
let indices=heightFieldTriangleIndices(base,triangle);
|
|
36
|
+
return heightFieldSample(base,indices.x)!=3.402823e38 &&
|
|
37
|
+
heightFieldSample(base,indices.y)!=3.402823e38 &&
|
|
38
|
+
heightFieldSample(base,indices.z)!=3.402823e38;
|
|
39
|
+
}
|
|
40
|
+
fn heightFieldTriangleData(collider:u32,triangle:u32)->u32{
|
|
41
|
+
let base=u32(bodies.colliders[collider].padding.x);
|
|
42
|
+
let header=readGeometry(base+1u);
|
|
43
|
+
let width=u32(header.z);let flags=u32(header.w);
|
|
44
|
+
let cell=heightFieldCell(width,triangle);let start=cell.y*width+cell.x;
|
|
45
|
+
let first=heightFieldSample(base,start);let second=heightFieldSample(base,start+1u);
|
|
46
|
+
let third=heightFieldSample(base,start+width);let fourth=heightFieldSample(base,start+width+1u);
|
|
47
|
+
if(any(vec4f(first,second,third,fourth)==vec4f(3.402823e38))){return (triangle+1u)*8u;}
|
|
48
|
+
// Remove the quad diagonal only when it joins coplanar triangles.
|
|
49
|
+
if((first-second)+(fourth-third)!=0.0){return (triangle+1u)*8u;}
|
|
50
|
+
let odd=(triangle&1u)!=0u;
|
|
51
|
+
var edge=select(2u,0u,odd);
|
|
52
|
+
if((flags&1u)!=0u){edge=select(1u,2u,odd);}
|
|
53
|
+
if((flags&2u)!=0u){edge=2u-edge;}
|
|
54
|
+
return ((triangle & 0xfffffffeu)+1u)*8u+(1u<<edge);
|
|
55
|
+
}
|
|
56
|
+
`;
|