@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
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
import { createBoundKernel, createBoundKernelAsync } from "../gpu-core/utils/bound-kernel.js";
|
|
5
5
|
import { Buffer } from '@luma.gl/core';
|
|
6
6
|
import { shiftRigidBodyBuffers } from "./rigid-body-origin.js";
|
|
7
|
+
import { packRigidBodyHeightField } from "./rigid-body-height-field.js";
|
|
7
8
|
import { getRigidBodyShapeProperties } from "./rigid-body-shape-properties.js";
|
|
8
9
|
import { addEnsembleStatus, readOnlyEnsembleShader } from "./rigid-body-ensemble-shaders.js";
|
|
9
10
|
import { makeEnsembleReset } from "./rigid-body-ensemble-reset.js";
|
|
11
|
+
import { RigidBodyTerrainAtlas } from "./rigid-body-terrain-atlas.js";
|
|
10
12
|
import { packRigidBodyShapes } from "./rigid-body-geometry.js";
|
|
11
13
|
import { getCompoundBodyInertia, normalizeRigidBodyRotation, rotateRigidBodyVector } from "./rigid-body-properties.js";
|
|
12
14
|
import { addGPUCommandNodes } from "../gpu-core/gpu-command-node.js";
|
|
@@ -22,7 +24,7 @@ import { addRigidBodyCheckpoint } from "./rigid-body-transaction.js";
|
|
|
22
24
|
import { getRigidBodyJointShader, packRigidBodyJointState, RIGID_BODY_JOINT_STATE_BYTES, validateRigidBodyJoints } from "./rigid-body-joints.js";
|
|
23
25
|
import { addRigidBodyPosePublication } from "./rigid-body-publication.js";
|
|
24
26
|
import { getRigidBodyShader } from "./rigid-body-shaders.js";
|
|
25
|
-
import {
|
|
27
|
+
import { getVehicleShader, VEHICLE_STRIDE, VEHICLE_TERRAIN_ROW_SIZE } from "./rigid-body-vehicle.js";
|
|
26
28
|
import { decodeRigidBodyContactEvents, getRigidBodyEventShader } from "./rigid-body-events.js";
|
|
27
29
|
import { RIGID_BODY_QUERY_SHADER } from "./rigid-body-queries.js";
|
|
28
30
|
export class GPURigidBodyWorld {
|
|
@@ -53,6 +55,12 @@ export class GPURigidBodyWorld {
|
|
|
53
55
|
eventRead = null;
|
|
54
56
|
queryComputation = null;
|
|
55
57
|
queryReduction = null;
|
|
58
|
+
/** Chassis definitions in GPU storage order. */
|
|
59
|
+
vehicles;
|
|
60
|
+
/** Whether any chassis has more than one terrain candidate. */
|
|
61
|
+
multiSurfaceVehicles;
|
|
62
|
+
/** Number of vehicles in each equal-sized ensemble partition, or zero for a standalone world. */
|
|
63
|
+
vehiclesPerInstance;
|
|
56
64
|
vehicleBuffer = null;
|
|
57
65
|
querySettings = null;
|
|
58
66
|
querySelection = null;
|
|
@@ -61,9 +69,23 @@ export class GPURigidBodyWorld {
|
|
|
61
69
|
targets = null;
|
|
62
70
|
simulationStatistics = null;
|
|
63
71
|
colliders;
|
|
72
|
+
bodyColliderStarts;
|
|
73
|
+
ensembleTerrainSlots;
|
|
64
74
|
props;
|
|
65
75
|
ownedBuffers = [];
|
|
76
|
+
allocationPlan;
|
|
66
77
|
ensembleBuffer = null;
|
|
78
|
+
/** Byte offsets of writable fixed-dimension height fields in the world metadata buffer. */
|
|
79
|
+
heightFieldSlots = new Map();
|
|
80
|
+
/** Float32-exact edit stamp, restored together with the contact cache. */
|
|
81
|
+
terrainRevision = 1;
|
|
82
|
+
terrainWake = null;
|
|
83
|
+
/** Page ownership and live lease counts for an opt-in fused atlas. */
|
|
84
|
+
terrainAtlas;
|
|
85
|
+
/** Start of the shared atlas in the GPU metadata buffer, measured in 32-bit words. */
|
|
86
|
+
terrainAtlasWord = 0;
|
|
87
|
+
/** Start of the shader geometry region in the GPU metadata buffer, measured in 32-bit words. */
|
|
88
|
+
terrainGeometryWord = 0;
|
|
67
89
|
ensembleResetOrigin;
|
|
68
90
|
ensembleReset;
|
|
69
91
|
initialEnsembleBodies;
|
|
@@ -146,6 +168,9 @@ export class GPURigidBodyWorld {
|
|
|
146
168
|
throw new Error('Supply shape or colliders');
|
|
147
169
|
const shapes = body.colliders ?? (body.shape ? [{ shape: body.shape }] : []);
|
|
148
170
|
for (const collider of shapes) {
|
|
171
|
+
if (collider.shape.type === 'height-field' &&
|
|
172
|
+
(body.mode ?? (body.mass === 0 ? 'static' : 'dynamic')) !== 'static')
|
|
173
|
+
throw new Error('Height fields require static bodies');
|
|
149
174
|
const properties = getRigidBodyShapeProperties(collider.shape);
|
|
150
175
|
if (!Number.isFinite(properties.volume) ||
|
|
151
176
|
!properties.center.every(Number.isFinite) ||
|
|
@@ -253,7 +278,7 @@ export class GPURigidBodyWorld {
|
|
|
253
278
|
(props.continuous.maximumCandidates ?? this.maximumPairs) > 0x40000000 ||
|
|
254
279
|
(props.continuous.mode === 'convex' &&
|
|
255
280
|
(Boolean(props.joints?.length) ||
|
|
256
|
-
colliders.some(collider => ['plane', 'triangle-mesh'].includes(collider.shape.type)))))
|
|
281
|
+
colliders.some(collider => ['plane', 'triangle-mesh', 'height-field'].includes(collider.shape.type)))))
|
|
257
282
|
throw new Error('Invalid continuous settings');
|
|
258
283
|
for (const index of props.continuous.bodies) {
|
|
259
284
|
const body = props.bodies[index];
|
|
@@ -282,29 +307,88 @@ export class GPURigidBodyWorld {
|
|
|
282
307
|
const definitions = structuredClone({ colliders, props });
|
|
283
308
|
this.props = definitions.props;
|
|
284
309
|
this.colliders = definitions.colliders;
|
|
285
|
-
|
|
286
|
-
if (
|
|
287
|
-
|
|
310
|
+
this.ensembleTerrainSlots = new Set(this.props.ensembleTerrainSlots);
|
|
311
|
+
if (this.ensembleTerrainSlots.size &&
|
|
312
|
+
(!this.props.ensembleBodiesPerInstance ||
|
|
313
|
+
[...this.ensembleTerrainSlots].some(index => this.colliders[index]?.shape.type !== 'height-field')))
|
|
314
|
+
throw new Error('Invalid ensemble terrain slots');
|
|
315
|
+
if (this.props.ensembleTerrainAtlas) {
|
|
316
|
+
this.terrainAtlas = new RigidBodyTerrainAtlas(this.props.ensembleTerrainAtlas, Array.from(this.ensembleTerrainSlots, collider => {
|
|
317
|
+
const shape = this.colliders[collider].shape;
|
|
318
|
+
if (shape.type !== 'height-field')
|
|
319
|
+
throw new Error('Invalid ensemble terrain slot');
|
|
320
|
+
return { collider, width: shape.field.width, height: shape.field.height };
|
|
321
|
+
}));
|
|
322
|
+
}
|
|
323
|
+
this.bodyColliderStarts = new Uint32Array(this.count + 1);
|
|
324
|
+
let colliderIndex = 0;
|
|
325
|
+
for (let body = 0; body < this.count; body++) {
|
|
326
|
+
this.bodyColliderStarts[body] = colliderIndex;
|
|
327
|
+
while (this.colliders[colliderIndex]?.body === body)
|
|
328
|
+
colliderIndex++;
|
|
329
|
+
}
|
|
330
|
+
this.bodyColliderStarts[this.count] = colliderIndex;
|
|
331
|
+
if (this.props.vehicle && this.props.vehicles)
|
|
332
|
+
throw new Error('Choose vehicle or vehicles');
|
|
333
|
+
this.vehicles = this.props.vehicles ?? (this.props.vehicle ? [this.props.vehicle] : []);
|
|
334
|
+
this.multiSurfaceVehicles = this.vehicles.some(vehicle => vehicle.additionalTerrainColliders?.length);
|
|
335
|
+
const bodiesPerInstance = props.ensembleBodiesPerInstance;
|
|
336
|
+
const collidersPerInstance = props.collisionPartitionSize;
|
|
337
|
+
this.vehiclesPerInstance = bodiesPerInstance
|
|
338
|
+
? this.vehicles.length / (this.count / bodiesPerInstance)
|
|
339
|
+
: 0;
|
|
340
|
+
if (!Number.isInteger(this.vehiclesPerInstance))
|
|
341
|
+
throw new Error('Invalid ensemble vehicle layout');
|
|
342
|
+
const vehicleChassis = new Set();
|
|
343
|
+
for (const [vehicleIndex, vehicle] of this.vehicles.entries()) {
|
|
344
|
+
const instance = bodiesPerInstance ? Math.floor(vehicleIndex / this.vehiclesPerInstance) : 0;
|
|
345
|
+
const terrainIndices = [
|
|
346
|
+
vehicle.terrainCollider,
|
|
347
|
+
...(vehicle.additionalTerrainColliders ?? [])
|
|
348
|
+
];
|
|
288
349
|
const chassis = this.props.bodies[vehicle.chassis];
|
|
289
|
-
const ground = terrain && this.props.bodies[terrain.body];
|
|
290
350
|
if (!chassis ||
|
|
291
|
-
|
|
292
|
-
|
|
351
|
+
vehicleChassis.has(vehicle.chassis) ||
|
|
352
|
+
terrainIndices.length > 4 ||
|
|
353
|
+
new Set(terrainIndices).size !== terrainIndices.length ||
|
|
354
|
+
terrainIndices.some(colliderIndex => {
|
|
355
|
+
const collider = this.colliders[colliderIndex];
|
|
356
|
+
const ground = collider && this.props.bodies[collider.body];
|
|
357
|
+
return (!ground ||
|
|
358
|
+
collider.isTrigger ||
|
|
359
|
+
this.getBodyMode(collider.body) !== 'static' ||
|
|
360
|
+
(bodiesPerInstance && Math.floor(colliderIndex / collidersPerInstance) !== instance));
|
|
361
|
+
}) ||
|
|
293
362
|
(chassis.mode ?? (chassis.mass === 0 ? 'static' : 'dynamic')) !== 'dynamic' ||
|
|
294
|
-
(ground.mode ?? (ground.mass === 0 ? 'static' : 'dynamic')) !== 'static' ||
|
|
295
363
|
vehicle.wheels.length !== 4 ||
|
|
296
|
-
|
|
297
|
-
this.props.ensembleBodiesPerInstance ||
|
|
364
|
+
(bodiesPerInstance && Math.floor(vehicle.chassis / bodiesPerInstance) !== instance) ||
|
|
298
365
|
![vehicle.radius, vehicle.travel, vehicle.springRate, vehicle.wheelInertia].every(value => Number.isFinite(value) && value > 0) ||
|
|
299
366
|
![vehicle.damping, vehicle.grip, vehicle.motorTorque, vehicle.brakeTorque].every(value => Number.isFinite(value) && value >= 0) ||
|
|
367
|
+
(vehicle.steeringWheelbase !== undefined &&
|
|
368
|
+
(!Number.isFinite(Math.fround(vehicle.steeringWheelbase)) ||
|
|
369
|
+
vehicle.steeringWheelbase <= 0)) ||
|
|
370
|
+
!Number.isFinite(Math.fround(vehicle.antiRollRate ?? 0)) ||
|
|
371
|
+
(vehicle.antiRollRate ?? 0) < 0 ||
|
|
372
|
+
(vehicle.slipGain !== undefined &&
|
|
373
|
+
(vehicle.slipGain.length !== 2 ||
|
|
374
|
+
!vehicle.slipGain.every(gain => Number.isFinite(Math.fround(gain)) && gain >= 0))) ||
|
|
300
375
|
vehicle.wheels.some(wheel => wheel.mount.length !== 3 || !wheel.mount.every(Number.isFinite)))
|
|
301
376
|
throw new Error('Invalid vehicle configuration');
|
|
377
|
+
vehicleChassis.add(vehicle.chassis);
|
|
302
378
|
}
|
|
303
379
|
if (props.ensembleBodiesPerInstance)
|
|
304
380
|
this.initialEnsembleBodies = this.props.bodies.slice(0, props.ensembleBodiesPerInstance);
|
|
305
381
|
}
|
|
382
|
+
/** Allocation size including optional immutable terrain rows after the wheel state. */
|
|
383
|
+
getVehicleByteLength() {
|
|
384
|
+
return (this.vehicles.length *
|
|
385
|
+
(VEHICLE_STRIDE + (this.multiSurfaceVehicles ? VEHICLE_TERRAIN_ROW_SIZE : 0)));
|
|
386
|
+
}
|
|
306
387
|
getStorageLayout() {
|
|
307
|
-
const packed = packRigidBodyShapes(this.colliders);
|
|
388
|
+
const packed = packRigidBodyShapes(this.colliders, Boolean(this.props.ensembleBodiesPerInstance), this.ensembleTerrainSlots, Boolean(this.terrainAtlas));
|
|
389
|
+
const geometryWords = packed.geometry.length + (this.terrainAtlas?.wordLength ?? 0);
|
|
390
|
+
if (this.terrainAtlas && geometryWords >= 2 ** 26)
|
|
391
|
+
throw new Error('Terrain atlas exceeds address capacity');
|
|
308
392
|
const sparse = this.broadPhase === 'hierarchical-grid';
|
|
309
393
|
const extended = this.colliders.some(collider => (collider.shape.type !== 'sphere' && collider.shape.type !== 'box') ||
|
|
310
394
|
(collider.isTrigger && collider.shape.type !== 'sphere'));
|
|
@@ -314,10 +398,19 @@ export class GPURigidBodyWorld {
|
|
|
314
398
|
sparse,
|
|
315
399
|
extended,
|
|
316
400
|
parallel,
|
|
317
|
-
...getRigidBodyStorageLayout(this.count, this.colliderStorageCount, this.maximumPairs,
|
|
401
|
+
...getRigidBodyStorageLayout(this.count, this.colliderStorageCount, this.maximumPairs, geometryWords, sparse, extended, parallel, this.props.eventCapacity ?? 0, this.props.enableQueries ?? false, this.props.failurePolicy === 'rollback', Boolean(this.props.continuous), this.props.joints?.length ?? 0, this.props.ensembleBodiesPerInstance ? this.count / this.props.ensembleBodiesPerInstance : 0)
|
|
318
402
|
};
|
|
319
|
-
if (this.
|
|
320
|
-
|
|
403
|
+
if (this.vehicles.length) {
|
|
404
|
+
const byteLength = this.getVehicleByteLength();
|
|
405
|
+
storage.buffers.push({ name: 'vehicle', byteLength, uniform: false });
|
|
406
|
+
if (this.props.failurePolicy === 'rollback') {
|
|
407
|
+
storage.buffers.push({
|
|
408
|
+
name: this.vehiclesPerInstance ? 'checkpoint-vehicles' : 'checkpoint-7',
|
|
409
|
+
byteLength: this.vehiclesPerInstance ? this.vehicles.length * VEHICLE_STRIDE : byteLength,
|
|
410
|
+
uniform: false
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
}
|
|
321
414
|
if (this.props.continuous?.mode === 'convex') {
|
|
322
415
|
storage.buffers = storage.buffers.filter(buffer => buffer.name !== 'continuous-previous');
|
|
323
416
|
storage.buffers.push({ name: 'continuous-dispatch', byteLength: 16, uniform: false });
|
|
@@ -370,7 +463,7 @@ export class GPURigidBodyWorld {
|
|
|
370
463
|
if (!this.device || !this.ensembleBuffer || this.destroyed)
|
|
371
464
|
throw new Error('World has no ensemble scheduler');
|
|
372
465
|
this.ensembleResetOrigin ??= this.origin;
|
|
373
|
-
this.ensembleReset ??= makeEnsembleReset(this.device, this.id, this.ownedBuffers, this.count, this.props.ensembleBodiesPerInstance, this.props.collisionPartitionSize, this.maximumPairs);
|
|
466
|
+
this.ensembleReset ??= makeEnsembleReset(this.device, this.id, this.ownedBuffers, this.count, this.props.ensembleBodiesPerInstance, this.props.collisionPartitionSize, this.maximumPairs, this.vehiclesPerInstance, this.ensembleTerrainSlots);
|
|
374
467
|
return this.ensembleReset.byteLength;
|
|
375
468
|
}
|
|
376
469
|
resetEnsembleInstance(instance) {
|
|
@@ -381,35 +474,36 @@ export class GPURigidBodyWorld {
|
|
|
381
474
|
const colliderStart = instance * this.props.collisionPartitionSize;
|
|
382
475
|
let colliderIndex = colliderStart;
|
|
383
476
|
const restored = this.initialEnsembleBodies.map(body => {
|
|
384
|
-
|
|
385
|
-
|
|
477
|
+
const { shape, colliders, ...properties } = body;
|
|
478
|
+
const resetCollider = (definition) => {
|
|
479
|
+
const index = colliderIndex++;
|
|
480
|
+
const { body: _, ...current } = this.colliders[index];
|
|
481
|
+
if (this.ensembleTerrainSlots.has(index))
|
|
482
|
+
return current;
|
|
386
483
|
return {
|
|
387
|
-
...
|
|
388
|
-
shape:
|
|
389
|
-
? current
|
|
390
|
-
:
|
|
484
|
+
...definition,
|
|
485
|
+
shape: definition.shape.type === 'convex-hull' || definition.shape.type === 'triangle-mesh'
|
|
486
|
+
? current.shape
|
|
487
|
+
: definition.shape,
|
|
488
|
+
excludedColliders: definition.excludedColliders?.map(index => index + colliderStart)
|
|
391
489
|
};
|
|
392
|
-
}
|
|
393
|
-
return {
|
|
394
|
-
...body,
|
|
395
|
-
colliders: body.colliders.map(collider => {
|
|
396
|
-
const current = this.colliders[colliderIndex++].shape;
|
|
397
|
-
return {
|
|
398
|
-
...collider,
|
|
399
|
-
shape: collider.shape.type === 'convex-hull' || collider.shape.type === 'triangle-mesh'
|
|
400
|
-
? current
|
|
401
|
-
: collider.shape,
|
|
402
|
-
excludedColliders: collider.excludedColliders?.map(index => index + colliderStart)
|
|
403
|
-
};
|
|
404
|
-
})
|
|
405
490
|
};
|
|
491
|
+
if (shape && !this.ensembleTerrainSlots.has(colliderIndex))
|
|
492
|
+
return { ...body, shape: resetCollider({ shape }).shape };
|
|
493
|
+
return { ...properties, colliders: (colliders ?? [{ shape: shape }]).map(resetCollider) };
|
|
406
494
|
});
|
|
407
|
-
const definitions =
|
|
495
|
+
const definitions = this.props.bodies;
|
|
408
496
|
definitions.splice(bodyStart, restored.length, ...restored);
|
|
409
|
-
this.
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
497
|
+
this.restoreColliderDefinitions(bodyStart, bodyStart + restored.length);
|
|
498
|
+
const metadata = this.ownedBuffers.find(buffer => buffer.id === `${this.id}-bodies`);
|
|
499
|
+
for (let index = colliderStart; index < colliderIndex; index++) {
|
|
500
|
+
this.colliderShapeScales.delete(index);
|
|
501
|
+
if (!this.ensembleTerrainSlots.has(index))
|
|
502
|
+
continue;
|
|
503
|
+
const collider = this.colliders[index];
|
|
504
|
+
const center = definitions[collider.body].centerOfMass ?? [0, 0, 0];
|
|
505
|
+
metadata.write(new Float32Array((collider.position ?? [0, 0, 0]).map((value, axis) => value - center[axis])), this.count * 48 + index * 96 + 16);
|
|
506
|
+
}
|
|
413
507
|
this.ensembleReset.reset(instance, this.origin.map((value, axis) => value - this.ensembleResetOrigin[axis]));
|
|
414
508
|
this.ensembleBuffer.write(new Uint32Array([0, 0, 0, 0, 1, 1]), (16 + instance * 8 + 1) * 4);
|
|
415
509
|
if (this.encodePosePublication) {
|
|
@@ -454,6 +548,7 @@ export class GPURigidBodyWorld {
|
|
|
454
548
|
claimedContacts,
|
|
455
549
|
journaledContacts,
|
|
456
550
|
bodySnapshotBytes: activeBodies * 80,
|
|
551
|
+
vehicleSnapshotBytes: activeInstances * this.vehiclesPerInstance * VEHICLE_STRIDE,
|
|
457
552
|
contactSnapshotBytes: journaledContacts * 416,
|
|
458
553
|
allocatorSnapshotBytes: (8 + activeInstances * 2 + journaledContacts * 3) * 4,
|
|
459
554
|
residentInstances: this.count / this.props.ensembleBodiesPerInstance,
|
|
@@ -471,7 +566,9 @@ export class GPURigidBodyWorld {
|
|
|
471
566
|
}
|
|
472
567
|
/** Allocation preflight without GPU allocation. Graph scratch and driver overhead are separate. */
|
|
473
568
|
getCapacityInfo() {
|
|
474
|
-
const
|
|
569
|
+
const buffers = this.allocationPlan
|
|
570
|
+
? this.allocationPlan.map(buffer => ({ ...buffer }))
|
|
571
|
+
: this.getStorageLayout().buffers;
|
|
475
572
|
return {
|
|
476
573
|
bodyCount: this.count,
|
|
477
574
|
colliderCount: this.colliderCount,
|
|
@@ -490,6 +587,9 @@ export class GPURigidBodyWorld {
|
|
|
490
587
|
if (this.props.continuous?.mode === 'convex' &&
|
|
491
588
|
Math.max(Math.ceil((this.props.continuous.maximumCandidates ?? this.maximumPairs) / 64), Math.ceil(2 ** Math.ceil(Math.log2(Math.max(1, this.colliders.length))) / 64)) > graph.device.limits.maxComputeWorkgroupsPerDimension)
|
|
492
589
|
throw new Error('Continuous candidate dispatch exceeds device limits');
|
|
590
|
+
if (!this.vehiclesPerInstance &&
|
|
591
|
+
this.vehicles.length > graph.device.limits.maxComputeWorkgroupsPerDimension)
|
|
592
|
+
throw new Error('Vehicle dispatch exceeds device limits');
|
|
493
593
|
for (const buffer of allocationPlan) {
|
|
494
594
|
const bindingLimit = buffer.uniform
|
|
495
595
|
? graph.device.limits.maxUniformBufferBindingSize
|
|
@@ -497,6 +597,7 @@ export class GPURigidBodyWorld {
|
|
|
497
597
|
if (buffer.byteLength > Math.min(graph.device.limits.maxBufferSize, bindingLimit))
|
|
498
598
|
throw new Error(`Rigid-body ${buffer.name} storage exceeds device limits`);
|
|
499
599
|
}
|
|
600
|
+
this.allocationPlan = allocationPlan;
|
|
500
601
|
this.device = graph.device;
|
|
501
602
|
const allocate = (name, data, uniform = false) => {
|
|
502
603
|
const buffer = graph.device.createBuffer({
|
|
@@ -525,6 +626,29 @@ export class GPURigidBodyWorld {
|
|
|
525
626
|
: undefined;
|
|
526
627
|
const metadata = new Float32Array(metadataLength);
|
|
527
628
|
metadata.set(packed.geometry, geometryOffset);
|
|
629
|
+
if (this.terrainAtlas) {
|
|
630
|
+
this.terrainGeometryWord = geometryOffset;
|
|
631
|
+
this.terrainAtlasWord = geometryOffset + packed.geometry.length;
|
|
632
|
+
const { wordsByCollider, uploads } = this.terrainAtlas.bind(Array.from(packed.atlasFields, ([collider, field]) => ({
|
|
633
|
+
collider,
|
|
634
|
+
data: new Float32Array(field.data)
|
|
635
|
+
})));
|
|
636
|
+
for (const { word, data } of uploads)
|
|
637
|
+
metadata.set(data, this.terrainAtlasWord + word);
|
|
638
|
+
for (const [collider, word] of wordsByCollider) {
|
|
639
|
+
const field = packed.atlasFields.get(collider);
|
|
640
|
+
const address = (packed.geometry.length + word) / 4;
|
|
641
|
+
const shape = packed.shapes[collider];
|
|
642
|
+
shape.padding[0] = address;
|
|
643
|
+
shape.padding[3] = field.triangleCount;
|
|
644
|
+
shape.policies[0] = address + field.nodeOffset;
|
|
645
|
+
shape.policies[1] = field.nodeCount;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
this.heightFieldSlots = new Map(Array.from(packed.heightFields, ([collider, offset]) => [
|
|
649
|
+
collider,
|
|
650
|
+
(geometryOffset + offset * 4) * 4
|
|
651
|
+
]));
|
|
528
652
|
const bodyColliders = Array.from({ length: this.count }, () => []);
|
|
529
653
|
if (this.colliderCount)
|
|
530
654
|
for (const collider of this.colliders)
|
|
@@ -582,7 +706,10 @@ export class GPURigidBodyWorld {
|
|
|
582
706
|
material?.restitutionCombine ? policies.indexOf(material.restitutionCombine) : 4,
|
|
583
707
|
material?.frictionCombine ? policies.indexOf(material.frictionCombine) : 4,
|
|
584
708
|
...shape.policies,
|
|
585
|
-
|
|
709
|
+
shape.padding[0],
|
|
710
|
+
shape.padding[1],
|
|
711
|
+
this.ensembleTerrainSlots.has(index) ? 1 : shape.padding[2],
|
|
712
|
+
shape.padding[3]
|
|
586
713
|
], this.count * 12 + index * 24);
|
|
587
714
|
}
|
|
588
715
|
const exclusionOffset = this.count * 12 + this.colliderStorageCount * 24;
|
|
@@ -710,7 +837,7 @@ export class GPURigidBodyWorld {
|
|
|
710
837
|
usage: Buffer.STORAGE
|
|
711
838
|
}, objectAttributes), { format: 'uint32', length: this.colliderStorageCount })
|
|
712
839
|
: undefined;
|
|
713
|
-
const source = getRigidBodyShader(this.count, this.props.iterations ?? 16, this.colliderStorageCount, extended, sparseLayout, parallel, this.props.maximumMeshTraversalTestsPerPair ?? 65536, getRigidBodyJointShader(this.props.joints ?? [], this.props.bodies), Boolean(this.props.joints?.length), this.props.linearDamping ?? 0, this.props.angularDamping ?? 0, this.props.joints?.length ?? 0, this.props.compactContacts ?? true, this.props.collisionPartitionSize, this.props.ensembleBodiesPerInstance, this.props.parallelContactSolver === 'block');
|
|
840
|
+
const source = getRigidBodyShader(this.count, this.props.iterations ?? 16, this.colliderStorageCount, extended, sparseLayout, parallel, this.props.maximumMeshTraversalTestsPerPair ?? 65536, getRigidBodyJointShader(this.props.joints ?? [], this.props.bodies), Boolean(this.props.joints?.length), this.props.linearDamping ?? 0, this.props.angularDamping ?? 0, this.props.joints?.length ?? 0, this.props.compactContacts ?? true, this.props.collisionPartitionSize, this.props.ensembleBodiesPerInstance, this.props.parallelContactSolver === 'block', this.colliders.some(collider => collider.shape.type === 'height-field'));
|
|
714
841
|
const parallelBindings = {
|
|
715
842
|
parallelReset: ['parallelState'],
|
|
716
843
|
parallelResetCounters: ['parallelState'],
|
|
@@ -780,33 +907,6 @@ export class GPURigidBodyWorld {
|
|
|
780
907
|
}
|
|
781
908
|
this.simulationStatistics = allocate('simulation-statistics', 64);
|
|
782
909
|
const statisticsResource = graph.importBuffer({ id: `${this.id}-statistics`, byteLength: 64, usage: Buffer.STORAGE }, this.simulationStatistics);
|
|
783
|
-
const checkpointStates = [
|
|
784
|
-
'positions',
|
|
785
|
-
'orientations',
|
|
786
|
-
'velocities',
|
|
787
|
-
'angularVelocities',
|
|
788
|
-
'sleepStates',
|
|
789
|
-
'targets'
|
|
790
|
-
].map(name => {
|
|
791
|
-
const binding = bindings.find(binding => binding.name === name);
|
|
792
|
-
return { buffer: binding.buffer, resource: binding.resource };
|
|
793
|
-
});
|
|
794
|
-
const restoreCheckpoint = this.props.failurePolicy === 'rollback'
|
|
795
|
-
? this.ensembleBuffer
|
|
796
|
-
? addEnsembleCheckpoint(graph, this.id, checkpointStates, { buffer: this.simulationStatistics, resource: statisticsResource }, bindings.find(binding => binding.name === 'ensemble'), bindings.find(binding => binding.name === 'manifolds'), this.props.ensembleBodiesPerInstance, this.maximumPairs, allocate)
|
|
797
|
-
: addRigidBodyCheckpoint(graph, this.id, [
|
|
798
|
-
'positions',
|
|
799
|
-
'orientations',
|
|
800
|
-
'velocities',
|
|
801
|
-
'angularVelocities',
|
|
802
|
-
'sleepStates',
|
|
803
|
-
'targets',
|
|
804
|
-
...(this.ensembleBuffer ? [] : ['manifolds'])
|
|
805
|
-
].map(name => {
|
|
806
|
-
const binding = bindings.find(binding => binding.name === name);
|
|
807
|
-
return { buffer: binding.buffer, resource: binding.resource };
|
|
808
|
-
}), { buffer: this.simulationStatistics, resource: statisticsResource }, allocate)
|
|
809
|
-
: undefined;
|
|
810
910
|
const continuousSelection = new Uint32Array(this.count);
|
|
811
911
|
for (const body of this.props.continuous?.bodies ?? [])
|
|
812
912
|
continuousSelection[body] = this.colliders.findIndex(collider => collider.body === body) + 1;
|
|
@@ -847,45 +947,67 @@ export class GPURigidBodyWorld {
|
|
|
847
947
|
parallelMarkSleep: 'Identify islands whose bodies are quiet enough to sleep.',
|
|
848
948
|
parallelSleep: 'Put quiet constraint islands to sleep.'
|
|
849
949
|
};
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
vehicle.springRate,
|
|
857
|
-
vehicle.damping,
|
|
858
|
-
vehicle.grip,
|
|
859
|
-
vehicle.motorTorque,
|
|
860
|
-
vehicle.brakeTorque,
|
|
861
|
-
vehicle.wheelInertia
|
|
862
|
-
], 4);
|
|
863
|
-
new Uint32Array(data.buffer).set([vehicle.chassis, vehicle.terrainCollider], 12);
|
|
864
|
-
vehicle.wheels.forEach((wheel, index) => {
|
|
865
|
-
const offset = 16 + index * 12;
|
|
866
|
-
data.set(wheel.mount, offset);
|
|
867
|
-
data.set([Number(Boolean(wheel.steer)), Number(Boolean(wheel.drive))], offset + 4);
|
|
868
|
-
data[offset + 10] = vehicle.travel;
|
|
950
|
+
let vehicleResource;
|
|
951
|
+
let addVehiclePass;
|
|
952
|
+
if (this.vehicles.length) {
|
|
953
|
+
const packed = new Float32Array(this.getVehicleByteLength() / 4);
|
|
954
|
+
for (const [vehicleIndex, vehicle] of this.vehicles.entries()) {
|
|
955
|
+
const data = packed.subarray((vehicleIndex * VEHICLE_STRIDE) / 4, ((vehicleIndex + 1) * VEHICLE_STRIDE) / 4);
|
|
869
956
|
data.set([
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
wheel.mount
|
|
885
|
-
1
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
957
|
+
vehicle.radius,
|
|
958
|
+
vehicle.travel,
|
|
959
|
+
vehicle.springRate,
|
|
960
|
+
vehicle.damping,
|
|
961
|
+
vehicle.grip,
|
|
962
|
+
vehicle.motorTorque,
|
|
963
|
+
vehicle.brakeTorque,
|
|
964
|
+
vehicle.wheelInertia
|
|
965
|
+
], 4);
|
|
966
|
+
new Uint32Array(data.buffer, data.byteOffset, data.length).set([vehicle.chassis, vehicle.terrainCollider], 12);
|
|
967
|
+
data.set([vehicle.steeringWheelbase ?? 0, vehicle.antiRollRate ?? 0], 14);
|
|
968
|
+
const [longitudinalGain, lateralGain] = vehicle.slipGain ?? [1.1, 1.5];
|
|
969
|
+
vehicle.wheels.forEach((wheel, index) => {
|
|
970
|
+
const offset = 16 + index * 12;
|
|
971
|
+
data.set([...wheel.mount, longitudinalGain + 1], offset);
|
|
972
|
+
data.set([Number(Boolean(wheel.steer)), Number(Boolean(wheel.drive)), lateralGain + 1], offset + 4);
|
|
973
|
+
data[offset + 10] = vehicle.travel;
|
|
974
|
+
data.set([
|
|
975
|
+
1,
|
|
976
|
+
0,
|
|
977
|
+
0,
|
|
978
|
+
0,
|
|
979
|
+
0,
|
|
980
|
+
1,
|
|
981
|
+
0,
|
|
982
|
+
0,
|
|
983
|
+
0,
|
|
984
|
+
0,
|
|
985
|
+
1,
|
|
986
|
+
0,
|
|
987
|
+
wheel.mount[0],
|
|
988
|
+
wheel.mount[1],
|
|
989
|
+
wheel.mount[2] - vehicle.travel,
|
|
990
|
+
1
|
|
991
|
+
], 64 + 16 * index);
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
if (this.multiSurfaceVehicles) {
|
|
995
|
+
// Place the immutable terrain rows after the unchanged vehicle pose/telemetry ranges.
|
|
996
|
+
const terrainRows = new Uint32Array(packed.buffer, this.vehicles.length * VEHICLE_STRIDE);
|
|
997
|
+
terrainRows.fill(0xffffffff);
|
|
998
|
+
for (const [vehicleIndex, vehicle] of this.vehicles.entries())
|
|
999
|
+
terrainRows.set(vehicle.additionalTerrainColliders ?? [], vehicleIndex * (VEHICLE_TERRAIN_ROW_SIZE / 4));
|
|
1000
|
+
}
|
|
1001
|
+
this.vehicleBuffer = allocate('vehicle', packed);
|
|
1002
|
+
vehicleResource = {
|
|
1003
|
+
buffer: this.vehicleBuffer,
|
|
1004
|
+
resource: graph.importBuffer({
|
|
1005
|
+
id: this.id + '-vehicle',
|
|
1006
|
+
byteLength: packed.byteLength,
|
|
1007
|
+
usage: Buffer.STORAGE | Buffer.COPY_SRC
|
|
1008
|
+
}, this.vehicleBuffer)
|
|
1009
|
+
};
|
|
1010
|
+
const ensembleBinding = bindings.find(binding => binding.name === 'ensemble');
|
|
889
1011
|
const vehicleBindings = [
|
|
890
1012
|
...bindings.filter(binding => [
|
|
891
1013
|
'settings',
|
|
@@ -894,18 +1016,16 @@ export class GPURigidBodyWorld {
|
|
|
894
1016
|
'velocities',
|
|
895
1017
|
'angularVelocities',
|
|
896
1018
|
'bodies',
|
|
897
|
-
'sleepStates'
|
|
1019
|
+
'sleepStates',
|
|
1020
|
+
'ensemble'
|
|
898
1021
|
].includes(binding.name)),
|
|
899
|
-
{
|
|
900
|
-
name: 'vehicle',
|
|
901
|
-
location: 12,
|
|
902
|
-
buffer: this.vehicleBuffer,
|
|
903
|
-
resource: graph.importBuffer({ id: this.id + '-vehicle', byteLength: data.byteLength, usage: Buffer.STORAGE }, this.vehicleBuffer)
|
|
904
|
-
}
|
|
1022
|
+
{ name: 'vehicle', location: 12, ...vehicleResource }
|
|
905
1023
|
];
|
|
906
1024
|
const properties = {
|
|
907
1025
|
id: this.id + '-suspension',
|
|
908
|
-
source: source +
|
|
1026
|
+
source: readOnlyEnsembleShader(source) +
|
|
1027
|
+
RIGID_BODY_QUERY_GEOMETRY_SHADER +
|
|
1028
|
+
getVehicleShader(this.vehicles.length, this.multiSurfaceVehicles, this.vehiclesPerInstance),
|
|
909
1029
|
entryPoint: 'advanceVehicle',
|
|
910
1030
|
shaderLayout: {
|
|
911
1031
|
bindings: vehicleBindings.map(({ name, location }) => name === 'settings'
|
|
@@ -914,31 +1034,70 @@ export class GPURigidBodyWorld {
|
|
|
914
1034
|
name,
|
|
915
1035
|
location,
|
|
916
1036
|
group: 0,
|
|
917
|
-
type: name === 'bodies' ? 'read-only-storage' : 'storage'
|
|
1037
|
+
type: name === 'bodies' || name === 'ensemble' ? 'read-only-storage' : 'storage'
|
|
918
1038
|
})
|
|
919
1039
|
}
|
|
920
1040
|
};
|
|
921
1041
|
const executable = (computation) => ({
|
|
922
1042
|
encode: ({ computePass, getBuffer }) => {
|
|
923
1043
|
Object.assign(computation.bindings, Object.fromEntries(vehicleBindings.map(binding => [binding.name, getBuffer(binding.resource)])));
|
|
924
|
-
|
|
1044
|
+
if (ensembleBinding)
|
|
1045
|
+
computation.kernel.dispatchIndirect(computePass, {
|
|
1046
|
+
bindings: computation.bindings,
|
|
1047
|
+
indirectBuffer: getBuffer(ensembleBinding.resource),
|
|
1048
|
+
indirectOffset: 16
|
|
1049
|
+
});
|
|
1050
|
+
else
|
|
1051
|
+
computation.kernel.dispatch(computePass, {
|
|
1052
|
+
bindings: computation.bindings,
|
|
1053
|
+
x: this.vehicles.length
|
|
1054
|
+
});
|
|
925
1055
|
},
|
|
926
1056
|
destroy: () => computation.kernel.destroy()
|
|
927
1057
|
});
|
|
928
|
-
graph.addComputePass({
|
|
1058
|
+
addVehiclePass = () => graph.addComputePass({
|
|
929
1059
|
id: properties.id,
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
: binding.name === '
|
|
935
|
-
? '
|
|
936
|
-
: '
|
|
937
|
-
|
|
1060
|
+
description: 'Sweep four wheels and apply suspension and tire forces per chassis.',
|
|
1061
|
+
resources: [
|
|
1062
|
+
...vehicleBindings.map(binding => ({
|
|
1063
|
+
buffer: binding.resource,
|
|
1064
|
+
usage: binding.name === 'settings'
|
|
1065
|
+
? 'uniform'
|
|
1066
|
+
: binding.name === 'bodies' || binding.name === 'ensemble'
|
|
1067
|
+
? 'storage-read'
|
|
1068
|
+
: 'storage-read-write'
|
|
1069
|
+
})),
|
|
1070
|
+
...(ensembleBinding
|
|
1071
|
+
? [{ buffer: ensembleBinding.resource, usage: 'indirect' }]
|
|
1072
|
+
: [])
|
|
1073
|
+
],
|
|
938
1074
|
compile: () => executable(createBoundKernel(graph.device, properties)),
|
|
939
1075
|
compileAsync: async () => executable(await createBoundKernelAsync(graph.device, properties))
|
|
940
1076
|
});
|
|
941
1077
|
}
|
|
1078
|
+
const checkpointStates = [
|
|
1079
|
+
'positions',
|
|
1080
|
+
'orientations',
|
|
1081
|
+
'velocities',
|
|
1082
|
+
'angularVelocities',
|
|
1083
|
+
'sleepStates',
|
|
1084
|
+
'targets'
|
|
1085
|
+
].map(name => {
|
|
1086
|
+
const binding = bindings.find(binding => binding.name === name);
|
|
1087
|
+
return { buffer: binding.buffer, resource: binding.resource };
|
|
1088
|
+
});
|
|
1089
|
+
const restoreCheckpoint = this.props.failurePolicy === 'rollback'
|
|
1090
|
+
? this.ensembleBuffer
|
|
1091
|
+
? addEnsembleCheckpoint(graph, this.id, checkpointStates, { buffer: this.simulationStatistics, resource: statisticsResource }, bindings.find(binding => binding.name === 'ensemble'), bindings.find(binding => binding.name === 'manifolds'), this.props.ensembleBodiesPerInstance, this.maximumPairs, allocate, vehicleResource && {
|
|
1092
|
+
state: vehicleResource,
|
|
1093
|
+
vehiclesPerInstance: this.vehiclesPerInstance
|
|
1094
|
+
})
|
|
1095
|
+
: addRigidBodyCheckpoint(graph, this.id, [
|
|
1096
|
+
...checkpointStates,
|
|
1097
|
+
bindings.find(binding => binding.name === 'manifolds'),
|
|
1098
|
+
...(vehicleResource ? [vehicleResource] : [])
|
|
1099
|
+
], { buffer: this.simulationStatistics, resource: statisticsResource }, allocate)
|
|
1100
|
+
: undefined;
|
|
942
1101
|
for (const entryPoint of [
|
|
943
1102
|
...(this.ensembleBuffer
|
|
944
1103
|
? ['ensembleClear', 'ensembleMark', 'ensembleCompact', 'ensembleDispatch']
|
|
@@ -977,8 +1136,10 @@ export class GPURigidBodyWorld {
|
|
|
977
1136
|
]
|
|
978
1137
|
: [...(extended && this.props.joints?.length ? ['meshCollect'] : []), 'solve', 'finish'])
|
|
979
1138
|
]) {
|
|
980
|
-
if (entryPoint === 'integrate')
|
|
1139
|
+
if (entryPoint === 'integrate') {
|
|
981
1140
|
restoreCheckpoint?.save?.();
|
|
1141
|
+
addVehiclePass?.();
|
|
1142
|
+
}
|
|
982
1143
|
if (sparse && entryPoint === 'collide') {
|
|
983
1144
|
const bodyBinding = bindings.find(binding => binding.name === 'bodies');
|
|
984
1145
|
const minimumBinding = bindings.find(binding => binding.name === 'minima');
|
|
@@ -1533,6 +1694,48 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
1533
1694
|
},
|
|
1534
1695
|
bindings: Object.fromEntries(Object.entries(controlProperties.bindings).filter(([name]) => invalidationBindings.includes(name)))
|
|
1535
1696
|
});
|
|
1697
|
+
if (this.heightFieldSlots.size && !this.ensembleBuffer) {
|
|
1698
|
+
this.terrainWake = createBoundKernel(graph.device, {
|
|
1699
|
+
id: `${this.id}-terrain-wake`,
|
|
1700
|
+
entryPoint: 'wakeTerrain',
|
|
1701
|
+
source: controlProperties.source +
|
|
1702
|
+
/* wgsl */ `
|
|
1703
|
+
@group(0) @binding(26) var<storage,read_write> terrainSleep:array<atomic<u32>>;
|
|
1704
|
+
@compute @workgroup_size(64) fn wakeTerrain(@builtin(global_invocation_id) invocation:vec3u) {
|
|
1705
|
+
let collider=invocation.x;if(collider>=COLLIDER_COUNT){return;}
|
|
1706
|
+
let body=colliderBody(collider);if(!dynamic(body)){return;}
|
|
1707
|
+
let tile=command.bodyIndex.x;if(bodies.colliders[tile].padding.w==0.0){return;}
|
|
1708
|
+
if(any(abs(colliderPosition(collider)-colliderPosition(tile))>shapeWorldExtent(collider)+shapeWorldExtent(tile)+vec3f(settings.solver.x))){return;}
|
|
1709
|
+
// Several colliders on one sleeping body may all overlap the tile.
|
|
1710
|
+
for(var axis=0u;axis<4u;axis++){atomicStore(&terrainSleep[body*4u+axis],0u);}
|
|
1711
|
+
}`,
|
|
1712
|
+
shaderLayout: {
|
|
1713
|
+
bindings: [
|
|
1714
|
+
...shaderLayout.bindings.filter(binding => ['settings', 'positions', 'orientations', 'bodies'].includes(binding.name)),
|
|
1715
|
+
{ name: 'command', group: 0, location: 8, type: 'uniform' },
|
|
1716
|
+
{ name: 'terrainSleep', group: 0, location: 26, type: 'storage' }
|
|
1717
|
+
]
|
|
1718
|
+
},
|
|
1719
|
+
bindings: {
|
|
1720
|
+
settings: buffers.settings,
|
|
1721
|
+
positions: buffers.positions,
|
|
1722
|
+
orientations: buffers.orientations,
|
|
1723
|
+
bodies: buffers.bodies,
|
|
1724
|
+
command: this.controlSettings,
|
|
1725
|
+
terrainSleep: this.sleepStates
|
|
1726
|
+
}
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
/** Wake sleeping bodies overlapping one published terrain footprint. */
|
|
1731
|
+
wakeTerrainFootprint(collider) {
|
|
1732
|
+
const { kernel, bindings } = this.terrainWake;
|
|
1733
|
+
this.controlSettings.write(new Uint32Array([collider]), 48);
|
|
1734
|
+
const encoder = this.device.createCommandEncoder();
|
|
1735
|
+
const pass = encoder.beginComputePass();
|
|
1736
|
+
kernel.dispatch(pass, { bindings, x: Math.ceil(this.colliderStorageCount / 64) });
|
|
1737
|
+
pass.end();
|
|
1738
|
+
this.device.submit(encoder.finish());
|
|
1536
1739
|
}
|
|
1537
1740
|
invalidateState(pass) {
|
|
1538
1741
|
// Controls may wake any island; reclassify enabled instances on the next GPU step.
|
|
@@ -1570,65 +1773,80 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
1570
1773
|
: undefined;
|
|
1571
1774
|
}
|
|
1572
1775
|
/** Set signed throttle, steering angle in radians and brake fraction for upcoming substeps. */
|
|
1573
|
-
setVehicleControls(throttle, steering, brake) {
|
|
1776
|
+
setVehicleControls(throttle, steering, brake, vehicleIndex = 0) {
|
|
1574
1777
|
if (!this.vehicleBuffer ||
|
|
1575
1778
|
this.destroyed ||
|
|
1576
|
-
![
|
|
1779
|
+
!this.vehicles[vehicleIndex] ||
|
|
1780
|
+
![throttle, steering, brake].every(value => Number.isFinite(Math.fround(value))))
|
|
1577
1781
|
throw new Error('Invalid vehicle controls');
|
|
1578
1782
|
this.vehicleBuffer.write(new Float32Array([
|
|
1579
1783
|
Math.max(-1, Math.min(1, throttle)),
|
|
1580
1784
|
steering,
|
|
1581
1785
|
Math.max(0, Math.min(1, brake)),
|
|
1582
1786
|
0
|
|
1583
|
-
]));
|
|
1787
|
+
]), vehicleIndex * VEHICLE_STRIDE);
|
|
1788
|
+
if (this.vehiclesPerInstance) {
|
|
1789
|
+
const instance = Math.floor(vehicleIndex / this.vehiclesPerInstance);
|
|
1790
|
+
this.ensembleBuffer.write(new Uint32Array([1]), (16 + instance * 8 + 6) * 4);
|
|
1791
|
+
}
|
|
1584
1792
|
}
|
|
1585
1793
|
/** Borrow four column-major wheel transforms relative to the chassis node, ordered by mount. */
|
|
1586
1794
|
get vehicleWheelPoses() {
|
|
1587
|
-
return this.
|
|
1588
|
-
|
|
1795
|
+
return this.getVehicleWheelPoses();
|
|
1796
|
+
}
|
|
1797
|
+
/** Borrow the indexed vehicle’s four chassis-local wheel poses, in mount order. */
|
|
1798
|
+
getVehicleWheelPoses(vehicleIndex = 0) {
|
|
1799
|
+
return this.vehicleBuffer && !this.destroyed && this.vehicles[vehicleIndex]
|
|
1800
|
+
? {
|
|
1801
|
+
buffer: this.vehicleBuffer,
|
|
1802
|
+
byteOffset: vehicleIndex * VEHICLE_STRIDE + 256,
|
|
1803
|
+
byteLength: 256
|
|
1804
|
+
}
|
|
1589
1805
|
: null;
|
|
1590
1806
|
}
|
|
1591
1807
|
/** Transfer wheel motion between rebuilt worlds for wheels with matching chassis-local mounts. */
|
|
1592
|
-
copyVehicleMotionFrom(previous) {
|
|
1808
|
+
copyVehicleMotionFrom(previous, vehicleIndex = 0, previousVehicleIndex = 0) {
|
|
1593
1809
|
const sourceBuffer = previous.vehicleBuffer;
|
|
1594
1810
|
const destinationBuffer = this.vehicleBuffer;
|
|
1595
|
-
const previousVehicle = previous.
|
|
1811
|
+
const previousVehicle = previous.vehicles[previousVehicleIndex];
|
|
1596
1812
|
if (!this.device || !sourceBuffer || !destinationBuffer || !previousVehicle)
|
|
1597
1813
|
return;
|
|
1598
1814
|
const encoder = this.device.createCommandEncoder();
|
|
1599
|
-
this.
|
|
1815
|
+
this.vehicles[vehicleIndex]?.wheels.forEach((wheel, index) => {
|
|
1600
1816
|
const sourceIndex = previousVehicle.wheels.findIndex(source => source.mount.every((coordinate, axis) => coordinate === wheel.mount[axis]));
|
|
1601
1817
|
if (sourceIndex < 0)
|
|
1602
1818
|
return;
|
|
1603
1819
|
encoder.copyBufferToBuffer({
|
|
1604
1820
|
sourceBuffer,
|
|
1605
1821
|
destinationBuffer,
|
|
1606
|
-
sourceOffset:
|
|
1607
|
-
destinationOffset:
|
|
1608
|
-
size:
|
|
1822
|
+
sourceOffset: previousVehicleIndex * VEHICLE_STRIDE + 92 + sourceIndex * 48,
|
|
1823
|
+
destinationOffset: vehicleIndex * VEHICLE_STRIDE + 92 + index * 48,
|
|
1824
|
+
size: 20
|
|
1609
1825
|
});
|
|
1610
1826
|
encoder.copyBufferToBuffer({
|
|
1611
1827
|
sourceBuffer,
|
|
1612
1828
|
destinationBuffer,
|
|
1613
|
-
sourceOffset: 256 + sourceIndex * 64,
|
|
1614
|
-
destinationOffset: 256 + index * 64,
|
|
1829
|
+
sourceOffset: previousVehicleIndex * VEHICLE_STRIDE + 256 + sourceIndex * 64,
|
|
1830
|
+
destinationOffset: vehicleIndex * VEHICLE_STRIDE + 256 + index * 64,
|
|
1615
1831
|
size: 64
|
|
1616
1832
|
});
|
|
1617
1833
|
});
|
|
1618
1834
|
this.device.submit(encoder.finish());
|
|
1619
1835
|
}
|
|
1620
1836
|
/** Read wheel spin, angle, suspension length and normal load after submitted steps. */
|
|
1621
|
-
async readVehicleWheels() {
|
|
1622
|
-
if (!this.vehicleBuffer || this.destroyed)
|
|
1837
|
+
async readVehicleWheels(vehicleIndex = 0) {
|
|
1838
|
+
if (!this.vehicleBuffer || this.destroyed || !this.vehicles[vehicleIndex])
|
|
1623
1839
|
throw new Error('Vehicle unavailable');
|
|
1624
|
-
const
|
|
1840
|
+
const bytes = await this.vehicleBuffer.readAsync(vehicleIndex * VEHICLE_STRIDE, 256);
|
|
1841
|
+
const values = new Float32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4);
|
|
1625
1842
|
return Array.from({ length: 4 }, (_, index) => {
|
|
1626
1843
|
const offset = 24 + index * 12;
|
|
1627
1844
|
return {
|
|
1628
1845
|
speed: values[offset],
|
|
1629
1846
|
angle: values[offset + 1],
|
|
1630
1847
|
length: values[offset + 2],
|
|
1631
|
-
load: values[offset + 3]
|
|
1848
|
+
load: values[offset + 3],
|
|
1849
|
+
steering: values[offset - 1]
|
|
1632
1850
|
};
|
|
1633
1851
|
});
|
|
1634
1852
|
}
|
|
@@ -1729,7 +1947,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
1729
1947
|
if (indices.has(edit.collider) ||
|
|
1730
1948
|
previous.type !== shape.type ||
|
|
1731
1949
|
shape.type === 'convex-hull' ||
|
|
1732
|
-
shape.type === 'triangle-mesh'
|
|
1950
|
+
shape.type === 'triangle-mesh' ||
|
|
1951
|
+
shape.type === 'height-field')
|
|
1733
1952
|
throw new Error('Shape edit requires a topology rebuild');
|
|
1734
1953
|
indices.add(edit.collider);
|
|
1735
1954
|
const properties = getRigidBodyShapeProperties(shape);
|
|
@@ -1763,6 +1982,103 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
1763
1982
|
this.setBodyParameters(body, {});
|
|
1764
1983
|
}
|
|
1765
1984
|
}
|
|
1985
|
+
/**
|
|
1986
|
+
* Replace or evict fixed-dimension height-field tiles between submissions.
|
|
1987
|
+
* Optional positions are in each collider's body-local frame. The caller owns
|
|
1988
|
+
* tile selection and must submit already encoded steps before editing residency.
|
|
1989
|
+
*/
|
|
1990
|
+
setHeightFieldTiles(edits) {
|
|
1991
|
+
if (!edits.length)
|
|
1992
|
+
return;
|
|
1993
|
+
const metadata = this.ownedBuffers.find(buffer => buffer.id === `${this.id}-bodies`);
|
|
1994
|
+
if (!metadata || this.destroyed || this.queryPending || this.eventRead || this.triggerRead)
|
|
1995
|
+
throw new Error('Terrain streaming requires an idle attached world');
|
|
1996
|
+
const seen = new Set();
|
|
1997
|
+
const packedFields = this.terrainAtlas
|
|
1998
|
+
? new Map()
|
|
1999
|
+
: undefined;
|
|
2000
|
+
const replacements = edits.map(({ collider: colliderIndex, field, position }) => {
|
|
2001
|
+
const collider = this.colliders[colliderIndex];
|
|
2002
|
+
const offset = this.heightFieldSlots.get(colliderIndex);
|
|
2003
|
+
if ((offset === undefined &&
|
|
2004
|
+
!(this.terrainAtlas && this.ensembleTerrainSlots.has(colliderIndex))) ||
|
|
2005
|
+
collider?.shape.type !== 'height-field' ||
|
|
2006
|
+
seen.has(colliderIndex))
|
|
2007
|
+
throw new Error('Invalid writable height-field slot');
|
|
2008
|
+
seen.add(colliderIndex);
|
|
2009
|
+
const previous = collider.shape.field;
|
|
2010
|
+
if (field && (field.width !== previous.width || field.height !== previous.height))
|
|
2011
|
+
throw new Error('Height-field slot dimensions are fixed');
|
|
2012
|
+
const center = this.props.bodies[collider.body].centerOfMass ?? [0, 0, 0];
|
|
2013
|
+
const localOffset = position?.map((value, axis) => value - center[axis]);
|
|
2014
|
+
if (position &&
|
|
2015
|
+
(position.length !== 3 || !localOffset?.every(value => Number.isFinite(Math.fround(value)))))
|
|
2016
|
+
throw new Error('Invalid height-field tile position');
|
|
2017
|
+
let payload = field ? packedFields?.get(field) : undefined;
|
|
2018
|
+
if (!payload) {
|
|
2019
|
+
const next = field
|
|
2020
|
+
? structuredClone(field)
|
|
2021
|
+
: { ...previous, heights: undefined, validity: undefined };
|
|
2022
|
+
const packed = packRigidBodyHeightField(next);
|
|
2023
|
+
const data = packedFields && packed.nodeCount ? new Float32Array(packed.data) : null;
|
|
2024
|
+
payload = { field: next, packed, data };
|
|
2025
|
+
if (field)
|
|
2026
|
+
packedFields?.set(field, payload);
|
|
2027
|
+
}
|
|
2028
|
+
return { collider, colliderIndex, offset, position, localOffset, ...payload };
|
|
2029
|
+
});
|
|
2030
|
+
const atlas = this.terrainAtlas?.bind(replacements.map(({ colliderIndex, data }) => ({ collider: colliderIndex, data })));
|
|
2031
|
+
// Stamp once per validated edit batch. On float32 counter wrap, clear old impulses
|
|
2032
|
+
// so a retained contact cannot confuse a new stamp with a very old revision.
|
|
2033
|
+
if (this.terrainRevision === 0xffffff) {
|
|
2034
|
+
this.wake();
|
|
2035
|
+
this.terrainRevision = 1;
|
|
2036
|
+
}
|
|
2037
|
+
const revision = ++this.terrainRevision;
|
|
2038
|
+
for (const { word, data } of atlas?.uploads ?? [])
|
|
2039
|
+
metadata.write(data, (this.terrainAtlasWord + word) * 4);
|
|
2040
|
+
const changedBodies = new Set();
|
|
2041
|
+
const affectedInstances = new Set();
|
|
2042
|
+
for (const replacement of replacements) {
|
|
2043
|
+
const { collider, colliderIndex, offset, field, position, localOffset, packed } = replacement;
|
|
2044
|
+
const base = this.count * 48 + colliderIndex * 96;
|
|
2045
|
+
if (this.terrainWake)
|
|
2046
|
+
this.wakeTerrainFootprint(colliderIndex);
|
|
2047
|
+
if (atlas) {
|
|
2048
|
+
const word = atlas.wordsByCollider.get(colliderIndex);
|
|
2049
|
+
const address = word === undefined ? 0 : (this.terrainAtlasWord - this.terrainGeometryWord + word) / 4;
|
|
2050
|
+
metadata.write(new Float32Array([
|
|
2051
|
+
word === undefined ? 0 : address + packed.nodeOffset,
|
|
2052
|
+
packed.nodeCount,
|
|
2053
|
+
address
|
|
2054
|
+
]), base + 72);
|
|
2055
|
+
}
|
|
2056
|
+
else {
|
|
2057
|
+
metadata.write(new Float32Array(packed.data), offset);
|
|
2058
|
+
metadata.write(new Float32Array([packed.nodeCount]), base + 76);
|
|
2059
|
+
}
|
|
2060
|
+
metadata.write(new Float32Array(packed.extent), base);
|
|
2061
|
+
metadata.write(new Float32Array([revision, packed.triangleCount]), base + 88);
|
|
2062
|
+
if (position && localOffset) {
|
|
2063
|
+
metadata.write(new Float32Array(localOffset), base + 16);
|
|
2064
|
+
collider.position = [...position];
|
|
2065
|
+
}
|
|
2066
|
+
collider.shape = { type: 'height-field', field };
|
|
2067
|
+
changedBodies.add(collider.body);
|
|
2068
|
+
if (this.terrainWake)
|
|
2069
|
+
this.wakeTerrainFootprint(colliderIndex);
|
|
2070
|
+
if (this.props.ensembleBodiesPerInstance)
|
|
2071
|
+
affectedInstances.add(Math.floor(collider.body / this.props.ensembleBodiesPerInstance));
|
|
2072
|
+
}
|
|
2073
|
+
for (const body of changedBodies)
|
|
2074
|
+
this.updateColliderDefinitions(body);
|
|
2075
|
+
for (const instance of affectedInstances)
|
|
2076
|
+
this.wakeEnsembleInstance(instance);
|
|
2077
|
+
}
|
|
2078
|
+
/** Shared atlas utilization, when the fused layout enabled page sharing. */
|
|
2079
|
+
getTerrainAtlasStats() {
|
|
2080
|
+
return this.terrainAtlas?.getStats();
|
|
2081
|
+
}
|
|
1766
2082
|
/** Change an existing collider material between submissions, invalidating cached friction. */
|
|
1767
2083
|
setColliderMaterial(colliderIndex, material) {
|
|
1768
2084
|
const collider = this.colliders[colliderIndex];
|
|
@@ -1829,11 +2145,9 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
1829
2145
|
updateColliderDefinitions(bodyIndex) {
|
|
1830
2146
|
const { shape, colliders, ...properties } = this.props.bodies[bodyIndex];
|
|
1831
2147
|
const updated = this.colliders
|
|
1832
|
-
.
|
|
2148
|
+
.slice(this.bodyColliderStarts[bodyIndex], this.bodyColliderStarts[bodyIndex + 1])
|
|
1833
2149
|
.map(({ body, ...candidate }) => candidate);
|
|
1834
|
-
|
|
1835
|
-
bodies[bodyIndex] = { ...properties, colliders: updated };
|
|
1836
|
-
this.props.bodies = bodies;
|
|
2150
|
+
this.props.bodies[bodyIndex] = { ...properties, colliders: updated };
|
|
1837
2151
|
}
|
|
1838
2152
|
getColliderMaterial(collider) {
|
|
1839
2153
|
const definition = this.colliders[collider];
|
|
@@ -1841,15 +2155,18 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
1841
2155
|
throw new Error('Invalid collider');
|
|
1842
2156
|
return structuredClone(definition.material ?? {});
|
|
1843
2157
|
}
|
|
1844
|
-
restoreColliderDefinitions() {
|
|
1845
|
-
// Body definitions are
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
const
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
2158
|
+
restoreColliderDefinitions(first = 0, end = this.count) {
|
|
2159
|
+
// Body definitions are world-owned. Keep shared geometry identities.
|
|
2160
|
+
for (let body = first; body < end; body++) {
|
|
2161
|
+
const definition = this.props.bodies[body];
|
|
2162
|
+
const colliders = definition.colliders ?? (definition.shape ? [{ shape: definition.shape }] : []);
|
|
2163
|
+
for (const [index, source] of colliders.entries()) {
|
|
2164
|
+
const collider = this.colliders[this.bodyColliderStarts[body] + index];
|
|
2165
|
+
collider.shape = source.shape;
|
|
2166
|
+
collider.material = source.material;
|
|
2167
|
+
collider.position = source.position;
|
|
2168
|
+
collider.orientation = source.orientation;
|
|
2169
|
+
}
|
|
1853
2170
|
}
|
|
1854
2171
|
}
|
|
1855
2172
|
/** Update motion properties between submissions; preserve the node pose when its COM changes. */
|
|
@@ -1885,13 +2202,16 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
1885
2202
|
validateRigidBodyJoints(this.props.joints, proposedBodies, this.solver);
|
|
1886
2203
|
}
|
|
1887
2204
|
const colliders = this.colliders.filter(collider => collider.body === bodyIndex);
|
|
1888
|
-
for (const collider of colliders)
|
|
2205
|
+
for (const collider of colliders) {
|
|
2206
|
+
if (collider.shape.type === 'height-field' && mode !== 'static')
|
|
2207
|
+
throw new Error('Height fields require static bodies');
|
|
1889
2208
|
if ((collider.shape.type === 'convex-hull' || collider.shape.type === 'triangle-mesh') &&
|
|
1890
2209
|
mode !== 'static' &&
|
|
1891
2210
|
mass > 0 &&
|
|
1892
2211
|
(!collider.shape.geometry.closed ||
|
|
1893
2212
|
!(getRigidBodyShapeProperties(collider.shape).volume > 0)))
|
|
1894
2213
|
throw new Error('Dynamic meshes require closed positive-volume geometry');
|
|
2214
|
+
}
|
|
1895
2215
|
if (this.props.continuous?.bodies.includes(bodyIndex) &&
|
|
1896
2216
|
(mode !== 'dynamic' ||
|
|
1897
2217
|
mass === 0 ||
|
|
@@ -2248,6 +2568,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
2248
2568
|
let bodyDefinitions = structuredClone(this.props.bodies);
|
|
2249
2569
|
let contactCursor = 0;
|
|
2250
2570
|
let triggerCursor = 0;
|
|
2571
|
+
let terrainRevision = this.terrainRevision;
|
|
2572
|
+
let terrainAtlas = this.terrainAtlas?.snapshot();
|
|
2251
2573
|
try {
|
|
2252
2574
|
for (const buffer of checkpointBuffers)
|
|
2253
2575
|
snapshots.push(device.createBuffer({
|
|
@@ -2286,6 +2608,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
2286
2608
|
publicationBounds = structuredClone(this.props.publicationBounds);
|
|
2287
2609
|
contactCursor = this.eventCursor;
|
|
2288
2610
|
triggerCursor = this.triggerCursor;
|
|
2611
|
+
terrainRevision = this.terrainRevision;
|
|
2612
|
+
terrainAtlas = this.terrainAtlas?.snapshot();
|
|
2289
2613
|
saved = true;
|
|
2290
2614
|
},
|
|
2291
2615
|
restore: () => {
|
|
@@ -2300,6 +2624,9 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
2300
2624
|
this.props.publicationBounds = structuredClone(publicationBounds);
|
|
2301
2625
|
this.eventCursor = contactCursor;
|
|
2302
2626
|
this.triggerCursor = triggerCursor;
|
|
2627
|
+
this.terrainRevision = terrainRevision;
|
|
2628
|
+
if (terrainAtlas)
|
|
2629
|
+
this.terrainAtlas.restore(terrainAtlas.leases, (_word, _words, page) => terrainAtlas.payloads.get(page));
|
|
2303
2630
|
},
|
|
2304
2631
|
destroy: () => {
|
|
2305
2632
|
if (released)
|
|
@@ -2325,6 +2652,8 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
2325
2652
|
colliderShapeScales: structuredClone([...this.colliderShapeScales]),
|
|
2326
2653
|
contactCursor: this.eventCursor,
|
|
2327
2654
|
triggerCursor: this.triggerCursor,
|
|
2655
|
+
terrainRevision: this.terrainRevision,
|
|
2656
|
+
terrainAtlasLeases: this.terrainAtlas?.getLeases(),
|
|
2328
2657
|
buffers: await Promise.all(this.getSnapshotBuffers(options.includeRollbackScratch).map(async (buffer) => ({
|
|
2329
2658
|
name: buffer.id.slice(this.id.length + 1),
|
|
2330
2659
|
data: new Uint8Array(await buffer.readAsync())
|
|
@@ -2334,12 +2663,17 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
2334
2663
|
/** Restore between submissions on the same configuration and implementation; no implicit wake. */
|
|
2335
2664
|
restoreState(capture) {
|
|
2336
2665
|
const checkpointBuffers = this.getSnapshotBuffers(capture.includeRollbackScratch);
|
|
2666
|
+
const terrainRevision = capture.terrainRevision ?? 1;
|
|
2337
2667
|
if (!this.device ||
|
|
2338
2668
|
this.destroyed ||
|
|
2339
2669
|
this.queryPending ||
|
|
2340
2670
|
this.eventRead ||
|
|
2341
2671
|
this.triggerRead ||
|
|
2342
2672
|
capture.version !== 1 ||
|
|
2673
|
+
Boolean(capture.terrainAtlasLeases) !== Boolean(this.terrainAtlas) ||
|
|
2674
|
+
!Number.isInteger(terrainRevision) ||
|
|
2675
|
+
terrainRevision < 1 ||
|
|
2676
|
+
terrainRevision > 0xffffff ||
|
|
2343
2677
|
(capture.origin !== undefined &&
|
|
2344
2678
|
(capture.origin.length !== 3 || !capture.origin.every(Number.isFinite))) ||
|
|
2345
2679
|
capture.buffers.length !== checkpointBuffers.length ||
|
|
@@ -2360,6 +2694,26 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
2360
2694
|
saved.data.byteLength !== buffer.byteLength)
|
|
2361
2695
|
throw new Error('Incompatible rigid-body capture storage');
|
|
2362
2696
|
}
|
|
2697
|
+
if (this.terrainAtlas && capture.terrainAtlasLeases) {
|
|
2698
|
+
const metadata = capture.buffers.find(buffer => buffer.name === 'bodies').data;
|
|
2699
|
+
const view = new DataView(metadata.buffer, metadata.byteOffset, metadata.byteLength);
|
|
2700
|
+
const colliderBase = this.count * 48;
|
|
2701
|
+
let active = 0;
|
|
2702
|
+
for (const collider of this.ensembleTerrainSlots)
|
|
2703
|
+
if (view.getFloat32(colliderBase + collider * 96 + 76, true) > 0)
|
|
2704
|
+
active++;
|
|
2705
|
+
if (active !== capture.terrainAtlasLeases.length)
|
|
2706
|
+
throw new Error('Incomplete captured terrain atlas leases');
|
|
2707
|
+
this.terrainAtlas.restore(capture.terrainAtlasLeases, (word, words) => {
|
|
2708
|
+
const first = (this.terrainAtlasWord + word) * 4;
|
|
2709
|
+
return new Float32Array(metadata.slice(first, first + words * 4).buffer);
|
|
2710
|
+
}, (collider, word) => {
|
|
2711
|
+
const base = colliderBase + collider * 96;
|
|
2712
|
+
const address = (this.terrainAtlasWord - this.terrainGeometryWord + word) / 4;
|
|
2713
|
+
if (view.getFloat32(base + 76, true) <= 0 || view.getFloat32(base + 80, true) !== address)
|
|
2714
|
+
throw new Error('Captured terrain collider has an invalid page address');
|
|
2715
|
+
});
|
|
2716
|
+
}
|
|
2363
2717
|
for (const [index, buffer] of checkpointBuffers.entries())
|
|
2364
2718
|
buffer.write(capture.buffers[index].data);
|
|
2365
2719
|
this.props.joints = structuredClone(capture.props.joints);
|
|
@@ -2370,6 +2724,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
2370
2724
|
this.worldOrigin = [...(capture.origin ?? [0, 0, 0])];
|
|
2371
2725
|
this.eventCursor = capture.contactCursor;
|
|
2372
2726
|
this.triggerCursor = capture.triggerCursor;
|
|
2727
|
+
this.terrainRevision = terrainRevision;
|
|
2373
2728
|
}
|
|
2374
2729
|
/** Stop submissions first. Reconstruct with these accepted poses and larger budgets after rollback. */
|
|
2375
2730
|
async getRecoveryProps(overrides = {}) {
|
|
@@ -2475,6 +2830,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
2475
2830
|
this.destroyed = true;
|
|
2476
2831
|
this.control?.kernel.destroy();
|
|
2477
2832
|
this.invalidation?.kernel.destroy();
|
|
2833
|
+
this.terrainWake?.kernel.destroy();
|
|
2478
2834
|
this.queryComputation?.kernel.destroy();
|
|
2479
2835
|
this.queryReduction?.kernel.destroy();
|
|
2480
2836
|
for (const buffer of this.ownedBuffers)
|
|
@@ -2497,7 +2853,13 @@ function serializeCaptureProps(props) {
|
|
|
2497
2853
|
...collider,
|
|
2498
2854
|
shape: collider.shape?.type === 'convex-hull' || collider.shape?.type === 'triangle-mesh'
|
|
2499
2855
|
? collider.shape
|
|
2500
|
-
:
|
|
2856
|
+
: collider.shape?.type === 'height-field'
|
|
2857
|
+
? {
|
|
2858
|
+
type: collider.shape.type,
|
|
2859
|
+
width: collider.shape.field.width,
|
|
2860
|
+
height: collider.shape.field.height
|
|
2861
|
+
}
|
|
2862
|
+
: { type: collider.shape?.type },
|
|
2501
2863
|
material: undefined,
|
|
2502
2864
|
position: undefined,
|
|
2503
2865
|
orientation: undefined
|