@adobe/data-gpu 0.9.75 → 0.9.76
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,76 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
|
|
3
|
+
import type { Entity } from "@adobe/data/ecs";
|
|
4
|
+
|
|
5
|
+
/** Must match `pbrIblRender` IBL bake mip count. */
|
|
6
|
+
export const PREFILTERED_MIP_COUNT = 7;
|
|
7
|
+
|
|
8
|
+
/** Drawable: visible entity with mesh ref, transform, and material. */
|
|
9
|
+
export const DRAWABLE = ["mesh", "visible", "position", "rotation", "scale", "material"] as const;
|
|
10
|
+
export const DRAWABLE_INTERP = [...DRAWABLE, "_renderPosition", "_renderRotation"] as const;
|
|
11
|
+
export const DRAWABLE_DIRECT = { exclude: ["_renderPosition"] } as const;
|
|
12
|
+
export const PRIMITIVE = ["_vertexBuffer", "_indexBuffer", "_indexCount", "_indexFormat", "_mesh", "_nodeLocalMatrix"] as const;
|
|
13
|
+
|
|
14
|
+
/** Minimal column shape the gather reads — satisfied by either query's columns. */
|
|
15
|
+
export interface ColumnReader<T> { get(i: number): T }
|
|
16
|
+
|
|
17
|
+
export function createIblBindGroupLayout(device: GPUDevice): GPUBindGroupLayout {
|
|
18
|
+
return device.createBindGroupLayout({
|
|
19
|
+
entries: [
|
|
20
|
+
{ binding: 0, visibility: GPUShaderStage.FRAGMENT, texture: { sampleType: "float", viewDimension: "cube" } },
|
|
21
|
+
{ binding: 1, visibility: GPUShaderStage.FRAGMENT, texture: { sampleType: "float", viewDimension: "cube" } },
|
|
22
|
+
{ binding: 2, visibility: GPUShaderStage.FRAGMENT, texture: { sampleType: "float", viewDimension: "2d" } },
|
|
23
|
+
{ binding: 3, visibility: GPUShaderStage.FRAGMENT, sampler: { type: "filtering" } },
|
|
24
|
+
],
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Compose column-major TRS into `out[o..o+15]`. */
|
|
29
|
+
export function composeTrs(
|
|
30
|
+
out: Float32Array, o: number,
|
|
31
|
+
p: ArrayLike<number>, pi: number, q: ArrayLike<number>, qi: number, s: ArrayLike<number>, si: number,
|
|
32
|
+
): void {
|
|
33
|
+
const qx = q[qi], qy = q[qi + 1], qz = q[qi + 2], qw = q[qi + 3];
|
|
34
|
+
const sx = s[si], sy = s[si + 1], sz = s[si + 2];
|
|
35
|
+
const xx = qx * qx, yy = qy * qy, zz = qz * qz;
|
|
36
|
+
const xy = qx * qy, xz = qx * qz, yz = qy * qz;
|
|
37
|
+
const wx = qw * qx, wy = qw * qy, wz = qw * qz;
|
|
38
|
+
out[o] = (1 - 2 * (yy + zz)) * sx; out[o + 1] = (2 * (xy + wz)) * sx; out[o + 2] = (2 * (xz - wy)) * sx; out[o + 3] = 0;
|
|
39
|
+
out[o + 4] = (2 * (xy - wz)) * sy; out[o + 5] = (1 - 2 * (xx + zz)) * sy; out[o + 6] = (2 * (yz + wx)) * sy; out[o + 7] = 0;
|
|
40
|
+
out[o + 8] = (2 * (xz + wy)) * sz; out[o + 9] = (2 * (yz - wx)) * sz; out[o + 10] = (1 - 2 * (xx + yy)) * sz; out[o + 11] = 0;
|
|
41
|
+
out[o + 12] = p[pi]; out[o + 13] = p[pi + 1]; out[o + 14] = p[pi + 2]; out[o + 15] = 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface MeshBatch {
|
|
45
|
+
off: number[];
|
|
46
|
+
materialIndex: number[];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** @deprecated Use `MeshBatch`. */
|
|
50
|
+
export type GeometryBatch = MeshBatch;
|
|
51
|
+
|
|
52
|
+
export interface InstancedDrawCache {
|
|
53
|
+
buffer: GPUBuffer;
|
|
54
|
+
indexBuffer: GPUBuffer;
|
|
55
|
+
bindGroup: GPUBindGroup;
|
|
56
|
+
capacity: number;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Refresh material entity → GPU index map when the tagged material set grows. */
|
|
60
|
+
export function refreshMaterialIndexMap(
|
|
61
|
+
db: { store: { queryArchetypes: (cols: string[]) => Iterable<{ rowCount: number; columns: { id: ColumnReader<Entity>; [k: string]: ColumnReader<number> } }> } },
|
|
62
|
+
indexColumn: string,
|
|
63
|
+
matCount: { value: number },
|
|
64
|
+
matIndex: Map<Entity, number>,
|
|
65
|
+
): void {
|
|
66
|
+
let mc = 0;
|
|
67
|
+
for (const arch of db.store.queryArchetypes([indexColumn])) mc += arch.rowCount;
|
|
68
|
+
if (mc === matCount.value) return;
|
|
69
|
+
matIndex.clear();
|
|
70
|
+
for (const arch of db.store.queryArchetypes([indexColumn])) {
|
|
71
|
+
const id = arch.columns.id;
|
|
72
|
+
const col = arch.columns[indexColumn];
|
|
73
|
+
for (let i = 0; i < arch.rowCount; i++) matIndex.set(id.get(i), col.get(i));
|
|
74
|
+
}
|
|
75
|
+
matCount.value = mc;
|
|
76
|
+
}
|
|
@@ -9,36 +9,21 @@ import { animation } from "../../animation/animation-plugin.js";
|
|
|
9
9
|
import type { JointTemplate } from "../../scene/model/gltf/parse-skin.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* pbrSkinning
|
|
13
|
-
*
|
|
14
|
-
* read:
|
|
15
|
-
* geometry
|
|
16
|
-
* _skinJointTemplate (from Geometry)
|
|
17
|
-
* _skinInverseBindMatrices (from Geometry)
|
|
18
|
-
* _animationClipRefs (from Geometry)
|
|
19
|
-
* _worldMatrix (from Model + joint Nodes)
|
|
20
|
-
* write:
|
|
21
|
-
* _Skeleton // new ephemeral entity, one per skinned Model
|
|
22
|
-
* Node // joint entities (TRS hierarchy)
|
|
23
|
-
* Animation // optional, when geometry has clips
|
|
24
|
-
* _skeletonInstanceBuffer
|
|
25
|
-
* _skeletonJointMatrixBuffer
|
|
26
|
-
* _skeletonJointMatrixBindGroup
|
|
12
|
+
* pbrSkinning — builds a `_Skeleton` for each `Model` whose `mesh` is a
|
|
13
|
+
* `SkinnedMesh` (non-empty `skinJointTemplate`).
|
|
27
14
|
*/
|
|
28
15
|
export const pbrSkinning = Database.Plugin.create({
|
|
29
16
|
extends: Database.Plugin.combine(modelLoader, pbrCore, transform, animation),
|
|
30
17
|
components: {
|
|
31
|
-
_skeletonJoints: { default: [] as number[] },
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/** N × 64 bytes — joint skinning matrices, refreshed each frame. */
|
|
36
|
-
_skeletonJointMatrixBuffer: { default: null as GPUBuffer | null },
|
|
18
|
+
_skeletonJoints: { default: [] as number[], nonPersistent: true },
|
|
19
|
+
_skeletonMesh: { ...Entity.schema, nonPersistent: true },
|
|
20
|
+
_skeletonInstanceBuffer: { default: null as GPUBuffer | null, nonPersistent: true },
|
|
21
|
+
_skeletonJointMatrixBuffer: { default: null as GPUBuffer | null, nonPersistent: true },
|
|
37
22
|
},
|
|
38
23
|
archetypes: {
|
|
39
24
|
_Skeleton: [
|
|
40
25
|
"_skeletonJoints",
|
|
41
|
-
"
|
|
26
|
+
"_skeletonMesh",
|
|
42
27
|
"_skeletonModelRef",
|
|
43
28
|
"_skeletonInstanceBuffer",
|
|
44
29
|
"_skeletonJointMatrixBuffer",
|
|
@@ -48,7 +33,7 @@ export const pbrSkinning = Database.Plugin.create({
|
|
|
48
33
|
transactions: {
|
|
49
34
|
initSkeleton(t, args: {
|
|
50
35
|
modelRef: number;
|
|
51
|
-
|
|
36
|
+
meshRef: number;
|
|
52
37
|
jointTemplate: readonly JointTemplate[];
|
|
53
38
|
instanceBuffer: GPUBuffer;
|
|
54
39
|
jointMatrixBuffer: GPUBuffer;
|
|
@@ -56,9 +41,6 @@ export const pbrSkinning = Database.Plugin.create({
|
|
|
56
41
|
clipRef: number | null;
|
|
57
42
|
}) {
|
|
58
43
|
const jointIds: number[] = new Array(args.jointTemplate.length);
|
|
59
|
-
// jointTemplate is in glTF skin.joints[] order. Parents can come
|
|
60
|
-
// after children in glTF, so resolve parent entity ids in two passes:
|
|
61
|
-
// first insert with parent=0, then update each joint's parent.
|
|
62
44
|
for (let i = 0; i < args.jointTemplate.length; i++) {
|
|
63
45
|
const j = args.jointTemplate[i];
|
|
64
46
|
jointIds[i] = t.archetypes.Node.insert({
|
|
@@ -76,7 +58,7 @@ export const pbrSkinning = Database.Plugin.create({
|
|
|
76
58
|
}
|
|
77
59
|
t.archetypes._Skeleton.insert({
|
|
78
60
|
_skeletonJoints: jointIds,
|
|
79
|
-
|
|
61
|
+
_skeletonMesh: args.meshRef,
|
|
80
62
|
_skeletonModelRef: args.modelRef,
|
|
81
63
|
_skeletonInstanceBuffer: args.instanceBuffer,
|
|
82
64
|
_skeletonJointMatrixBuffer: args.jointMatrixBuffer,
|
|
@@ -110,15 +92,18 @@ export const pbrSkinning = Database.Plugin.create({
|
|
|
110
92
|
],
|
|
111
93
|
});
|
|
112
94
|
}
|
|
113
|
-
for (const arch of db.store.queryArchetypes(["
|
|
95
|
+
for (const arch of db.store.queryArchetypes(["mesh"])) {
|
|
114
96
|
const ids = arch.columns.id;
|
|
115
|
-
const
|
|
97
|
+
const meshRefs = arch.columns.mesh;
|
|
116
98
|
for (let i = 0; i < arch.rowCount; i++) {
|
|
117
99
|
const modelId = ids.get(i);
|
|
118
100
|
if (initialized.has(modelId)) continue;
|
|
119
|
-
const
|
|
120
|
-
const
|
|
121
|
-
|
|
101
|
+
const meshId = meshRefs.get(i);
|
|
102
|
+
const asset = db.store.read(meshId) as {
|
|
103
|
+
skinJointTemplate?: JointTemplate[];
|
|
104
|
+
animationClipRefs?: number[];
|
|
105
|
+
} | null;
|
|
106
|
+
const template = asset?.skinJointTemplate;
|
|
122
107
|
if (!template || template.length === 0) continue;
|
|
123
108
|
initialized.add(modelId);
|
|
124
109
|
|
|
@@ -139,12 +124,12 @@ export const pbrSkinning = Database.Plugin.create({
|
|
|
139
124
|
});
|
|
140
125
|
db.transactions.initSkeleton({
|
|
141
126
|
modelRef: modelId,
|
|
142
|
-
|
|
127
|
+
meshRef: meshId,
|
|
143
128
|
jointTemplate: template,
|
|
144
129
|
instanceBuffer,
|
|
145
130
|
jointMatrixBuffer: matrixBuffer,
|
|
146
131
|
jointMatrixBindGroup: matrixBindGroup,
|
|
147
|
-
clipRef:
|
|
132
|
+
clipRef: asset?.animationClipRefs?.[0] ?? null,
|
|
148
133
|
});
|
|
149
134
|
}
|
|
150
135
|
}
|
|
@@ -160,29 +145,28 @@ export const pbrSkinning = Database.Plugin.create({
|
|
|
160
145
|
if (!device) return;
|
|
161
146
|
for (const arch of db.store.queryArchetypes([
|
|
162
147
|
"_skeletonJoints",
|
|
163
|
-
"
|
|
148
|
+
"_skeletonMesh",
|
|
164
149
|
"_skeletonModelRef",
|
|
165
150
|
"_skeletonInstanceBuffer",
|
|
166
151
|
"_skeletonJointMatrixBuffer",
|
|
167
152
|
])) {
|
|
168
153
|
const jointsCol = arch.columns._skeletonJoints;
|
|
169
|
-
const
|
|
154
|
+
const meshCol = arch.columns._skeletonMesh;
|
|
170
155
|
const modelCol = arch.columns._skeletonModelRef;
|
|
171
156
|
const instBufCol = arch.columns._skeletonInstanceBuffer;
|
|
172
157
|
const bufCol = arch.columns._skeletonJointMatrixBuffer;
|
|
173
158
|
for (let i = 0; i < arch.rowCount; i++) {
|
|
174
159
|
const joints = jointsCol.get(i);
|
|
175
|
-
const
|
|
160
|
+
const meshId = meshCol.get(i);
|
|
176
161
|
const modelId = modelCol.get(i);
|
|
177
162
|
const instanceBuffer = instBufCol.get(i);
|
|
178
163
|
const buffer = bufCol.get(i);
|
|
179
164
|
if (!buffer || !instanceBuffer) continue;
|
|
180
|
-
const ibm = db.store.get(
|
|
165
|
+
const ibm = db.store.get(meshId, "skinInverseBindMatrices") as Float32Array | null;
|
|
181
166
|
if (!ibm) continue;
|
|
182
167
|
const modelWorld = db.store.get(modelId, "_worldMatrix");
|
|
183
168
|
if (!modelWorld) continue;
|
|
184
169
|
|
|
185
|
-
// The vertex shader's `instances[0]` slot.
|
|
186
170
|
device.queue.writeBuffer(instanceBuffer, 0, new Float32Array(modelWorld));
|
|
187
171
|
|
|
188
172
|
const invModelWorld = Mat4x4.inverse(modelWorld);
|
|
@@ -191,8 +175,6 @@ export const pbrSkinning = Database.Plugin.create({
|
|
|
191
175
|
}
|
|
192
176
|
for (let j = 0; j < joints.length; j++) {
|
|
193
177
|
const jw = db.store.get(joints[j], "_worldMatrix") ?? Mat4x4.identity;
|
|
194
|
-
// inverse(modelWorld) × jointWorld × IBM — leaves vertices in
|
|
195
|
-
// model-local space; vertex shader applies modelWorld separately.
|
|
196
178
|
const ibmJoint: Mat4x4 = [
|
|
197
179
|
ibm[j * 16 + 0], ibm[j * 16 + 1], ibm[j * 16 + 2], ibm[j * 16 + 3],
|
|
198
180
|
ibm[j * 16 + 4], ibm[j * 16 + 5], ibm[j * 16 + 6], ibm[j * 16 + 7],
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
|
|
3
|
+
import type { Aabb } from "@adobe/data/math";
|
|
4
|
+
import type { JointTemplate } from "../gltf/parse-skin.js";
|
|
5
|
+
|
|
6
|
+
/** Baked static mesh asset — local-space bounds only. */
|
|
7
|
+
export interface StaticMesh {
|
|
8
|
+
localBounds: Aabb;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Baked skinned mesh asset — static capabilities plus skeleton/animation data. */
|
|
12
|
+
export interface SkinnedMesh extends StaticMesh {
|
|
13
|
+
skinJointTemplate: JointTemplate[];
|
|
14
|
+
skinInverseBindMatrices: Float32Array | null;
|
|
15
|
+
animationClipRefs: number[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export * as Mesh from "./public.js";
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
|
|
3
|
+
import { Database, Entity } from "@adobe/data/ecs";
|
|
4
|
+
import { Aabb, Quat, type Vec3 } from "@adobe/data/math";
|
|
5
|
+
import { Node } from "../node/node.js";
|
|
6
|
+
import { plugin as Material } from "../../../material/material-plugin.js";
|
|
7
|
+
import type { ShapeSpec } from "./shape/shape-spec.js";
|
|
8
|
+
import type { JointTemplate } from "./gltf/parse-skin.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Mesh asset model — separates mesh **intent** (pending import), **asset**
|
|
12
|
+
* (static or skinned capabilities), and **instance** (placed drawables).
|
|
13
|
+
*
|
|
14
|
+
* - `GltfMeshPending` / `ShapeMeshPending` — work queue; the entity id is the
|
|
15
|
+
* stable mesh handle instances can reference before GPU data exists.
|
|
16
|
+
* - `StaticMesh` / `SkinnedMesh` — baked assets with capability components.
|
|
17
|
+
* - `Model` — hierarchical instance (glTF / scene graph).
|
|
18
|
+
* - `MeshInstance` — render-only instance with a material (factor path).
|
|
19
|
+
*/
|
|
20
|
+
export const mesh = Database.Plugin.create({
|
|
21
|
+
extends: Database.Plugin.combine(Node.plugin, Material),
|
|
22
|
+
components: {
|
|
23
|
+
/** Instance → baked mesh asset entity. */
|
|
24
|
+
mesh: Entity.schema,
|
|
25
|
+
/** Pending glTF import — cleared when the row migrates to Static/SkinnedMesh. */
|
|
26
|
+
gltfUrl: { type: "string" },
|
|
27
|
+
/** Pending procedural import — cleared when baked to StaticMesh. */
|
|
28
|
+
shapeSpec: { default: null as ShapeSpec | null },
|
|
29
|
+
/** Optional grid dimensions on baked mesh assets (used by extensions for scale). */
|
|
30
|
+
voxelVolumeSize: { default: null as Vec3 | null },
|
|
31
|
+
/** Asset-space axis-aligned bounds (all baked meshes). */
|
|
32
|
+
localBounds: { default: null as Aabb | null },
|
|
33
|
+
/** Skinned-mesh capabilities (SkinnedMesh archetype). */
|
|
34
|
+
skinJointTemplate: { default: [] as JointTemplate[] },
|
|
35
|
+
skinInverseBindMatrices: { default: null as Float32Array | null },
|
|
36
|
+
animationClipRefs: { default: [] as number[] },
|
|
37
|
+
/** CPU-retained collision source for auto-collider generation. */
|
|
38
|
+
cpuCollisionPositions: { default: null as Float32Array | null },
|
|
39
|
+
cpuCollisionIndices: { default: null as Uint32Array | null },
|
|
40
|
+
/** CPU-retained skin bind data for ragdoll capsule fitting. */
|
|
41
|
+
cpuSkin: { default: null as { positions: Float32Array; joints: Uint32Array; weights: Float32Array } | null },
|
|
42
|
+
},
|
|
43
|
+
resources: {
|
|
44
|
+
_gltfMeshByUrl: { default: null as Map<string, Entity> | null, nonPersistent: true },
|
|
45
|
+
},
|
|
46
|
+
archetypes: {
|
|
47
|
+
GltfMeshPending: ["gltfUrl"],
|
|
48
|
+
ShapeMeshPending: ["shapeSpec"],
|
|
49
|
+
StaticMesh: ["localBounds"],
|
|
50
|
+
SkinnedMesh: ["localBounds", "skinJointTemplate", "skinInverseBindMatrices", "animationClipRefs"],
|
|
51
|
+
MeshInstance: ["mesh", "position", "rotation", "scale", "visible", "material"],
|
|
52
|
+
Model: ["mesh", "position", "rotation", "scale", "visible", "parent"],
|
|
53
|
+
},
|
|
54
|
+
transactions: {
|
|
55
|
+
insertGltfMesh(t, args: { url: string }): Entity {
|
|
56
|
+
const map = t.resources._gltfMeshByUrl ??= new Map();
|
|
57
|
+
const existing = map.get(args.url);
|
|
58
|
+
if (existing != null) return existing;
|
|
59
|
+
const id = t.archetypes.GltfMeshPending.insert({ gltfUrl: args.url });
|
|
60
|
+
map.set(args.url, id);
|
|
61
|
+
return id;
|
|
62
|
+
},
|
|
63
|
+
insertShapeMesh(t, args: { shapeSpec: ShapeSpec }): Entity {
|
|
64
|
+
return t.archetypes.ShapeMeshPending.insert({ shapeSpec: args.shapeSpec });
|
|
65
|
+
},
|
|
66
|
+
insertMeshInstance(t, args: {
|
|
67
|
+
mesh: Entity;
|
|
68
|
+
material: Entity;
|
|
69
|
+
position?: Vec3;
|
|
70
|
+
rotation?: Quat;
|
|
71
|
+
scale?: Vec3;
|
|
72
|
+
}): Entity {
|
|
73
|
+
return t.archetypes.MeshInstance.insert({
|
|
74
|
+
mesh: args.mesh,
|
|
75
|
+
material: args.material,
|
|
76
|
+
position: args.position ?? [0, 0, 0],
|
|
77
|
+
rotation: args.rotation ?? Quat.identity,
|
|
78
|
+
scale: args.scale ?? [1, 1, 1],
|
|
79
|
+
visible: true,
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
insertModel(t, args: {
|
|
83
|
+
mesh: Entity;
|
|
84
|
+
position?: Vec3;
|
|
85
|
+
rotation?: Quat;
|
|
86
|
+
scale?: Vec3;
|
|
87
|
+
parent?: Entity;
|
|
88
|
+
}): Entity {
|
|
89
|
+
return t.archetypes.Model.insert({
|
|
90
|
+
mesh: args.mesh,
|
|
91
|
+
position: args.position ?? [0, 0, 0],
|
|
92
|
+
rotation: args.rotation ?? Quat.identity,
|
|
93
|
+
scale: args.scale ?? [1, 1, 1],
|
|
94
|
+
visible: true,
|
|
95
|
+
parent: args.parent ?? 0,
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
/** @deprecated Use `mesh` — kept for scene combiner import path. */
|
|
102
|
+
export const model = mesh;
|
|
@@ -5,13 +5,13 @@ import type { Aabb } from "@adobe/data/math";
|
|
|
5
5
|
import { pbrCore } from "../../rendering/pbr-core-plugin.js";
|
|
6
6
|
import { animation } from "../../animation/animation-plugin.js";
|
|
7
7
|
import { core } from "../../../core/core-plugin.js";
|
|
8
|
-
import {
|
|
8
|
+
import { mesh } from "./mesh-plugin.js";
|
|
9
9
|
import { loadGltfPrimitives, type GpuPrimitiveData } from "./gltf/load-gltf-model.js";
|
|
10
10
|
import type { LoadedAnimation } from "./gltf/parse-animations.js";
|
|
11
11
|
import type { JointTemplate } from "./gltf/parse-skin.js";
|
|
12
12
|
|
|
13
13
|
export interface LoadedArgs {
|
|
14
|
-
|
|
14
|
+
mesh: number;
|
|
15
15
|
bounds: Aabb;
|
|
16
16
|
primitives: GpuPrimitiveData[];
|
|
17
17
|
skinJointTemplate: JointTemplate[];
|
|
@@ -22,44 +22,23 @@ export interface LoadedArgs {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* modelLoader
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* modelUrl
|
|
29
|
-
* write:
|
|
30
|
-
* _bounds: Aabb
|
|
31
|
-
* _skinJointTemplate: JointTemplate[]
|
|
32
|
-
* _skinInverseBindMatrices: Float32Array | null
|
|
33
|
-
* _animationClipRefs: EntityId[]
|
|
34
|
-
* _VisibleMaterial
|
|
35
|
-
* _PbrPrimitive
|
|
36
|
-
* AnimationClip // when the glTF carries animations
|
|
25
|
+
* modelLoader — queries `GltfMeshPending`, fetches each `gltfUrl`, inserts
|
|
26
|
+
* `_PbrPrimitive` rows, and migrates the mesh entity to `StaticMesh` or
|
|
27
|
+
* `SkinnedMesh` with capability components.
|
|
37
28
|
*/
|
|
38
29
|
export const modelLoader = Database.Plugin.create({
|
|
39
|
-
extends: Database.Plugin.combine(pbrCore,
|
|
40
|
-
components: {
|
|
41
|
-
_bounds: { default: null as Aabb | null },
|
|
42
|
-
_skinJointTemplate: { default: [] as JointTemplate[] },
|
|
43
|
-
_skinInverseBindMatrices: { default: null as Float32Array | null },
|
|
44
|
-
_animationClipRefs: { default: [] as number[] },
|
|
45
|
-
// CPU-retained model-space collision geometry (auto-collider source).
|
|
46
|
-
_cpuPositions: { default: null as Float32Array | null },
|
|
47
|
-
_cpuIndices: { default: null as Uint32Array | null },
|
|
48
|
-
// CPU-retained skin (mesh-bind positions + 4 joints + 4 weights per vertex),
|
|
49
|
-
// for fitting per-bone ragdoll capsules.
|
|
50
|
-
_cpuSkin: { default: null as { positions: Float32Array; joints: Uint32Array; weights: Float32Array } | null },
|
|
51
|
-
},
|
|
30
|
+
extends: Database.Plugin.combine(pbrCore, mesh, core, animation),
|
|
52
31
|
transactions: {
|
|
53
32
|
insertLoadedPrimitives(t, args: LoadedArgs) {
|
|
54
33
|
for (const p of args.primitives) {
|
|
55
34
|
const materialId = t.archetypes._VisibleMaterial.insert({
|
|
56
|
-
|
|
35
|
+
nonPersistent: true,
|
|
57
36
|
_materialBindGroup: p.pbrMaterialBindGroup,
|
|
58
|
-
|
|
37
|
+
_mesh: args.mesh,
|
|
59
38
|
});
|
|
60
39
|
t.archetypes._PbrPrimitive.insert({
|
|
61
|
-
|
|
62
|
-
|
|
40
|
+
nonPersistent: true,
|
|
41
|
+
_mesh: args.mesh,
|
|
63
42
|
_material: materialId,
|
|
64
43
|
_vertexBuffer: p.pbrVertexBuffer,
|
|
65
44
|
_skinVertexBuffer: p.pbrSkinVertexBuffer,
|
|
@@ -78,14 +57,17 @@ export const modelLoader = Database.Plugin.create({
|
|
|
78
57
|
});
|
|
79
58
|
clipRefs.push(clipId);
|
|
80
59
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
60
|
+
const skinned = args.skinJointTemplate.length > 0;
|
|
61
|
+
t.update(args.mesh, {
|
|
62
|
+
localBounds: args.bounds,
|
|
63
|
+
cpuCollisionPositions: args.collision?.positions ?? null,
|
|
64
|
+
cpuCollisionIndices: args.collision?.indices ?? null,
|
|
65
|
+
cpuSkin: args.skinVertices,
|
|
66
|
+
...(skinned ? {
|
|
67
|
+
skinJointTemplate: args.skinJointTemplate,
|
|
68
|
+
skinInverseBindMatrices: args.skinInverseBindMatrices,
|
|
69
|
+
animationClipRefs: clipRefs,
|
|
70
|
+
} : {}),
|
|
89
71
|
});
|
|
90
72
|
},
|
|
91
73
|
},
|
|
@@ -96,19 +78,19 @@ export const modelLoader = Database.Plugin.create({
|
|
|
96
78
|
return () => {
|
|
97
79
|
const { device } = db.store.resources;
|
|
98
80
|
if (!device) return;
|
|
99
|
-
for (const arch of db.store.queryArchetypes(["
|
|
81
|
+
for (const arch of db.store.queryArchetypes(["gltfUrl"])) {
|
|
100
82
|
const ids = arch.columns.id;
|
|
101
|
-
const urls = arch.columns.
|
|
83
|
+
const urls = arch.columns.gltfUrl;
|
|
102
84
|
for (let i = 0; i < arch.rowCount; i++) {
|
|
103
85
|
const id = ids.get(i);
|
|
104
86
|
if (inFlight.has(id)) continue;
|
|
105
87
|
const url = urls.get(i);
|
|
106
|
-
if (!url) continue;
|
|
88
|
+
if (!url) continue;
|
|
107
89
|
inFlight.add(id);
|
|
108
90
|
loadGltfPrimitives(device, url)
|
|
109
91
|
.then(loaded => {
|
|
110
92
|
db.transactions.insertLoadedPrimitives({
|
|
111
|
-
|
|
93
|
+
mesh: id,
|
|
112
94
|
bounds: loaded.bounds,
|
|
113
95
|
primitives: loaded.primitives,
|
|
114
96
|
skinJointTemplate: loaded.skin?.jointTemplate ?? [],
|
|
@@ -1,46 +1,3 @@
|
|
|
1
1
|
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import { Quat, type Vec3 } from "@adobe/data/math";
|
|
5
|
-
import { Node } from "../node/node.js";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Authored renderable scene. A `Geometry` is an asset identified by URL; a
|
|
9
|
-
* `Model` is a placed instance of a Geometry — a Node plus a reference to
|
|
10
|
-
* the Geometry it draws.
|
|
11
|
-
*
|
|
12
|
-
* Loading is performed by `modelLoader`, which reads the `modelUrl` and
|
|
13
|
-
* produces the GPU primitives the renderers consume.
|
|
14
|
-
*/
|
|
15
|
-
export const model = Database.Plugin.create({
|
|
16
|
-
extends: Node.plugin,
|
|
17
|
-
components: {
|
|
18
|
-
modelUrl: { type: "string" },
|
|
19
|
-
geometry: Entity.schema,
|
|
20
|
-
},
|
|
21
|
-
archetypes: {
|
|
22
|
-
Geometry: ["modelUrl"],
|
|
23
|
-
Model: ["geometry", "position", "rotation", "scale", "visible", "parent"],
|
|
24
|
-
},
|
|
25
|
-
transactions: {
|
|
26
|
-
insertGeometry(t, args: { modelUrl: string }): number {
|
|
27
|
-
return t.archetypes.Geometry.insert({ modelUrl: args.modelUrl });
|
|
28
|
-
},
|
|
29
|
-
insertModel(t, args: {
|
|
30
|
-
geometry: number;
|
|
31
|
-
position?: Vec3;
|
|
32
|
-
rotation?: Quat;
|
|
33
|
-
scale?: Vec3;
|
|
34
|
-
parent?: number;
|
|
35
|
-
}): number {
|
|
36
|
-
return t.archetypes.Model.insert({
|
|
37
|
-
geometry: args.geometry,
|
|
38
|
-
position: args.position ?? [0, 0, 0],
|
|
39
|
-
rotation: args.rotation ?? Quat.identity,
|
|
40
|
-
scale: args.scale ?? [1, 1, 1],
|
|
41
|
-
visible: true,
|
|
42
|
-
parent: args.parent ?? 0,
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
});
|
|
3
|
+
export { mesh as model } from "./mesh-plugin.js";
|
|
@@ -3,13 +3,9 @@
|
|
|
3
3
|
import type { Entity } from "@adobe/data/ecs";
|
|
4
4
|
import type { Node } from "../node/node.js";
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* One row of the `Model` archetype — a placed instance of a Geometry. A
|
|
8
|
-
* Node (transform + visibility + parent) plus a reference to the Geometry
|
|
9
|
-
* the renderer should draw.
|
|
10
|
-
*/
|
|
6
|
+
/** One row of the `Model` archetype — a placed instance of a mesh asset. */
|
|
11
7
|
export interface Model extends Node {
|
|
12
|
-
|
|
8
|
+
mesh: Entity;
|
|
13
9
|
}
|
|
14
10
|
|
|
15
11
|
export * as Model from "./public.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
|
|
3
|
+
import type { Aabb } from "@adobe/data/math";
|
|
4
|
+
import type { ShapeMesh } from "./shape-mesh.js";
|
|
5
|
+
|
|
6
|
+
const FLOATS_PER_VERTEX = 12;
|
|
7
|
+
|
|
8
|
+
/** Axis-aligned bounds of packed StandardVertex positions in a shape mesh. */
|
|
9
|
+
export const boundsFromShapeMesh = (mesh: ShapeMesh): Aabb => {
|
|
10
|
+
const v = mesh.vertices;
|
|
11
|
+
let minX = Infinity, minY = Infinity, minZ = Infinity;
|
|
12
|
+
let maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;
|
|
13
|
+
for (let i = 0; i < v.length; i += FLOATS_PER_VERTEX) {
|
|
14
|
+
const x = v[i], y = v[i + 1], z = v[i + 2];
|
|
15
|
+
if (x < minX) minX = x; if (x > maxX) maxX = x;
|
|
16
|
+
if (y < minY) minY = y; if (y > maxY) maxY = y;
|
|
17
|
+
if (z < minZ) minZ = z; if (z > maxZ) maxZ = z;
|
|
18
|
+
}
|
|
19
|
+
return { min: [minX, minY, minZ], max: [maxX, maxY, maxZ] };
|
|
20
|
+
};
|