@adobe/data-gpu 0.9.75 → 0.9.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +9 -0
- package/README.md +36 -0
- package/dist/core/core-plugin.d.ts +1 -1
- package/dist/core/public.d.ts +2 -0
- package/dist/core/public.js +4 -0
- package/dist/core/public.js.map +1 -0
- package/dist/graphics/animation/animation-data-plugin.d.ts +8 -0
- package/dist/graphics/animation/animation-plugin.d.ts +10 -2
- package/dist/graphics/camera/camera-plugin.d.ts +3 -3
- package/dist/graphics/camera/orbit/attach-orbit-drag.d.ts +1 -21
- package/dist/graphics/camera/orbit/attach-orbit-drag.js +0 -10
- package/dist/graphics/camera/orbit/attach-orbit-drag.js.map +1 -1
- package/dist/graphics/camera/orbit/orbit-data-plugin.d.ts +6 -6
- package/dist/graphics/camera/orbit/orbit-data-plugin.js +1 -1
- package/dist/graphics/camera/orbit/orbit-data-plugin.js.map +1 -1
- package/dist/graphics/camera/orbit/orbit-drag-service.d.ts +11 -0
- package/dist/graphics/camera/orbit/orbit-drag-service.js +3 -0
- package/dist/graphics/camera/orbit/orbit-drag-service.js.map +1 -0
- package/dist/graphics/camera/orbit/orbit-plugin.d.ts +6 -6
- package/dist/graphics/camera/orbit/orbit-system-plugin.d.ts +8 -8
- package/dist/graphics/camera/orbit/orbit-system-plugin.js +6 -9
- package/dist/graphics/camera/orbit/orbit-system-plugin.js.map +1 -1
- package/dist/graphics/camera/orbit/orbit.d.ts +5 -5
- package/dist/graphics/camera/orbit/public.d.ts +2 -2
- package/dist/graphics/camera/orbit/public.js +2 -1
- package/dist/graphics/camera/orbit/public.js.map +1 -1
- package/dist/graphics/graphics-plugin.d.ts +1 -1
- package/dist/graphics/index.d.ts +1 -0
- package/dist/graphics/index.js +3 -0
- package/dist/graphics/index.js.map +1 -0
- package/dist/graphics/picking/picking-plugin.d.ts +9871 -1912
- package/dist/graphics/picking/picking-plugin.js +3 -3
- package/dist/graphics/picking/picking-plugin.js.map +1 -1
- package/dist/graphics/public.d.ts +38 -0
- package/dist/graphics/public.js +40 -0
- package/dist/graphics/public.js.map +1 -0
- package/dist/graphics/rendering/bone-collider-plugin.d.ts +2967 -486
- package/dist/graphics/rendering/bone-collider-plugin.js +13 -12
- package/dist/graphics/rendering/bone-collider-plugin.js.map +1 -1
- package/dist/graphics/rendering/display-transform-plugin.d.ts +2 -0
- package/dist/graphics/rendering/display-transform-plugin.js +2 -2
- package/dist/graphics/rendering/display-transform-plugin.js.map +1 -1
- package/dist/graphics/rendering/ibl-render/ibl-render-plugin.d.ts +2857 -403
- package/dist/graphics/rendering/ibl-render/ibl-render-plugin.js +9 -9
- package/dist/graphics/rendering/ibl-render/ibl-render-plugin.js.map +1 -1
- package/dist/graphics/rendering/interpolation-plugin.d.ts +1040 -156
- package/dist/graphics/rendering/jolt-ragdoll-plugin.d.ts +3017 -538
- package/dist/graphics/rendering/jolt-ragdoll-plugin.js +6 -6
- package/dist/graphics/rendering/jolt-ragdoll-plugin.js.map +1 -1
- package/dist/graphics/rendering/material-palette-gpu/material-palette-gpu-plugin.d.ts +1123 -0
- package/dist/graphics/rendering/material-palette-gpu/material-palette-gpu-plugin.js +79 -0
- package/dist/graphics/rendering/material-palette-gpu/material-palette-gpu-plugin.js.map +1 -0
- package/dist/graphics/rendering/material-palette-gpu/material-palette-gpu.test.d.ts +1 -0
- package/dist/graphics/rendering/material-palette-gpu/material-palette-gpu.test.js +18 -0
- package/dist/graphics/rendering/material-palette-gpu/material-palette-gpu.test.js.map +1 -0
- package/dist/graphics/rendering/material-palette-gpu/material-palette.d.ts +25 -0
- package/dist/graphics/rendering/material-palette-gpu/material-palette.js +27 -0
- package/dist/graphics/rendering/material-palette-gpu/material-palette.js.map +1 -0
- package/dist/graphics/rendering/material-palette-gpu/palette-bind-group.d.ts +3 -0
- package/dist/graphics/rendering/material-palette-gpu/palette-bind-group.js +22 -0
- package/dist/graphics/rendering/material-palette-gpu/palette-bind-group.js.map +1 -0
- package/dist/graphics/rendering/model-collider-plugin.d.ts +2903 -663
- package/dist/graphics/rendering/model-collider-plugin.js +11 -34
- package/dist/graphics/rendering/model-collider-plugin.js.map +1 -1
- package/dist/graphics/rendering/pbr-core-plugin.d.ts +16 -8
- package/dist/graphics/rendering/pbr-core-plugin.js +16 -19
- package/dist/graphics/rendering/pbr-core-plugin.js.map +1 -1
- package/dist/graphics/rendering/pbr-render/pbr-factor-render-plugin.d.ts +3514 -0
- package/dist/graphics/rendering/pbr-render/pbr-factor-render-plugin.js +189 -0
- package/dist/graphics/rendering/pbr-render/pbr-factor-render-plugin.js.map +1 -0
- package/dist/graphics/rendering/pbr-render/pbr-factor-shader.wgsl.d.ts +7 -0
- package/dist/graphics/rendering/pbr-render/pbr-factor-shader.wgsl.js +124 -0
- package/dist/graphics/rendering/pbr-render/pbr-factor-shader.wgsl.js.map +1 -0
- package/dist/graphics/rendering/pbr-render/physics-bridge-plugin.d.ts +769 -571
- package/dist/graphics/rendering/pbr-render/physics-bridge-plugin.js +98 -79
- package/dist/graphics/rendering/pbr-render/physics-bridge-plugin.js.map +1 -1
- package/dist/graphics/rendering/pbr-render/primitive-render-shared.d.ts +43 -0
- package/dist/graphics/rendering/pbr-render/primitive-render-shared.js +59 -0
- package/dist/graphics/rendering/pbr-render/primitive-render-shared.js.map +1 -0
- package/dist/graphics/rendering/skinning/skinning-plugin.d.ts +2930 -270
- package/dist/graphics/rendering/skinning/skinning-plugin.js +19 -40
- package/dist/graphics/rendering/skinning/skinning-plugin.js.map +1 -1
- package/dist/graphics/scene/model/geometry/public.d.ts +1 -0
- package/dist/graphics/scene/model/mesh/mesh.d.ts +13 -0
- package/dist/graphics/scene/model/mesh/mesh.js +3 -0
- package/dist/graphics/scene/model/mesh/mesh.js.map +1 -0
- package/dist/graphics/scene/model/mesh/public.d.ts +1 -0
- package/dist/graphics/scene/model/mesh/public.js +3 -0
- package/dist/graphics/scene/model/mesh/public.js.map +1 -0
- package/dist/graphics/scene/model/mesh-plugin.d.ts +5177 -0
- package/dist/graphics/scene/model/mesh-plugin.js +87 -0
- package/dist/graphics/scene/model/mesh-plugin.js.map +1 -0
- package/dist/graphics/scene/model/model-loader-plugin.d.ts +2728 -295
- package/dist/graphics/scene/model/model-loader-plugin.js +24 -42
- package/dist/graphics/scene/model/model-loader-plugin.js.map +1 -1
- package/dist/graphics/scene/model/model-plugin.d.ts +1 -352
- package/dist/graphics/scene/model/model-plugin.js +1 -37
- package/dist/graphics/scene/model/model-plugin.js.map +1 -1
- package/dist/graphics/scene/model/model.d.ts +2 -6
- package/dist/graphics/scene/model/model.js.map +1 -1
- package/dist/graphics/scene/model/public.d.ts +1 -1
- package/dist/graphics/scene/model/public.js +2 -1
- package/dist/graphics/scene/model/public.js.map +1 -1
- package/dist/graphics/scene/model/shape/bounds-from-shape-mesh.d.ts +4 -0
- package/dist/graphics/scene/model/shape/bounds-from-shape-mesh.js +25 -0
- package/dist/graphics/scene/model/shape/bounds-from-shape-mesh.js.map +1 -0
- package/dist/graphics/scene/model/shape/shape-geometry-plugin.d.ts +233 -386
- package/dist/graphics/scene/model/shape/shape-geometry-plugin.js +87 -18
- package/dist/graphics/scene/model/shape/shape-geometry-plugin.js.map +1 -1
- package/dist/graphics/scene/model/shape/shape-spec.d.ts +17 -0
- package/dist/graphics/scene/model/shape/shape-spec.js +3 -0
- package/dist/graphics/scene/model/shape/shape-spec.js.map +1 -0
- package/dist/graphics/scene/model/world-bounds-plugin.d.ts +2670 -245
- package/dist/graphics/scene/model/world-bounds-plugin.js +6 -25
- package/dist/graphics/scene/model/world-bounds-plugin.js.map +1 -1
- package/dist/graphics/scene/node/node-data-plugin.d.ts +15 -4
- package/dist/graphics/scene/node/node-data-plugin.js +12 -5
- package/dist/graphics/scene/node/node-data-plugin.js.map +1 -1
- package/dist/graphics/scene/node/node-data-plugin.test.d.ts +1 -0
- package/dist/graphics/scene/node/node-data-plugin.test.js +40 -0
- package/dist/graphics/scene/node/node-data-plugin.test.js.map +1 -0
- package/dist/graphics/scene/node/node-plugin.d.ts +8 -1
- package/dist/graphics/scene/node/transform-plugin.d.ts +8 -1
- package/dist/graphics/scene/scene-plugin.d.ts +2353 -100
- package/dist/graphics/scene/scene-plugin.js +3 -3
- package/dist/graphics/scene/scene-plugin.js.map +1 -1
- package/dist/graphics/scene/scene-uniforms/scene-uniforms-plugin.d.ts +3 -3
- package/dist/index.d.ts +1 -53
- package/dist/index.js +1 -54
- package/dist/index.js.map +1 -1
- package/dist/material/assemble-material-row.d.ts +4 -0
- package/dist/material/assemble-material-row.js +22 -0
- package/dist/material/assemble-material-row.js.map +1 -0
- package/dist/material/definitions.d.ts +833 -0
- package/dist/material/definitions.js +423 -0
- package/dist/material/definitions.js.map +1 -0
- package/dist/material/emission-mode.d.ts +8 -0
- package/dist/material/emission-mode.js +9 -0
- package/dist/material/emission-mode.js.map +1 -0
- package/dist/material/index.d.ts +1 -0
- package/dist/material/index.js +3 -0
- package/dist/material/index.js.map +1 -0
- package/dist/material/json/from-json-string.d.ts +2 -0
- package/dist/material/json/from-json-string.js +12 -0
- package/dist/material/json/from-json-string.js.map +1 -0
- package/dist/material/json/from-json.d.ts +10 -0
- package/dist/material/json/from-json.js +16 -0
- package/dist/material/json/from-json.js.map +1 -0
- package/dist/material/json/from-json.test.d.ts +1 -0
- package/dist/material/json/from-json.test.js +46 -0
- package/dist/material/json/from-json.test.js.map +1 -0
- package/dist/material/json/is-properties-json.d.ts +2 -0
- package/dist/material/json/is-properties-json.js +65 -0
- package/dist/material/json/is-properties-json.js.map +1 -0
- package/dist/material/json/library-json.d.ts +3 -0
- package/dist/material/json/library-json.js +2 -0
- package/dist/material/json/library-json.js.map +1 -0
- package/dist/material/json/load-json.d.ts +7 -0
- package/dist/material/json/load-json.js +10 -0
- package/dist/material/json/load-json.js.map +1 -0
- package/dist/material/json/properties-json.d.ts +25 -0
- package/dist/material/json/properties-json.js +2 -0
- package/dist/material/json/properties-json.js.map +1 -0
- package/dist/material/json/public.d.ts +9 -0
- package/dist/material/json/public.js +6 -0
- package/dist/material/json/public.js.map +1 -0
- package/dist/material/json/to-definition.d.ts +5 -0
- package/dist/material/json/to-definition.js +65 -0
- package/dist/material/json/to-definition.js.map +1 -0
- package/dist/material/material-by-name-lookup.d.ts +11 -0
- package/dist/material/material-by-name-lookup.js +3 -0
- package/dist/material/material-by-name-lookup.js.map +1 -0
- package/dist/material/material-defaults.d.ts +23 -0
- package/dist/material/material-defaults.js +25 -0
- package/dist/material/material-defaults.js.map +1 -0
- package/dist/material/material-definition.d.ts +3 -0
- package/dist/material/material-definition.js +2 -0
- package/dist/material/material-definition.js.map +1 -0
- package/dist/material/material-name.d.ts +2 -0
- package/dist/material/material-name.js +2 -0
- package/dist/material/material-name.js.map +1 -0
- package/dist/material/material-plugin.d.ts +891 -22
- package/dist/material/material-plugin.js +46 -21
- package/dist/material/material-plugin.js.map +1 -1
- package/dist/material/material-plugin.test.d.ts +1 -0
- package/dist/material/material-plugin.test.js +87 -0
- package/dist/material/material-plugin.test.js.map +1 -0
- package/dist/material/material.d.ts +27 -29
- package/dist/material/material.js +0 -1
- package/dist/material/material.js.map +1 -1
- package/dist/material/public.d.ts +12 -2
- package/dist/material/public.js +12 -2
- package/dist/material/public.js.map +1 -1
- package/dist/material/require-material.d.ts +4 -0
- package/dist/material/require-material.js +10 -0
- package/dist/material/require-material.js.map +1 -0
- package/dist/material/standard-material-names.d.ts +2 -0
- package/dist/material/standard-material-names.js +4 -0
- package/dist/material/standard-material-names.js.map +1 -0
- package/dist/material/standard-materials.d.ts +1 -1
- package/dist/material/standard-materials.js +17 -24
- package/dist/material/standard-materials.js.map +1 -1
- package/dist/material/stress-strain-curve/create.d.ts +8 -0
- package/dist/material/stress-strain-curve/create.js +2 -0
- package/dist/material/stress-strain-curve/create.js.map +1 -0
- package/dist/material/stress-strain-curve/public.d.ts +2 -0
- package/dist/material/stress-strain-curve/public.js +3 -0
- package/dist/material/stress-strain-curve/public.js.map +1 -0
- package/dist/material/stress-strain-curve/schema.d.ts +52 -0
- package/dist/material/stress-strain-curve/schema.js +19 -0
- package/dist/material/stress-strain-curve/schema.js.map +1 -0
- package/dist/material/stress-strain-curve/schema.test.d.ts +1 -0
- package/dist/material/stress-strain-curve/schema.test.js +18 -0
- package/dist/material/stress-strain-curve/schema.test.js.map +1 -0
- package/dist/material/stress-strain-curve/stress-strain-curve.d.ts +4 -0
- package/dist/material/stress-strain-curve/stress-strain-curve.js +2 -0
- package/dist/material/stress-strain-curve/stress-strain-curve.js.map +1 -0
- package/dist/physics/body/collider-shape/mass-from-volume.d.ts +2 -0
- package/dist/physics/body/collider-shape/mass-from-volume.js +4 -0
- package/dist/physics/body/collider-shape/mass-from-volume.js.map +1 -0
- package/dist/physics/body/collider-shape/mass-from-volume.test.d.ts +1 -0
- package/dist/physics/body/collider-shape/mass-from-volume.test.js +8 -0
- package/dist/physics/body/collider-shape/mass-from-volume.test.js.map +1 -0
- package/dist/physics/collider-primitive-render-archetype.d.ts +2 -0
- package/dist/physics/collider-primitive-render-archetype.js +3 -0
- package/dist/physics/collider-primitive-render-archetype.js.map +1 -0
- package/dist/physics/collider-primitive-render-archetypes.d.ts +2 -0
- package/dist/physics/collider-primitive-render-archetypes.js +9 -0
- package/dist/physics/collider-primitive-render-archetypes.js.map +1 -0
- package/dist/physics/index.d.ts +1 -0
- package/dist/physics/index.js +3 -0
- package/dist/physics/index.js.map +1 -0
- package/dist/physics/is-voxel-shape-physics-pending.d.ts +3 -0
- package/dist/physics/is-voxel-shape-physics-pending.js +7 -0
- package/dist/physics/is-voxel-shape-physics-pending.js.map +1 -0
- package/dist/physics/physics-clock/physics-clock.d.ts +15 -0
- package/dist/physics/physics-clock/physics-clock.js +3 -0
- package/dist/physics/physics-clock/physics-clock.js.map +1 -0
- package/dist/physics/physics-clock-plugin.d.ts +2 -22
- package/dist/physics/physics-clock-plugin.js +0 -2
- package/dist/physics/physics-clock-plugin.js.map +1 -1
- package/dist/physics/physics-clock.test.js.map +1 -1
- package/dist/physics/physics-data-plugin.d.ts +889 -13
- package/dist/physics/physics-data-plugin.js +8 -6
- package/dist/physics/physics-data-plugin.js.map +1 -1
- package/dist/physics/public.d.ts +21 -0
- package/dist/physics/public.js +23 -0
- package/dist/physics/public.js.map +1 -0
- package/dist/physics/ragdoll/bone-capsule.d.ts +8 -0
- package/dist/physics/ragdoll/bone-capsule.js +3 -0
- package/dist/physics/ragdoll/bone-capsule.js.map +1 -0
- package/dist/physics/ragdoll/fit-bone-capsules-input.d.ts +11 -0
- package/dist/physics/ragdoll/fit-bone-capsules-input.js +3 -0
- package/dist/physics/ragdoll/fit-bone-capsules-input.js.map +1 -0
- package/dist/physics/ragdoll/fit-bone-capsules.d.ts +2 -38
- package/dist/physics/ragdoll/fit-bone-capsules.js +13 -0
- package/dist/physics/ragdoll/fit-bone-capsules.js.map +1 -1
- package/dist/physics/ragdoll/fit-bone-capsules.test.js.map +1 -1
- package/dist/physics/ragdoll/skin-vertices.d.ts +6 -0
- package/dist/physics/ragdoll/skin-vertices.js +3 -0
- package/dist/physics/ragdoll/skin-vertices.js.map +1 -0
- package/dist/physics/rigid-body-components.d.ts +2 -0
- package/dist/physics/rigid-body-components.js +13 -0
- package/dist/physics/rigid-body-components.js.map +1 -0
- package/dist/physics/solvers/jolt-solver-plugin.d.ts +918 -41
- package/dist/physics/solvers/jolt-solver-plugin.js +19 -3
- package/dist/physics/solvers/jolt-solver-plugin.js.map +1 -1
- package/dist/physics/solvers/rapier-solver-plugin.d.ts +918 -41
- package/dist/physics/solvers/rapier-solver-plugin.js +7 -2
- package/dist/physics/solvers/rapier-solver-plugin.js.map +1 -1
- package/dist/physics/solvers/solver-benchmark-options.d.ts +14 -0
- package/dist/physics/solvers/solver-benchmark-options.js +3 -0
- package/dist/physics/solvers/solver-benchmark-options.js.map +1 -0
- package/dist/physics/solvers/solver-benchmark-result.d.ts +15 -0
- package/dist/physics/solvers/solver-benchmark-result.js +3 -0
- package/dist/physics/solvers/solver-benchmark-result.js.map +1 -0
- package/dist/physics/solvers/solver-benchmark.d.ts +2 -43
- package/dist/physics/solvers/solver-benchmark.js.map +1 -1
- package/dist/physics/static-collider-components.d.ts +2 -0
- package/dist/physics/static-collider-components.js +10 -0
- package/dist/physics/static-collider-components.js.map +1 -0
- package/package.json +14 -2
- package/src/core/public.ts +4 -0
- package/src/graphics/camera/orbit/attach-orbit-drag.ts +7 -27
- package/src/graphics/camera/orbit/orbit-data-plugin.ts +1 -1
- package/src/graphics/camera/orbit/orbit-drag-service.ts +13 -0
- package/src/graphics/camera/orbit/orbit-system-plugin.ts +6 -9
- package/src/graphics/camera/orbit/orbit.ts +5 -5
- package/src/graphics/camera/orbit/public.ts +2 -2
- package/src/graphics/index.ts +3 -0
- package/src/graphics/picking/picking-plugin.ts +4 -4
- package/src/graphics/public.ts +40 -0
- package/src/graphics/rendering/bone-collider-plugin.ts +16 -12
- package/src/graphics/rendering/display-transform-plugin.ts +2 -2
- package/src/graphics/rendering/ibl-render/ibl-render-plugin.ts +9 -9
- package/src/graphics/rendering/interpolation.test.ts +1 -1
- package/src/graphics/rendering/jolt-ragdoll-plugin.ts +11 -7
- package/src/graphics/rendering/material-palette-gpu/material-palette-gpu-plugin.ts +86 -0
- package/src/graphics/rendering/material-palette-gpu/material-palette-gpu.test.ts +20 -0
- package/src/graphics/rendering/material-palette-gpu/material-palette.ts +41 -0
- package/src/graphics/rendering/material-palette-gpu/palette-bind-group.ts +24 -0
- package/src/graphics/rendering/model-collider-plugin.ts +19 -35
- package/src/graphics/rendering/pbr-core-plugin.ts +16 -19
- package/src/graphics/rendering/pbr-render/{pbr-render-plugin.ts → pbr-factor-render-plugin.ts} +60 -111
- package/src/graphics/rendering/pbr-render/{pbr-array-shader.wgsl.ts → pbr-factor-shader.wgsl.ts} +19 -40
- package/src/graphics/rendering/pbr-render/physics-bridge-plugin.ts +95 -69
- package/src/graphics/rendering/pbr-render/primitive-render-shared.ts +76 -0
- package/src/graphics/rendering/skinning/skinning-plugin.ts +23 -41
- package/src/graphics/scene/model/geometry/public.ts +1 -1
- package/src/graphics/scene/model/mesh/mesh.ts +18 -0
- package/src/graphics/scene/model/mesh/public.ts +3 -0
- package/src/graphics/scene/model/mesh-plugin.ts +102 -0
- package/src/graphics/scene/model/model-loader-plugin.ts +25 -43
- package/src/graphics/scene/model/model-plugin.ts +1 -44
- package/src/graphics/scene/model/model.ts +2 -6
- package/src/graphics/scene/model/public.ts +3 -1
- package/src/graphics/scene/model/shape/bounds-from-shape-mesh.ts +20 -0
- package/src/graphics/scene/model/shape/shape-geometry-plugin.ts +97 -18
- package/src/graphics/scene/model/shape/shape-spec.ts +9 -0
- package/src/graphics/scene/model/world-bounds-plugin.ts +6 -25
- package/src/graphics/scene/node/node-data-plugin.test.ts +47 -0
- package/src/graphics/scene/node/node-data-plugin.ts +12 -5
- package/src/graphics/scene/scene-plugin.ts +3 -3
- package/src/index.ts +1 -70
- package/src/material/assemble-material-row.ts +26 -0
- package/src/material/definitions.ts +427 -0
- package/src/material/emission-mode.ts +11 -0
- package/src/material/index.ts +3 -0
- package/src/material/json/from-json-string.ts +11 -0
- package/src/material/json/from-json.test.ts +50 -0
- package/src/material/json/from-json.ts +23 -0
- package/src/material/json/is-properties-json.ts +77 -0
- package/src/material/json/library-json.ts +4 -0
- package/src/material/json/load-json.ts +15 -0
- package/src/material/json/properties-json.ts +25 -0
- package/src/material/json/public.ts +9 -0
- package/src/material/json/to-definition.ts +70 -0
- package/src/material/material-by-name-lookup.ts +10 -0
- package/src/material/material-defaults.ts +26 -0
- package/src/material/material-definition.ts +4 -0
- package/src/material/material-name.ts +3 -0
- package/src/material/material-plugin.test.ts +97 -0
- package/src/material/material-plugin.ts +67 -39
- package/src/material/material.ts +35 -34
- package/src/material/public.ts +12 -2
- package/src/material/require-material.ts +15 -0
- package/src/material/standard-material-names.ts +4 -0
- package/src/material/standard-materials.ts +21 -27
- package/src/material/stress-strain-curve/create.ts +9 -0
- package/src/material/stress-strain-curve/public.ts +2 -0
- package/src/material/stress-strain-curve/schema.test.ts +20 -0
- package/src/material/stress-strain-curve/schema.ts +20 -0
- package/src/material/stress-strain-curve/stress-strain-curve.ts +11 -0
- package/src/physics/README.md +9 -1
- package/src/physics/body/collider-shape/mass-from-volume.test.ts +8 -0
- package/src/physics/body/collider-shape/mass-from-volume.ts +4 -0
- package/src/physics/collider-primitive-render-archetype.ts +5 -0
- package/src/physics/collider-primitive-render-archetypes.ts +9 -0
- package/src/physics/index.ts +3 -0
- package/src/physics/is-voxel-shape-physics-pending.ts +9 -0
- package/src/physics/physics-clock/physics-clock.ts +17 -0
- package/src/physics/physics-clock-plugin.ts +1 -24
- package/src/physics/physics-clock.test.ts +2 -1
- package/src/physics/physics-data-plugin.ts +8 -6
- package/src/physics/public.ts +23 -0
- package/src/physics/ragdoll/bone-capsule.ts +11 -0
- package/src/physics/ragdoll/fit-bone-capsules-input.ts +14 -0
- package/src/physics/ragdoll/fit-bone-capsules.test.ts +2 -1
- package/src/physics/ragdoll/fit-bone-capsules.ts +2 -27
- package/src/physics/ragdoll/skin-vertices.ts +8 -0
- package/src/physics/rigid-body-components.ts +13 -0
- package/src/physics/solvers/README.md +4 -0
- package/src/physics/solvers/jolt-solver-plugin.ts +19 -5
- package/src/physics/solvers/rapier-solver-plugin.ts +5 -2
- package/src/physics/solvers/solver-benchmark-options.ts +16 -0
- package/src/physics/solvers/solver-benchmark-result.ts +17 -0
- package/src/physics/solvers/solver-benchmark.ts +2 -35
- package/src/physics/static-collider-components.ts +10 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/graphics/rendering/material-gpu/material-arrays.ts +0 -113
- package/src/graphics/rendering/material-gpu/material-bind-group.ts +0 -61
- package/src/graphics/rendering/material-gpu/material-gpu-plugin.ts +0 -95
- package/src/graphics/scene/model/geometry/geometry.ts +0 -12
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
import type { MaterialDefinition } from "./material-definition.js";
|
|
2
|
+
import { StressStrainCurve } from "./stress-strain-curve/stress-strain-curve.js";
|
|
3
|
+
|
|
4
|
+
const defaultSolid = {
|
|
5
|
+
friction: 0.5,
|
|
6
|
+
compliance: 1e-8,
|
|
7
|
+
normalScale: 1,
|
|
8
|
+
occlusionStrength: 1,
|
|
9
|
+
baseColorUrl: "",
|
|
10
|
+
metallicRoughnessUrl: "",
|
|
11
|
+
normalUrl: "",
|
|
12
|
+
occlusionUrl: "",
|
|
13
|
+
emissiveUrl: "",
|
|
14
|
+
} as const satisfies Partial<MaterialDefinition>;
|
|
15
|
+
|
|
16
|
+
const noSolidCurve = {
|
|
17
|
+
stressStrainCurve: StressStrainCurve.create({
|
|
18
|
+
tensileYieldStrainStress: [0,0],
|
|
19
|
+
tensileFractureStrainStress: [0,0],
|
|
20
|
+
compressiveYieldStrainStress: [0,0],
|
|
21
|
+
compressiveFractureStrainStress: [0,0],
|
|
22
|
+
}),
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const metaMaterialBase: Omit<MaterialDefinition, "baseColorFactor"> = {
|
|
26
|
+
metallicFactor: 0.8,
|
|
27
|
+
roughnessFactor: 0.2,
|
|
28
|
+
irReflectance: 0.5,
|
|
29
|
+
irEmission: 0,
|
|
30
|
+
emissionMode: 0,
|
|
31
|
+
restitution: 0.35,
|
|
32
|
+
emissiveFactor: [0, 0, 0],
|
|
33
|
+
density: 1200,
|
|
34
|
+
viscosity: 0,
|
|
35
|
+
heatCapacity: Number.POSITIVE_INFINITY,
|
|
36
|
+
thermalConductivity: 100,
|
|
37
|
+
...defaultSolid,
|
|
38
|
+
stressStrainCurve: StressStrainCurve.create({
|
|
39
|
+
tensileYieldStrainStress: [0.01333, 40],
|
|
40
|
+
tensileFractureStrainStress: [0.08, 48],
|
|
41
|
+
compressiveYieldStrainStress: [-0.015, -45],
|
|
42
|
+
compressiveFractureStrainStress: [-0.09, -52],
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const definitions = {
|
|
47
|
+
air: {
|
|
48
|
+
baseColorFactor: [1,1,1,0],
|
|
49
|
+
metallicFactor: 0,
|
|
50
|
+
roughnessFactor: 0,
|
|
51
|
+
irReflectance: 0,
|
|
52
|
+
irEmission: 0,
|
|
53
|
+
emissionMode: 0,
|
|
54
|
+
restitution: 0,
|
|
55
|
+
emissiveFactor: [0,0,0],
|
|
56
|
+
density: 1.225,
|
|
57
|
+
viscosity: 0,
|
|
58
|
+
heatCapacity: 1006,
|
|
59
|
+
thermalConductivity: 0.024,
|
|
60
|
+
...defaultSolid,
|
|
61
|
+
...noSolidCurve,
|
|
62
|
+
},
|
|
63
|
+
water: {
|
|
64
|
+
baseColorFactor: [0,0,1,0.1],
|
|
65
|
+
metallicFactor: 0,
|
|
66
|
+
roughnessFactor: 0,
|
|
67
|
+
irReflectance: 0,
|
|
68
|
+
irEmission: 0,
|
|
69
|
+
emissionMode: 0,
|
|
70
|
+
restitution: 0.05,
|
|
71
|
+
emissiveFactor: [0,0,0],
|
|
72
|
+
density: 997,
|
|
73
|
+
viscosity: 1,
|
|
74
|
+
heatCapacity: 4200,
|
|
75
|
+
thermalConductivity: 0.66,
|
|
76
|
+
...defaultSolid,
|
|
77
|
+
...noSolidCurve,
|
|
78
|
+
},
|
|
79
|
+
rock: {
|
|
80
|
+
baseColorFactor: [0.5,0.5,0.5,1],
|
|
81
|
+
metallicFactor: 0,
|
|
82
|
+
roughnessFactor: 0.8,
|
|
83
|
+
irReflectance: 0.1,
|
|
84
|
+
irEmission: 0,
|
|
85
|
+
emissionMode: 0,
|
|
86
|
+
restitution: 0.15,
|
|
87
|
+
emissiveFactor: [0,0,0],
|
|
88
|
+
density: 2650,
|
|
89
|
+
viscosity: 0,
|
|
90
|
+
heatCapacity: 800,
|
|
91
|
+
thermalConductivity: 4,
|
|
92
|
+
stressStrainCurve: StressStrainCurve.create({
|
|
93
|
+
tensileYieldStrainStress: [0.0016,80],
|
|
94
|
+
tensileFractureStrainStress: [0.002,90],
|
|
95
|
+
compressiveYieldStrainStress: [-0.0026,-130],
|
|
96
|
+
compressiveFractureStrainStress: [-0.004,-160],
|
|
97
|
+
}),
|
|
98
|
+
},
|
|
99
|
+
ice: {
|
|
100
|
+
baseColorFactor: [0.8,0.8,1,0.5],
|
|
101
|
+
metallicFactor: 0,
|
|
102
|
+
roughnessFactor: 0.1,
|
|
103
|
+
irReflectance: 0.2,
|
|
104
|
+
irEmission: 0,
|
|
105
|
+
emissionMode: 0,
|
|
106
|
+
restitution: 0.2,
|
|
107
|
+
emissiveFactor: [0,0,0],
|
|
108
|
+
density: 917,
|
|
109
|
+
viscosity: 0,
|
|
110
|
+
heatCapacity: 2040,
|
|
111
|
+
thermalConductivity: 2.18,
|
|
112
|
+
stressStrainCurve: StressStrainCurve.create({
|
|
113
|
+
tensileYieldStrainStress: [0.00156,15],
|
|
114
|
+
tensileFractureStrainStress: [0.002,18],
|
|
115
|
+
compressiveYieldStrainStress: [-0.00365,-35],
|
|
116
|
+
compressiveFractureStrainStress: [-0.005,-45],
|
|
117
|
+
}),
|
|
118
|
+
},
|
|
119
|
+
iron: {
|
|
120
|
+
baseColorFactor: [0.7,0.7,0.7,1],
|
|
121
|
+
metallicFactor: 1,
|
|
122
|
+
roughnessFactor: 0.3,
|
|
123
|
+
irReflectance: 0.4,
|
|
124
|
+
irEmission: 0,
|
|
125
|
+
emissionMode: 0,
|
|
126
|
+
restitution: 0.45,
|
|
127
|
+
emissiveFactor: [0,0,0],
|
|
128
|
+
density: 7874,
|
|
129
|
+
viscosity: 0,
|
|
130
|
+
heatCapacity: 460,
|
|
131
|
+
thermalConductivity: 50,
|
|
132
|
+
stressStrainCurve: StressStrainCurve.create({
|
|
133
|
+
tensileYieldStrainStress: [0.001,200],
|
|
134
|
+
tensileFractureStrainStress: [0.12,350],
|
|
135
|
+
compressiveYieldStrainStress: [-0.0011,-220],
|
|
136
|
+
compressiveFractureStrainStress: [-0.11,-400],
|
|
137
|
+
}),
|
|
138
|
+
},
|
|
139
|
+
dirt: {
|
|
140
|
+
baseColorFactor: [0.4,0.3,0.2,1],
|
|
141
|
+
metallicFactor: 0,
|
|
142
|
+
roughnessFactor: 0.9,
|
|
143
|
+
irReflectance: 0.05,
|
|
144
|
+
irEmission: 0,
|
|
145
|
+
emissionMode: 0,
|
|
146
|
+
restitution: 0.05,
|
|
147
|
+
emissiveFactor: [0,0,0],
|
|
148
|
+
density: 1510,
|
|
149
|
+
viscosity: 0,
|
|
150
|
+
heatCapacity: 800,
|
|
151
|
+
thermalConductivity: 0.25,
|
|
152
|
+
stressStrainCurve: StressStrainCurve.create({
|
|
153
|
+
tensileYieldStrainStress: [0.04,2],
|
|
154
|
+
tensileFractureStrainStress: [0.08,4],
|
|
155
|
+
compressiveYieldStrainStress: [-0.12,-6],
|
|
156
|
+
compressiveFractureStrainStress: [-0.2,-10],
|
|
157
|
+
}),
|
|
158
|
+
},
|
|
159
|
+
sand: {
|
|
160
|
+
baseColorFactor: [0.9,0.8,0.6,1],
|
|
161
|
+
metallicFactor: 0,
|
|
162
|
+
roughnessFactor: 0.8,
|
|
163
|
+
irReflectance: 0.1,
|
|
164
|
+
irEmission: 0,
|
|
165
|
+
emissionMode: 0,
|
|
166
|
+
restitution: 0.15,
|
|
167
|
+
emissiveFactor: [0,0,0],
|
|
168
|
+
density: 2100,
|
|
169
|
+
viscosity: 0,
|
|
170
|
+
heatCapacity: 830,
|
|
171
|
+
thermalConductivity: 0.2,
|
|
172
|
+
stressStrainCurve: StressStrainCurve.create({
|
|
173
|
+
tensileYieldStrainStress: [0.0125,1],
|
|
174
|
+
tensileFractureStrainStress: [0.025,2],
|
|
175
|
+
compressiveYieldStrainStress: [-0.05,-4],
|
|
176
|
+
compressiveFractureStrainStress: [-0.09,-7],
|
|
177
|
+
}),
|
|
178
|
+
},
|
|
179
|
+
woodHard: {
|
|
180
|
+
baseColorFactor: [0.6,0.4,0.2,1],
|
|
181
|
+
metallicFactor: 0,
|
|
182
|
+
roughnessFactor: 0.7,
|
|
183
|
+
irReflectance: 0.05,
|
|
184
|
+
irEmission: 0,
|
|
185
|
+
emissionMode: 0,
|
|
186
|
+
restitution: 0.3,
|
|
187
|
+
emissiveFactor: [0,0,0],
|
|
188
|
+
density: 650,
|
|
189
|
+
viscosity: 0,
|
|
190
|
+
heatCapacity: 2000,
|
|
191
|
+
thermalConductivity: 0.16,
|
|
192
|
+
stressStrainCurve: StressStrainCurve.create({
|
|
193
|
+
tensileYieldStrainStress: [0.00375,45],
|
|
194
|
+
tensileFractureStrainStress: [0.04,52],
|
|
195
|
+
compressiveYieldStrainStress: [-0.0048,-58],
|
|
196
|
+
compressiveFractureStrainStress: [-0.055,-68],
|
|
197
|
+
}),
|
|
198
|
+
},
|
|
199
|
+
woodSoft: {
|
|
200
|
+
baseColorFactor: [0.7,0.5,0.3,1],
|
|
201
|
+
metallicFactor: 0,
|
|
202
|
+
roughnessFactor: 0.8,
|
|
203
|
+
irReflectance: 0.05,
|
|
204
|
+
irEmission: 0,
|
|
205
|
+
emissionMode: 0,
|
|
206
|
+
restitution: 0.28,
|
|
207
|
+
emissiveFactor: [0,0,0],
|
|
208
|
+
density: 490,
|
|
209
|
+
viscosity: 0,
|
|
210
|
+
heatCapacity: 2300,
|
|
211
|
+
thermalConductivity: 0.12,
|
|
212
|
+
stressStrainCurve: StressStrainCurve.create({
|
|
213
|
+
tensileYieldStrainStress: [0.00389,35],
|
|
214
|
+
tensileFractureStrainStress: [0.045,42],
|
|
215
|
+
compressiveYieldStrainStress: [-0.00489,-44],
|
|
216
|
+
compressiveFractureStrainStress: [-0.055,-54],
|
|
217
|
+
}),
|
|
218
|
+
},
|
|
219
|
+
steel: {
|
|
220
|
+
baseColorFactor: [0.55,0.55,0.6,1],
|
|
221
|
+
metallicFactor: 1,
|
|
222
|
+
roughnessFactor: 0.2,
|
|
223
|
+
irReflectance: 0.3,
|
|
224
|
+
irEmission: 0,
|
|
225
|
+
emissionMode: 0,
|
|
226
|
+
restitution: 0.55,
|
|
227
|
+
emissiveFactor: [0,0,0],
|
|
228
|
+
density: 7850,
|
|
229
|
+
viscosity: 0,
|
|
230
|
+
heatCapacity: 490,
|
|
231
|
+
thermalConductivity: 50,
|
|
232
|
+
stressStrainCurve: StressStrainCurve.create({
|
|
233
|
+
tensileYieldStrainStress: [0.00175,350],
|
|
234
|
+
tensileFractureStrainStress: [0.15,500],
|
|
235
|
+
compressiveYieldStrainStress: [-0.0019,-380],
|
|
236
|
+
compressiveFractureStrainStress: [-0.13,-520],
|
|
237
|
+
}),
|
|
238
|
+
},
|
|
239
|
+
concrete: {
|
|
240
|
+
baseColorFactor: [0.6,0.6,0.6,1],
|
|
241
|
+
metallicFactor: 0,
|
|
242
|
+
roughnessFactor: 0.9,
|
|
243
|
+
irReflectance: 0.1,
|
|
244
|
+
irEmission: 0,
|
|
245
|
+
emissionMode: 0,
|
|
246
|
+
restitution: 0.12,
|
|
247
|
+
emissiveFactor: [0,0,0],
|
|
248
|
+
density: 2400,
|
|
249
|
+
viscosity: 0,
|
|
250
|
+
heatCapacity: 880,
|
|
251
|
+
thermalConductivity: 1.4,
|
|
252
|
+
stressStrainCurve: StressStrainCurve.create({
|
|
253
|
+
tensileYieldStrainStress: [0.000117,3.5],
|
|
254
|
+
tensileFractureStrainStress: [0.00015,4],
|
|
255
|
+
compressiveYieldStrainStress: [-0.00117,-35],
|
|
256
|
+
compressiveFractureStrainStress: [-0.003,-40],
|
|
257
|
+
}),
|
|
258
|
+
},
|
|
259
|
+
reinforcedConcrete: {
|
|
260
|
+
baseColorFactor: [0.55,0.55,0.55,1],
|
|
261
|
+
metallicFactor: 0.1,
|
|
262
|
+
roughnessFactor: 0.9,
|
|
263
|
+
irReflectance: 0.15,
|
|
264
|
+
irEmission: 0,
|
|
265
|
+
emissionMode: 0,
|
|
266
|
+
restitution: 0.14,
|
|
267
|
+
emissiveFactor: [0,0,0],
|
|
268
|
+
density: 2500,
|
|
269
|
+
viscosity: 0,
|
|
270
|
+
heatCapacity: 880,
|
|
271
|
+
thermalConductivity: 2,
|
|
272
|
+
stressStrainCurve: StressStrainCurve.create({
|
|
273
|
+
tensileYieldStrainStress: [0.00015,4.5],
|
|
274
|
+
tensileFractureStrainStress: [0.00022,5.5],
|
|
275
|
+
compressiveYieldStrainStress: [-0.0015,-45],
|
|
276
|
+
compressiveFractureStrainStress: [-0.0035,-55],
|
|
277
|
+
}),
|
|
278
|
+
},
|
|
279
|
+
glass: {
|
|
280
|
+
baseColorFactor: [0.9,0.95,1,0.3],
|
|
281
|
+
metallicFactor: 0,
|
|
282
|
+
roughnessFactor: 0.05,
|
|
283
|
+
irReflectance: 0.1,
|
|
284
|
+
irEmission: 0,
|
|
285
|
+
emissionMode: 0,
|
|
286
|
+
restitution: 0.18,
|
|
287
|
+
emissiveFactor: [0,0,0],
|
|
288
|
+
density: 2500,
|
|
289
|
+
viscosity: 0,
|
|
290
|
+
heatCapacity: 840,
|
|
291
|
+
thermalConductivity: 1,
|
|
292
|
+
stressStrainCurve: StressStrainCurve.create({
|
|
293
|
+
tensileYieldStrainStress: [0.00043,30],
|
|
294
|
+
tensileFractureStrainStress: [0.0007,35],
|
|
295
|
+
compressiveYieldStrainStress: [-0.005,-350],
|
|
296
|
+
compressiveFractureStrainStress: [-0.006,-400],
|
|
297
|
+
}),
|
|
298
|
+
},
|
|
299
|
+
temperedGlass: {
|
|
300
|
+
baseColorFactor: [0.5,0.55,0.6,0.4],
|
|
301
|
+
metallicFactor: 0,
|
|
302
|
+
roughnessFactor: 0.05,
|
|
303
|
+
irReflectance: 0.15,
|
|
304
|
+
irEmission: 0,
|
|
305
|
+
emissionMode: 0,
|
|
306
|
+
restitution: 0.22,
|
|
307
|
+
emissiveFactor: [0,0,0],
|
|
308
|
+
density: 2500,
|
|
309
|
+
viscosity: 0,
|
|
310
|
+
heatCapacity: 840,
|
|
311
|
+
thermalConductivity: 1,
|
|
312
|
+
stressStrainCurve: StressStrainCurve.create({
|
|
313
|
+
tensileYieldStrainStress: [0.00171,120],
|
|
314
|
+
tensileFractureStrainStress: [0.004,200],
|
|
315
|
+
compressiveYieldStrainStress: [-0.00786,-550],
|
|
316
|
+
compressiveFractureStrainStress: [-0.0095,-620],
|
|
317
|
+
}),
|
|
318
|
+
},
|
|
319
|
+
meta: {
|
|
320
|
+
...metaMaterialBase,
|
|
321
|
+
baseColorFactor: [0.2,0.6,0.7,1],
|
|
322
|
+
},
|
|
323
|
+
marble: {
|
|
324
|
+
baseColorFactor: [0.9,0.9,0.9,1],
|
|
325
|
+
metallicFactor: 0,
|
|
326
|
+
roughnessFactor: 0.3,
|
|
327
|
+
irReflectance: 0.2,
|
|
328
|
+
irEmission: 0,
|
|
329
|
+
emissionMode: 0,
|
|
330
|
+
restitution: 0.12,
|
|
331
|
+
emissiveFactor: [0,0,0],
|
|
332
|
+
density: 2700,
|
|
333
|
+
viscosity: 0,
|
|
334
|
+
heatCapacity: 830,
|
|
335
|
+
thermalConductivity: 1.4,
|
|
336
|
+
stressStrainCurve: StressStrainCurve.create({
|
|
337
|
+
tensileYieldStrainStress: [0.000455,25],
|
|
338
|
+
tensileFractureStrainStress: [0.00065,30],
|
|
339
|
+
compressiveYieldStrainStress: [-0.00173,-95],
|
|
340
|
+
compressiveFractureStrainStress: [-0.00273,-125],
|
|
341
|
+
}),
|
|
342
|
+
},
|
|
343
|
+
granite: {
|
|
344
|
+
baseColorFactor: [0.8,0.8,0.8,1],
|
|
345
|
+
metallicFactor: 0,
|
|
346
|
+
roughnessFactor: 0.6,
|
|
347
|
+
irReflectance: 0.15,
|
|
348
|
+
irEmission: 0,
|
|
349
|
+
emissionMode: 0,
|
|
350
|
+
restitution: 0.12,
|
|
351
|
+
emissiveFactor: [0,0,0],
|
|
352
|
+
density: 2700,
|
|
353
|
+
viscosity: 0,
|
|
354
|
+
heatCapacity: 830,
|
|
355
|
+
thermalConductivity: 1.4,
|
|
356
|
+
stressStrainCurve: StressStrainCurve.create({
|
|
357
|
+
tensileYieldStrainStress: [0.00222,100],
|
|
358
|
+
tensileFractureStrainStress: [0.0032,120],
|
|
359
|
+
compressiveYieldStrainStress: [-0.00422,-190],
|
|
360
|
+
compressiveFractureStrainStress: [-0.00555,-230],
|
|
361
|
+
}),
|
|
362
|
+
},
|
|
363
|
+
metaRed: {
|
|
364
|
+
...metaMaterialBase,
|
|
365
|
+
baseColorFactor: [1,0,0,1],
|
|
366
|
+
},
|
|
367
|
+
metaOrange: {
|
|
368
|
+
...metaMaterialBase,
|
|
369
|
+
baseColorFactor: [1,0.5,0,1],
|
|
370
|
+
},
|
|
371
|
+
metaYellow: {
|
|
372
|
+
...metaMaterialBase,
|
|
373
|
+
baseColorFactor: [1,1,0,1],
|
|
374
|
+
},
|
|
375
|
+
metaLime: {
|
|
376
|
+
...metaMaterialBase,
|
|
377
|
+
baseColorFactor: [0.5,1,0,1],
|
|
378
|
+
},
|
|
379
|
+
metaGreen: {
|
|
380
|
+
...metaMaterialBase,
|
|
381
|
+
baseColorFactor: [0,1,0,1],
|
|
382
|
+
},
|
|
383
|
+
metaTeal: {
|
|
384
|
+
...metaMaterialBase,
|
|
385
|
+
baseColorFactor: [0,1,0.5,1],
|
|
386
|
+
},
|
|
387
|
+
metaCyan: {
|
|
388
|
+
...metaMaterialBase,
|
|
389
|
+
baseColorFactor: [0,1,1,1],
|
|
390
|
+
},
|
|
391
|
+
metaBlue: {
|
|
392
|
+
...metaMaterialBase,
|
|
393
|
+
baseColorFactor: [0,0.5,1,1],
|
|
394
|
+
},
|
|
395
|
+
metaIndigo: {
|
|
396
|
+
...metaMaterialBase,
|
|
397
|
+
baseColorFactor: [0.25,0,1,1],
|
|
398
|
+
},
|
|
399
|
+
metaViolet: {
|
|
400
|
+
...metaMaterialBase,
|
|
401
|
+
baseColorFactor: [0.5,0,1,1],
|
|
402
|
+
},
|
|
403
|
+
metaPurple: {
|
|
404
|
+
...metaMaterialBase,
|
|
405
|
+
baseColorFactor: [0.75,0,1,1],
|
|
406
|
+
},
|
|
407
|
+
metaMagenta: {
|
|
408
|
+
...metaMaterialBase,
|
|
409
|
+
baseColorFactor: [1,0,1,1],
|
|
410
|
+
},
|
|
411
|
+
metaPink: {
|
|
412
|
+
...metaMaterialBase,
|
|
413
|
+
baseColorFactor: [1,0.5,0.75,1],
|
|
414
|
+
},
|
|
415
|
+
metaWhite: {
|
|
416
|
+
...metaMaterialBase,
|
|
417
|
+
baseColorFactor: [1,1,1,1],
|
|
418
|
+
},
|
|
419
|
+
metaGray: {
|
|
420
|
+
...metaMaterialBase,
|
|
421
|
+
baseColorFactor: [0.5,0.5,0.5,1],
|
|
422
|
+
},
|
|
423
|
+
metaBlack: {
|
|
424
|
+
...metaMaterialBase,
|
|
425
|
+
baseColorFactor: [0,0,0,1],
|
|
426
|
+
},
|
|
427
|
+
} as const satisfies Record<string, Partial<MaterialDefinition>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
|
|
3
|
+
/** Visible emission interpretation (matches legacy material schema). */
|
|
4
|
+
export const EmissionMode = {
|
|
5
|
+
/** UV fluorescence — emissive does not add to visible output. */
|
|
6
|
+
uvFluorescence: 0,
|
|
7
|
+
/** Visible luminescence — `emissiveFactor` + `irEmission` contribute to the lit color. */
|
|
8
|
+
visibleLuminescence: 1,
|
|
9
|
+
} as const;
|
|
10
|
+
|
|
11
|
+
export type EmissionMode = (typeof EmissionMode)[keyof typeof EmissionMode];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { fromJson, type FromJsonResult } from "./from-json.js";
|
|
2
|
+
|
|
3
|
+
export const fromJsonString = (text: string): FromJsonResult => {
|
|
4
|
+
let parsed: unknown;
|
|
5
|
+
try {
|
|
6
|
+
parsed = JSON.parse(text);
|
|
7
|
+
} catch {
|
|
8
|
+
return { ok: false, reason: "not_object" };
|
|
9
|
+
}
|
|
10
|
+
return fromJson(parsed);
|
|
11
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { fromJson } from "./from-json.js";
|
|
3
|
+
import { fromJsonString } from "./from-json-string.js";
|
|
4
|
+
|
|
5
|
+
const airJson = {
|
|
6
|
+
baseColor: [1, 1, 1, 0],
|
|
7
|
+
metallic: 0,
|
|
8
|
+
roughness: 0,
|
|
9
|
+
irReflectance: 0,
|
|
10
|
+
irEmission: 0,
|
|
11
|
+
emissionRgb: [0, 0, 0],
|
|
12
|
+
emissionMode: 0,
|
|
13
|
+
density: 1.225,
|
|
14
|
+
viscosity: 0,
|
|
15
|
+
specificHeatCapacity: 1006,
|
|
16
|
+
thermalConductivity: 0.024,
|
|
17
|
+
stressStrainCurve: {
|
|
18
|
+
tensileYieldStrainStress: [0, 0],
|
|
19
|
+
tensileFractureStrainStress: [0, 0],
|
|
20
|
+
compressiveYieldStrainStress: [0, 0],
|
|
21
|
+
compressiveFractureStrainStress: [0, 0],
|
|
22
|
+
},
|
|
23
|
+
restitution: 0,
|
|
24
|
+
} as const;
|
|
25
|
+
|
|
26
|
+
describe("fromJson", () => {
|
|
27
|
+
it("parses a name → props library object", () => {
|
|
28
|
+
const result = fromJson({ air: airJson, rock: airJson });
|
|
29
|
+
|
|
30
|
+
expect(result.ok).toBe(true);
|
|
31
|
+
if (!result.ok) return;
|
|
32
|
+
|
|
33
|
+
expect(Object.keys(result.definitions)).toEqual(["air", "rock"]);
|
|
34
|
+
expect(result.definitions.air?.density).toBe(1.225);
|
|
35
|
+
expect(result.definitions.air?.heatCapacity).toBe(1006);
|
|
36
|
+
expect(result.definitions.air?.metallicFactor).toBe(0);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("rejects invalid entries", () => {
|
|
40
|
+
const result = fromJson({ bad: { metallic: 1 } });
|
|
41
|
+
expect(result).toEqual({ ok: false, reason: "invalid_entry", name: "bad" });
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
describe("fromJsonString", () => {
|
|
46
|
+
it("parses JSON text", () => {
|
|
47
|
+
const result = fromJsonString(JSON.stringify({ air: airJson }));
|
|
48
|
+
expect(result.ok).toBe(true);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { MaterialDefinition } from "../material-definition.js";
|
|
2
|
+
import { toDefinitionFromUnknown } from "./to-definition.js";
|
|
3
|
+
|
|
4
|
+
export type FromJsonResult =
|
|
5
|
+
| { readonly ok: true; readonly definitions: Readonly<Record<string, MaterialDefinition>> }
|
|
6
|
+
| { readonly ok: false; readonly reason: "not_object" | "invalid_entry"; readonly name?: string };
|
|
7
|
+
|
|
8
|
+
export const fromJson = (input: unknown): FromJsonResult => {
|
|
9
|
+
if (typeof input !== "object" || input === null || Array.isArray(input)) {
|
|
10
|
+
return { ok: false, reason: "not_object" };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const definitions: Record<string, MaterialDefinition> = {};
|
|
14
|
+
for (const [name, props] of Object.entries(input)) {
|
|
15
|
+
const definition = toDefinitionFromUnknown(props as Record<string, unknown>);
|
|
16
|
+
if (!definition) {
|
|
17
|
+
return { ok: false, reason: "invalid_entry", name };
|
|
18
|
+
}
|
|
19
|
+
definitions[name] = definition;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return { ok: true, definitions };
|
|
23
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { PropertiesJson } from "./properties-json.js";
|
|
2
|
+
|
|
3
|
+
const isNumber = (value: unknown): value is number =>
|
|
4
|
+
typeof value === "number" && Number.isFinite(value);
|
|
5
|
+
|
|
6
|
+
const isVec2 = (value: unknown): value is readonly [number, number] =>
|
|
7
|
+
Array.isArray(value)
|
|
8
|
+
&& value.length === 2
|
|
9
|
+
&& isNumber(value[0])
|
|
10
|
+
&& isNumber(value[1]);
|
|
11
|
+
|
|
12
|
+
const isVec3 = (value: unknown): value is readonly [number, number, number] =>
|
|
13
|
+
Array.isArray(value)
|
|
14
|
+
&& value.length === 3
|
|
15
|
+
&& isNumber(value[0])
|
|
16
|
+
&& isNumber(value[1])
|
|
17
|
+
&& isNumber(value[2]);
|
|
18
|
+
|
|
19
|
+
const isVec4 = (value: unknown): value is readonly [number, number, number, number] =>
|
|
20
|
+
Array.isArray(value)
|
|
21
|
+
&& value.length === 4
|
|
22
|
+
&& isNumber(value[0])
|
|
23
|
+
&& isNumber(value[1])
|
|
24
|
+
&& isNumber(value[2])
|
|
25
|
+
&& isNumber(value[3]);
|
|
26
|
+
|
|
27
|
+
const isStressStrainCurveJson = (
|
|
28
|
+
value: unknown,
|
|
29
|
+
): value is PropertiesJson["stressStrainCurve"] => {
|
|
30
|
+
if (typeof value !== "object" || value === null) return false;
|
|
31
|
+
const curve = value as Record<string, unknown>;
|
|
32
|
+
return (
|
|
33
|
+
isVec2(curve.tensileYieldStrainStress)
|
|
34
|
+
&& isVec2(curve.tensileFractureStrainStress)
|
|
35
|
+
&& isVec2(curve.compressiveYieldStrainStress)
|
|
36
|
+
&& isVec2(curve.compressiveFractureStrainStress)
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const readVec4 = (props: Record<string, unknown>): readonly [number, number, number, number] | null => {
|
|
41
|
+
if (isVec4(props.baseColorFactor)) return props.baseColorFactor;
|
|
42
|
+
if (isVec4(props.baseColor)) return props.baseColor;
|
|
43
|
+
return null;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const readVec3 = (props: Record<string, unknown>): readonly [number, number, number] | null => {
|
|
47
|
+
if (isVec3(props.emissiveFactor)) return props.emissiveFactor;
|
|
48
|
+
if (isVec3(props.emissionRgb)) return props.emissionRgb;
|
|
49
|
+
return null;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const readNumber = (props: Record<string, unknown>, ...keys: string[]): number | null => {
|
|
53
|
+
for (const key of keys) {
|
|
54
|
+
if (isNumber(props[key])) return props[key];
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const isPropertiesJson = (value: unknown): value is PropertiesJson => {
|
|
60
|
+
if (typeof value !== "object" || value === null) return false;
|
|
61
|
+
const props = value as Record<string, unknown>;
|
|
62
|
+
return (
|
|
63
|
+
readVec4(props) !== null
|
|
64
|
+
&& readVec3(props) !== null
|
|
65
|
+
&& isNumber(props.metallicFactor ?? props.metallic)
|
|
66
|
+
&& isNumber(props.roughnessFactor ?? props.roughness)
|
|
67
|
+
&& isNumber(props.irReflectance)
|
|
68
|
+
&& isNumber(props.irEmission)
|
|
69
|
+
&& isNumber(props.emissionMode)
|
|
70
|
+
&& isNumber(props.density)
|
|
71
|
+
&& isNumber(props.viscosity)
|
|
72
|
+
&& isNumber(props.heatCapacity ?? props.specificHeatCapacity)
|
|
73
|
+
&& isNumber(props.thermalConductivity)
|
|
74
|
+
&& isStressStrainCurveJson(props.stressStrainCurve)
|
|
75
|
+
&& isNumber(props.restitution)
|
|
76
|
+
);
|
|
77
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { fromJsonString } from "./from-json-string.js";
|
|
2
|
+
import type { FromJsonResult } from "./from-json.js";
|
|
3
|
+
|
|
4
|
+
export type LoadJsonResult =
|
|
5
|
+
| FromJsonResult
|
|
6
|
+
| { readonly ok: false; readonly reason: "fetch_failed"; readonly status: number };
|
|
7
|
+
|
|
8
|
+
export const loadJson = async (url: string): Promise<LoadJsonResult> => {
|
|
9
|
+
const response = await fetch(url);
|
|
10
|
+
if (!response.ok) {
|
|
11
|
+
return { ok: false, reason: "fetch_failed", status: response.status };
|
|
12
|
+
}
|
|
13
|
+
const text = await response.text();
|
|
14
|
+
return fromJsonString(text);
|
|
15
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** One material entry in a material library JSON file. */
|
|
2
|
+
export type PropertiesJson = {
|
|
3
|
+
readonly baseColorFactor: readonly [number, number, number, number];
|
|
4
|
+
readonly emissiveFactor: readonly [number, number, number];
|
|
5
|
+
readonly metallicFactor: number;
|
|
6
|
+
readonly roughnessFactor: number;
|
|
7
|
+
readonly irReflectance: number;
|
|
8
|
+
readonly irEmission: number;
|
|
9
|
+
readonly emissionMode: number;
|
|
10
|
+
readonly density: number;
|
|
11
|
+
readonly viscosity: number;
|
|
12
|
+
readonly heatCapacity: number;
|
|
13
|
+
readonly thermalConductivity: number;
|
|
14
|
+
readonly restitution: number;
|
|
15
|
+
readonly friction?: number;
|
|
16
|
+
readonly compliance?: number;
|
|
17
|
+
readonly normalScale?: number;
|
|
18
|
+
readonly occlusionStrength?: number;
|
|
19
|
+
readonly stressStrainCurve: {
|
|
20
|
+
readonly tensileYieldStrainStress: readonly [number, number];
|
|
21
|
+
readonly tensileFractureStrainStress: readonly [number, number];
|
|
22
|
+
readonly compressiveYieldStrainStress: readonly [number, number];
|
|
23
|
+
readonly compressiveFractureStrainStress: readonly [number, number];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { LibraryJson } from "./library-json.js";
|
|
2
|
+
export type { PropertiesJson } from "./properties-json.js";
|
|
3
|
+
export type { FromJsonResult } from "./from-json.js";
|
|
4
|
+
export type { LoadJsonResult } from "./load-json.js";
|
|
5
|
+
export { isPropertiesJson } from "./is-properties-json.js";
|
|
6
|
+
export { toDefinition } from "./to-definition.js";
|
|
7
|
+
export { fromJson } from "./from-json.js";
|
|
8
|
+
export { fromJsonString } from "./from-json-string.js";
|
|
9
|
+
export { loadJson } from "./load-json.js";
|