@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
package/src/graphics/rendering/pbr-render/{pbr-render-plugin.ts → pbr-factor-render-plugin.ts}
RENAMED
|
@@ -2,79 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
import { Database, type Entity } from "@adobe/data/ecs";
|
|
4
4
|
import { pbrIblRender } from "../ibl-render/ibl-render-plugin.js";
|
|
5
|
-
import {
|
|
5
|
+
import { materialPaletteGpu } from "../material-palette-gpu/material-palette-gpu-plugin.js";
|
|
6
6
|
import { displayTransform } from "../display-transform-plugin.js";
|
|
7
7
|
import { SceneUniforms } from "../../scene/scene-uniforms/scene-uniforms.js";
|
|
8
8
|
import { StandardVertex } from "../standard-vertex/standard-vertex.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/** Minimal column shape the gather reads — satisfied by either query's columns. */
|
|
26
|
-
interface Col<T> { get(i: number): T }
|
|
27
|
-
|
|
28
|
-
function createIblBindGroupLayout(device: GPUDevice): GPUBindGroupLayout {
|
|
29
|
-
return device.createBindGroupLayout({
|
|
30
|
-
entries: [
|
|
31
|
-
{ binding: 0, visibility: GPUShaderStage.FRAGMENT, texture: { sampleType: "float", viewDimension: "cube" } },
|
|
32
|
-
{ binding: 1, visibility: GPUShaderStage.FRAGMENT, texture: { sampleType: "float", viewDimension: "cube" } },
|
|
33
|
-
{ binding: 2, visibility: GPUShaderStage.FRAGMENT, texture: { sampleType: "float", viewDimension: "2d" } },
|
|
34
|
-
{ binding: 3, visibility: GPUShaderStage.FRAGMENT, sampler: { type: "filtering" } },
|
|
35
|
-
],
|
|
36
|
-
});
|
|
37
|
-
}
|
|
9
|
+
import { createFactorPaletteBindGroupLayout } from "../material-palette-gpu/palette-bind-group.js";
|
|
10
|
+
import { buildPbrFactorShader } from "./pbr-factor-shader.wgsl.js";
|
|
11
|
+
import {
|
|
12
|
+
composeTrs,
|
|
13
|
+
createIblBindGroupLayout,
|
|
14
|
+
DRAWABLE,
|
|
15
|
+
DRAWABLE_DIRECT,
|
|
16
|
+
DRAWABLE_INTERP,
|
|
17
|
+
PREFILTERED_MIP_COUNT,
|
|
18
|
+
PRIMITIVE,
|
|
19
|
+
type ColumnReader,
|
|
20
|
+
type MeshBatch,
|
|
21
|
+
} from "./primitive-render-shared.js";
|
|
22
|
+
|
|
23
|
+
interface InstCache { buffer: GPUBuffer; indexBuffer: GPUBuffer; bindGroup: GPUBindGroup; capacity: number }
|
|
38
24
|
|
|
39
25
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* drawable per frame, so the array churn of the math-helper form matters.
|
|
44
|
-
*/
|
|
45
|
-
function composeTrs(
|
|
46
|
-
out: Float32Array, o: number,
|
|
47
|
-
p: ArrayLike<number>, pi: number, q: ArrayLike<number>, qi: number, s: ArrayLike<number>, si: number,
|
|
48
|
-
): void {
|
|
49
|
-
const qx = q[qi], qy = q[qi + 1], qz = q[qi + 2], qw = q[qi + 3];
|
|
50
|
-
const sx = s[si], sy = s[si + 1], sz = s[si + 2];
|
|
51
|
-
const xx = qx * qx, yy = qy * qy, zz = qz * qz;
|
|
52
|
-
const xy = qx * qy, xz = qx * qz, yz = qy * qz;
|
|
53
|
-
const wx = qw * qx, wy = qw * qy, wz = qw * qz;
|
|
54
|
-
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;
|
|
55
|
-
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;
|
|
56
|
-
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;
|
|
57
|
-
out[o + 12] = p[pi]; out[o + 13] = p[pi + 1]; out[o + 14] = p[pi + 2]; out[o + 15] = 1;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* pbrRender — the single PBR + IBL renderer. It extends `pbrIblRender`, reusing
|
|
62
|
-
* its IBL bake, skybox, scene/material bind groups and glTF draw path verbatim,
|
|
63
|
-
* and adds one extra draw query for **instanced primitives** whose material
|
|
64
|
-
* comes from the shared `materialGpu` arrays (selected per instance by the
|
|
65
|
-
* material entity's `_layerIndex`). Two efficient queries, one render plugin:
|
|
66
|
-
*
|
|
67
|
-
* - glTF models → per-material bind group, native-resolution textures (pbrIblRender)
|
|
68
|
-
* - primitives → shared texture_2d_array + per-instance layer (this system)
|
|
26
|
+
* pbrFactorRender — instanced primitive PBR from material factors only (no map
|
|
27
|
+
* sampling). Extends `pbrIblRender` for IBL + skybox + optional glTF draws.
|
|
28
|
+
* Pairs with `materialPaletteGpu` (`_paletteIndex` on factor materials).
|
|
69
29
|
*
|
|
70
|
-
*
|
|
71
|
-
* first. World matrices are computed directly from `position`/`rotation`/`scale`
|
|
72
|
-
* (primitives are flat — no hierarchy), so it's independent of `transform`.
|
|
30
|
+
* Pairs with `materialPaletteGpu` (`_paletteIndex`). Idle when no factor materials or drawables exist.
|
|
73
31
|
*/
|
|
74
|
-
export const
|
|
75
|
-
extends: Database.Plugin.combine(pbrIblRender,
|
|
32
|
+
export const pbrFactorRender = Database.Plugin.create({
|
|
33
|
+
extends: Database.Plugin.combine(pbrIblRender, materialPaletteGpu, displayTransform),
|
|
76
34
|
systems: {
|
|
77
|
-
|
|
35
|
+
pbrFactorPrimitiveRenderSystem: {
|
|
78
36
|
schedule: { during: ["render"], after: ["beginRenderPass", "pbrIblRenderSystem"], before: ["endRenderPass"] },
|
|
79
37
|
create: db => {
|
|
80
38
|
let pipeline: GPURenderPipeline | null = null;
|
|
@@ -87,25 +45,21 @@ export const pbrRender = Database.Plugin.create({
|
|
|
87
45
|
let cachedSceneBuffer: GPUBuffer | null = null;
|
|
88
46
|
let cachedIrradiance: GPUTexture | null = null;
|
|
89
47
|
|
|
90
|
-
|
|
48
|
+
const matIndex = new Map<Entity, number>();
|
|
91
49
|
let matCount = -1;
|
|
92
50
|
|
|
93
|
-
|
|
94
|
-
const instCache = new Map<Entity, Inst>();
|
|
51
|
+
const instCache = new Map<Entity, InstCache>();
|
|
95
52
|
let matScratch = new Float32Array(16);
|
|
96
|
-
let
|
|
97
|
-
// Per-frame matrix arena (composed TRS, one mat4 per drawable) + per-geometry
|
|
98
|
-
// draw lists (matrix offset + layer). All pooled and reused across frames —
|
|
99
|
-
// the gather runs over every visible body each frame, so zero allocation here.
|
|
53
|
+
let indexScratch = new Uint32Array(1);
|
|
100
54
|
let mats = new Float32Array(64 * 16);
|
|
101
|
-
const batches = new Map<Entity,
|
|
55
|
+
const batches = new Map<Entity, MeshBatch>();
|
|
102
56
|
|
|
103
57
|
return () => {
|
|
104
58
|
const {
|
|
105
59
|
device, renderPassEncoder, canvasFormat, depthFormat, _sceneUniformsBuffer,
|
|
106
|
-
|
|
60
|
+
_factorPaletteBindGroup, _iblIrradiance, _iblPrefiltered, _iblBrdfLut,
|
|
107
61
|
} = db.store.resources;
|
|
108
|
-
if (!device || !renderPassEncoder || !_sceneUniformsBuffer || !
|
|
62
|
+
if (!device || !renderPassEncoder || !_sceneUniformsBuffer || !_factorPaletteBindGroup) return;
|
|
109
63
|
if (!_iblIrradiance || !_iblPrefiltered || !_iblBrdfLut) return;
|
|
110
64
|
|
|
111
65
|
if (!sceneLayout) sceneLayout = SceneUniforms.createBindGroupLayout(device);
|
|
@@ -121,9 +75,11 @@ export const pbrRender = Database.Plugin.create({
|
|
|
121
75
|
addressModeU: "clamp-to-edge", addressModeV: "clamp-to-edge", addressModeW: "clamp-to-edge",
|
|
122
76
|
});
|
|
123
77
|
if (!pipeline) {
|
|
124
|
-
const module = device.createShaderModule({ code:
|
|
78
|
+
const module = device.createShaderModule({ code: buildPbrFactorShader({ prefilteredMipCount: PREFILTERED_MIP_COUNT }) });
|
|
125
79
|
pipeline = device.createRenderPipeline({
|
|
126
|
-
layout: device.createPipelineLayout({
|
|
80
|
+
layout: device.createPipelineLayout({
|
|
81
|
+
bindGroupLayouts: [sceneLayout, createFactorPaletteBindGroupLayout(device), iblLayout, instanceLayout],
|
|
82
|
+
}),
|
|
127
83
|
vertex: { module, entryPoint: "vs_main", buffers: [StandardVertex.layout] },
|
|
128
84
|
fragment: { module, entryPoint: "fs_main", targets: [{ format: canvasFormat }] },
|
|
129
85
|
primitive: { topology: "triangle-list", cullMode: "back" },
|
|
@@ -148,62 +104,58 @@ export const pbrRender = Database.Plugin.create({
|
|
|
148
104
|
cachedIrradiance = _iblIrradiance;
|
|
149
105
|
}
|
|
150
106
|
|
|
151
|
-
// material → layer, refreshed only when the material set grows
|
|
152
107
|
let mc = 0;
|
|
153
|
-
for (const arch of db.store.queryArchetypes(["
|
|
108
|
+
for (const arch of db.store.queryArchetypes(["_paletteIndex"])) mc += arch.rowCount;
|
|
154
109
|
if (mc !== matCount) {
|
|
155
|
-
|
|
156
|
-
for (const arch of db.store.queryArchetypes(["
|
|
157
|
-
const id = arch.columns.id,
|
|
158
|
-
for (let i = 0; i < arch.rowCount; i++)
|
|
110
|
+
matIndex.clear();
|
|
111
|
+
for (const arch of db.store.queryArchetypes(["_paletteIndex"])) {
|
|
112
|
+
const id = arch.columns.id, pi = arch.columns._paletteIndex;
|
|
113
|
+
for (let i = 0; i < arch.rowCount; i++) matIndex.set(id.get(i), pi.get(i));
|
|
159
114
|
}
|
|
160
115
|
matCount = mc;
|
|
161
116
|
}
|
|
162
117
|
|
|
163
|
-
|
|
164
|
-
// world matrix straight from the chosen pose/scale column typed arrays
|
|
165
|
-
// into the pooled `mats` arena — no per-row array allocation. Two passes:
|
|
166
|
-
// bodies with a display pose use it; everything else uses position/rotation.
|
|
167
|
-
for (const b of batches.values()) { b.off.length = 0; b.layer.length = 0; }
|
|
118
|
+
for (const b of batches.values()) { b.off.length = 0; b.materialIndex.length = 0; }
|
|
168
119
|
let drawCount = 0;
|
|
169
120
|
const gather = (
|
|
170
|
-
rowCount: number, vis:
|
|
121
|
+
rowCount: number, vis: ColumnReader<boolean>, meshCol: ColumnReader<Entity>, mat: ColumnReader<Entity>,
|
|
171
122
|
posArr: ArrayLike<number>, rotArr: ArrayLike<number>, sclArr: ArrayLike<number>,
|
|
172
123
|
): void => {
|
|
173
124
|
for (let i = 0; i < rowCount; i++) {
|
|
174
125
|
if (!vis.get(i)) continue;
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
126
|
+
const paletteIndex = matIndex.get(mat.get(i));
|
|
127
|
+
if (paletteIndex === undefined) continue;
|
|
177
128
|
if ((drawCount + 1) * 16 > mats.length) { const grown = new Float32Array(mats.length * 2); grown.set(mats); mats = grown; }
|
|
178
129
|
composeTrs(mats, drawCount * 16, posArr, i * 3, rotArr, i * 4, sclArr, i * 3);
|
|
179
|
-
const g =
|
|
130
|
+
const g = meshCol.get(i);
|
|
180
131
|
let b = batches.get(g);
|
|
181
|
-
if (!b) { b = { off: [],
|
|
182
|
-
b.off.push(drawCount);
|
|
132
|
+
if (!b) { b = { off: [], materialIndex: [] }; batches.set(g, b); }
|
|
133
|
+
b.off.push(drawCount);
|
|
134
|
+
b.materialIndex.push(paletteIndex);
|
|
183
135
|
drawCount++;
|
|
184
136
|
}
|
|
185
137
|
};
|
|
186
138
|
for (const arch of db.store.queryArchetypes(DRAWABLE_INTERP)) {
|
|
187
|
-
gather(arch.rowCount, arch.columns.visible, arch.columns.
|
|
139
|
+
gather(arch.rowCount, arch.columns.visible, arch.columns.mesh, arch.columns.material,
|
|
188
140
|
arch.columns._renderPosition.getTypedArray(), arch.columns._renderRotation.getTypedArray(), arch.columns.scale.getTypedArray());
|
|
189
141
|
}
|
|
190
142
|
for (const arch of db.store.queryArchetypes(DRAWABLE, DRAWABLE_DIRECT)) {
|
|
191
|
-
gather(arch.rowCount, arch.columns.visible, arch.columns.
|
|
143
|
+
gather(arch.rowCount, arch.columns.visible, arch.columns.mesh, arch.columns.material,
|
|
192
144
|
arch.columns.position.getTypedArray(), arch.columns.rotation.getTypedArray(), arch.columns.scale.getTypedArray());
|
|
193
145
|
}
|
|
194
146
|
if (drawCount === 0) return;
|
|
195
147
|
|
|
196
148
|
renderPassEncoder.setPipeline(pipeline);
|
|
197
149
|
renderPassEncoder.setBindGroup(0, sceneBindGroup);
|
|
198
|
-
renderPassEncoder.setBindGroup(1,
|
|
150
|
+
renderPassEncoder.setBindGroup(1, _factorPaletteBindGroup);
|
|
199
151
|
renderPassEncoder.setBindGroup(2, iblBindGroup);
|
|
200
152
|
|
|
201
153
|
for (const arch of db.store.queryArchetypes(PRIMITIVE)) {
|
|
202
154
|
const vbs = arch.columns._vertexBuffer, ibs = arch.columns._indexBuffer;
|
|
203
155
|
const counts = arch.columns._indexCount, formats = arch.columns._indexFormat;
|
|
204
|
-
const
|
|
156
|
+
const meshRefs = arch.columns._mesh, primIds = arch.columns.id;
|
|
205
157
|
for (let i = 0; i < arch.rowCount; i++) {
|
|
206
|
-
const b = batches.get(
|
|
158
|
+
const b = batches.get(meshRefs.get(i));
|
|
207
159
|
if (!b || b.off.length === 0) continue;
|
|
208
160
|
const n = b.off.length;
|
|
209
161
|
const primId = primIds.get(i);
|
|
@@ -211,32 +163,29 @@ export const pbrRender = Database.Plugin.create({
|
|
|
211
163
|
let entry = instCache.get(primId);
|
|
212
164
|
if (!entry || entry.capacity < n) {
|
|
213
165
|
entry?.buffer.destroy();
|
|
214
|
-
entry?.
|
|
166
|
+
entry?.indexBuffer.destroy();
|
|
215
167
|
const buffer = device.createBuffer({ size: Math.max(n * 64, 64), usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST });
|
|
216
|
-
const
|
|
168
|
+
const indexBuffer = device.createBuffer({ size: Math.max(n * 4, 4), usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST });
|
|
217
169
|
const bindGroup = device.createBindGroup({
|
|
218
170
|
layout: instanceLayout,
|
|
219
|
-
entries: [{ binding: 0, resource: { buffer } }, { binding: 1, resource: { buffer:
|
|
171
|
+
entries: [{ binding: 0, resource: { buffer } }, { binding: 1, resource: { buffer: indexBuffer } }],
|
|
220
172
|
});
|
|
221
|
-
entry = { buffer,
|
|
173
|
+
entry = { buffer, indexBuffer, bindGroup, capacity: n };
|
|
222
174
|
instCache.set(primId, entry);
|
|
223
175
|
}
|
|
224
176
|
if (matScratch.length < n * 16) matScratch = new Float32Array(n * 16);
|
|
225
|
-
if (
|
|
226
|
-
// Copy this geometry's matrices out of the arena into a contiguous
|
|
227
|
-
// upload buffer. Primitive node matrices are identity (flat shapes;
|
|
228
|
-
// glTF hierarchy goes through pbrIblRender), so no extra multiply.
|
|
177
|
+
if (indexScratch.length < n) indexScratch = new Uint32Array(n);
|
|
229
178
|
for (let j = 0; j < n; j++) {
|
|
230
179
|
const src = b.off[j] * 16, dst = j * 16;
|
|
231
180
|
for (let k = 0; k < 16; k++) matScratch[dst + k] = mats[src + k];
|
|
232
|
-
|
|
181
|
+
indexScratch[j] = b.materialIndex[j];
|
|
233
182
|
}
|
|
234
183
|
device.queue.writeBuffer(entry.buffer, 0, matScratch, 0, n * 16);
|
|
235
|
-
device.queue.writeBuffer(entry.
|
|
184
|
+
device.queue.writeBuffer(entry.indexBuffer, 0, indexScratch, 0, n);
|
|
236
185
|
|
|
237
186
|
renderPassEncoder.setBindGroup(3, entry.bindGroup);
|
|
238
|
-
renderPassEncoder.setVertexBuffer(0, vbs.get(i)!);
|
|
239
|
-
renderPassEncoder.setIndexBuffer(ibs.get(i)!, formats.get(i));
|
|
187
|
+
renderPassEncoder.setVertexBuffer(0, vbs.get(i)!);
|
|
188
|
+
renderPassEncoder.setIndexBuffer(ibs.get(i)!, formats.get(i));
|
|
240
189
|
renderPassEncoder.drawIndexed(counts.get(i), n);
|
|
241
190
|
}
|
|
242
191
|
}
|
package/src/graphics/rendering/pbr-render/{pbr-array-shader.wgsl.ts → pbr-factor-shader.wgsl.ts}
RENAMED
|
@@ -5,13 +5,10 @@ import { schema as sceneUniformsSchema } from "../../scene/scene-uniforms/schema
|
|
|
5
5
|
import brdf from "../ibl-render/brdf.wgsl.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* a palette of per-layer factors (group 1) — selected by a per-instance layer
|
|
11
|
-
* index (group 3, binding 1). Shading is identical Cook-Torrance + split-sum
|
|
12
|
-
* IBL to the per-material `ibl-shader`; only the material *source* differs.
|
|
8
|
+
* Factor-only PBR for instanced primitives — palette factors + vertex normals,
|
|
9
|
+
* no material map sampling. Used by `pbrFactorRender`.
|
|
13
10
|
*/
|
|
14
|
-
export function
|
|
11
|
+
export function buildPbrFactorShader(options: { prefilteredMipCount: number }): string {
|
|
15
12
|
return /* wgsl */ `
|
|
16
13
|
struct SceneUniforms {
|
|
17
14
|
${wgslStructFields(sceneUniformsSchema)}
|
|
@@ -20,18 +17,13 @@ ${wgslStructFields(sceneUniformsSchema)}
|
|
|
20
17
|
struct MaterialFactors {
|
|
21
18
|
baseColorFactor: vec4f,
|
|
22
19
|
emissiveMetallic: vec4f, // emissive.rgb, metallicFactor
|
|
23
|
-
|
|
20
|
+
roughNormalIr: vec4f, // roughnessFactor, normalScale, occlusionStrength, irEmission
|
|
21
|
+
emissionMeta: vec4f, // emissionMode, _, _, _
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
@group(0) @binding(0) var<uniform> scene: SceneUniforms;
|
|
27
25
|
|
|
28
26
|
@group(1) @binding(0) var<storage, read> palette: array<MaterialFactors>;
|
|
29
|
-
@group(1) @binding(1) var baseColorArray: texture_2d_array<f32>;
|
|
30
|
-
@group(1) @binding(2) var metallicRoughnessArray: texture_2d_array<f32>;
|
|
31
|
-
@group(1) @binding(3) var normalArray: texture_2d_array<f32>;
|
|
32
|
-
@group(1) @binding(4) var occlusionArray: texture_2d_array<f32>;
|
|
33
|
-
@group(1) @binding(5) var emissiveArray: texture_2d_array<f32>;
|
|
34
|
-
@group(1) @binding(6) var matSampler: sampler;
|
|
35
27
|
|
|
36
28
|
@group(2) @binding(0) var iblIrradiance: texture_cube<f32>;
|
|
37
29
|
@group(2) @binding(1) var iblPrefiltered: texture_cube<f32>;
|
|
@@ -39,7 +31,7 @@ struct MaterialFactors {
|
|
|
39
31
|
@group(2) @binding(3) var iblSampler: sampler;
|
|
40
32
|
|
|
41
33
|
@group(3) @binding(0) var<storage, read> instances: array<mat4x4<f32>>;
|
|
42
|
-
@group(3) @binding(1) var<storage, read>
|
|
34
|
+
@group(3) @binding(1) var<storage, read> paletteIndices: array<u32>;
|
|
43
35
|
|
|
44
36
|
const PREFILTERED_MIP_COUNT: f32 = ${options.prefilteredMipCount.toFixed(1)};
|
|
45
37
|
|
|
@@ -54,10 +46,7 @@ struct VertexOutput {
|
|
|
54
46
|
@builtin(position) clipPosition: vec4f,
|
|
55
47
|
@location(0) worldPosition: vec3f,
|
|
56
48
|
@location(1) normal: vec3f,
|
|
57
|
-
@location(
|
|
58
|
-
@location(3) bitangent: vec3f,
|
|
59
|
-
@location(4) uv: vec2f,
|
|
60
|
-
@location(5) @interpolate(flat) layer: u32,
|
|
49
|
+
@location(5) @interpolate(flat) paletteIndex: u32,
|
|
61
50
|
}
|
|
62
51
|
|
|
63
52
|
@vertex
|
|
@@ -74,10 +63,7 @@ fn vs_main(@builtin(instance_index) instanceIndex: u32, in: VertexInput) -> Vert
|
|
|
74
63
|
out.clipPosition = scene.viewProjectionMatrix * worldPos;
|
|
75
64
|
out.worldPosition = worldPos.xyz;
|
|
76
65
|
out.normal = normalize(normalMat * in.normal);
|
|
77
|
-
out.
|
|
78
|
-
out.bitangent = normalize(cross(out.normal, out.tangent) * in.tangent.w);
|
|
79
|
-
out.uv = in.uv;
|
|
80
|
-
out.layer = layers[instanceIndex];
|
|
66
|
+
out.paletteIndex = paletteIndices[instanceIndex];
|
|
81
67
|
return out;
|
|
82
68
|
}
|
|
83
69
|
|
|
@@ -85,32 +71,26 @@ ${brdf}
|
|
|
85
71
|
|
|
86
72
|
@fragment
|
|
87
73
|
fn fs_main(in: VertexOutput) -> @location(0) vec4f {
|
|
88
|
-
let f = palette[in.
|
|
89
|
-
let li = i32(in.layer);
|
|
74
|
+
let f = palette[in.paletteIndex];
|
|
90
75
|
|
|
91
|
-
let baseColor =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
let metallic = mr.b * f.emissiveMetallic.w;
|
|
95
|
-
var roughness = mr.g * f.roughNormalOcc.x;
|
|
76
|
+
let baseColor = f.baseColorFactor;
|
|
77
|
+
let metallic = f.emissiveMetallic.w;
|
|
78
|
+
var roughness = f.roughNormalIr.x;
|
|
96
79
|
roughness = max(roughness, MIN_ROUGHNESS);
|
|
97
80
|
let alpha = roughness * roughness;
|
|
81
|
+
let occlusion = f.roughNormalIr.z;
|
|
82
|
+
let emissionMode = f.emissionMeta.x;
|
|
83
|
+
let irEmission = f.roughNormalIr.w;
|
|
84
|
+
// 0 = UV fluorescence (no visible add); 1 = visible luminescence (emissive + IR glow).
|
|
85
|
+
let emissive = select(vec3f(0.0), f.emissiveMetallic.xyz + vec3f(irEmission), emissionMode >= 0.5);
|
|
98
86
|
|
|
99
|
-
let
|
|
100
|
-
let emissive = textureSample(emissiveArray, matSampler, in.uv, li).rgb * f.emissiveMetallic.xyz;
|
|
101
|
-
|
|
102
|
-
let nSampled = textureSample(normalArray, matSampler, in.uv, li).rgb * 2.0 - vec3f(1.0);
|
|
103
|
-
let nScaled = vec3f(nSampled.xy * f.roughNormalOcc.y, nSampled.z);
|
|
104
|
-
let tbn = mat3x3<f32>(in.tangent, in.bitangent, in.normal);
|
|
105
|
-
let N = normalize(tbn * nScaled);
|
|
106
|
-
|
|
87
|
+
let N = normalize(in.normal);
|
|
107
88
|
let V = normalize(scene.cameraPosition - in.worldPosition);
|
|
108
89
|
let nDotV = max(dot(N, V), 0.001);
|
|
109
90
|
let R = reflect(-V, N);
|
|
110
91
|
|
|
111
92
|
let f0 = mix(vec3f(0.04), baseColor.rgb, metallic);
|
|
112
93
|
|
|
113
|
-
// --- IBL contribution (split-sum) ---
|
|
114
94
|
let F_ibl = f_schlick_roughness(nDotV, f0, roughness);
|
|
115
95
|
let kD_ibl = (vec3f(1.0) - F_ibl) * (1.0 - metallic);
|
|
116
96
|
|
|
@@ -122,9 +102,8 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4f {
|
|
|
122
102
|
let envBrdf = textureSampleLevel(iblBrdfLut, iblSampler, vec2f(nDotV, roughness), 0.0).rg;
|
|
123
103
|
let specularIbl = prefiltered * (F_ibl * envBrdf.x + envBrdf.y);
|
|
124
104
|
|
|
125
|
-
let ambient = (diffuseIbl + specularIbl) *
|
|
105
|
+
let ambient = (diffuseIbl + specularIbl) * occlusion;
|
|
126
106
|
|
|
127
|
-
// --- Direct light (parity with the single scene light) ---
|
|
128
107
|
let L = normalize(-scene.lightDirection);
|
|
129
108
|
let H = normalize(V + L);
|
|
130
109
|
let nDotL = max(dot(N, L), 0.0);
|
|
@@ -2,101 +2,127 @@
|
|
|
2
2
|
|
|
3
3
|
import { Database, type Entity } from "@adobe/data/ecs";
|
|
4
4
|
import { physicsData } from "../../../physics/physics-data-plugin.js";
|
|
5
|
-
import {
|
|
5
|
+
import { RIGID_BODY_COMPONENTS } from "../../../physics/rigid-body-components.js";
|
|
6
|
+
import { STATIC_COLLIDER_COMPONENTS } from "../../../physics/static-collider-components.js";
|
|
7
|
+
import { mesh } from "../../scene/model/mesh-plugin.js";
|
|
6
8
|
import { shapeGeometry } from "../../scene/model/shape/shape-geometry-plugin.js";
|
|
7
9
|
import { capsuleMesh, flatShadedMesh } from "../../scene/model/shape/shape-mesh.js";
|
|
8
10
|
import { convexHullMesh } from "../../scene/model/shape/convex-hull.js";
|
|
9
11
|
import { uploadShapeMesh } from "../../scene/model/shape/upload-shape-mesh.js";
|
|
12
|
+
import { boundsFromShapeMesh } from "../../scene/model/shape/bounds-from-shape-mesh.js";
|
|
10
13
|
import type { ColliderMesh } from "../../../physics/body/collider-mesh.js";
|
|
11
14
|
import { interpolation } from "../interpolation-plugin.js";
|
|
12
15
|
|
|
16
|
+
/** Authored column sets for primitive collider rows (RigidBody, ConvexBody,
|
|
17
|
+
* StaticCollider, MeshCollider). Query by these sets — not the named handle —
|
|
18
|
+
* so solver-tagged variants are found after migration. Rows with
|
|
19
|
+
* `voxelShapeName` are skipped at runtime (mechs voxel bodies). */
|
|
20
|
+
const PRIMITIVE_COLLIDER_QUERIES: readonly {
|
|
21
|
+
include: readonly string[];
|
|
22
|
+
exclude?: readonly string[];
|
|
23
|
+
}[] = [
|
|
24
|
+
{ include: RIGID_BODY_COMPONENTS, exclude: ["convexPoints"] },
|
|
25
|
+
{ include: [...RIGID_BODY_COMPONENTS, "convexPoints"] },
|
|
26
|
+
{ include: STATIC_COLLIDER_COMPONENTS, exclude: ["colliderMesh"] },
|
|
27
|
+
{ include: [...STATIC_COLLIDER_COMPONENTS, "colliderMesh"] },
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
const hasVoxelShapeName = (store: { read(id: Entity): Record<string, unknown> | null }, id: Entity): boolean =>
|
|
31
|
+
store.read(id)?.voxelShapeName != null;
|
|
32
|
+
|
|
13
33
|
/**
|
|
14
|
-
* physicsRenderBridge —
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* It also folds in `interpolation`, so dynamic bodies render at the smooth,
|
|
22
|
-
* render-rate display pose for free (the solver steps on a fixed clock that need
|
|
23
|
-
* not match the render rate) — bridging physics to the renderer is exactly when
|
|
24
|
-
* you want that. Use `interpolation` directly only with a custom (non-bridge) path.
|
|
25
|
-
*
|
|
26
|
-
* Also declares `Prop` — a render-only placed geometry with a material that is
|
|
27
|
-
* not a physics body at all (decorative scenery with no collider).
|
|
34
|
+
* physicsRenderBridge — assigns default primitive render meshes for standard
|
|
35
|
+
* physics bodies whose visual is the collider primitive (RigidBody,
|
|
36
|
+
* StaticCollider, ConvexBody, MeshCollider — including solver-tagged variants).
|
|
37
|
+
* Collider shape
|
|
38
|
+
* drives the mesh; bodies on other archetypes (e.g. `VoxelRigidBody`) are not
|
|
39
|
+
* touched — their visual path owns `mesh` assignment separately.
|
|
28
40
|
*/
|
|
29
41
|
export const physicsRenderBridge = Database.Plugin.create({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Prop: ["geometry", "position", "rotation", "scale", "visible", "material"],
|
|
33
|
-
},
|
|
42
|
+
imports: Database.Plugin.combine(mesh, shapeGeometry, interpolation),
|
|
43
|
+
extends: physicsData,
|
|
34
44
|
systems: {
|
|
35
45
|
physicsBridge: {
|
|
46
|
+
// Runs late in postUpdate so voxel-owned bodies can resolve first;
|
|
47
|
+
// name sorts after `voxelShapeVisualBridge` when both were postUpdate.
|
|
36
48
|
schedule: { during: ["postUpdate"] },
|
|
37
49
|
create: db => {
|
|
38
|
-
|
|
39
|
-
// be non-uniformly scaled (its caps would distort), so it's built at its
|
|
40
|
-
// real size and drawn at unit scale — one mesh per distinct (radius,
|
|
41
|
-
// half-height), cached here (scenes use very few capsule sizes).
|
|
42
|
-
const capsuleGeometry = new Map<string, Entity>();
|
|
50
|
+
const capsuleMeshes = new Map<string, Entity>();
|
|
43
51
|
const ensureCapsule = (device: GPUDevice, r: number, hy: number): Entity => {
|
|
44
52
|
const key = `${r}:${hy}`;
|
|
45
|
-
let
|
|
46
|
-
if (
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
let id = capsuleMeshes.get(key);
|
|
54
|
+
if (id === undefined) {
|
|
55
|
+
const data = capsuleMesh(r, hy);
|
|
56
|
+
const m = uploadShapeMesh(device, data);
|
|
57
|
+
id = db.transactions.insertStaticMeshPrimitive({
|
|
58
|
+
vertexBuffer: m.vb, indexBuffer: m.ib, indexCount: m.count,
|
|
59
|
+
localBounds: boundsFromShapeMesh(data),
|
|
60
|
+
});
|
|
61
|
+
capsuleMeshes.set(key, id);
|
|
50
62
|
}
|
|
51
|
-
return
|
|
63
|
+
return id;
|
|
52
64
|
};
|
|
53
|
-
|
|
54
|
-
// by the point-array reference (bodies sharing a cloud share one mesh + draw).
|
|
55
|
-
const hullGeometry = new Map<Float32Array, Entity>();
|
|
65
|
+
const hullMeshes = new Map<Float32Array, Entity>();
|
|
56
66
|
const ensureHull = (device: GPUDevice, points: Float32Array): Entity => {
|
|
57
|
-
let
|
|
58
|
-
if (
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
let id = hullMeshes.get(points);
|
|
68
|
+
if (id === undefined) {
|
|
69
|
+
const data = convexHullMesh(points);
|
|
70
|
+
const m = uploadShapeMesh(device, data);
|
|
71
|
+
id = db.transactions.insertStaticMeshPrimitive({
|
|
72
|
+
vertexBuffer: m.vb, indexBuffer: m.ib, indexCount: m.count,
|
|
73
|
+
localBounds: boundsFromShapeMesh(data),
|
|
74
|
+
});
|
|
75
|
+
hullMeshes.set(points, id);
|
|
62
76
|
}
|
|
63
|
-
return
|
|
77
|
+
return id;
|
|
64
78
|
};
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const m = uploadShapeMesh(device,
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
const triMeshes = new Map<ColliderMesh, Entity>();
|
|
80
|
+
const ensureTriMesh = (device: GPUDevice, cm: ColliderMesh): Entity => {
|
|
81
|
+
let id = triMeshes.get(cm);
|
|
82
|
+
if (id === undefined) {
|
|
83
|
+
const data = flatShadedMesh(cm.positions, cm.indices);
|
|
84
|
+
const m = uploadShapeMesh(device, data);
|
|
85
|
+
id = db.transactions.insertStaticMeshPrimitive({
|
|
86
|
+
vertexBuffer: m.vb, indexBuffer: m.ib, indexCount: m.count,
|
|
87
|
+
localBounds: boundsFromShapeMesh(data),
|
|
88
|
+
});
|
|
89
|
+
triMeshes.set(cm, id);
|
|
73
90
|
}
|
|
74
|
-
return
|
|
91
|
+
return id;
|
|
75
92
|
};
|
|
76
93
|
return () => {
|
|
77
|
-
const shapes = db.store.resources.
|
|
94
|
+
const shapes = db.store.resources._shapeMeshes;
|
|
78
95
|
const device = db.store.resources.device;
|
|
79
96
|
if (!shapes || !device) return;
|
|
80
|
-
for (const
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
scale = [1, 1, 1];
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
for (const { include, exclude } of PRIMITIVE_COLLIDER_QUERIES) {
|
|
98
|
+
for (const arch of db.store.queryArchetypes(
|
|
99
|
+
include as typeof RIGID_BODY_COMPONENTS,
|
|
100
|
+
exclude ? { exclude: exclude as ["convexPoints"] | ["colliderMesh"] } : undefined,
|
|
101
|
+
)) {
|
|
102
|
+
const ids = arch.columns.id;
|
|
103
|
+
const css = arch.columns.colliderShape;
|
|
104
|
+
const hes = arch.columns.halfExtents;
|
|
105
|
+
for (let i = arch.rowCount - 1; i >= 0; i--) {
|
|
106
|
+
const id = ids.get(i);
|
|
107
|
+
if (hasVoxelShapeName(db.store, id)) continue;
|
|
108
|
+
if (db.store.get(id, "mesh") != null) continue;
|
|
109
|
+
const shape = css.get(i);
|
|
110
|
+
const he = hes.get(i);
|
|
111
|
+
let meshId: Entity;
|
|
112
|
+
let scale: [number, number, number];
|
|
113
|
+
if (shape === "box") { meshId = shapes.cube; scale = [he[0], he[1], he[2]]; }
|
|
114
|
+
else if (shape === "capsule") { meshId = ensureCapsule(device, he[0], he[1]); scale = [1, 1, 1]; }
|
|
115
|
+
else if (shape === "hull") {
|
|
116
|
+
const pts = db.store.get(id, "convexPoints");
|
|
117
|
+
meshId = pts ? ensureHull(device, pts) : shapes.sphere;
|
|
118
|
+
scale = [1, 1, 1];
|
|
119
|
+
} else if (shape === "mesh") {
|
|
120
|
+
const cm = db.store.get(id, "colliderMesh");
|
|
121
|
+
meshId = cm ? ensureTriMesh(device, cm) : shapes.cube;
|
|
122
|
+
scale = [1, 1, 1];
|
|
123
|
+
} else { meshId = shapes.sphere; scale = [he[0], he[0], he[0]]; }
|
|
124
|
+
db.store.update(id, { mesh: meshId, scale, visible: true });
|
|
125
|
+
}
|
|
100
126
|
}
|
|
101
127
|
}
|
|
102
128
|
};
|