@adobe/data-gpu 0.9.75 → 0.9.77
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/CLAUDE.md +9 -0
- package/README.md +36 -0
- package/dist/core/core-plugin.d.ts +1 -1
- package/dist/core/public.d.ts +2 -0
- package/dist/core/public.js +4 -0
- package/dist/core/public.js.map +1 -0
- package/dist/graphics/animation/animation-data-plugin.d.ts +8 -0
- package/dist/graphics/animation/animation-plugin.d.ts +10 -2
- package/dist/graphics/camera/camera-plugin.d.ts +3 -3
- package/dist/graphics/camera/orbit/attach-orbit-drag.d.ts +1 -21
- package/dist/graphics/camera/orbit/attach-orbit-drag.js +0 -10
- package/dist/graphics/camera/orbit/attach-orbit-drag.js.map +1 -1
- package/dist/graphics/camera/orbit/orbit-data-plugin.d.ts +6 -6
- package/dist/graphics/camera/orbit/orbit-data-plugin.js +1 -1
- package/dist/graphics/camera/orbit/orbit-data-plugin.js.map +1 -1
- package/dist/graphics/camera/orbit/orbit-drag-service.d.ts +11 -0
- package/dist/graphics/camera/orbit/orbit-drag-service.js +3 -0
- package/dist/graphics/camera/orbit/orbit-drag-service.js.map +1 -0
- package/dist/graphics/camera/orbit/orbit-plugin.d.ts +6 -6
- package/dist/graphics/camera/orbit/orbit-system-plugin.d.ts +8 -8
- package/dist/graphics/camera/orbit/orbit-system-plugin.js +6 -9
- package/dist/graphics/camera/orbit/orbit-system-plugin.js.map +1 -1
- package/dist/graphics/camera/orbit/orbit.d.ts +5 -5
- package/dist/graphics/camera/orbit/public.d.ts +2 -2
- package/dist/graphics/camera/orbit/public.js +2 -1
- package/dist/graphics/camera/orbit/public.js.map +1 -1
- package/dist/graphics/graphics-plugin.d.ts +1 -1
- package/dist/graphics/index.d.ts +1 -0
- package/dist/graphics/index.js +3 -0
- package/dist/graphics/index.js.map +1 -0
- package/dist/graphics/picking/picking-plugin.d.ts +9871 -1912
- package/dist/graphics/picking/picking-plugin.js +3 -3
- package/dist/graphics/picking/picking-plugin.js.map +1 -1
- package/dist/graphics/public.d.ts +38 -0
- package/dist/graphics/public.js +40 -0
- package/dist/graphics/public.js.map +1 -0
- package/dist/graphics/rendering/bone-collider-plugin.d.ts +2967 -486
- package/dist/graphics/rendering/bone-collider-plugin.js +13 -12
- package/dist/graphics/rendering/bone-collider-plugin.js.map +1 -1
- package/dist/graphics/rendering/display-transform-plugin.d.ts +2 -0
- package/dist/graphics/rendering/display-transform-plugin.js +2 -2
- package/dist/graphics/rendering/display-transform-plugin.js.map +1 -1
- package/dist/graphics/rendering/ibl-render/ibl-render-plugin.d.ts +2857 -403
- package/dist/graphics/rendering/ibl-render/ibl-render-plugin.js +9 -9
- package/dist/graphics/rendering/ibl-render/ibl-render-plugin.js.map +1 -1
- package/dist/graphics/rendering/interpolation-plugin.d.ts +1040 -156
- package/dist/graphics/rendering/jolt-ragdoll-plugin.d.ts +3017 -538
- package/dist/graphics/rendering/jolt-ragdoll-plugin.js +6 -6
- package/dist/graphics/rendering/jolt-ragdoll-plugin.js.map +1 -1
- package/dist/graphics/rendering/material-palette-gpu/material-palette-gpu-plugin.d.ts +1123 -0
- package/dist/graphics/rendering/material-palette-gpu/material-palette-gpu-plugin.js +79 -0
- package/dist/graphics/rendering/material-palette-gpu/material-palette-gpu-plugin.js.map +1 -0
- package/dist/graphics/rendering/material-palette-gpu/material-palette-gpu.test.d.ts +1 -0
- package/dist/graphics/rendering/material-palette-gpu/material-palette-gpu.test.js +18 -0
- package/dist/graphics/rendering/material-palette-gpu/material-palette-gpu.test.js.map +1 -0
- package/dist/graphics/rendering/material-palette-gpu/material-palette.d.ts +25 -0
- package/dist/graphics/rendering/material-palette-gpu/material-palette.js +27 -0
- package/dist/graphics/rendering/material-palette-gpu/material-palette.js.map +1 -0
- package/dist/graphics/rendering/material-palette-gpu/palette-bind-group.d.ts +3 -0
- package/dist/graphics/rendering/material-palette-gpu/palette-bind-group.js +22 -0
- package/dist/graphics/rendering/material-palette-gpu/palette-bind-group.js.map +1 -0
- package/dist/graphics/rendering/model-collider-plugin.d.ts +2903 -663
- package/dist/graphics/rendering/model-collider-plugin.js +11 -34
- package/dist/graphics/rendering/model-collider-plugin.js.map +1 -1
- package/dist/graphics/rendering/pbr-core-plugin.d.ts +16 -8
- package/dist/graphics/rendering/pbr-core-plugin.js +16 -19
- package/dist/graphics/rendering/pbr-core-plugin.js.map +1 -1
- package/dist/graphics/rendering/pbr-render/pbr-factor-render-plugin.d.ts +3514 -0
- package/dist/graphics/rendering/pbr-render/pbr-factor-render-plugin.js +189 -0
- package/dist/graphics/rendering/pbr-render/pbr-factor-render-plugin.js.map +1 -0
- package/dist/graphics/rendering/pbr-render/pbr-factor-shader.wgsl.d.ts +7 -0
- package/dist/graphics/rendering/pbr-render/pbr-factor-shader.wgsl.js +124 -0
- package/dist/graphics/rendering/pbr-render/pbr-factor-shader.wgsl.js.map +1 -0
- package/dist/graphics/rendering/pbr-render/physics-bridge-plugin.d.ts +769 -571
- package/dist/graphics/rendering/pbr-render/physics-bridge-plugin.js +98 -79
- package/dist/graphics/rendering/pbr-render/physics-bridge-plugin.js.map +1 -1
- package/dist/graphics/rendering/pbr-render/primitive-render-shared.d.ts +43 -0
- package/dist/graphics/rendering/pbr-render/primitive-render-shared.js +59 -0
- package/dist/graphics/rendering/pbr-render/primitive-render-shared.js.map +1 -0
- package/dist/graphics/rendering/skinning/skinning-plugin.d.ts +2930 -270
- package/dist/graphics/rendering/skinning/skinning-plugin.js +19 -40
- package/dist/graphics/rendering/skinning/skinning-plugin.js.map +1 -1
- package/dist/graphics/scene/model/geometry/public.d.ts +1 -0
- package/dist/graphics/scene/model/mesh/mesh.d.ts +13 -0
- package/dist/graphics/scene/model/mesh/mesh.js +3 -0
- package/dist/graphics/scene/model/mesh/mesh.js.map +1 -0
- package/dist/graphics/scene/model/mesh/public.d.ts +1 -0
- package/dist/graphics/scene/model/mesh/public.js +3 -0
- package/dist/graphics/scene/model/mesh/public.js.map +1 -0
- package/dist/graphics/scene/model/mesh-plugin.d.ts +5177 -0
- package/dist/graphics/scene/model/mesh-plugin.js +87 -0
- package/dist/graphics/scene/model/mesh-plugin.js.map +1 -0
- package/dist/graphics/scene/model/model-loader-plugin.d.ts +2728 -295
- package/dist/graphics/scene/model/model-loader-plugin.js +24 -42
- package/dist/graphics/scene/model/model-loader-plugin.js.map +1 -1
- package/dist/graphics/scene/model/model-plugin.d.ts +1 -352
- package/dist/graphics/scene/model/model-plugin.js +1 -37
- package/dist/graphics/scene/model/model-plugin.js.map +1 -1
- package/dist/graphics/scene/model/model.d.ts +2 -6
- package/dist/graphics/scene/model/model.js.map +1 -1
- package/dist/graphics/scene/model/public.d.ts +1 -1
- package/dist/graphics/scene/model/public.js +2 -1
- package/dist/graphics/scene/model/public.js.map +1 -1
- package/dist/graphics/scene/model/shape/bounds-from-shape-mesh.d.ts +4 -0
- package/dist/graphics/scene/model/shape/bounds-from-shape-mesh.js +25 -0
- package/dist/graphics/scene/model/shape/bounds-from-shape-mesh.js.map +1 -0
- package/dist/graphics/scene/model/shape/shape-geometry-plugin.d.ts +233 -386
- package/dist/graphics/scene/model/shape/shape-geometry-plugin.js +87 -18
- package/dist/graphics/scene/model/shape/shape-geometry-plugin.js.map +1 -1
- package/dist/graphics/scene/model/shape/shape-spec.d.ts +17 -0
- package/dist/graphics/scene/model/shape/shape-spec.js +3 -0
- package/dist/graphics/scene/model/shape/shape-spec.js.map +1 -0
- package/dist/graphics/scene/model/world-bounds-plugin.d.ts +2670 -245
- package/dist/graphics/scene/model/world-bounds-plugin.js +6 -25
- package/dist/graphics/scene/model/world-bounds-plugin.js.map +1 -1
- package/dist/graphics/scene/node/node-data-plugin.d.ts +15 -4
- package/dist/graphics/scene/node/node-data-plugin.js +12 -5
- package/dist/graphics/scene/node/node-data-plugin.js.map +1 -1
- package/dist/graphics/scene/node/node-data-plugin.test.d.ts +1 -0
- package/dist/graphics/scene/node/node-data-plugin.test.js +40 -0
- package/dist/graphics/scene/node/node-data-plugin.test.js.map +1 -0
- package/dist/graphics/scene/node/node-plugin.d.ts +8 -1
- package/dist/graphics/scene/node/transform-plugin.d.ts +8 -1
- package/dist/graphics/scene/scene-plugin.d.ts +2353 -100
- package/dist/graphics/scene/scene-plugin.js +3 -3
- package/dist/graphics/scene/scene-plugin.js.map +1 -1
- package/dist/graphics/scene/scene-uniforms/scene-uniforms-plugin.d.ts +3 -3
- package/dist/index.d.ts +1 -53
- package/dist/index.js +1 -54
- package/dist/index.js.map +1 -1
- package/dist/material/assemble-material-row.d.ts +4 -0
- package/dist/material/assemble-material-row.js +22 -0
- package/dist/material/assemble-material-row.js.map +1 -0
- package/dist/material/definitions.d.ts +833 -0
- package/dist/material/definitions.js +423 -0
- package/dist/material/definitions.js.map +1 -0
- package/dist/material/emission-mode.d.ts +8 -0
- package/dist/material/emission-mode.js +9 -0
- package/dist/material/emission-mode.js.map +1 -0
- package/dist/material/index.d.ts +1 -0
- package/dist/material/index.js +3 -0
- package/dist/material/index.js.map +1 -0
- package/dist/material/json/from-json-string.d.ts +2 -0
- package/dist/material/json/from-json-string.js +12 -0
- package/dist/material/json/from-json-string.js.map +1 -0
- package/dist/material/json/from-json.d.ts +10 -0
- package/dist/material/json/from-json.js +16 -0
- package/dist/material/json/from-json.js.map +1 -0
- package/dist/material/json/from-json.test.d.ts +1 -0
- package/dist/material/json/from-json.test.js +46 -0
- package/dist/material/json/from-json.test.js.map +1 -0
- package/dist/material/json/is-properties-json.d.ts +2 -0
- package/dist/material/json/is-properties-json.js +65 -0
- package/dist/material/json/is-properties-json.js.map +1 -0
- package/dist/material/json/library-json.d.ts +3 -0
- package/dist/material/json/library-json.js +2 -0
- package/dist/material/json/library-json.js.map +1 -0
- package/dist/material/json/load-json.d.ts +7 -0
- package/dist/material/json/load-json.js +10 -0
- package/dist/material/json/load-json.js.map +1 -0
- package/dist/material/json/properties-json.d.ts +25 -0
- package/dist/material/json/properties-json.js +2 -0
- package/dist/material/json/properties-json.js.map +1 -0
- package/dist/material/json/public.d.ts +9 -0
- package/dist/material/json/public.js +6 -0
- package/dist/material/json/public.js.map +1 -0
- package/dist/material/json/to-definition.d.ts +5 -0
- package/dist/material/json/to-definition.js +65 -0
- package/dist/material/json/to-definition.js.map +1 -0
- package/dist/material/material-by-name-lookup.d.ts +11 -0
- package/dist/material/material-by-name-lookup.js +3 -0
- package/dist/material/material-by-name-lookup.js.map +1 -0
- package/dist/material/material-defaults.d.ts +23 -0
- package/dist/material/material-defaults.js +25 -0
- package/dist/material/material-defaults.js.map +1 -0
- package/dist/material/material-definition.d.ts +3 -0
- package/dist/material/material-definition.js +2 -0
- package/dist/material/material-definition.js.map +1 -0
- package/dist/material/material-name.d.ts +2 -0
- package/dist/material/material-name.js +2 -0
- package/dist/material/material-name.js.map +1 -0
- package/dist/material/material-plugin.d.ts +891 -22
- package/dist/material/material-plugin.js +46 -21
- package/dist/material/material-plugin.js.map +1 -1
- package/dist/material/material-plugin.test.d.ts +1 -0
- package/dist/material/material-plugin.test.js +87 -0
- package/dist/material/material-plugin.test.js.map +1 -0
- package/dist/material/material.d.ts +27 -29
- package/dist/material/material.js +0 -1
- package/dist/material/material.js.map +1 -1
- package/dist/material/public.d.ts +12 -2
- package/dist/material/public.js +12 -2
- package/dist/material/public.js.map +1 -1
- package/dist/material/require-material.d.ts +4 -0
- package/dist/material/require-material.js +10 -0
- package/dist/material/require-material.js.map +1 -0
- package/dist/material/standard-material-names.d.ts +2 -0
- package/dist/material/standard-material-names.js +4 -0
- package/dist/material/standard-material-names.js.map +1 -0
- package/dist/material/standard-materials.d.ts +1 -1
- package/dist/material/standard-materials.js +17 -24
- package/dist/material/standard-materials.js.map +1 -1
- package/dist/material/stress-strain-curve/create.d.ts +8 -0
- package/dist/material/stress-strain-curve/create.js +2 -0
- package/dist/material/stress-strain-curve/create.js.map +1 -0
- package/dist/material/stress-strain-curve/public.d.ts +2 -0
- package/dist/material/stress-strain-curve/public.js +3 -0
- package/dist/material/stress-strain-curve/public.js.map +1 -0
- package/dist/material/stress-strain-curve/schema.d.ts +52 -0
- package/dist/material/stress-strain-curve/schema.js +19 -0
- package/dist/material/stress-strain-curve/schema.js.map +1 -0
- package/dist/material/stress-strain-curve/schema.test.d.ts +1 -0
- package/dist/material/stress-strain-curve/schema.test.js +18 -0
- package/dist/material/stress-strain-curve/schema.test.js.map +1 -0
- package/dist/material/stress-strain-curve/stress-strain-curve.d.ts +4 -0
- package/dist/material/stress-strain-curve/stress-strain-curve.js +2 -0
- package/dist/material/stress-strain-curve/stress-strain-curve.js.map +1 -0
- package/dist/physics/body/collider-shape/mass-from-volume.d.ts +2 -0
- package/dist/physics/body/collider-shape/mass-from-volume.js +4 -0
- package/dist/physics/body/collider-shape/mass-from-volume.js.map +1 -0
- package/dist/physics/body/collider-shape/mass-from-volume.test.d.ts +1 -0
- package/dist/physics/body/collider-shape/mass-from-volume.test.js +8 -0
- package/dist/physics/body/collider-shape/mass-from-volume.test.js.map +1 -0
- package/dist/physics/collider-primitive-render-archetype.d.ts +2 -0
- package/dist/physics/collider-primitive-render-archetype.js +3 -0
- package/dist/physics/collider-primitive-render-archetype.js.map +1 -0
- package/dist/physics/collider-primitive-render-archetypes.d.ts +2 -0
- package/dist/physics/collider-primitive-render-archetypes.js +9 -0
- package/dist/physics/collider-primitive-render-archetypes.js.map +1 -0
- package/dist/physics/index.d.ts +1 -0
- package/dist/physics/index.js +3 -0
- package/dist/physics/index.js.map +1 -0
- package/dist/physics/is-voxel-shape-physics-pending.d.ts +3 -0
- package/dist/physics/is-voxel-shape-physics-pending.js +7 -0
- package/dist/physics/is-voxel-shape-physics-pending.js.map +1 -0
- package/dist/physics/physics-clock/physics-clock.d.ts +15 -0
- package/dist/physics/physics-clock/physics-clock.js +3 -0
- package/dist/physics/physics-clock/physics-clock.js.map +1 -0
- package/dist/physics/physics-clock-plugin.d.ts +2 -22
- package/dist/physics/physics-clock-plugin.js +0 -2
- package/dist/physics/physics-clock-plugin.js.map +1 -1
- package/dist/physics/physics-clock.test.js.map +1 -1
- package/dist/physics/physics-data-plugin.d.ts +889 -13
- package/dist/physics/physics-data-plugin.js +8 -6
- package/dist/physics/physics-data-plugin.js.map +1 -1
- package/dist/physics/public.d.ts +21 -0
- package/dist/physics/public.js +23 -0
- package/dist/physics/public.js.map +1 -0
- package/dist/physics/ragdoll/bone-capsule.d.ts +8 -0
- package/dist/physics/ragdoll/bone-capsule.js +3 -0
- package/dist/physics/ragdoll/bone-capsule.js.map +1 -0
- package/dist/physics/ragdoll/fit-bone-capsules-input.d.ts +11 -0
- package/dist/physics/ragdoll/fit-bone-capsules-input.js +3 -0
- package/dist/physics/ragdoll/fit-bone-capsules-input.js.map +1 -0
- package/dist/physics/ragdoll/fit-bone-capsules.d.ts +2 -38
- package/dist/physics/ragdoll/fit-bone-capsules.js +13 -0
- package/dist/physics/ragdoll/fit-bone-capsules.js.map +1 -1
- package/dist/physics/ragdoll/fit-bone-capsules.test.js.map +1 -1
- package/dist/physics/ragdoll/skin-vertices.d.ts +6 -0
- package/dist/physics/ragdoll/skin-vertices.js +3 -0
- package/dist/physics/ragdoll/skin-vertices.js.map +1 -0
- package/dist/physics/rigid-body-components.d.ts +2 -0
- package/dist/physics/rigid-body-components.js +13 -0
- package/dist/physics/rigid-body-components.js.map +1 -0
- package/dist/physics/solvers/jolt-solver-plugin.d.ts +918 -41
- package/dist/physics/solvers/jolt-solver-plugin.js +19 -3
- package/dist/physics/solvers/jolt-solver-plugin.js.map +1 -1
- package/dist/physics/solvers/rapier-solver-plugin.d.ts +918 -41
- package/dist/physics/solvers/rapier-solver-plugin.js +7 -2
- package/dist/physics/solvers/rapier-solver-plugin.js.map +1 -1
- package/dist/physics/solvers/solver-benchmark-options.d.ts +14 -0
- package/dist/physics/solvers/solver-benchmark-options.js +3 -0
- package/dist/physics/solvers/solver-benchmark-options.js.map +1 -0
- package/dist/physics/solvers/solver-benchmark-result.d.ts +15 -0
- package/dist/physics/solvers/solver-benchmark-result.js +3 -0
- package/dist/physics/solvers/solver-benchmark-result.js.map +1 -0
- package/dist/physics/solvers/solver-benchmark.d.ts +2 -43
- package/dist/physics/solvers/solver-benchmark.js.map +1 -1
- package/dist/physics/static-collider-components.d.ts +2 -0
- package/dist/physics/static-collider-components.js +10 -0
- package/dist/physics/static-collider-components.js.map +1 -0
- package/package.json +14 -2
- package/src/core/public.ts +4 -0
- package/src/graphics/camera/orbit/attach-orbit-drag.ts +7 -27
- package/src/graphics/camera/orbit/orbit-data-plugin.ts +1 -1
- package/src/graphics/camera/orbit/orbit-drag-service.ts +13 -0
- package/src/graphics/camera/orbit/orbit-system-plugin.ts +6 -9
- package/src/graphics/camera/orbit/orbit.ts +5 -5
- package/src/graphics/camera/orbit/public.ts +2 -2
- package/src/graphics/index.ts +3 -0
- package/src/graphics/picking/picking-plugin.ts +4 -4
- package/src/graphics/public.ts +40 -0
- package/src/graphics/rendering/bone-collider-plugin.ts +16 -12
- package/src/graphics/rendering/display-transform-plugin.ts +2 -2
- package/src/graphics/rendering/ibl-render/ibl-render-plugin.ts +9 -9
- package/src/graphics/rendering/interpolation.test.ts +1 -1
- package/src/graphics/rendering/jolt-ragdoll-plugin.ts +11 -7
- package/src/graphics/rendering/material-palette-gpu/material-palette-gpu-plugin.ts +86 -0
- package/src/graphics/rendering/material-palette-gpu/material-palette-gpu.test.ts +20 -0
- package/src/graphics/rendering/material-palette-gpu/material-palette.ts +41 -0
- package/src/graphics/rendering/material-palette-gpu/palette-bind-group.ts +24 -0
- package/src/graphics/rendering/model-collider-plugin.ts +19 -35
- package/src/graphics/rendering/pbr-core-plugin.ts +16 -19
- package/src/graphics/rendering/pbr-render/{pbr-render-plugin.ts → pbr-factor-render-plugin.ts} +60 -111
- package/src/graphics/rendering/pbr-render/{pbr-array-shader.wgsl.ts → pbr-factor-shader.wgsl.ts} +19 -40
- package/src/graphics/rendering/pbr-render/physics-bridge-plugin.ts +95 -69
- package/src/graphics/rendering/pbr-render/primitive-render-shared.ts +76 -0
- package/src/graphics/rendering/skinning/skinning-plugin.ts +23 -41
- package/src/graphics/scene/model/geometry/public.ts +1 -1
- package/src/graphics/scene/model/mesh/mesh.ts +18 -0
- package/src/graphics/scene/model/mesh/public.ts +3 -0
- package/src/graphics/scene/model/mesh-plugin.ts +102 -0
- package/src/graphics/scene/model/model-loader-plugin.ts +25 -43
- package/src/graphics/scene/model/model-plugin.ts +1 -44
- package/src/graphics/scene/model/model.ts +2 -6
- package/src/graphics/scene/model/public.ts +3 -1
- package/src/graphics/scene/model/shape/bounds-from-shape-mesh.ts +20 -0
- package/src/graphics/scene/model/shape/shape-geometry-plugin.ts +97 -18
- package/src/graphics/scene/model/shape/shape-spec.ts +9 -0
- package/src/graphics/scene/model/world-bounds-plugin.ts +6 -25
- package/src/graphics/scene/node/node-data-plugin.test.ts +47 -0
- package/src/graphics/scene/node/node-data-plugin.ts +12 -5
- package/src/graphics/scene/scene-plugin.ts +3 -3
- package/src/index.ts +1 -70
- package/src/material/assemble-material-row.ts +26 -0
- package/src/material/definitions.ts +427 -0
- package/src/material/emission-mode.ts +11 -0
- package/src/material/index.ts +3 -0
- package/src/material/json/from-json-string.ts +11 -0
- package/src/material/json/from-json.test.ts +50 -0
- package/src/material/json/from-json.ts +23 -0
- package/src/material/json/is-properties-json.ts +77 -0
- package/src/material/json/library-json.ts +4 -0
- package/src/material/json/load-json.ts +15 -0
- package/src/material/json/properties-json.ts +25 -0
- package/src/material/json/public.ts +9 -0
- package/src/material/json/to-definition.ts +70 -0
- package/src/material/material-by-name-lookup.ts +10 -0
- package/src/material/material-defaults.ts +26 -0
- package/src/material/material-definition.ts +4 -0
- package/src/material/material-name.ts +3 -0
- package/src/material/material-plugin.test.ts +97 -0
- package/src/material/material-plugin.ts +67 -39
- package/src/material/material.ts +35 -34
- package/src/material/public.ts +12 -2
- package/src/material/require-material.ts +15 -0
- package/src/material/standard-material-names.ts +4 -0
- package/src/material/standard-materials.ts +21 -27
- package/src/material/stress-strain-curve/create.ts +9 -0
- package/src/material/stress-strain-curve/public.ts +2 -0
- package/src/material/stress-strain-curve/schema.test.ts +20 -0
- package/src/material/stress-strain-curve/schema.ts +20 -0
- package/src/material/stress-strain-curve/stress-strain-curve.ts +11 -0
- package/src/physics/README.md +9 -1
- package/src/physics/body/collider-shape/mass-from-volume.test.ts +8 -0
- package/src/physics/body/collider-shape/mass-from-volume.ts +4 -0
- package/src/physics/collider-primitive-render-archetype.ts +5 -0
- package/src/physics/collider-primitive-render-archetypes.ts +9 -0
- package/src/physics/index.ts +3 -0
- package/src/physics/is-voxel-shape-physics-pending.ts +9 -0
- package/src/physics/physics-clock/physics-clock.ts +17 -0
- package/src/physics/physics-clock-plugin.ts +1 -24
- package/src/physics/physics-clock.test.ts +2 -1
- package/src/physics/physics-data-plugin.ts +8 -6
- package/src/physics/public.ts +23 -0
- package/src/physics/ragdoll/bone-capsule.ts +11 -0
- package/src/physics/ragdoll/fit-bone-capsules-input.ts +14 -0
- package/src/physics/ragdoll/fit-bone-capsules.test.ts +2 -1
- package/src/physics/ragdoll/fit-bone-capsules.ts +2 -27
- package/src/physics/ragdoll/skin-vertices.ts +8 -0
- package/src/physics/rigid-body-components.ts +13 -0
- package/src/physics/solvers/README.md +4 -0
- package/src/physics/solvers/jolt-solver-plugin.ts +19 -5
- package/src/physics/solvers/rapier-solver-plugin.ts +5 -2
- package/src/physics/solvers/solver-benchmark-options.ts +16 -0
- package/src/physics/solvers/solver-benchmark-result.ts +17 -0
- package/src/physics/solvers/solver-benchmark.ts +2 -35
- package/src/physics/static-collider-components.ts +10 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/graphics/rendering/material-gpu/material-arrays.ts +0 -113
- package/src/graphics/rendering/material-gpu/material-bind-group.ts +0 -61
- package/src/graphics/rendering/material-gpu/material-gpu-plugin.ts +0 -95
- package/src/graphics/scene/model/geometry/geometry.ts +0 -12
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
|
|
3
|
+
import type { Entity } from "@adobe/data/ecs";
|
|
4
|
+
|
|
5
|
+
/** True while a body carries `voxelShapeName` but the mesh ref is not yet resolved. */
|
|
6
|
+
export const isVoxelShapePhysicsPending = (store: unknown, id: Entity): boolean => {
|
|
7
|
+
const row = (store as { read(id: Entity): Record<string, unknown> | null }).read(id);
|
|
8
|
+
return row?.voxelShapeName != null && row?.voxelShape == null;
|
|
9
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fixed-timestep physics clock state — decouples simulation rate from render rate.
|
|
5
|
+
*/
|
|
6
|
+
export interface PhysicsClock {
|
|
7
|
+
/** Fixed simulation step length, seconds (default 1/60). */
|
|
8
|
+
readonly fixedDt: number;
|
|
9
|
+
/** Unsimulated time carried to the next frame, seconds (< fixedDt). */
|
|
10
|
+
readonly accumulator: number;
|
|
11
|
+
/** accumulator / fixedDt ∈ [0,1): render interpolation fraction prev→current. */
|
|
12
|
+
readonly alpha: number;
|
|
13
|
+
/** Whole steps the solver should run this frame (0..maxSubSteps). */
|
|
14
|
+
readonly steps: number;
|
|
15
|
+
/** Cap on steps/frame — prevents the "spiral of death" after a long stall. */
|
|
16
|
+
readonly maxSubSteps: number;
|
|
17
|
+
}
|
|
@@ -2,28 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Database } from "@adobe/data/ecs";
|
|
4
4
|
import { core } from "../core/core-plugin.js";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Fixed-timestep physics clock — decouples the simulation rate from the render
|
|
8
|
-
* rate (Fiedler "fix your timestep"). Each render frame the accumulator absorbs
|
|
9
|
-
* the variable `frameTime.dt`; the solver then runs a whole number of fixed
|
|
10
|
-
* `fixedDt` steps (0, 1, or several), and `alpha` is the leftover fraction used
|
|
11
|
-
* to interpolate the rendered pose between the last two simulated states.
|
|
12
|
-
*
|
|
13
|
-
* Default 60 Hz; set another rate at init with `setFixedTimestep(hz)`.
|
|
14
|
-
*/
|
|
15
|
-
export interface PhysicsClock {
|
|
16
|
-
/** Fixed simulation step length, seconds (default 1/60). */
|
|
17
|
-
readonly fixedDt: number;
|
|
18
|
-
/** Unsimulated time carried to the next frame, seconds (< fixedDt). */
|
|
19
|
-
readonly accumulator: number;
|
|
20
|
-
/** accumulator / fixedDt ∈ [0,1): render interpolation fraction prev→current. */
|
|
21
|
-
readonly alpha: number;
|
|
22
|
-
/** Whole steps the solver should run this frame (0..maxSubSteps). */
|
|
23
|
-
readonly steps: number;
|
|
24
|
-
/** Cap on steps/frame — prevents the "spiral of death" after a long stall. */
|
|
25
|
-
readonly maxSubSteps: number;
|
|
26
|
-
}
|
|
5
|
+
import type { PhysicsClock } from "./physics-clock/physics-clock.js";
|
|
27
6
|
|
|
28
7
|
const DEFAULT: PhysicsClock = { fixedDt: 1 / 60, accumulator: 0, alpha: 0, steps: 0, maxSubSteps: 8 };
|
|
29
8
|
|
|
@@ -50,8 +29,6 @@ export const physicsClock = Database.Plugin.create({
|
|
|
50
29
|
create: db => () => {
|
|
51
30
|
const c = db.store.resources.physicsClock;
|
|
52
31
|
const h = c.fixedDt;
|
|
53
|
-
// clamp the absorbed time to the step budget so a long stall (tab
|
|
54
|
-
// backgrounded, GC) can't queue hundreds of steps (spiral of death)
|
|
55
32
|
const acc = c.accumulator + Math.min(db.store.resources.frameTime.dt, h * c.maxSubSteps);
|
|
56
33
|
const steps = Math.min(Math.floor(acc / h), c.maxSubSteps);
|
|
57
34
|
db.store.resources.physicsClock = { ...c, accumulator: acc - steps * h, alpha: (acc - steps * h) / h, steps };
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { describe, it, expect } from "vitest";
|
|
4
4
|
import { Database } from "@adobe/data/ecs";
|
|
5
|
-
import { physicsClock
|
|
5
|
+
import { physicsClock } from "./physics-clock-plugin.js";
|
|
6
|
+
import type { PhysicsClock } from "./physics-clock/physics-clock.js";
|
|
6
7
|
|
|
7
8
|
/** The accumulator turns a variable render dt into a whole number of fixed steps
|
|
8
9
|
* plus a leftover interpolation `alpha`, capped against the spiral of death. */
|
|
@@ -7,6 +7,8 @@ import { BodyType } from "./body/body-type/body-type.js";
|
|
|
7
7
|
import { ColliderShape } from "./body/collider-shape/collider-shape.js";
|
|
8
8
|
import type { ColliderMesh } from "./body/collider-mesh.js";
|
|
9
9
|
import { Material } from "../material/material.js";
|
|
10
|
+
import { RIGID_BODY_COMPONENTS } from "./rigid-body-components.js";
|
|
11
|
+
import { STATIC_COLLIDER_COMPONENTS } from "./static-collider-components.js";
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* The shared, solver-agnostic rigid-body data model — the seam every physics
|
|
@@ -48,8 +50,8 @@ export const physicsData = Database.Plugin.create({
|
|
|
48
50
|
rotation: Quat.schema, // unified with Node.rotation so a body renders directly
|
|
49
51
|
linearVelocity: Vec3.schema,
|
|
50
52
|
angularVelocity: Vec3.schema,
|
|
51
|
-
_prevPosition: Vec3.schema, // derived: pose before the last fixed step (render interpolation)
|
|
52
|
-
_prevRotation: Quat.schema,
|
|
53
|
+
_prevPosition: { ...Vec3.schema, nonPersistent: true }, // derived: pose before the last fixed step (render interpolation)
|
|
54
|
+
_prevRotation: { ...Quat.schema, nonPersistent: true },
|
|
53
55
|
// Bodies sharing the same non-zero collisionGroup do not collide with each
|
|
54
56
|
// other (they still collide with group 0 / the world) — e.g. a ragdoll's
|
|
55
57
|
// bones. 0 = default (collide with everything). Honored by both solvers
|
|
@@ -63,11 +65,11 @@ export const physicsData = Database.Plugin.create({
|
|
|
63
65
|
colliderMesh: { default: null as ColliderMesh | null }, // colliderShape "mesh": static triangle soup
|
|
64
66
|
},
|
|
65
67
|
archetypes: {
|
|
66
|
-
RigidBody: [
|
|
67
|
-
StaticCollider: [
|
|
68
|
+
RigidBody: [...RIGID_BODY_COMPONENTS],
|
|
69
|
+
StaticCollider: [...STATIC_COLLIDER_COMPONENTS],
|
|
68
70
|
// A convex-hull body (dynamic / kinematic): authored as a point cloud.
|
|
69
|
-
ConvexBody: [
|
|
71
|
+
ConvexBody: [...RIGID_BODY_COMPONENTS, "convexPoints"],
|
|
70
72
|
// A static triangle-mesh collider (terrain / level geometry).
|
|
71
|
-
MeshCollider: [
|
|
73
|
+
MeshCollider: [...STATIC_COLLIDER_COMPONENTS, "colliderMesh"],
|
|
72
74
|
},
|
|
73
75
|
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
|
|
3
|
+
export * from "./physics-data-plugin.js";
|
|
4
|
+
export * from "./rigid-body-components.js";
|
|
5
|
+
export * from "./static-collider-components.js";
|
|
6
|
+
export * from "./collider-primitive-render-archetypes.js";
|
|
7
|
+
export * from "./collider-primitive-render-archetype.js";
|
|
8
|
+
export * from "./physics-clock/physics-clock.js";
|
|
9
|
+
export * from "./physics-clock-plugin.js";
|
|
10
|
+
export * from "./joint/joint-plugin.js";
|
|
11
|
+
export * from "./joint/joint.js";
|
|
12
|
+
export * from "./joint/joint-type/joint-type.js";
|
|
13
|
+
export * from "./body/rigid-body.js";
|
|
14
|
+
export * from "./body/static-collider.js";
|
|
15
|
+
export * from "./body/body-type/body-type.js";
|
|
16
|
+
export * from "./body/collider-shape/collider-shape.js";
|
|
17
|
+
export * from "./solvers/rapier-solver-plugin.js";
|
|
18
|
+
export * from "./solvers/jolt-solver-plugin.js";
|
|
19
|
+
export * from "./solvers/solver-benchmark.js";
|
|
20
|
+
export * from "./solvers/solver-benchmark-options.js";
|
|
21
|
+
export * from "./solvers/solver-benchmark-result.js";
|
|
22
|
+
export * from "./ragdoll/fit-bone-capsules.js";
|
|
23
|
+
export * from "./ragdoll/bone-capsule.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
|
|
3
|
+
import type { Quat, Vec3 } from "@adobe/data/math";
|
|
4
|
+
|
|
5
|
+
export interface BoneCapsule {
|
|
6
|
+
jointIndex: number;
|
|
7
|
+
offsetPosition: Vec3;
|
|
8
|
+
offsetRotation: Quat;
|
|
9
|
+
radius: number;
|
|
10
|
+
halfHeight: number;
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
|
|
3
|
+
import type { SkinVertices } from "./skin-vertices.js";
|
|
4
|
+
|
|
5
|
+
export interface FitBoneCapsulesInput {
|
|
6
|
+
jointCount: number;
|
|
7
|
+
/** glTF inverse-bind matrices, column-major, `jointCount × 16`. */
|
|
8
|
+
inverseBindMatrices: Float32Array;
|
|
9
|
+
skin: SkinVertices;
|
|
10
|
+
/** A vertex joins a bone only if its dominant weight ≥ this (default 0.5). */
|
|
11
|
+
minWeight?: number;
|
|
12
|
+
/** Bones with fewer assigned vertices than this get no capsule (default 6). */
|
|
13
|
+
minVertices?: number;
|
|
14
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
2
|
|
|
3
3
|
import { describe, it, expect } from "vitest";
|
|
4
|
-
import { fitBoneCapsules
|
|
4
|
+
import { fitBoneCapsules } from "./fit-bone-capsules.js";
|
|
5
|
+
import type { SkinVertices } from "./skin-vertices.js";
|
|
5
6
|
|
|
6
7
|
const IDENTITY_IBM = (n: number) => {
|
|
7
8
|
const m = new Float32Array(n * 16);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
2
|
|
|
3
3
|
import type { Vec3, Quat } from "@adobe/data/math";
|
|
4
|
+
import type { BoneCapsule } from "./bone-capsule.js";
|
|
5
|
+
import type { FitBoneCapsulesInput } from "./fit-bone-capsules-input.js";
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* Fits one capsule collider to each significant bone of a skinned mesh — the
|
|
@@ -16,33 +18,6 @@ import type { Vec3, Quat } from "@adobe/data/math";
|
|
|
16
18
|
* `jointWorldMatrix · offset`, tracking the animated skeleton.
|
|
17
19
|
*/
|
|
18
20
|
|
|
19
|
-
/** Skinned vertices in mesh (bind) space: `positions` (xyz triples), `joints`
|
|
20
|
-
* (4 joint indices/vertex), `weights` (4 weights/vertex). */
|
|
21
|
-
export interface SkinVertices {
|
|
22
|
-
positions: Float32Array;
|
|
23
|
-
joints: Uint32Array;
|
|
24
|
-
weights: Float32Array;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface FitBoneCapsulesInput {
|
|
28
|
-
jointCount: number;
|
|
29
|
-
/** glTF inverse-bind matrices, column-major, `jointCount × 16`. */
|
|
30
|
-
inverseBindMatrices: Float32Array;
|
|
31
|
-
skin: SkinVertices;
|
|
32
|
-
/** A vertex joins a bone only if its dominant weight ≥ this (default 0.5). */
|
|
33
|
-
minWeight?: number;
|
|
34
|
-
/** Bones with fewer assigned vertices than this get no capsule (default 6). */
|
|
35
|
-
minVertices?: number;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface BoneCapsule {
|
|
39
|
-
jointIndex: number;
|
|
40
|
-
offsetPosition: Vec3; // capsule centre, bone-bind-local
|
|
41
|
-
offsetRotation: Quat; // orients the Y-aligned capsule onto the fitted axis, bone-bind-local
|
|
42
|
-
radius: number;
|
|
43
|
-
halfHeight: number; // half-length of the cylindrical section
|
|
44
|
-
}
|
|
45
|
-
|
|
46
21
|
/** Transform a point by a column-major 4×4 matrix (slice `o..o+16`), into `out`. */
|
|
47
22
|
function transformPoint(m: Float32Array, o: number, x: number, y: number, z: number, out: [number, number, number]): void {
|
|
48
23
|
out[0] = m[o] * x + m[o + 4] * y + m[o + 8] * z + m[o + 12];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
|
|
3
|
+
/** Column set shared by `RigidBody`, `ConvexBody`, and `VoxelRigidBody`. */
|
|
4
|
+
export const RIGID_BODY_COMPONENTS = [
|
|
5
|
+
"bodyType",
|
|
6
|
+
"colliderShape",
|
|
7
|
+
"halfExtents",
|
|
8
|
+
"material",
|
|
9
|
+
"position",
|
|
10
|
+
"rotation",
|
|
11
|
+
"linearVelocity",
|
|
12
|
+
"angularVelocity",
|
|
13
|
+
] as const;
|
|
@@ -7,6 +7,10 @@ scene runs unchanged on any solver** (`Database.Plugin.combine(scene, solver)`).
|
|
|
7
7
|
|
|
8
8
|
Two production-grade solvers ship, both compiled to WASM and wired identically:
|
|
9
9
|
|
|
10
|
+
```ts
|
|
11
|
+
import { joltSolver, rapierSolver } from "@adobe/data-gpu/physics";
|
|
12
|
+
```
|
|
13
|
+
|
|
10
14
|
| solver | engine | license |
|
|
11
15
|
| --- | --- | --- |
|
|
12
16
|
| `joltSolver` | Jolt Physics (Jorrit Rouwe) | MIT |
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import initJolt from "jolt-physics";
|
|
4
4
|
import { Database, type Entity } from "@adobe/data/ecs";
|
|
5
|
+
import { isVoxelShapePhysicsPending } from "../is-voxel-shape-physics-pending.js";
|
|
5
6
|
import { True } from "@adobe/data/schema";
|
|
6
7
|
import { physicsClock } from "../physics-clock-plugin.js";
|
|
7
8
|
import { physicsData } from "../physics-data-plugin.js";
|
|
@@ -9,6 +10,7 @@ import { jointData } from "../joint/joint-plugin.js";
|
|
|
9
10
|
import { BodyType } from "../body/body-type/body-type.js";
|
|
10
11
|
import { ColliderShape } from "../body/collider-shape/collider-shape.js";
|
|
11
12
|
import type { ColliderMesh } from "../body/collider-mesh.js";
|
|
13
|
+
import { massFromVolume } from "../body/collider-shape/mass-from-volume.js";
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* A third rigid-body solver behind the same `physicsData` seam — Jolt Physics
|
|
@@ -60,7 +62,7 @@ type JVec3 = InstanceType<JoltModule["Vec3"]>;
|
|
|
60
62
|
type JShape = InstanceType<JoltModule["Shape"]>;
|
|
61
63
|
type JPhysicsSystem = InstanceType<JoltModule["PhysicsSystem"]>;
|
|
62
64
|
|
|
63
|
-
interface MatProps { restitution: number; friction: number }
|
|
65
|
+
interface MatProps { density: number; restitution: number; friction: number }
|
|
64
66
|
|
|
65
67
|
/** The live Jolt world, published once WASM init completes, so Jolt-native
|
|
66
68
|
* extensions (e.g. `joltRagdoll`) can add their own bodies/constraints into the
|
|
@@ -76,8 +78,8 @@ export interface JoltContext {
|
|
|
76
78
|
export const joltSolver = Database.Plugin.create({
|
|
77
79
|
extends: Database.Plugin.combine(physicsData, jointData, physicsClock),
|
|
78
80
|
components: {
|
|
79
|
-
_joltBody: True.schema, // tag: this body has been mirrored into the Jolt world
|
|
80
|
-
_joltJoint: True.schema, // tag: this joint has been mirrored into the Jolt world
|
|
81
|
+
_joltBody: { ...True.schema, nonPersistent: true }, // tag: this body has been mirrored into the Jolt world
|
|
82
|
+
_joltJoint: { ...True.schema, nonPersistent: true }, // tag: this joint has been mirrored into the Jolt world
|
|
81
83
|
},
|
|
82
84
|
resources: {
|
|
83
85
|
_joltContext: { default: null as JoltContext | null, nonPersistent: true },
|
|
@@ -95,8 +97,8 @@ export const joltSolver = Database.Plugin.create({
|
|
|
95
97
|
const bodies = new Map<Entity, JBody>(); // entity → Jolt body
|
|
96
98
|
|
|
97
99
|
const matPropsOf = (id: Entity): MatProps => {
|
|
98
|
-
const m = db.store.read(id) as { restitution?: number; friction?: number } | null;
|
|
99
|
-
return { restitution: m?.restitution ?? 0.2, friction: m?.friction ?? 0.5 };
|
|
100
|
+
const m = db.store.read(id) as { density?: number; restitution?: number; friction?: number } | null;
|
|
101
|
+
return { density: m?.density ?? 1, restitution: m?.restitution ?? 0.2, friction: m?.friction ?? 0.5 };
|
|
100
102
|
};
|
|
101
103
|
|
|
102
104
|
// hull/mesh colliders may be auto-generated from a model that's still
|
|
@@ -197,6 +199,16 @@ export const joltSolver = Database.Plugin.create({
|
|
|
197
199
|
const settings = new jolt.BodyCreationSettings(shp, pos, rot, motionType, layer);
|
|
198
200
|
settings.mRestitution = m.restitution;
|
|
199
201
|
settings.mFriction = m.friction;
|
|
202
|
+
if (motion === "dynamic") {
|
|
203
|
+
const volume = shp.GetVolume();
|
|
204
|
+
if (volume > 0) {
|
|
205
|
+
const mp = shp.GetMassProperties();
|
|
206
|
+
mp.ScaleToMass(massFromVolume(volume, m.density));
|
|
207
|
+
settings.mOverrideMassProperties = jolt.EOverrideMassProperties_MassAndInertiaProvided;
|
|
208
|
+
settings.mMassPropertiesOverride = mp;
|
|
209
|
+
jolt.destroy(mp);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
200
212
|
const body = bi.CreateBody(settings);
|
|
201
213
|
bi.AddBody(body.GetID(), motion === "static" ? jolt.EActivation_DontActivate : jolt.EActivation_Activate);
|
|
202
214
|
if (motion === "dynamic" && (vx || vy || vz || wx || wy || wz)) {
|
|
@@ -233,6 +245,7 @@ export const joltSolver = Database.Plugin.create({
|
|
|
233
245
|
for (let r = arch.rowCount - 1; r >= 0; r--) {
|
|
234
246
|
const id = ids.get(r), bodyType = bt.get(r), shape = cs.get(r), h = he.get(r), p = pos.get(r), o = ori.get(r), v = lv.get(r), w = av.get(r);
|
|
235
247
|
if (!colliderReady(id, shape)) continue; // auto-collider not generated yet
|
|
248
|
+
if (isVoxelShapePhysicsPending(db.store, id)) continue;
|
|
236
249
|
ensureBody(jolt, bi, id, bodyType, shape, h[0], h[1], h[2], mat.get(r), p[0], p[1], p[2], o, v[0], v[1], v[2], w[0], w[1], w[2]);
|
|
237
250
|
// Tag as mirrored. Dynamics also migrate onto the derived prev-pose
|
|
238
251
|
// snapshot (the interpolator reads it); kinematic bodies are authored
|
|
@@ -247,6 +260,7 @@ export const joltSolver = Database.Plugin.create({
|
|
|
247
260
|
for (let r = arch.rowCount - 1; r >= 0; r--) {
|
|
248
261
|
const id = ids.get(r), shape = cs.get(r), h = he.get(r), p = pos.get(r);
|
|
249
262
|
if (!colliderReady(id, shape)) continue; // auto-collider not generated yet
|
|
263
|
+
if (isVoxelShapePhysicsPending(db.store, id)) continue;
|
|
250
264
|
ensureBody(jolt, bi, id, "static", shape, h[0], h[1], h[2], mat.get(r), p[0], p[1], p[2], ori.get(r), 0, 0, 0, 0, 0, 0);
|
|
251
265
|
db.store.update(id, { _joltBody: true });
|
|
252
266
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import RAPIER from "@dimforge/rapier3d-compat";
|
|
4
4
|
import { Database, type Entity } from "@adobe/data/ecs";
|
|
5
|
+
import { isVoxelShapePhysicsPending } from "../is-voxel-shape-physics-pending.js";
|
|
5
6
|
import { True } from "@adobe/data/schema";
|
|
6
7
|
import { physicsClock } from "../physics-clock-plugin.js";
|
|
7
8
|
import { physicsData } from "../physics-data-plugin.js";
|
|
@@ -47,8 +48,8 @@ interface MatProps { density: number; restitution: number; friction: number }
|
|
|
47
48
|
export const rapierSolver = Database.Plugin.create({
|
|
48
49
|
extends: Database.Plugin.combine(physicsData, jointData, physicsClock),
|
|
49
50
|
components: {
|
|
50
|
-
_rapierBody: True.schema, // tag: this body has been mirrored into the Rapier world
|
|
51
|
-
_rapierJoint: True.schema, // tag: this joint has been mirrored into the Rapier world
|
|
51
|
+
_rapierBody: { ...True.schema, nonPersistent: true }, // tag: this body has been mirrored into the Rapier world
|
|
52
|
+
_rapierJoint: { ...True.schema, nonPersistent: true }, // tag: this joint has been mirrored into the Rapier world
|
|
52
53
|
},
|
|
53
54
|
systems: {
|
|
54
55
|
rapierStep: {
|
|
@@ -125,6 +126,7 @@ export const rapierSolver = Database.Plugin.create({
|
|
|
125
126
|
for (let r = arch.rowCount - 1; r >= 0; r--) {
|
|
126
127
|
const id = ids.get(r), bodyType = bt.get(r), shape = cs.get(r), h = he.get(r), p = pos.get(r), o = ori.get(r), v = lv.get(r), w = av.get(r);
|
|
127
128
|
if (!colliderReady(id, shape)) continue; // auto-collider not generated yet
|
|
129
|
+
if (isVoxelShapePhysicsPending(db.store, id)) continue;
|
|
128
130
|
ensureBody(id, bodyType, shape, h[0], h[1], h[2], mat.get(r), p[0], p[1], p[2], o, v[0], v[1], v[2], w[0], w[1], w[2]);
|
|
129
131
|
// Tag as mirrored. Dynamics also migrate onto the derived prev-pose
|
|
130
132
|
// snapshot (the interpolator reads it); kinematic bodies are authored
|
|
@@ -139,6 +141,7 @@ export const rapierSolver = Database.Plugin.create({
|
|
|
139
141
|
for (let r = arch.rowCount - 1; r >= 0; r--) {
|
|
140
142
|
const id = ids.get(r), shape = cs.get(r), h = he.get(r), p = pos.get(r);
|
|
141
143
|
if (!colliderReady(id, shape)) continue; // auto-collider not generated yet
|
|
144
|
+
if (isVoxelShapePhysicsPending(db.store, id)) continue;
|
|
142
145
|
ensureBody(id, "static", shape, h[0], h[1], h[2], mat.get(r), p[0], p[1], p[2], ori.get(r), 0, 0, 0, 0, 0, 0);
|
|
143
146
|
db.store.update(id, { _rapierBody: true });
|
|
144
147
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
|
|
3
|
+
export interface SolverBenchmarkOptions {
|
|
4
|
+
/** Dynamic bodies dropped into the scene (≈ workload size). Default 256. */
|
|
5
|
+
bodies?: number;
|
|
6
|
+
/** Timed frames. Default 300. */
|
|
7
|
+
frames?: number;
|
|
8
|
+
/** Warm-up frames before timing. Default 90. */
|
|
9
|
+
warmupFrames?: number;
|
|
10
|
+
/** Fixed timestep per frame (seconds). Default 1/60. */
|
|
11
|
+
dt?: number;
|
|
12
|
+
/** Fraction of `bodies` that are spheres (rest are boxes). Default 0.5. */
|
|
13
|
+
sphereFraction?: number;
|
|
14
|
+
/** Extra static collider boxes as resting scenery. Default 0. */
|
|
15
|
+
staticBodies?: number;
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
|
|
3
|
+
export interface SolverBenchmarkResult {
|
|
4
|
+
bodies: number;
|
|
5
|
+
frames: number;
|
|
6
|
+
/** Total wall-clock time of the timed frames (ms). */
|
|
7
|
+
totalMs: number;
|
|
8
|
+
/** Mean cost of one frame (ms). */
|
|
9
|
+
msPerFrame: number;
|
|
10
|
+
/** Simulation frames per real second. */
|
|
11
|
+
simFps: number;
|
|
12
|
+
/** Slowest single frame (ms). */
|
|
13
|
+
maxFrameMs: number;
|
|
14
|
+
avgY: number;
|
|
15
|
+
maxSpeed: number;
|
|
16
|
+
belowFloor: number;
|
|
17
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
2
|
|
|
3
3
|
import { Database } from "@adobe/data/ecs";
|
|
4
|
+
import type { SolverBenchmarkOptions } from "./solver-benchmark-options.js";
|
|
5
|
+
import type { SolverBenchmarkResult } from "./solver-benchmark-result.js";
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* Headless benchmark harness for a physics **solver plugin** (anything built on
|
|
@@ -14,41 +16,6 @@ import { Database } from "@adobe/data/ecs";
|
|
|
14
16
|
* yields to the event loop so that init + scene settling complete before timing.
|
|
15
17
|
*/
|
|
16
18
|
|
|
17
|
-
export interface SolverBenchmarkOptions {
|
|
18
|
-
/** Dynamic bodies dropped into the scene (≈ workload size). Default 256. */
|
|
19
|
-
bodies?: number;
|
|
20
|
-
/** Timed frames. Default 300. */
|
|
21
|
-
frames?: number;
|
|
22
|
-
/** Warm-up frames before timing (lets async init finish + the pile settle). Default 90. */
|
|
23
|
-
warmupFrames?: number;
|
|
24
|
-
/** Fixed timestep per frame (seconds). Default 1/60. */
|
|
25
|
-
dt?: number;
|
|
26
|
-
/** Fraction of `bodies` that are spheres (rest are boxes). Default 0.5. */
|
|
27
|
-
sphereFraction?: number;
|
|
28
|
-
/** Extra *static* collider boxes laid out as resting scenery. They barely
|
|
29
|
-
* cost the engine (nothing moves) but they ARE mirrored once and then scanned
|
|
30
|
-
* by a naive per-frame sync — so this isolates the gather/sync overhead, which
|
|
31
|
-
* is the realistic "many static, few dynamic" target workload. Default 0. */
|
|
32
|
-
staticBodies?: number;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface SolverBenchmarkResult {
|
|
36
|
-
bodies: number;
|
|
37
|
-
frames: number;
|
|
38
|
-
/** Total wall-clock time of the timed frames (ms). */
|
|
39
|
-
totalMs: number;
|
|
40
|
-
/** Mean cost of one frame (ms) — the headline number. */
|
|
41
|
-
msPerFrame: number;
|
|
42
|
-
/** Simulation frames per real second (1000 / msPerFrame). */
|
|
43
|
-
simFps: number;
|
|
44
|
-
/** Slowest single frame (ms) — surfaces hitches. */
|
|
45
|
-
maxFrameMs: number;
|
|
46
|
-
// --- coarse end-state, for cross-solver parity / sanity (not perf) ---
|
|
47
|
-
avgY: number; // mean height of dynamic bodies (piled ≈ low, exploded ≈ wild)
|
|
48
|
-
maxSpeed: number; // fastest dynamic body (a stable pile is near 0)
|
|
49
|
-
belowFloor: number; // dynamic bodies that sank below the floor top (should be 0)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
19
|
interface LooseStore {
|
|
53
20
|
archetypes: Record<string, { insert(v: unknown): number }>;
|
|
54
21
|
queryArchetypes(include: readonly string[], opts?: { exclude?: readonly string[] }): Iterable<{
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
|
|
3
|
+
/** Column set shared by `StaticCollider`, `MeshCollider`, and `VoxelStaticCollider`. */
|
|
4
|
+
export const STATIC_COLLIDER_COMPONENTS = [
|
|
5
|
+
"colliderShape",
|
|
6
|
+
"halfExtents",
|
|
7
|
+
"material",
|
|
8
|
+
"position",
|
|
9
|
+
"rotation",
|
|
10
|
+
] as const;
|