@luma.gl/graph 10.0.0-beta.1 → 10.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arrow/gpu/arrow-gpu-analytics-adapters.cjs +22 -9
- package/dist/arrow/gpu/arrow-gpu-analytics-adapters.d.ts +11 -2
- package/dist/arrow/gpu/arrow-gpu-analytics-adapters.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-analytics-adapters.js +27 -10
- package/dist/arrow/gpu/arrow-gpu-analytics-adapters.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-analytics-readback.cjs +24 -13
- package/dist/arrow/gpu/arrow-gpu-analytics-readback.d.ts +9 -1
- package/dist/arrow/gpu/arrow-gpu-analytics-readback.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-analytics-readback.js +41 -14
- package/dist/arrow/gpu/arrow-gpu-analytics-readback.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.cjs +24 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts +10 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.js +29 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.js.map +1 -1
- package/dist/arrow/index.cjs +2 -0
- package/dist/arrow/index.cjs.map +3 -3
- package/dist/arrow/index.d.ts +1 -1
- package/dist/arrow/index.d.ts.map +1 -1
- package/dist/arrow/index.js +1 -1
- package/dist/arrow/index.js.map +1 -1
- package/dist/experimental-models.cjs +21 -0
- package/dist/experimental-models.d.ts +2 -0
- package/dist/experimental-models.d.ts.map +1 -0
- package/dist/experimental-models.js +5 -0
- package/dist/experimental-models.js.map +1 -0
- package/dist/experimental-simulation.cjs +21 -0
- package/dist/experimental-simulation.d.ts +2 -0
- package/dist/experimental-simulation.d.ts.map +1 -0
- package/dist/experimental-simulation.js +5 -0
- package/dist/experimental-simulation.js.map +1 -0
- package/dist/gpu-core/gpu-bvh-bounds.cjs +63 -0
- package/dist/gpu-core/gpu-bvh-bounds.d.ts +32 -0
- package/dist/gpu-core/gpu-bvh-bounds.d.ts.map +1 -0
- package/dist/gpu-core/gpu-bvh-bounds.js +56 -0
- package/dist/gpu-core/gpu-bvh-bounds.js.map +1 -0
- package/dist/gpu-core/gpu-command-graph-submission-pacer.cjs +92 -0
- package/dist/gpu-core/gpu-command-graph-submission-pacer.d.ts +41 -0
- package/dist/gpu-core/gpu-command-graph-submission-pacer.d.ts.map +1 -0
- package/dist/gpu-core/gpu-command-graph-submission-pacer.js +85 -0
- package/dist/gpu-core/gpu-command-graph-submission-pacer.js.map +1 -0
- package/dist/gpu-core/index.cjs +6 -0
- package/dist/gpu-core/index.cjs.map +3 -3
- package/dist/gpu-core/index.d.ts +4 -0
- package/dist/gpu-core/index.d.ts.map +1 -1
- package/dist/gpu-core/index.js +2 -0
- package/dist/gpu-core/index.js.map +1 -1
- package/dist/gpu-dataframe/gpu-analytics-compiler-utils.cjs +6 -6
- package/dist/gpu-dataframe/gpu-analytics-compiler-utils.d.ts +1 -1
- package/dist/gpu-dataframe/gpu-analytics-compiler-utils.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-analytics-compiler-utils.js +6 -6
- package/dist/gpu-dataframe/gpu-analytics-compiler-utils.js.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame-query.cjs +60 -15
- package/dist/gpu-dataframe/gpu-data-frame-query.d.ts +13 -2
- package/dist/gpu-dataframe/gpu-data-frame-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame-query.js +69 -18
- package/dist/gpu-dataframe/gpu-data-frame-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame.cjs +1 -3
- package/dist/gpu-dataframe/gpu-data-frame.d.ts +10 -0
- package/dist/gpu-dataframe/gpu-data-frame.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame.js +1 -3
- package/dist/gpu-dataframe/gpu-data-frame.js.map +1 -1
- package/dist/gpu-dataframe/gpu-expression-shader.cjs +157 -25
- package/dist/gpu-dataframe/gpu-expression-shader.d.ts +9 -5
- package/dist/gpu-dataframe/gpu-expression-shader.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-expression-shader.js +184 -25
- package/dist/gpu-dataframe/gpu-expression-shader.js.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.cjs +100 -8
- package/dist/gpu-dataframe/gpu-expression.d.ts +35 -3
- package/dist/gpu-dataframe/gpu-expression.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.js +92 -6
- package/dist/gpu-dataframe/gpu-expression.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.cjs +2 -3
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js +4 -3
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-query.cjs +4 -4
- package/dist/gpu-dataframe/gpu-global-aggregation-query.d.ts +5 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-query.js +11 -5
- package/dist/gpu-dataframe/gpu-global-aggregation-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-sort-compiler.cjs +136 -99
- package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts +7 -2
- package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-sort-compiler.js +135 -97
- package/dist/gpu-dataframe/gpu-global-sort-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.cjs +286 -49
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts +17 -2
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js +290 -40
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-group-by-query.cjs +10 -8
- package/dist/gpu-dataframe/gpu-group-by-query.d.ts +7 -1
- package/dist/gpu-dataframe/gpu-group-by-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-group-by-query.js +14 -8
- 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 +8 -8
- package/dist/gpu-dataframe/gpu-join-compiler.d.ts +1 -1
- package/dist/gpu-dataframe/gpu-join-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-join-compiler.js +9 -9
- package/dist/gpu-dataframe/gpu-join-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-query-compiler.cjs +38 -10
- package/dist/gpu-dataframe/gpu-query-compiler.d.ts +3 -2
- package/dist/gpu-dataframe/gpu-query-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-query-compiler.js +37 -9
- 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 +12 -2
- package/dist/gpu-dataframe/index.cjs.map +3 -3
- package/dist/gpu-dataframe/index.d.ts +3 -3
- package/dist/gpu-dataframe/index.d.ts.map +1 -1
- package/dist/gpu-dataframe/index.js +2 -2
- 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-batch.cjs +11 -10
- package/dist/gpu-physics/gpu-physics-batch.d.ts +1 -0
- package/dist/gpu-physics/gpu-physics-batch.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-physics-batch.js +14 -10
- package/dist/gpu-physics/gpu-physics-batch.js.map +1 -1
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.cjs +116 -0
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.d.ts +42 -0
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.d.ts.map +1 -0
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.js +90 -0
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.js.map +1 -0
- package/dist/gpu-physics/gpu-physics-ensemble.cjs +105 -8
- package/dist/gpu-physics/gpu-physics-ensemble.d.ts +40 -2
- package/dist/gpu-physics/gpu-physics-ensemble.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-physics-ensemble.js +109 -6
- package/dist/gpu-physics/gpu-physics-ensemble.js.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.cjs +737 -213
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts +111 -5
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.js +842 -231
- 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 +10 -3
- 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-cache-shaders.cjs +10 -6
- package/dist/gpu-physics/rigid-body-cache-shaders.d.ts +2 -1
- package/dist/gpu-physics/rigid-body-cache-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-cache-shaders.js +15 -6
- package/dist/gpu-physics/rigid-body-cache-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-capacity.cjs +15 -2
- package/dist/gpu-physics/rigid-body-capacity.d.ts +3 -1
- package/dist/gpu-physics/rigid-body-capacity.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-capacity.js +21 -2
- package/dist/gpu-physics/rigid-body-capacity.js.map +1 -1
- package/dist/gpu-physics/rigid-body-cast-index.cjs +192 -0
- package/dist/gpu-physics/rigid-body-cast-index.d.ts +44 -0
- package/dist/gpu-physics/rigid-body-cast-index.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-cast-index.js +194 -0
- package/dist/gpu-physics/rigid-body-cast-index.js.map +1 -0
- 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-layout.cjs +4 -2
- package/dist/gpu-physics/rigid-body-ensemble-layout.d.ts +2 -1
- package/dist/gpu-physics/rigid-body-ensemble-layout.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-layout.js +5 -2
- package/dist/gpu-physics/rigid-body-ensemble-layout.js.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-reset.cjs +45 -14
- 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 +53 -14
- package/dist/gpu-physics/rigid-body-ensemble-reset.js.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-shaders.cjs +14 -7
- package/dist/gpu-physics/rigid-body-ensemble-shaders.d.ts +5 -0
- package/dist/gpu-physics/rigid-body-ensemble-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-shaders.js +17 -7
- package/dist/gpu-physics/rigid-body-ensemble-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-transaction.cjs +40 -8
- package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts +5 -2
- package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-transaction.js +49 -9
- package/dist/gpu-physics/rigid-body-ensemble-transaction.js.map +1 -1
- package/dist/gpu-physics/rigid-body-event-compaction.cjs +184 -0
- package/dist/gpu-physics/rigid-body-event-compaction.d.ts +35 -0
- package/dist/gpu-physics/rigid-body-event-compaction.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-event-compaction.js +168 -0
- package/dist/gpu-physics/rigid-body-event-compaction.js.map +1 -0
- package/dist/gpu-physics/rigid-body-event-snapshot.cjs +51 -0
- package/dist/gpu-physics/rigid-body-event-snapshot.d.ts +33 -0
- package/dist/gpu-physics/rigid-body-event-snapshot.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-event-snapshot.js +34 -0
- package/dist/gpu-physics/rigid-body-event-snapshot.js.map +1 -0
- package/dist/gpu-physics/rigid-body-events.cjs +57 -25
- package/dist/gpu-physics/rigid-body-events.d.ts +2 -1
- package/dist/gpu-physics/rigid-body-events.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-events.js +60 -25
- package/dist/gpu-physics/rigid-body-events.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-joints.cjs +8 -3
- package/dist/gpu-physics/rigid-body-joints.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-joints.js +10 -6
- package/dist/gpu-physics/rigid-body-joints.js.map +1 -1
- 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-queries.cjs +159 -16
- package/dist/gpu-physics/rigid-body-queries.d.ts +24 -1
- package/dist/gpu-physics/rigid-body-queries.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-queries.js +166 -14
- package/dist/gpu-physics/rigid-body-queries.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 +13 -7
- 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 +16 -8
- 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 +54 -15
- package/dist/gpu-physics/rigid-body-triggers.d.ts +1 -0
- package/dist/gpu-physics/rigid-body-triggers.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-triggers.js +56 -15
- 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-physics/sphere-world-shaders.cjs +48 -20
- package/dist/gpu-physics/sphere-world-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/sphere-world-shaders.js +51 -21
- package/dist/gpu-physics/sphere-world-shaders.js.map +1 -1
- package/dist/gpu-project/benchmarks.cjs.map +2 -2
- 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 +3 -3
- package/dist/gpu-project/crs.d.ts +1 -1
- package/dist/gpu-project/index.cjs.map +2 -2
- 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/projection-program.cjs +2 -9
- package/dist/gpu-project/projection-program.d.ts.map +1 -1
- package/dist/gpu-project/projection-program.js +1 -8
- package/dist/gpu-project/projection-program.js.map +1 -1
- 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 +269 -171
- package/dist/gpu-sql/gpu-sql.d.ts +36 -1
- package/dist/gpu-sql/gpu-sql.d.ts.map +1 -1
- package/dist/gpu-sql/gpu-sql.js +313 -181
- package/dist/gpu-sql/gpu-sql.js.map +1 -1
- package/dist/gpu-sql/index.cjs.map +3 -3
- package/dist/gpu-sql/index.d.ts +1 -1
- package/dist/gpu-sql/index.d.ts.map +1 -1
- package/dist/utils/float32.cjs +35 -0
- package/dist/utils/float32.d.ts +3 -0
- package/dist/utils/float32.d.ts.map +1 -0
- package/dist/utils/float32.js +16 -0
- package/dist/utils/float32.js.map +1 -0
- package/package.json +19 -19
- package/src/arrow/gpu/arrow-gpu-analytics-adapters.ts +77 -25
- package/src/arrow/gpu/arrow-gpu-analytics-readback.ts +52 -16
- package/src/arrow/gpu/arrow-gpu-table-conversion.ts +46 -1
- package/src/arrow/index.ts +1 -0
- package/src/experimental-models.ts +5 -0
- package/src/experimental-simulation.ts +5 -0
- package/src/gpu-core/gpu-bvh-bounds.ts +84 -0
- package/src/gpu-core/gpu-command-graph-submission-pacer.ts +102 -0
- package/src/gpu-core/index.ts +5 -0
- package/src/gpu-dataframe/gpu-analytics-compiler-utils.ts +7 -10
- package/src/gpu-dataframe/gpu-data-frame-query.ts +119 -25
- package/src/gpu-dataframe/gpu-data-frame.ts +35 -2
- package/src/gpu-dataframe/gpu-expression-shader.ts +267 -32
- package/src/gpu-dataframe/gpu-expression.ts +186 -10
- package/src/gpu-dataframe/gpu-global-aggregation-compiler.ts +6 -3
- package/src/gpu-dataframe/gpu-global-aggregation-query.ts +17 -6
- package/src/gpu-dataframe/gpu-global-sort-compiler.ts +177 -105
- package/src/gpu-dataframe/gpu-group-aggregation-compiler.ts +469 -53
- package/src/gpu-dataframe/gpu-group-by-query.ts +29 -13
- package/src/gpu-dataframe/gpu-histogram-compiler.ts +0 -1
- package/src/gpu-dataframe/gpu-join-compiler.ts +12 -8
- package/src/gpu-dataframe/gpu-query-compiler.ts +61 -19
- 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 +16 -3
- 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-batch.ts +19 -13
- package/src/gpu-physics/gpu-physics-ensemble-terrain.ts +114 -0
- package/src/gpu-physics/gpu-physics-ensemble.ts +166 -7
- package/src/gpu-physics/gpu-rigid-body-world.ts +1085 -287
- package/src/gpu-physics/index.ts +46 -0
- package/src/gpu-physics/rigid-body-bounds-shaders.ts +16 -1
- package/src/gpu-physics/rigid-body-cache-shaders.ts +18 -6
- package/src/gpu-physics/rigid-body-capacity.ts +25 -4
- package/src/gpu-physics/rigid-body-cast-index.ts +277 -0
- package/src/gpu-physics/rigid-body-convex-shaders.ts +3 -2
- package/src/gpu-physics/rigid-body-ensemble-layout.ts +6 -2
- package/src/gpu-physics/rigid-body-ensemble-reset.ts +67 -15
- package/src/gpu-physics/rigid-body-ensemble-shaders.ts +18 -7
- package/src/gpu-physics/rigid-body-ensemble-transaction.ts +61 -10
- package/src/gpu-physics/rigid-body-event-compaction.ts +252 -0
- package/src/gpu-physics/rigid-body-event-snapshot.ts +76 -0
- package/src/gpu-physics/rigid-body-events.ts +63 -25
- 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-joints.ts +9 -11
- 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-queries.ts +202 -14
- package/src/gpu-physics/rigid-body-query-geometry.ts +22 -4
- package/src/gpu-physics/rigid-body-shaders.ts +20 -8
- 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 +65 -20
- package/src/gpu-physics/rigid-body-vehicle.ts +108 -41
- package/src/gpu-physics/sphere-world-shaders.ts +53 -21
- 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/projection-program.ts +1 -9
- 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 +535 -223
- package/src/gpu-sql/index.ts +1 -1
- package/src/utils/float32.ts +16 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {Buffer, type Device} from '@luma.gl/core';
|
|
6
|
+
|
|
7
|
+
/** The event stream position and step represented by a recovered overlap snapshot. */
|
|
8
|
+
export type GPURigidBodyEventSnapshot = {
|
|
9
|
+
/** Resume delta reads after this sequence. */
|
|
10
|
+
sequence: number;
|
|
11
|
+
/** Most recent step published by this ring. */
|
|
12
|
+
step: number;
|
|
13
|
+
/** Saturated counters require reconstructing the world to resume the stream. */
|
|
14
|
+
saturated: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** A pair present in the contact publisher's current history. */
|
|
18
|
+
export type GPURigidBodyActiveContact = {
|
|
19
|
+
bodies: [number, number];
|
|
20
|
+
colliders: [number, number];
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** Contact stream recovery point and its complete active pair set. */
|
|
24
|
+
export type GPURigidBodyContactSnapshot = GPURigidBodyEventSnapshot & {
|
|
25
|
+
contacts: GPURigidBodyActiveContact[];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** An active target with its current representative sensor/target collider pair. */
|
|
29
|
+
export type GPURigidBodyActiveTrigger = {
|
|
30
|
+
trigger: number;
|
|
31
|
+
body: number;
|
|
32
|
+
collider: number;
|
|
33
|
+
triggerCollider: number;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** Trigger stream recovery point and its complete active overlap set. */
|
|
37
|
+
export type GPURigidBodyTriggerSnapshot = GPURigidBodyEventSnapshot & {
|
|
38
|
+
overlaps: GPURigidBodyActiveTrigger[];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/** Copy the ring header and published history in queue order as one coherent readback. */
|
|
42
|
+
export async function readRigidBodyEventSnapshot<Result extends GPURigidBodyEventSnapshot>(
|
|
43
|
+
device: Device,
|
|
44
|
+
ring: Buffer,
|
|
45
|
+
history: Buffer,
|
|
46
|
+
decode: (snapshot: GPURigidBodyEventSnapshot, rows: Uint32Array) => Result
|
|
47
|
+
): Promise<Result> {
|
|
48
|
+
/** The snapshot omits retained event payloads and never reads poses or manifolds. */
|
|
49
|
+
const staging = device.createBuffer({
|
|
50
|
+
id: `${ring.id}-snapshot`,
|
|
51
|
+
byteLength: 16 + history.byteLength,
|
|
52
|
+
usage: Buffer.MAP_READ | Buffer.COPY_DST
|
|
53
|
+
});
|
|
54
|
+
try {
|
|
55
|
+
/** All prior submissions complete before both copies; later submissions cannot interleave. */
|
|
56
|
+
const encoder = device.createCommandEncoder();
|
|
57
|
+
encoder.copyBufferToBuffer({sourceBuffer: ring, destinationBuffer: staging, size: 16});
|
|
58
|
+
encoder.copyBufferToBuffer({
|
|
59
|
+
sourceBuffer: history,
|
|
60
|
+
destinationBuffer: staging,
|
|
61
|
+
destinationOffset: 16,
|
|
62
|
+
size: history.byteLength
|
|
63
|
+
});
|
|
64
|
+
device.submit(encoder.finish());
|
|
65
|
+
return await staging.mapAndReadAsync(buffer => {
|
|
66
|
+
/** The mapped bytes are consumed synchronously before the staging buffer is unmapped. */
|
|
67
|
+
const words = new Uint32Array(buffer);
|
|
68
|
+
return decode(
|
|
69
|
+
{sequence: words[0], step: words[1], saturated: words[2] !== 0},
|
|
70
|
+
words.subarray(4)
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
} finally {
|
|
74
|
+
staging.destroy();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -53,10 +53,12 @@ export function decodeRigidBodyContactEvents(
|
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/** Publish contact transitions from committed instances in the current step. */
|
|
56
57
|
export function getRigidBodyEventShader(
|
|
57
58
|
capacity: number,
|
|
58
59
|
impulseThreshold: number,
|
|
59
|
-
rollback = false
|
|
60
|
+
rollback = false,
|
|
61
|
+
pairsPerInstance?: number
|
|
60
62
|
): string {
|
|
61
63
|
return /* wgsl */ `
|
|
62
64
|
${rollback ? '@group(0) @binding(14) var<storage,read> eventStatistics:array<u32>;' : ''}
|
|
@@ -64,31 +66,67 @@ struct ContactEvent { stamp:vec4u, identifiers:vec4u, point:vec4f, normal:vec4f
|
|
|
64
66
|
struct EventRing { sequence:u32, step:u32, saturated:u32, reserved:u32, entries:array<ContactEvent,${capacity}> }
|
|
65
67
|
@group(0) @binding(12) var<storage,read_write> contactHistory:array<vec4u>;
|
|
66
68
|
@group(0) @binding(13) var<storage,read_write> contactEvents:EventRing;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
const CONTACT_END:u32=1u;
|
|
70
|
+
const CONTACT_BEGIN:u32=2u;
|
|
71
|
+
const CONTACT_IMPACT:u32=4u;
|
|
72
|
+
const CONTACT_PROCESS:u32=8u;
|
|
73
|
+
|
|
74
|
+
fn eventCommit()->bool{
|
|
75
|
+
return ${rollback ? 'eventStatistics[1]==0u&&eventStatistics[15]==0u' : 'true'};
|
|
76
|
+
}
|
|
77
|
+
fn contactImpulse(pair:u32)->vec2f{
|
|
78
|
+
var impulse=0.0;var strongest=0u;
|
|
79
|
+
for(var contact=0u;contact<manifolds[pair].count;contact++){
|
|
80
|
+
impulse+=max(0.0,manifolds[pair].contacts[contact].impulse.x);
|
|
81
|
+
if(manifolds[pair].contacts[contact].impulse.x>manifolds[pair].contacts[strongest].impulse.x){strongest=contact;}
|
|
82
|
+
}
|
|
83
|
+
return vec2f(impulse,f32(strongest));
|
|
84
|
+
}
|
|
85
|
+
fn eventClassify(pair:u32)->u32{
|
|
86
|
+
if(!eventCommit()){return 0u;}
|
|
87
|
+
${
|
|
88
|
+
pairsPerInstance
|
|
89
|
+
? `let instance=pair/${pairsPerInstance}u;
|
|
90
|
+
if(instance>=INSTANCE_COUNT||atomicLoad(&ensemble[16u+instance*8u+7u])!=0u){return 0u;}`
|
|
91
|
+
: ''
|
|
92
|
+
}
|
|
93
|
+
let first=getFirstCollider(pair);let second=getSecondCollider(pair);
|
|
94
|
+
if(!colliderScheduled(first)){return 0u;}
|
|
95
|
+
let previous=contactHistory[pair];let hasContact=manifolds[pair].count>0u;
|
|
96
|
+
let same=previous.x==first&&previous.y==second;
|
|
97
|
+
var flags=CONTACT_PROCESS;
|
|
98
|
+
if(previous.z!=0u&&(!hasContact||!same)){flags|=CONTACT_END;}
|
|
99
|
+
if(hasContact){
|
|
100
|
+
if(previous.z==0u||!same){flags|=CONTACT_BEGIN;}
|
|
101
|
+
else if(contactImpulse(pair).x>${impulseThreshold}){flags|=CONTACT_IMPACT;}
|
|
102
|
+
}
|
|
103
|
+
return flags;
|
|
104
|
+
}
|
|
105
|
+
fn eventCount(flags:u32)->u32{return countOneBits(flags&7u);}
|
|
106
|
+
fn emitContact(sequence:u32,step:u32,first:u32,second:u32,phase:u32,point:vec3f,normal:vec3f,impulse:f32){
|
|
107
|
+
let slot=(sequence-1u)%${capacity}u;
|
|
108
|
+
contactEvents.entries[slot]=ContactEvent(vec4u(sequence,step,phase,0),vec4u(colliderBody(first),colliderBody(second),first,second),vec4f(point,impulse),vec4f(normal,0));
|
|
71
109
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
let
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if(previous.z!=0u&&(!hasContact||!same)){emitContact(previous.x,previous.y,2u,vec3f(0),vec3f(0),0);}
|
|
81
|
-
if(hasContact){
|
|
82
|
-
var impulse=0.0;var strongest=0u;
|
|
83
|
-
for(var contact=0u;contact<manifolds[pair].count;contact++){
|
|
84
|
-
impulse+=max(0.0,manifolds[pair].contacts[contact].impulse.x);
|
|
85
|
-
if(manifolds[pair].contacts[contact].impulse.x>manifolds[pair].contacts[strongest].impulse.x){strongest=contact;}
|
|
86
|
-
}
|
|
87
|
-
let contact=manifolds[pair].contacts[strongest];
|
|
88
|
-
if(previous.z==0u||!same){emitContact(first,second,0u,contact.point.xyz,contact.normal.xyz,impulse);}
|
|
89
|
-
else if(impulse>${impulseThreshold}){emitContact(first,second,1u,contact.point.xyz,contact.normal.xyz,impulse);}
|
|
110
|
+
fn eventPublish(pair:u32,flags:u32,offset:u32,reservation:vec3u){
|
|
111
|
+
if((flags&CONTACT_PROCESS)==0u){return;}
|
|
112
|
+
let first=getFirstCollider(pair);let second=getSecondCollider(pair);
|
|
113
|
+
if((flags&CONTACT_END)!=0u){
|
|
114
|
+
let sequence=retainedEventSequence(reservation,offset);
|
|
115
|
+
if(sequence!=0u){
|
|
116
|
+
let previous=contactHistory[pair];
|
|
117
|
+
emitContact(sequence,reservation.z,previous.x,previous.y,2u,vec3f(0),vec3f(0),0);
|
|
90
118
|
}
|
|
91
|
-
contactHistory[pair]=vec4u(first,second,select(0u,1u,hasContact),0u);
|
|
92
119
|
}
|
|
93
|
-
|
|
120
|
+
if((flags&(CONTACT_BEGIN|CONTACT_IMPACT))!=0u){
|
|
121
|
+
let sequence=retainedEventSequence(reservation,offset+select(0u,1u,(flags&CONTACT_END)!=0u));
|
|
122
|
+
if(sequence!=0u){
|
|
123
|
+
let impulse=contactImpulse(pair);
|
|
124
|
+
let contact=manifolds[pair].contacts[u32(impulse.y)];
|
|
125
|
+
let phase=select(1u,0u,(flags&CONTACT_BEGIN)!=0u);
|
|
126
|
+
emitContact(sequence,reservation.z,first,second,phase,contact.point.xyz,contact.normal.xyz,impulse.x);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
contactHistory[pair]=vec4u(first,second,select(0u,1u,manifolds[pair].count>0u),0u);
|
|
130
|
+
}
|
|
131
|
+
`;
|
|
94
132
|
}
|
|
@@ -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
|
+
`;
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {RigidBodyVector} from './rigid-body-properties';
|
|
6
|
+
|
|
7
|
+
/** Grid in the collider's local Z-up frame, with row-major scalar heights. */
|
|
8
|
+
export type GPURigidBodyHeightField = {
|
|
9
|
+
/** Number of columns, including both ends of the tile. */
|
|
10
|
+
width: number;
|
|
11
|
+
/** Number of rows, including both ends of the tile. */
|
|
12
|
+
height: number;
|
|
13
|
+
/** First sample in local XY, after any cell-registration shift. */
|
|
14
|
+
origin?: readonly [number, number];
|
|
15
|
+
/** Metric column basis vector. Defaults to a unit step along X. */
|
|
16
|
+
columnStep?: readonly [number, number];
|
|
17
|
+
/** Metric row basis vector. Defaults to a unit step along Y. */
|
|
18
|
+
rowStep?: readonly [number, number];
|
|
19
|
+
/** The diagonal connecting opposite samples in each cell. */
|
|
20
|
+
diagonal?: '00-11' | '10-01';
|
|
21
|
+
/** Missing heights allocate a vacant slot. Nonfinite or masked samples omit their triangles. */
|
|
22
|
+
heights?: Float32Array | Float64Array;
|
|
23
|
+
/** Optional row-major mask with zero for an absent sample. */
|
|
24
|
+
validity?: Uint8Array;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** Structural subset of math.gl HeightField needed to create a collider without a terrain dependency. */
|
|
28
|
+
export type GPURigidBodyHeightFieldSource = {
|
|
29
|
+
/** Source column count. */
|
|
30
|
+
readonly width: number;
|
|
31
|
+
/** Source row count. */
|
|
32
|
+
readonly height: number;
|
|
33
|
+
/** Metric source origin before applying sample registration. */
|
|
34
|
+
readonly origin: readonly [number, number];
|
|
35
|
+
/** Metric column basis vector. */
|
|
36
|
+
readonly columnStep: readonly [number, number];
|
|
37
|
+
/** Metric row basis vector. */
|
|
38
|
+
readonly rowStep: readonly [number, number];
|
|
39
|
+
/** Placement of the first sample relative to the source origin. */
|
|
40
|
+
readonly registration: 'vertex' | 'cell';
|
|
41
|
+
/** Authored triangle diagonal used for each cell. */
|
|
42
|
+
readonly diagonal: '00-11' | '10-01';
|
|
43
|
+
/** Return detached row-major data and validity. */
|
|
44
|
+
copyData(): {heights: Float32Array | Float64Array; validity: Uint8Array};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** Detach math.gl samples and express them relative to the supplied collider origin. */
|
|
48
|
+
export function makeRigidBodyHeightField(
|
|
49
|
+
source: GPURigidBodyHeightFieldSource,
|
|
50
|
+
colliderOrigin: RigidBodyVector
|
|
51
|
+
): GPURigidBodyHeightField {
|
|
52
|
+
const samples = source.copyData();
|
|
53
|
+
const registrationOffset = source.registration === 'cell' ? 0.5 : 0;
|
|
54
|
+
return {
|
|
55
|
+
width: source.width,
|
|
56
|
+
height: source.height,
|
|
57
|
+
origin: [
|
|
58
|
+
source.origin[0] -
|
|
59
|
+
colliderOrigin[0] +
|
|
60
|
+
registrationOffset * (source.columnStep[0] + source.rowStep[0]),
|
|
61
|
+
source.origin[1] -
|
|
62
|
+
colliderOrigin[1] +
|
|
63
|
+
registrationOffset * (source.columnStep[1] + source.rowStep[1])
|
|
64
|
+
],
|
|
65
|
+
columnStep: [...source.columnStep],
|
|
66
|
+
rowStep: [...source.rowStep],
|
|
67
|
+
diagonal: source.diagonal,
|
|
68
|
+
heights: Float64Array.from(samples.heights, height => height - colliderOrigin[2]),
|
|
69
|
+
validity: samples.validity
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** One reserved f32 value marks a missing height in the GPU data. */
|
|
74
|
+
const MISSING_HEIGHT = Math.fround(3.402823e38);
|
|
75
|
+
/** Leaves cover a contiguous range from a single row of at most eight cells. */
|
|
76
|
+
const CELLS_PER_LEAF = 8;
|
|
77
|
+
|
|
78
|
+
/** Exact fixed payload size, independent of height values and missing-data masks. */
|
|
79
|
+
export function getRigidBodyHeightFieldPageWords(width: number, height: number): number {
|
|
80
|
+
const sampleCount = width * height;
|
|
81
|
+
if (
|
|
82
|
+
!Number.isSafeInteger(width) ||
|
|
83
|
+
!Number.isSafeInteger(height) ||
|
|
84
|
+
width < 2 ||
|
|
85
|
+
height < 2 ||
|
|
86
|
+
sampleCount > 1_000_000
|
|
87
|
+
)
|
|
88
|
+
throw new Error('Invalid height-field grid');
|
|
89
|
+
// Every row eventually uses the same bisection of its columns. Interleaving the
|
|
90
|
+
// row splits changes traversal order, but the full binary tree has 2 * leaves - 1 nodes.
|
|
91
|
+
const memo = new Map<number, number>();
|
|
92
|
+
/** Count single-row leaves after the same column bisection used by the packer. */
|
|
93
|
+
const countLeaves = (columns: number): number => {
|
|
94
|
+
if (columns <= CELLS_PER_LEAF) return 1;
|
|
95
|
+
const cached = memo.get(columns);
|
|
96
|
+
if (cached !== undefined) return cached;
|
|
97
|
+
const half = Math.floor(columns / 2);
|
|
98
|
+
const leaves = countLeaves(half) + countLeaves(columns - half);
|
|
99
|
+
memo.set(columns, leaves);
|
|
100
|
+
return leaves;
|
|
101
|
+
};
|
|
102
|
+
const leaves = countLeaves(width - 1) * (height - 1);
|
|
103
|
+
return 8 + Math.ceil(sampleCount / 4) * 4 + (2 * leaves - 1) * 12;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Pack scalar samples and a bounded stackless hierarchy, with no stored vertices or triangle indices. */
|
|
107
|
+
export function packRigidBodyHeightField(field: GPURigidBodyHeightField) {
|
|
108
|
+
const {width, height, heights, validity, diagonal = '00-11'} = field;
|
|
109
|
+
const sampleCount = width * height;
|
|
110
|
+
if (
|
|
111
|
+
!Number.isSafeInteger(width) ||
|
|
112
|
+
!Number.isSafeInteger(height) ||
|
|
113
|
+
width < 2 ||
|
|
114
|
+
height < 2 ||
|
|
115
|
+
sampleCount > 1_000_000 ||
|
|
116
|
+
(heights && heights.length !== sampleCount) ||
|
|
117
|
+
(validity && validity.length !== sampleCount) ||
|
|
118
|
+
(diagonal !== '00-11' && diagonal !== '10-01')
|
|
119
|
+
)
|
|
120
|
+
throw new Error('Invalid height-field grid');
|
|
121
|
+
|
|
122
|
+
const origin = (field.origin ?? [0, 0]).map(Math.fround);
|
|
123
|
+
const columnStep = (field.columnStep ?? [1, 0]).map(Math.fround);
|
|
124
|
+
const rowStep = (field.rowStep ?? [0, 1]).map(Math.fround);
|
|
125
|
+
const determinant = columnStep[0] * rowStep[1] - columnStep[1] * rowStep[0];
|
|
126
|
+
const horizontalScale = [0, 1].map(
|
|
127
|
+
axis =>
|
|
128
|
+
Math.abs(origin[axis]) +
|
|
129
|
+
Math.abs(columnStep[axis]) * (width - 1) +
|
|
130
|
+
Math.abs(rowStep[axis]) * (height - 1)
|
|
131
|
+
);
|
|
132
|
+
if (
|
|
133
|
+
origin.length !== 2 ||
|
|
134
|
+
columnStep.length !== 2 ||
|
|
135
|
+
rowStep.length !== 2 ||
|
|
136
|
+
![...origin, ...columnStep, ...rowStep, ...horizontalScale].every(value =>
|
|
137
|
+
Number.isFinite(Math.fround(value))
|
|
138
|
+
) ||
|
|
139
|
+
Math.abs(determinant) <= 1e-7 * Math.hypot(...columnStep) * Math.hypot(...rowStep)
|
|
140
|
+
)
|
|
141
|
+
throw new Error('Invalid height-field transform');
|
|
142
|
+
|
|
143
|
+
// Match shader arithmetic at the sample positions, padding conservative XY bounds
|
|
144
|
+
// for separate rounding of the index products and sum.
|
|
145
|
+
const roundingPadding = horizontalScale.map(value => value * 2 ** -21);
|
|
146
|
+
const nodeOffset = 2 + Math.ceil(sampleCount / 4);
|
|
147
|
+
const data = new Array<number>(nodeOffset * 4).fill(MISSING_HEIGHT);
|
|
148
|
+
data.splice(
|
|
149
|
+
0,
|
|
150
|
+
8,
|
|
151
|
+
...columnStep,
|
|
152
|
+
...rowStep,
|
|
153
|
+
...origin,
|
|
154
|
+
width,
|
|
155
|
+
Number(diagonal === '10-01') + 2 * Number(determinant < 0)
|
|
156
|
+
);
|
|
157
|
+
for (let index = 0; heights && index < sampleCount; index++) {
|
|
158
|
+
if (validity?.[index] === 0 || !Number.isFinite(heights[index])) continue;
|
|
159
|
+
const sample = Math.fround(heights[index]);
|
|
160
|
+
if (!Number.isFinite(sample) || sample === MISSING_HEIGHT)
|
|
161
|
+
throw new Error('Height-field sample exceeds float32 range');
|
|
162
|
+
data[8 + index] = sample;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Build deterministic rectangular nodes even for an empty or partially loaded slot. */
|
|
166
|
+
const appendNode = (
|
|
167
|
+
firstColumn: number,
|
|
168
|
+
firstRow: number,
|
|
169
|
+
columns: number,
|
|
170
|
+
rows: number
|
|
171
|
+
): number => {
|
|
172
|
+
const offset = data.length;
|
|
173
|
+
data.push(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
174
|
+
let minimumHeight = Infinity;
|
|
175
|
+
let maximumHeight = -Infinity;
|
|
176
|
+
if (rows === 1 && columns <= CELLS_PER_LEAF) {
|
|
177
|
+
const firstSample = firstRow * width + firstColumn;
|
|
178
|
+
for (let column = 0; column < columns; column++) {
|
|
179
|
+
const sample = 8 + firstSample + column;
|
|
180
|
+
const first = data[sample];
|
|
181
|
+
const second = data[sample + 1];
|
|
182
|
+
const third = data[sample + width];
|
|
183
|
+
const fourth = data[sample + width + 1];
|
|
184
|
+
const triangles =
|
|
185
|
+
diagonal === '00-11'
|
|
186
|
+
? [first, second, fourth, first, fourth, third]
|
|
187
|
+
: [first, second, third, second, fourth, third];
|
|
188
|
+
for (let triangle = 0; triangle < 6; triangle += 3) {
|
|
189
|
+
const cornerA = triangles[triangle];
|
|
190
|
+
const cornerB = triangles[triangle + 1];
|
|
191
|
+
const cornerC = triangles[triangle + 2];
|
|
192
|
+
if (
|
|
193
|
+
cornerA === MISSING_HEIGHT ||
|
|
194
|
+
cornerB === MISSING_HEIGHT ||
|
|
195
|
+
cornerC === MISSING_HEIGHT
|
|
196
|
+
)
|
|
197
|
+
continue;
|
|
198
|
+
minimumHeight = Math.min(minimumHeight, cornerA, cornerB, cornerC);
|
|
199
|
+
maximumHeight = Math.max(maximumHeight, cornerA, cornerB, cornerC);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
data[offset + 7] = minimumHeight <= maximumHeight ? columns * 2 : 0;
|
|
203
|
+
data[offset + 8] = 2 * (firstRow * (width - 1) + firstColumn);
|
|
204
|
+
} else {
|
|
205
|
+
let firstChild: number;
|
|
206
|
+
let secondChild: number;
|
|
207
|
+
if (columns > CELLS_PER_LEAF && (rows === 1 || columns >= rows * CELLS_PER_LEAF)) {
|
|
208
|
+
const split = Math.floor(columns / 2);
|
|
209
|
+
firstChild = appendNode(firstColumn, firstRow, split, rows);
|
|
210
|
+
secondChild = appendNode(firstColumn + split, firstRow, columns - split, rows);
|
|
211
|
+
} else {
|
|
212
|
+
const split = Math.floor(rows / 2);
|
|
213
|
+
firstChild = appendNode(firstColumn, firstRow, columns, split);
|
|
214
|
+
secondChild = appendNode(firstColumn, firstRow + split, columns, rows - split);
|
|
215
|
+
}
|
|
216
|
+
minimumHeight = Math.min(data[firstChild + 2], data[secondChild + 2]);
|
|
217
|
+
maximumHeight = Math.max(data[firstChild + 6], data[secondChild + 6]);
|
|
218
|
+
}
|
|
219
|
+
if (minimumHeight <= maximumHeight) {
|
|
220
|
+
for (let axis = 0; axis < 2; axis++) {
|
|
221
|
+
const first = origin[axis] + firstColumn * columnStep[axis] + firstRow * rowStep[axis];
|
|
222
|
+
const column = columns * columnStep[axis];
|
|
223
|
+
const row = rows * rowStep[axis];
|
|
224
|
+
data[offset + axis] =
|
|
225
|
+
first + Math.min(0, column) + Math.min(0, row) - roundingPadding[axis];
|
|
226
|
+
data[offset + 4 + axis] =
|
|
227
|
+
first + Math.max(0, column) + Math.max(0, row) + roundingPadding[axis];
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
data[offset + 2] = minimumHeight;
|
|
231
|
+
data[offset + 6] = maximumHeight;
|
|
232
|
+
data[offset + 3] = (data.length - nodeOffset * 4) / 12;
|
|
233
|
+
return offset;
|
|
234
|
+
};
|
|
235
|
+
const root = appendNode(0, 0, width - 1, height - 1);
|
|
236
|
+
const active = data[root + 2] <= data[root + 6];
|
|
237
|
+
// Empty hierarchy branches have reversed finite bounds. Readers skip them without
|
|
238
|
+
// evaluating a cast against invalid limits. The allocation stays identical on reload.
|
|
239
|
+
for (let offset = root; offset < data.length; offset += 12) {
|
|
240
|
+
if (data[offset + 2] > data[offset + 6]) {
|
|
241
|
+
data[offset + 2] = 1;
|
|
242
|
+
data[offset + 6] = -1;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
const extent = active
|
|
246
|
+
? [0, 1, 2].map(axis => Math.max(Math.abs(data[root + axis]), Math.abs(data[root + 4 + axis])))
|
|
247
|
+
: [0, 0, 0];
|
|
248
|
+
if (!extent.every(value => Number.isFinite(Math.fround(value))))
|
|
249
|
+
throw new Error('Height-field bounds exceed float32 range');
|
|
250
|
+
return {
|
|
251
|
+
data,
|
|
252
|
+
extent,
|
|
253
|
+
nodeOffset,
|
|
254
|
+
nodeCount: active ? (data.length - root) / 12 : 0,
|
|
255
|
+
triangleCount: active ? (width - 1) * (height - 1) * 2 : 0
|
|
256
|
+
};
|
|
257
|
+
}
|
|
@@ -58,23 +58,21 @@ export function validateRigidBodyJoints(
|
|
|
58
58
|
joint.first === joint.second ||
|
|
59
59
|
[joint.first, joint.second].some(
|
|
60
60
|
index => !Number.isInteger(index) || index < 0 || index >= bodies.length
|
|
61
|
-
) ||
|
|
62
|
-
![joint.first, joint.second].some(
|
|
63
|
-
index =>
|
|
64
|
-
(bodies[index].mode ?? ((bodies[index].mass ?? 1) === 0 ? 'static' : 'dynamic')) ===
|
|
65
|
-
'dynamic'
|
|
66
61
|
)
|
|
67
62
|
)
|
|
68
63
|
throw new Error('Invalid joint bodies');
|
|
64
|
+
/** Ordered constraints can remain present while their bodies follow animation. */
|
|
65
|
+
const modes = [joint.first, joint.second].map(index => {
|
|
66
|
+
/** Resolve default static bodies from their mass when mode is omitted. */
|
|
67
|
+
const body = bodies[index];
|
|
68
|
+
return body.mode ?? ((body.mass ?? 1) === 0 ? 'static' : 'dynamic');
|
|
69
|
+
});
|
|
70
|
+
if (modes.every(mode => mode === 'static')) throw new Error('Invalid joint bodies');
|
|
69
71
|
if (solver === 'parallel') {
|
|
70
72
|
// Parallel contacts can alternate with a small serial sweep of anchored distance rows.
|
|
71
73
|
// Dynamic-dynamic joints still require shared island ownership and remain ordered-only.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
(bodies[index].mode ?? ((bodies[index].mass ?? 1) === 0 ? 'static' : 'dynamic')) ===
|
|
75
|
-
'static'
|
|
76
|
-
);
|
|
77
|
-
if (joint.type !== 'distance' || !anchored) throw new Error('Unsupported parallel joint');
|
|
74
|
+
if (joint.type !== 'distance' || !modes.includes('static') || !modes.includes('dynamic'))
|
|
75
|
+
throw new Error('Unsupported parallel joint');
|
|
78
76
|
}
|
|
79
77
|
if (joint.type === 'general') validateGeneralJoint(joint);
|
|
80
78
|
for (const frame of [joint.firstFrame, joint.secondFrame]) {
|
|
@@ -44,12 +44,13 @@ fn queueMeshPairContacts(pair:u32,first:u32,second:u32,previous:Manifold){
|
|
|
44
44
|
if(work>=MESH_TRAVERSAL_BUDGET){exhausted=true;break;}work++;
|
|
45
45
|
let minimum=readGeometry(outerOffset+outerNode*3u);
|
|
46
46
|
let maximum=readGeometry(outerOffset+outerNode*3u+1u);
|
|
47
|
-
if(any(maximum.xyz<outerLower)||any(minimum.xyz>outerUpper)){outerNode=u32(minimum.w);continue;}
|
|
47
|
+
if(any(minimum.xyz>maximum.xyz)||any(maximum.xyz<outerLower)||any(minimum.xyz>outerUpper)){outerNode=u32(minimum.w);continue;}
|
|
48
48
|
if(maximum.w>0.0){
|
|
49
49
|
let start=u32(readGeometry(outerOffset+outerNode*3u+2u).x);
|
|
50
50
|
for(var offset=0u;offset<u32(maximum.w);offset++){
|
|
51
51
|
if(work>=MESH_TRAVERSAL_BUDGET){exhausted=true;break;}work++;
|
|
52
52
|
let outerTriangle=start+offset;
|
|
53
|
+
if(!meshTriangleActive(outerMesh,outerTriangle)){continue;}
|
|
53
54
|
var lower=vec3f(3.402823e38);var upper=vec3f(-3.402823e38);
|
|
54
55
|
for(var corner=0u;corner<3u;corner++){
|
|
55
56
|
let worldPoint=colliderPosition(outerMesh)+rotate(colliderRotation(outerMesh),triangleVertex(outerMesh,outerTriangle,corner));
|
|
@@ -63,12 +64,13 @@ fn queueMeshPairContacts(pair:u32,first:u32,second:u32,previous:Manifold){
|
|
|
63
64
|
if(work>=MESH_TRAVERSAL_BUDGET){exhausted=true;break;}work++;
|
|
64
65
|
let queryMinimum=readGeometry(queryOffset+queryNode*3u);
|
|
65
66
|
let queryMaximum=readGeometry(queryOffset+queryNode*3u+1u);
|
|
66
|
-
if(any(queryMaximum.xyz<lower)||any(queryMinimum.xyz>upper)){queryNode=u32(queryMinimum.w);continue;}
|
|
67
|
+
if(any(queryMinimum.xyz>queryMaximum.xyz)||any(queryMaximum.xyz<lower)||any(queryMinimum.xyz>upper)){queryNode=u32(queryMinimum.w);continue;}
|
|
67
68
|
if(queryMaximum.w>0.0){
|
|
68
69
|
let queryStart=u32(readGeometry(queryOffset+queryNode*3u+2u).x);
|
|
69
70
|
for(var queryIndex=0u;queryIndex<u32(queryMaximum.w);queryIndex++){
|
|
70
71
|
if(work>=MESH_TRAVERSAL_BUDGET){exhausted=true;break;}work++;
|
|
71
72
|
let queryTriangle=queryStart+queryIndex;
|
|
73
|
+
if(!meshTriangleActive(queryMesh,queryTriangle)){continue;}
|
|
72
74
|
let firstPoint=triangleVertex(queryMesh,queryTriangle,0u);
|
|
73
75
|
let secondPoint=triangleVertex(queryMesh,queryTriangle,1u);
|
|
74
76
|
let thirdPoint=triangleVertex(queryMesh,queryTriangle,2u);
|