@luma.gl/engine 10.0.0-beta.1 → 10.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation/deform-positions.d.ts +1 -1
- package/dist/animation/deform-positions.d.ts.map +1 -1
- package/dist/animation/skin.cjs +4 -4
- package/dist/animation/skin.d.ts +1 -1
- package/dist/animation/skin.d.ts.map +1 -1
- package/dist/animation/skin.js +1 -1
- package/dist/animation/skin.js.map +1 -1
- package/dist/animation/texture-transform.cjs +7 -7
- package/dist/animation/texture-transform.js +1 -1
- package/dist/animation/texture-transform.js.map +1 -1
- package/dist/arrow/arrow-mesh-types.d.ts +1 -1
- package/dist/arrow/arrow-mesh-types.d.ts.map +1 -1
- package/dist/arrow/index.cjs.map +2 -2
- package/dist/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.cjs +2 -2
- package/dist/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.d.ts +1 -1
- package/dist/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.js +1 -1
- package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.cjs +1 -0
- package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.d.ts.map +1 -1
- package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.js +1 -0
- package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.js.map +1 -1
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.cjs +2 -2
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.js +1 -1
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.js.map +1 -1
- package/dist/audio/audio-controller.cjs +6 -6
- package/dist/audio/audio-controller.d.ts +1 -1
- package/dist/audio/audio-controller.d.ts.map +1 -1
- package/dist/audio/audio-controller.js +1 -1
- package/dist/audio/audio-controller.js.map +1 -1
- package/dist/audio/audio-environment.cjs +6 -6
- package/dist/audio/audio-environment.d.ts +1 -1
- package/dist/audio/audio-environment.d.ts.map +1 -1
- package/dist/audio/audio-environment.js +1 -1
- package/dist/audio/audio-environment.js.map +1 -1
- package/dist/compute/computation.d.ts +1 -1
- package/dist/compute/computation.d.ts.map +1 -1
- package/dist/debug/pixel-data-utils.d.ts +1 -1
- package/dist/debug/pixel-data-utils.d.ts.map +1 -1
- package/dist/dist.dev.js +293 -229
- package/dist/dist.min.js +73 -59
- package/dist/effects/index.cjs.map +1 -1
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.d.ts +1 -1
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.d.ts +1 -1
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/gtao.cjs +4 -4
- package/dist/effects/passes/screen-space/gtao.d.ts +1 -1
- package/dist/effects/passes/screen-space/gtao.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/gtao.js +1 -1
- package/dist/effects/passes/screen-space/gtao.js.map +1 -1
- package/dist/effects/passes/screen-space/height-fog.d.ts +1 -1
- package/dist/effects/passes/screen-space/height-fog.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/screen-space-global-illumination.d.ts +1 -1
- package/dist/effects/passes/screen-space/screen-space-global-illumination.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/screen-space-reflections.d.ts +1 -1
- package/dist/effects/passes/screen-space/screen-space-reflections.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/ssr-camera-temporal.d.ts +1 -1
- package/dist/effects/passes/screen-space/ssr-camera-temporal.d.ts.map +1 -1
- package/dist/experimental/controls/index.cjs +0 -3
- package/dist/experimental/controls/index.cjs.map +2 -2
- package/dist/experimental/controls/index.d.ts +0 -2
- package/dist/experimental/controls/index.d.ts.map +1 -1
- package/dist/experimental/controls/index.js +0 -1
- package/dist/experimental/controls/index.js.map +1 -1
- package/dist/experimental/webxr/webxr-input.d.ts +1 -1
- package/dist/experimental/webxr/webxr-input.d.ts.map +1 -1
- package/dist/experimental-controls.cjs +21 -0
- package/dist/experimental-controls.d.ts +2 -0
- package/dist/experimental-controls.d.ts.map +1 -0
- package/dist/experimental-controls.js +5 -0
- package/dist/experimental-controls.js.map +1 -0
- package/dist/experimental-materials.cjs +21 -0
- package/dist/experimental-materials.d.ts +2 -0
- package/dist/experimental-materials.d.ts.map +1 -0
- package/dist/experimental-materials.js +5 -0
- package/dist/experimental-materials.js.map +1 -0
- package/dist/experimental-textures.cjs +21 -0
- package/dist/experimental-textures.d.ts +2 -0
- package/dist/experimental-textures.d.ts.map +1 -0
- package/dist/experimental-textures.js +5 -0
- package/dist/experimental-textures.js.map +1 -0
- package/dist/{experimental/controls/orbit-controls.cjs → experimental-webxr.cjs} +5 -11
- package/dist/experimental-webxr.d.ts +2 -0
- package/dist/experimental-webxr.d.ts.map +1 -0
- package/dist/experimental-webxr.js +5 -0
- package/dist/experimental-webxr.js.map +1 -0
- package/dist/geometry/edge-geometry.d.ts +1 -1
- package/dist/geometry/edge-geometry.d.ts.map +1 -1
- package/dist/geometry/geometry-primitives.cjs +18 -17
- package/dist/geometry/geometry-primitives.d.ts +2 -2
- package/dist/geometry/geometry-primitives.d.ts.map +1 -1
- package/dist/geometry/geometry-primitives.js +3 -2
- package/dist/geometry/geometry-primitives.js.map +1 -1
- package/dist/geometry/geometry-table.d.ts +1 -1
- package/dist/geometry/geometry-table.d.ts.map +1 -1
- package/dist/geometry/geometry-utils.cjs +6 -6
- package/dist/geometry/geometry-utils.d.ts +2 -2
- package/dist/geometry/geometry-utils.d.ts.map +1 -1
- package/dist/geometry/geometry-utils.js +1 -1
- package/dist/geometry/geometry-utils.js.map +1 -1
- package/dist/geometry/geometry.cjs +2 -2
- package/dist/geometry/geometry.d.ts +4 -3
- package/dist/geometry/geometry.d.ts.map +1 -1
- package/dist/geometry/geometry.js +1 -1
- package/dist/geometry/geometry.js.map +1 -1
- package/dist/geometry/gpu-geometry.d.ts +1 -1
- package/dist/geometry/gpu-geometry.d.ts.map +1 -1
- package/dist/geometry/gpu-vector-geometry-adapter.d.ts +1 -1
- package/dist/geometry/gpu-vector-geometry-adapter.d.ts.map +1 -1
- package/dist/geometry/ring-geometry.cjs +6 -6
- package/dist/geometry/ring-geometry.d.ts +1 -1
- package/dist/geometry/ring-geometry.d.ts.map +1 -1
- package/dist/geometry/ring-geometry.js +2 -2
- package/dist/geometry/ring-geometry.js.map +1 -1
- package/dist/gltf/gltf/create-composed-scenegraphs-from-gltf.cjs +80 -0
- package/dist/gltf/gltf/create-composed-scenegraphs-from-gltf.d.ts +28 -0
- package/dist/gltf/gltf/create-composed-scenegraphs-from-gltf.d.ts.map +1 -0
- package/dist/gltf/gltf/create-composed-scenegraphs-from-gltf.js +74 -0
- package/dist/gltf/gltf/create-composed-scenegraphs-from-gltf.js.map +1 -0
- package/dist/gltf/gltf/create-gltf-model.d.ts +1 -1
- package/dist/gltf/gltf/create-gltf-model.d.ts.map +1 -1
- package/dist/gltf/gltf/create-scenegraph-from-gltf.cjs +13 -4
- package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts.map +1 -1
- package/dist/gltf/gltf/create-scenegraph-from-gltf.js +11 -0
- package/dist/gltf/gltf/create-scenegraph-from-gltf.js.map +1 -1
- package/dist/gltf/gltf/gltf-animated-crowd.d.ts +2 -1
- package/dist/gltf/gltf/gltf-animated-crowd.d.ts.map +1 -1
- package/dist/gltf/gltf/gltf-animated-crowd.js.map +1 -1
- package/dist/gltf/gltf/gltf-instancing.cjs +2 -2
- package/dist/gltf/gltf/gltf-instancing.d.ts +1 -1
- package/dist/gltf/gltf/gltf-instancing.d.ts.map +1 -1
- package/dist/gltf/gltf/gltf-instancing.js +1 -1
- package/dist/gltf/gltf/gltf-instancing.js.map +1 -1
- package/dist/gltf/gltf/gltf-lightmap.cjs +2 -2
- package/dist/gltf/gltf/gltf-lightmap.d.ts +1 -1
- package/dist/gltf/gltf/gltf-lightmap.d.ts.map +1 -1
- package/dist/gltf/gltf/gltf-lightmap.js +1 -1
- package/dist/gltf/gltf/gltf-lightmap.js.map +1 -1
- package/dist/gltf/gltf/gltf-skin.cjs +1 -1
- package/dist/gltf/gltf/gltf-skin.js +2 -2
- package/dist/gltf/gltf/gltf-skin.js.map +1 -1
- package/dist/gltf/index.cjs +3 -0
- package/dist/gltf/index.cjs.map +3 -3
- package/dist/gltf/index.d.ts +1 -0
- package/dist/gltf/index.d.ts.map +1 -1
- package/dist/gltf/index.js +1 -0
- package/dist/gltf/index.js.map +1 -1
- package/dist/gltf/parsers/parse-gltf-lights.cjs +5 -5
- package/dist/gltf/parsers/parse-gltf-lights.js +1 -1
- package/dist/gltf/parsers/parse-gltf-lights.js.map +1 -1
- package/dist/gltf/parsers/parse-gltf-physics-pointer.cjs +1 -1
- package/dist/gltf/parsers/parse-gltf-physics-pointer.js +1 -1
- package/dist/gltf/parsers/parse-gltf-physics-pointer.js.map +1 -1
- package/dist/gltf/parsers/parse-gltf.cjs +2 -1
- package/dist/gltf/parsers/parse-gltf.d.ts +2 -0
- package/dist/gltf/parsers/parse-gltf.d.ts.map +1 -1
- package/dist/gltf/parsers/parse-gltf.js +3 -1
- package/dist/gltf/parsers/parse-gltf.js.map +1 -1
- package/dist/gltf/parsers/parse-pbr-material.cjs +27 -27
- package/dist/gltf/parsers/parse-pbr-material.js +1 -1
- package/dist/gltf/parsers/parse-pbr-material.js.map +1 -1
- package/dist/gltf/physics/export-state.cjs +118 -17
- package/dist/gltf/physics/export-state.d.ts +9 -2
- package/dist/gltf/physics/export-state.d.ts.map +1 -1
- package/dist/gltf/physics/export-state.js +172 -19
- package/dist/gltf/physics/export-state.js.map +1 -1
- package/dist/gltf/physics/index.cjs.map +2 -2
- package/dist/gltf/physics/index.d.ts +1 -1
- package/dist/gltf/physics/index.d.ts.map +1 -1
- package/dist/gltf/physics/index.js.map +1 -1
- package/dist/gltf/physics/mesh-snapshot.cjs +3 -3
- package/dist/gltf/physics/mesh-snapshot.js +1 -1
- package/dist/gltf/physics/mesh-snapshot.js.map +1 -1
- package/dist/gltf/physics/node-collision-geometry.cjs +3 -3
- package/dist/gltf/physics/node-collision-geometry.js +1 -1
- package/dist/gltf/physics/node-collision-geometry.js.map +1 -1
- package/dist/gltf/physics/parse-gltf-physics.cjs +20 -17
- package/dist/gltf/physics/parse-gltf-physics.d.ts.map +1 -1
- package/dist/gltf/physics/parse-gltf-physics.js +7 -3
- package/dist/gltf/physics/parse-gltf-physics.js.map +1 -1
- package/dist/gltf/physics/parse-physics-joints.cjs +3 -3
- package/dist/gltf/physics/parse-physics-joints.d.ts +1 -1
- package/dist/gltf/physics/parse-physics-joints.d.ts.map +1 -1
- package/dist/gltf/physics/parse-physics-joints.js +1 -1
- package/dist/gltf/physics/parse-physics-joints.js.map +1 -1
- package/dist/gltf/physics/physics-types.d.ts +4 -0
- package/dist/gltf/physics/physics-types.d.ts.map +1 -1
- package/dist/gltf/physics/property-bindings.cjs +9 -6
- package/dist/gltf/physics/property-bindings.d.ts.map +1 -1
- package/dist/gltf/physics/property-bindings.js +12 -3
- package/dist/gltf/physics/property-bindings.js.map +1 -1
- package/dist/gltf/types/gltf-postprocessed-schema.d.ts +4 -0
- package/dist/gltf/types/gltf-postprocessed-schema.d.ts.map +1 -1
- package/dist/gltf/types/gltf-types.d.ts +2 -0
- package/dist/gltf/types/gltf-types.d.ts.map +1 -1
- package/dist/graph/models/index.cjs.map +2 -2
- package/dist/graph/models/path/path-storage-model.cjs +8 -8
- package/dist/graph/models/path/path-storage-model.d.ts +1 -1
- package/dist/graph/models/path/path-storage-model.js +2 -2
- package/dist/graph/models/polygon/polygon-attribute-model.cjs +4 -4
- package/dist/graph/models/polygon/polygon-attribute-model.d.ts +1 -1
- package/dist/graph/models/polygon/polygon-attribute-model.js +1 -1
- package/dist/graph/models/polygon/polygon-shaders.d.ts +1 -1
- package/dist/graph/models/polygon/polygon-storage-model.cjs +4 -4
- package/dist/graph/models/polygon/polygon-storage-model.d.ts +1 -1
- package/dist/graph/models/polygon/polygon-storage-model.js +1 -1
- package/dist/graph/physics/index.cjs +3 -0
- package/dist/graph/physics/index.cjs.map +3 -3
- package/dist/graph/physics/index.d.ts +2 -1
- package/dist/graph/physics/index.d.ts.map +1 -1
- package/dist/graph/physics/index.js +1 -0
- package/dist/graph/physics/index.js.map +1 -1
- package/dist/graph/physics/physics-controller-geometry.cjs +8 -8
- package/dist/graph/physics/physics-controller-geometry.js +2 -2
- package/dist/graph/physics/physics-controller-geometry.js.map +1 -1
- package/dist/graph/physics/physics-controller.cjs +95 -31
- package/dist/graph/physics/physics-controller.d.ts +36 -9
- package/dist/graph/physics/physics-controller.d.ts.map +1 -1
- package/dist/graph/physics/physics-controller.js +96 -31
- package/dist/graph/physics/physics-controller.js.map +1 -1
- package/dist/graph/physics/physics-scenegraph.cjs +4 -4
- package/dist/graph/physics/physics-scenegraph.d.ts +1 -1
- package/dist/graph/physics/physics-scenegraph.d.ts.map +1 -1
- package/dist/graph/physics/physics-scenegraph.js +1 -1
- package/dist/graph/physics/physics-scenegraph.js.map +1 -1
- package/dist/graph/physics/scenegraph-instance.cjs +14 -7
- package/dist/graph/physics/scenegraph-instance.d.ts.map +1 -1
- package/dist/graph/physics/scenegraph-instance.js +15 -7
- package/dist/graph/physics/scenegraph-instance.js.map +1 -1
- package/dist/graph/physics/scenegraph-motion.cjs +7 -7
- package/dist/graph/physics/scenegraph-motion.d.ts +1 -1
- package/dist/graph/physics/scenegraph-motion.d.ts.map +1 -1
- package/dist/graph/physics/scenegraph-motion.js +1 -1
- package/dist/graph/physics/scenegraph-motion.js.map +1 -1
- package/dist/graph/physics/scenegraph-properties.cjs +3 -3
- package/dist/graph/physics/scenegraph-properties.js +1 -1
- package/dist/graph/physics/scenegraph-properties.js.map +1 -1
- package/dist/graph/physics/scenegraph-publication.cjs +5 -5
- package/dist/graph/physics/scenegraph-publication.d.ts +1 -1
- package/dist/graph/physics/scenegraph-publication.d.ts.map +1 -1
- package/dist/graph/physics/scenegraph-publication.js +1 -1
- package/dist/graph/physics/scenegraph-publication.js.map +1 -1
- package/dist/graph/physics/scenegraph-ragdoll.cjs +132 -0
- package/dist/graph/physics/scenegraph-ragdoll.d.ts +32 -0
- package/dist/graph/physics/scenegraph-ragdoll.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-ragdoll.js +117 -0
- package/dist/graph/physics/scenegraph-ragdoll.js.map +1 -0
- package/dist/graph/tables/index.cjs.map +2 -2
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lighting/ambient-occlusion-pass.cjs +3 -3
- package/dist/lighting/ambient-occlusion-pass.d.ts +2 -1
- package/dist/lighting/ambient-occlusion-pass.d.ts.map +1 -1
- package/dist/lighting/ambient-occlusion-pass.js +1 -1
- package/dist/lighting/ambient-occlusion-pass.js.map +1 -1
- package/dist/lighting/clustered-light-grid.d.ts +1 -1
- package/dist/lighting/clustered-light-grid.d.ts.map +1 -1
- package/dist/lighting/contact-shadow-pass.cjs +2 -2
- package/dist/lighting/contact-shadow-pass.d.ts +2 -1
- package/dist/lighting/contact-shadow-pass.d.ts.map +1 -1
- package/dist/lighting/contact-shadow-pass.js +1 -1
- package/dist/lighting/contact-shadow-pass.js.map +1 -1
- package/dist/lighting/index.cjs.map +2 -2
- package/dist/lighting/lightmap-atlas.cjs +6 -6
- package/dist/lighting/lightmap-atlas.d.ts +1 -1
- package/dist/lighting/lightmap-atlas.d.ts.map +1 -1
- package/dist/lighting/lightmap-atlas.js +1 -1
- package/dist/lighting/lightmap-atlas.js.map +1 -1
- package/dist/lighting/reflection-probe.cjs +4 -4
- package/dist/lighting/reflection-probe.d.ts +2 -1
- package/dist/lighting/reflection-probe.d.ts.map +1 -1
- package/dist/lighting/reflection-probe.js +1 -1
- package/dist/lighting/reflection-probe.js.map +1 -1
- package/dist/lighting/shadow-map-renderer.cjs +13 -13
- package/dist/lighting/shadow-map-renderer.d.ts +2 -2
- package/dist/lighting/shadow-map-renderer.d.ts.map +1 -1
- package/dist/lighting/shadow-map-renderer.js +1 -1
- package/dist/lighting/shadow-map-renderer.js.map +1 -1
- package/dist/model/gpu-vector-model.d.ts +1 -1
- package/dist/model/gpu-vector-model.d.ts.map +1 -1
- package/dist/model/model.d.ts +1 -1
- package/dist/model/model.d.ts.map +1 -1
- package/dist/models/light-model-utils.cjs +2 -2
- package/dist/models/light-model-utils.d.ts +1 -1
- package/dist/models/light-model-utils.d.ts.map +1 -1
- package/dist/models/light-model-utils.js +1 -1
- package/dist/models/light-model-utils.js.map +1 -1
- package/dist/modules/picking/color-picking.d.ts +1 -1
- package/dist/modules/picking/index-color-picking.d.ts +1 -1
- package/dist/modules/picking/index-picking.d.ts +1 -1
- package/dist/modules/picking/legacy-color-picking.d.ts +1 -1
- package/dist/modules/picking/picking-uniforms.d.ts +1 -1
- package/dist/modules/picking/picking-uniforms.d.ts.map +1 -1
- package/dist/modules/picking/picking.d.ts +1 -1
- package/dist/scenegraph/controllers/area-light-controller.cjs +11 -11
- package/dist/scenegraph/controllers/area-light-controller.js +1 -1
- package/dist/scenegraph/controllers/area-light-controller.js.map +1 -1
- package/dist/scenegraph/controllers/billboard-controller.cjs +28 -28
- package/dist/scenegraph/controllers/billboard-controller.d.ts +2 -1
- package/dist/scenegraph/controllers/billboard-controller.d.ts.map +1 -1
- package/dist/scenegraph/controllers/billboard-controller.js +1 -1
- package/dist/scenegraph/controllers/billboard-controller.js.map +1 -1
- package/dist/scenegraph/controllers/joint-controller.cjs +5 -5
- package/dist/scenegraph/controllers/joint-controller.js +1 -1
- package/dist/scenegraph/controllers/joint-controller.js.map +1 -1
- package/dist/scenegraph/controllers/punctual-light-controller.cjs +2 -2
- package/dist/scenegraph/controllers/punctual-light-controller.d.ts +1 -1
- package/dist/scenegraph/controllers/punctual-light-controller.d.ts.map +1 -1
- package/dist/scenegraph/controllers/punctual-light-controller.js +1 -1
- package/dist/scenegraph/controllers/punctual-light-controller.js.map +1 -1
- package/dist/scenegraph/controllers/skin-controller.cjs +22 -3
- package/dist/scenegraph/controllers/skin-controller.d.ts +4 -0
- package/dist/scenegraph/controllers/skin-controller.d.ts.map +1 -1
- package/dist/scenegraph/controllers/skin-controller.js +22 -2
- package/dist/scenegraph/controllers/skin-controller.js.map +1 -1
- package/dist/scenegraph/group-node.cjs +14 -14
- package/dist/scenegraph/group-node.d.ts +2 -2
- package/dist/scenegraph/group-node.d.ts.map +1 -1
- package/dist/scenegraph/group-node.js +1 -1
- package/dist/scenegraph/group-node.js.map +1 -1
- package/dist/scenegraph/model-node.d.ts +1 -1
- package/dist/scenegraph/model-node.d.ts.map +1 -1
- package/dist/scenegraph/physics-transforms.cjs +2 -2
- package/dist/scenegraph/physics-transforms.d.ts +1 -1
- package/dist/scenegraph/physics-transforms.d.ts.map +1 -1
- package/dist/scenegraph/physics-transforms.js +1 -1
- package/dist/scenegraph/physics-transforms.js.map +1 -1
- package/dist/scenegraph/scenegraph-bounds.cjs +3 -3
- package/dist/scenegraph/scenegraph-bounds.d.ts +1 -1
- package/dist/scenegraph/scenegraph-bounds.d.ts.map +1 -1
- package/dist/scenegraph/scenegraph-bounds.js +1 -1
- package/dist/scenegraph/scenegraph-bounds.js.map +1 -1
- package/dist/scenegraph/scenegraph-node.cjs +7 -7
- package/dist/scenegraph/scenegraph-node.d.ts +2 -1
- package/dist/scenegraph/scenegraph-node.d.ts.map +1 -1
- package/dist/scenegraph/scenegraph-node.js +1 -1
- package/dist/scenegraph/scenegraph-node.js.map +1 -1
- package/dist/scenegraph/transform-source.d.ts +1 -1
- package/dist/scenegraph/transform-source.d.ts.map +1 -1
- package/dist/shader-plugins/depth-interval.cjs +60 -0
- package/dist/shader-plugins/depth-interval.d.ts +10 -0
- package/dist/shader-plugins/depth-interval.d.ts.map +1 -0
- package/dist/shader-plugins/depth-interval.js +42 -0
- package/dist/shader-plugins/depth-interval.js.map +1 -0
- package/dist/splats/index.cjs.map +2 -2
- package/dist/splats/index.d.ts +1 -1
- package/dist/splats/index.d.ts.map +1 -1
- package/dist/splats/index.js.map +1 -1
- package/dist/splats/splat-picking.d.ts +2 -2
- package/dist/splats/splat-picking.d.ts.map +1 -1
- package/dist/splats/splat-renderer.cjs +51 -2
- package/dist/splats/splat-renderer.d.ts +15 -1
- package/dist/splats/splat-renderer.d.ts.map +1 -1
- package/dist/splats/splat-renderer.js +61 -2
- package/dist/splats/splat-renderer.js.map +1 -1
- package/dist/splats/splat-shaders.cjs +46 -3
- package/dist/splats/splat-shaders.d.ts +5 -3
- package/dist/splats/splat-shaders.d.ts.map +1 -1
- package/dist/splats/splat-shaders.js +42 -3
- package/dist/splats/splat-shaders.js.map +1 -1
- package/dist/text/text-3d/extrude.cjs +15 -15
- package/dist/text/text-3d/extrude.js +1 -1
- package/dist/text/text-3d/extrude.js.map +1 -1
- package/dist/text/text-3d/index.cjs.map +2 -2
- package/dist/text/text-3d/paths/curves.cjs +5 -5
- package/dist/text/text-3d/paths/curves.d.ts +1 -1
- package/dist/text/text-3d/paths/curves.d.ts.map +1 -1
- package/dist/text/text-3d/paths/curves.js +1 -1
- package/dist/text/text-3d/paths/curves.js.map +1 -1
- package/dist/text/text-3d/paths/path.cjs +5 -5
- package/dist/text/text-3d/paths/path.d.ts +1 -1
- package/dist/text/text-3d/paths/path.d.ts.map +1 -1
- package/dist/text/text-3d/paths/path.js +1 -1
- package/dist/text/text-3d/paths/path.js.map +1 -1
- package/dist/text/text-3d/paths/shape-path.d.ts +1 -1
- package/dist/text/text-3d/paths/shape-path.d.ts.map +1 -1
- package/dist/text/text-3d/paths/shape-utils.cjs +2 -2
- package/dist/text/text-3d/paths/shape-utils.d.ts +1 -1
- package/dist/text/text-3d/paths/shape-utils.d.ts.map +1 -1
- package/dist/text/text-3d/paths/shape-utils.js +1 -1
- package/dist/text/text-3d/paths/shape-utils.js.map +1 -1
- package/package.json +12 -12
- package/src/animation/deform-positions.ts +1 -1
- package/src/animation/skin.ts +2 -1
- package/src/animation/texture-transform.ts +1 -1
- package/src/arrow/arrow-geometry.ts +1 -1
- package/src/arrow/arrow-mesh-types.ts +1 -1
- package/src/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.ts +1 -1
- package/src/arrow/renderers/path/transforms/gpu-path-float64-deltas.ts +1 -0
- package/src/arrow/renderers/polygon/renderers/arrow-polygon-renderer.ts +1 -1
- package/src/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.ts +1 -1
- package/src/audio/audio-controller.ts +1 -1
- package/src/audio/audio-environment.ts +1 -1
- package/src/compute/computation.ts +1 -1
- package/src/debug/pixel-data-utils.ts +1 -1
- package/src/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.ts +1 -1
- package/src/effects/passes/screen-space/clustered-volumetric-lighting.ts +1 -1
- package/src/effects/passes/screen-space/gtao.ts +1 -1
- package/src/effects/passes/screen-space/height-fog.ts +1 -1
- package/src/effects/passes/screen-space/screen-space-global-illumination.ts +1 -1
- package/src/effects/passes/screen-space/screen-space-reflections.ts +1 -1
- package/src/effects/passes/screen-space/ssr-camera-temporal.ts +1 -1
- package/src/experimental/controls/index.ts +0 -2
- package/src/experimental/webxr/webxr-input.ts +1 -1
- package/{dist/experimental/controls/orbit-controls.js → src/experimental-controls.ts} +2 -2
- package/src/experimental-materials.ts +5 -0
- package/src/experimental-textures.ts +5 -0
- package/src/experimental-webxr.ts +5 -0
- package/src/geometry/edge-geometry.ts +2 -2
- package/src/geometry/geometry-primitives.ts +6 -3
- package/src/geometry/geometry-table.ts +1 -1
- package/src/geometry/geometry-utils.ts +3 -3
- package/src/geometry/geometry.ts +7 -7
- package/src/geometry/gpu-geometry.ts +1 -1
- package/src/geometry/gpu-vector-geometry-adapter.ts +1 -1
- package/src/geometry/ring-geometry.ts +2 -2
- package/src/gltf/gltf/create-composed-scenegraphs-from-gltf.ts +100 -0
- package/src/gltf/gltf/create-gltf-model.ts +1 -1
- package/src/gltf/gltf/create-scenegraph-from-gltf.ts +12 -0
- package/src/gltf/gltf/gltf-animated-crowd.ts +2 -1
- package/src/gltf/gltf/gltf-instancing.ts +1 -1
- package/src/gltf/gltf/gltf-lightmap.ts +1 -1
- package/src/gltf/gltf/gltf-skin.ts +2 -2
- package/src/gltf/index.ts +5 -0
- package/src/gltf/parsers/parse-gltf-lights.ts +1 -1
- package/src/gltf/parsers/parse-gltf-physics-pointer.ts +1 -1
- package/src/gltf/parsers/parse-gltf.ts +6 -4
- package/src/gltf/parsers/parse-pbr-material.ts +1 -1
- package/src/gltf/physics/README.md +16 -0
- package/src/gltf/physics/export-state.ts +216 -19
- package/src/gltf/physics/index.ts +1 -1
- package/src/gltf/physics/mesh-snapshot.ts +1 -1
- package/src/gltf/physics/node-collision-geometry.ts +1 -1
- package/src/gltf/physics/parse-gltf-physics.ts +6 -3
- package/src/gltf/physics/parse-physics-joints.ts +1 -1
- package/src/gltf/physics/physics-types.ts +4 -0
- package/src/gltf/physics/property-bindings.ts +11 -3
- package/src/gltf/types/gltf-postprocessed-schema.ts +4 -0
- package/src/gltf/types/gltf-types.ts +2 -0
- package/src/graph/models/path/path-storage-model.ts +3 -3
- package/src/graph/models/polygon/polygon-attribute-model.ts +1 -1
- package/src/graph/models/polygon/polygon-storage-model.ts +1 -1
- package/src/graph/physics/index.ts +2 -0
- package/src/graph/physics/physics-controller-geometry.ts +2 -2
- package/src/graph/physics/physics-controller.ts +139 -40
- package/src/graph/physics/physics-scenegraph.ts +1 -1
- package/src/graph/physics/scenegraph-instance.ts +25 -9
- package/src/graph/physics/scenegraph-motion.ts +1 -1
- package/src/graph/physics/scenegraph-properties.ts +1 -1
- package/src/graph/physics/scenegraph-publication.ts +1 -1
- package/src/graph/physics/scenegraph-ragdoll.ts +133 -0
- package/src/index.ts +2 -0
- package/src/lighting/ambient-occlusion-pass.ts +2 -1
- package/src/lighting/clustered-light-grid.ts +1 -1
- package/src/lighting/contact-shadow-pass.ts +2 -1
- package/src/lighting/lightmap-atlas.ts +1 -1
- package/src/lighting/reflection-probe.ts +2 -1
- package/src/lighting/shadow-map-renderer.ts +2 -2
- package/src/model/gpu-vector-model.ts +1 -1
- package/src/model/model.ts +1 -1
- package/src/models/light-model-utils.ts +2 -1
- package/src/modules/picking/legacy-picking-manager.ts +1 -1
- package/src/modules/picking/picking-uniforms.ts +1 -1
- package/src/scenegraph/controllers/area-light-controller.ts +1 -1
- package/src/scenegraph/controllers/billboard-controller.ts +2 -1
- package/src/scenegraph/controllers/joint-controller.ts +1 -1
- package/src/scenegraph/controllers/punctual-light-controller.ts +1 -1
- package/src/scenegraph/controllers/skin-controller.ts +21 -2
- package/src/scenegraph/group-node.ts +2 -2
- package/src/scenegraph/model-node.ts +1 -1
- package/src/scenegraph/physics-transforms.ts +1 -1
- package/src/scenegraph/scenegraph-bounds.ts +2 -2
- package/src/scenegraph/scenegraph-node.ts +2 -1
- package/src/scenegraph/transform-source.ts +1 -1
- package/src/shader-plugins/depth-interval.ts +45 -0
- package/src/splats/README.md +10 -0
- package/src/splats/index.ts +1 -0
- package/src/splats/splat-renderer.ts +82 -2
- package/src/splats/splat-shaders.ts +48 -3
- package/src/text/text-3d/extrude.ts +1 -1
- package/src/text/text-3d/font.ts +1 -1
- package/src/text/text-3d/paths/curves.ts +1 -1
- package/src/text/text-3d/paths/path.ts +1 -1
- package/src/text/text-3d/paths/shape-path.ts +1 -1
- package/src/text/text-3d/paths/shape-utils.ts +2 -2
- package/dist/experimental/controls/orbit-controls.d.ts +0 -3
- package/dist/experimental/controls/orbit-controls.d.ts.map +0 -1
- package/dist/experimental/controls/orbit-controls.js.map +0 -1
- package/src/experimental/controls/orbit-controls.ts +0 -6
package/dist/dist.dev.js
CHANGED
|
@@ -148,6 +148,7 @@ var __exports__ = (() => {
|
|
|
148
148
|
loadImageBitmap: () => loadImageBitmap,
|
|
149
149
|
makeAdapterAnimationBinding: () => makeAdapterAnimationBinding,
|
|
150
150
|
makeAnimationLoop: () => makeAnimationLoop,
|
|
151
|
+
makeDepthIntervalPlugin: () => makeDepthIntervalPlugin,
|
|
151
152
|
makeEdgeGeometry: () => makeEdgeGeometry,
|
|
152
153
|
makeEdgeGeometryFromGeometries: () => makeEdgeGeometryFromGeometries,
|
|
153
154
|
makeGPUVectorGeometry: () => makeGPUVectorGeometry,
|
|
@@ -657,6 +658,18 @@ var __exports__ = (() => {
|
|
|
657
658
|
}
|
|
658
659
|
};
|
|
659
660
|
|
|
661
|
+
// ../../node_modules/@math.gl/core/dist/types/typed-array-brand.js
|
|
662
|
+
var typedArrayTagGetter = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype), Symbol.toStringTag).get;
|
|
663
|
+
function getTypedArrayName(value) {
|
|
664
|
+
return ArrayBuffer.isView(value) ? typedArrayTagGetter.call(value) : void 0;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// ../../node_modules/@math.gl/core/dist/types/is-array.js
|
|
668
|
+
function isTypedArray(value) {
|
|
669
|
+
const name = getTypedArrayName(value);
|
|
670
|
+
return name !== void 0 && name !== "BigInt64Array" && name !== "BigUint64Array";
|
|
671
|
+
}
|
|
672
|
+
|
|
660
673
|
// ../../node_modules/@math.gl/geometry/dist/lib/geometry.js
|
|
661
674
|
var geometryId = 0;
|
|
662
675
|
var Geometry = class {
|
|
@@ -712,9 +725,6 @@ var __exports__ = (() => {
|
|
|
712
725
|
}
|
|
713
726
|
return attribute;
|
|
714
727
|
}
|
|
715
|
-
function isTypedArray(value) {
|
|
716
|
-
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
717
|
-
}
|
|
718
728
|
function validateIndices(indices, attributes) {
|
|
719
729
|
let maximumIndex = -1;
|
|
720
730
|
for (const index of indices.value)
|
|
@@ -3555,31 +3565,6 @@ var __exports__ = (() => {
|
|
|
3555
3565
|
}
|
|
3556
3566
|
};
|
|
3557
3567
|
|
|
3558
|
-
// ../../node_modules/@math.gl/geometry/dist/lib/geometry-utils.js
|
|
3559
|
-
function unpackIndexedGeometry(geometry) {
|
|
3560
|
-
if (!geometry.indices)
|
|
3561
|
-
return geometry;
|
|
3562
|
-
const indices = geometry.indices.value;
|
|
3563
|
-
const attributes = {};
|
|
3564
|
-
for (const [name, attribute] of Object.entries(geometry.attributes)) {
|
|
3565
|
-
if (!attribute)
|
|
3566
|
-
continue;
|
|
3567
|
-
if (attribute.constant || !attribute.size) {
|
|
3568
|
-
attributes[name] = attribute;
|
|
3569
|
-
continue;
|
|
3570
|
-
}
|
|
3571
|
-
const ArrayType = attribute.value.constructor;
|
|
3572
|
-
const value = new ArrayType(indices.length * attribute.size);
|
|
3573
|
-
for (let i = 0; i < indices.length; i++) {
|
|
3574
|
-
for (let component = 0; component < attribute.size; component++) {
|
|
3575
|
-
value[i * attribute.size + component] = attribute.value[Number(indices[i]) * attribute.size + component];
|
|
3576
|
-
}
|
|
3577
|
-
}
|
|
3578
|
-
attributes[name] = { ...attribute, value };
|
|
3579
|
-
}
|
|
3580
|
-
return { attributes };
|
|
3581
|
-
}
|
|
3582
|
-
|
|
3583
3568
|
// ../../node_modules/@math.gl/geometry/dist/geometries/geometry-helpers.js
|
|
3584
3569
|
function assertPositive(value, name) {
|
|
3585
3570
|
if (!Number.isFinite(value) || value <= 0)
|
|
@@ -4194,6 +4179,33 @@ var __exports__ = (() => {
|
|
|
4194
4179
|
|
|
4195
4180
|
// src/geometry/geometry-utils.ts
|
|
4196
4181
|
var import_core3 = __toESM(require_core(), 1);
|
|
4182
|
+
|
|
4183
|
+
// ../../node_modules/@math.gl/geometry/dist/lib/geometry-utils.js
|
|
4184
|
+
function unpackIndexedGeometry(geometry) {
|
|
4185
|
+
if (!geometry.indices)
|
|
4186
|
+
return geometry;
|
|
4187
|
+
const indices = geometry.indices.value;
|
|
4188
|
+
const attributes = {};
|
|
4189
|
+
for (const [name, attribute] of Object.entries(geometry.attributes)) {
|
|
4190
|
+
if (!attribute)
|
|
4191
|
+
continue;
|
|
4192
|
+
if (attribute.constant || !attribute.size) {
|
|
4193
|
+
attributes[name] = attribute;
|
|
4194
|
+
continue;
|
|
4195
|
+
}
|
|
4196
|
+
const ArrayType = attribute.value.constructor;
|
|
4197
|
+
const value = new ArrayType(indices.length * attribute.size);
|
|
4198
|
+
for (let i = 0; i < indices.length; i++) {
|
|
4199
|
+
for (let component = 0; component < attribute.size; component++) {
|
|
4200
|
+
value[i * attribute.size + component] = attribute.value[Number(indices[i]) * attribute.size + component];
|
|
4201
|
+
}
|
|
4202
|
+
}
|
|
4203
|
+
attributes[name] = { ...attribute, value };
|
|
4204
|
+
}
|
|
4205
|
+
return { attributes };
|
|
4206
|
+
}
|
|
4207
|
+
|
|
4208
|
+
// src/geometry/geometry-utils.ts
|
|
4197
4209
|
function makeInterleavedGeometry(geometry, options = {}) {
|
|
4198
4210
|
const bufferName = options.bufferName || "geometry";
|
|
4199
4211
|
if (isInterleavedGeometry(geometry, bufferName)) {
|
|
@@ -4630,7 +4642,7 @@ var __exports__ = (() => {
|
|
|
4630
4642
|
};
|
|
4631
4643
|
|
|
4632
4644
|
// src/animation-loop/animation-loop.ts
|
|
4633
|
-
var
|
|
4645
|
+
var import_core4 = __toESM(require_core(), 1);
|
|
4634
4646
|
|
|
4635
4647
|
// src/animation-loop/request-animation-frame.ts
|
|
4636
4648
|
function requestAnimationFramePolyfill(callback) {
|
|
@@ -4900,7 +4912,7 @@ var __exports__ = (() => {
|
|
|
4900
4912
|
throw new Error("No device provided");
|
|
4901
4913
|
}
|
|
4902
4914
|
this.stats = props.stats || new Stats({ id: `animation-loop-${statIdCounter++}` });
|
|
4903
|
-
this.sharedStats =
|
|
4915
|
+
this.sharedStats = import_core4.luma.stats.get(ANIMATION_LOOP_STATS);
|
|
4904
4916
|
this.frameRate = this.stats.get("Frame Rate");
|
|
4905
4917
|
this.frameRate.setSampleSize(1);
|
|
4906
4918
|
this.cpuTime = this.stats.get("CPU Time");
|
|
@@ -5312,10 +5324,10 @@ var __exports__ = (() => {
|
|
|
5312
5324
|
};
|
|
5313
5325
|
|
|
5314
5326
|
// src/animation-loop/make-animation-loop.ts
|
|
5315
|
-
var
|
|
5327
|
+
var import_core5 = __toESM(require_core(), 1);
|
|
5316
5328
|
function makeAnimationLoop(AnimationLoopTemplateCtor, props) {
|
|
5317
5329
|
let renderLoop = null;
|
|
5318
|
-
const device = props?.device ||
|
|
5330
|
+
const device = props?.device || import_core5.luma.createDevice({
|
|
5319
5331
|
id: "animation-loop",
|
|
5320
5332
|
adapters: props?.adapters,
|
|
5321
5333
|
createCanvasContext: true
|
|
@@ -5673,7 +5685,7 @@ var __exports__ = (() => {
|
|
|
5673
5685
|
}
|
|
5674
5686
|
|
|
5675
5687
|
// src/model/gpu-vector-model.ts
|
|
5676
|
-
var
|
|
5688
|
+
var import_core13 = __toESM(require_core(), 1);
|
|
5677
5689
|
var import_shaders3 = __toESM(require_shaders(), 1);
|
|
5678
5690
|
|
|
5679
5691
|
// ../shaders/src/lib/utils/assert.ts
|
|
@@ -9358,7 +9370,7 @@ ${declarations.join("\n")}`).match(
|
|
|
9358
9370
|
};
|
|
9359
9371
|
|
|
9360
9372
|
// src/model/batch-uniform-buffer.ts
|
|
9361
|
-
var
|
|
9373
|
+
var import_core6 = __toESM(require_core(), 1);
|
|
9362
9374
|
var BatchUniformBuffer = class {
|
|
9363
9375
|
constructor(device) {
|
|
9364
9376
|
this.device = device;
|
|
@@ -9373,7 +9385,7 @@ ${declarations.join("\n")}`).match(
|
|
|
9373
9385
|
const buffer = this.device.createBuffer({
|
|
9374
9386
|
id: "batch-uniforms",
|
|
9375
9387
|
byteLength: capacity,
|
|
9376
|
-
usage:
|
|
9388
|
+
usage: import_core6.Buffer.UNIFORM | import_core6.Buffer.COPY_DST
|
|
9377
9389
|
});
|
|
9378
9390
|
this.buffer?.destroy();
|
|
9379
9391
|
this.buffer = buffer;
|
|
@@ -9387,7 +9399,7 @@ ${declarations.join("\n")}`).match(
|
|
|
9387
9399
|
}
|
|
9388
9400
|
/** Writes one slot without overwriting earlier batches in this call. */
|
|
9389
9401
|
write(data) {
|
|
9390
|
-
(0,
|
|
9402
|
+
(0, import_core6.assert)(this.buffer && this.byteOffset + data.byteLength <= this.buffer.byteLength);
|
|
9391
9403
|
const binding = { buffer: this.buffer, offset: this.byteOffset, size: data.byteLength };
|
|
9392
9404
|
this.buffer.write(data, binding.offset);
|
|
9393
9405
|
this.byteOffset += this.getAlignedByteLength(data.byteLength);
|
|
@@ -9565,7 +9577,7 @@ ${declarations.join("\n")}`).match(
|
|
|
9565
9577
|
}
|
|
9566
9578
|
|
|
9567
9579
|
// src/utils/buffer-layout-helper.ts
|
|
9568
|
-
var
|
|
9580
|
+
var import_core7 = __toESM(require_core(), 1);
|
|
9569
9581
|
var BufferLayoutHelper = class {
|
|
9570
9582
|
bufferLayouts;
|
|
9571
9583
|
constructor(bufferLayouts) {
|
|
@@ -9576,7 +9588,7 @@ ${declarations.join("\n")}`).match(
|
|
|
9576
9588
|
}
|
|
9577
9589
|
/** Get attribute names from a BufferLayout */
|
|
9578
9590
|
getAttributeNamesForBuffer(bufferLayout) {
|
|
9579
|
-
return (0,
|
|
9591
|
+
return (0, import_core7.getBufferLayoutAttributeNames)(bufferLayout);
|
|
9580
9592
|
}
|
|
9581
9593
|
mergeBufferLayouts(bufferLayouts1, bufferLayouts2) {
|
|
9582
9594
|
const mergedLayouts = [...bufferLayouts1];
|
|
@@ -9593,16 +9605,16 @@ ${declarations.join("\n")}`).match(
|
|
|
9593
9605
|
};
|
|
9594
9606
|
|
|
9595
9607
|
// src/utils/buffer-layout-order.ts
|
|
9596
|
-
var
|
|
9608
|
+
var import_core8 = __toESM(require_core(), 1);
|
|
9597
9609
|
function sortedBufferLayoutByShaderSourceLocations(shaderLayout, bufferLayout) {
|
|
9598
|
-
const shaderLayoutMap = (0,
|
|
9610
|
+
const shaderLayoutMap = (0, import_core8.getShaderAttributeLocationMap)(shaderLayout);
|
|
9599
9611
|
const sortedLayout = bufferLayout.slice();
|
|
9600
9612
|
sortedLayout.sort((a, b) => {
|
|
9601
|
-
const minLocationA = (0,
|
|
9602
|
-
(0,
|
|
9613
|
+
const minLocationA = (0, import_core8.getMinimumAttributeLocation)(
|
|
9614
|
+
(0, import_core8.getBufferLayoutAttributeNames)(a).map((attributeName) => shaderLayoutMap[attributeName])
|
|
9603
9615
|
);
|
|
9604
|
-
const minLocationB = (0,
|
|
9605
|
-
(0,
|
|
9616
|
+
const minLocationB = (0, import_core8.getMinimumAttributeLocation)(
|
|
9617
|
+
(0, import_core8.getBufferLayoutAttributeNames)(b).map((attributeName) => shaderLayoutMap[attributeName])
|
|
9606
9618
|
);
|
|
9607
9619
|
return minLocationA - minLocationB;
|
|
9608
9620
|
});
|
|
@@ -9765,7 +9777,7 @@ ${declarations.join("\n")}`).match(
|
|
|
9765
9777
|
}
|
|
9766
9778
|
|
|
9767
9779
|
// src/model/gpu-vector-model-batches.ts
|
|
9768
|
-
var
|
|
9780
|
+
var import_core9 = __toESM(require_core(), 1);
|
|
9769
9781
|
function validateGPUVectorModelLayouts(ownerName, vectors, bufferLayouts) {
|
|
9770
9782
|
for (const [name, vector] of Object.entries(vectors)) {
|
|
9771
9783
|
if (!vector) continue;
|
|
@@ -9829,22 +9841,22 @@ ${declarations.join("\n")}`).match(
|
|
|
9829
9841
|
if (format.includes("<")) {
|
|
9830
9842
|
throw new Error(`${ownerName} GPUVector "${name}" requires a fixed-width scalar format`);
|
|
9831
9843
|
}
|
|
9832
|
-
return
|
|
9844
|
+
return import_core9.vertexFormatDecoder.getVertexFormatInfo(format);
|
|
9833
9845
|
}
|
|
9834
9846
|
|
|
9835
9847
|
// src/utils/gpu-vector-batch-structure.ts
|
|
9836
|
-
var
|
|
9848
|
+
var import_core10 = __toESM(require_core(), 1);
|
|
9837
9849
|
function validateGPUVectorBatchStructure(vectors) {
|
|
9838
9850
|
let reference;
|
|
9839
9851
|
for (const vector of Object.values(vectors)) {
|
|
9840
9852
|
if (!vector || "isConstant" in vector) continue;
|
|
9841
9853
|
let rowCount = 0;
|
|
9842
9854
|
for (const chunk of vector.data) rowCount += chunk.length;
|
|
9843
|
-
(0,
|
|
9855
|
+
(0, import_core10.assert)(rowCount === vector.length);
|
|
9844
9856
|
if (reference) {
|
|
9845
|
-
(0,
|
|
9857
|
+
(0, import_core10.assert)(vector.length === reference.length && vector.data.length === reference.data.length);
|
|
9846
9858
|
for (let batchIndex = 0; batchIndex < vector.data.length; batchIndex++) {
|
|
9847
|
-
(0,
|
|
9859
|
+
(0, import_core10.assert)(vector.data[batchIndex].length === reference.data[batchIndex].length);
|
|
9848
9860
|
}
|
|
9849
9861
|
} else reference = vector;
|
|
9850
9862
|
}
|
|
@@ -9937,7 +9949,7 @@ ${declarations.join("\n")}`).match(
|
|
|
9937
9949
|
}
|
|
9938
9950
|
|
|
9939
9951
|
// src/model/gpu-vector-bindings.ts
|
|
9940
|
-
var
|
|
9952
|
+
var import_core11 = __toESM(require_core(), 1);
|
|
9941
9953
|
var GPUVectorBindings = class {
|
|
9942
9954
|
constructor(device, id) {
|
|
9943
9955
|
this.device = device;
|
|
@@ -9962,7 +9974,7 @@ ${declarations.join("\n")}`).match(
|
|
|
9962
9974
|
validateGPUVectorBatchStructure(columns);
|
|
9963
9975
|
} else {
|
|
9964
9976
|
for (const column of Object.values(columns)) {
|
|
9965
|
-
if (column && !isConstant(column)) (0,
|
|
9977
|
+
if (column && !isConstant(column)) (0, import_core11.assert)(column.data.length === 1);
|
|
9966
9978
|
}
|
|
9967
9979
|
}
|
|
9968
9980
|
this.claimedNames.clear();
|
|
@@ -9980,7 +9992,7 @@ ${declarations.join("\n")}`).match(
|
|
|
9980
9992
|
(layout) => layout.name === name || layout.attributes?.some((attribute) => attribute.attribute === name)
|
|
9981
9993
|
))
|
|
9982
9994
|
return [];
|
|
9983
|
-
(0,
|
|
9995
|
+
(0, import_core11.assert)(column.format);
|
|
9984
9996
|
const format = column.format;
|
|
9985
9997
|
const byteStride = isConstant(column) ? 0 : column.byteStride;
|
|
9986
9998
|
return [{ name, stepMode, byteStride, attributes: [{ attribute: name, format, byteOffset: 0 }] }];
|
|
@@ -9996,10 +10008,10 @@ ${declarations.join("\n")}`).match(
|
|
|
9996
10008
|
);
|
|
9997
10009
|
const mode = layout?.stepMode ?? stepMode;
|
|
9998
10010
|
if (mode === "instance") {
|
|
9999
|
-
(0,
|
|
10011
|
+
(0, import_core11.assert)(this.instanceCount === void 0 || this.instanceCount === column.length);
|
|
10000
10012
|
this.instanceCount = column.length;
|
|
10001
10013
|
} else {
|
|
10002
|
-
(0,
|
|
10014
|
+
(0, import_core11.assert)(this.vertexCount === void 0 || this.vertexCount === column.length);
|
|
10003
10015
|
this.vertexCount = column.length;
|
|
10004
10016
|
}
|
|
10005
10017
|
this.rowCount = stepMode === "instance" ? this.instanceCount : this.vertexCount;
|
|
@@ -10044,7 +10056,7 @@ ${declarations.join("\n")}`).match(
|
|
|
10044
10056
|
for (const definition of definitions) {
|
|
10045
10057
|
const column = columns[definition.attribute] ?? (definition.attribute === layout.name ? columns[layout.name] : void 0);
|
|
10046
10058
|
if (!column) continue;
|
|
10047
|
-
(0,
|
|
10059
|
+
(0, import_core11.assert)(column.format === void 0 || column.format === definition.format);
|
|
10048
10060
|
if (isConstant(column)) {
|
|
10049
10061
|
this.constants[definition.attribute] = getShaderConstant(column);
|
|
10050
10062
|
constantByteLength = Math.max(
|
|
@@ -10071,7 +10083,7 @@ ${declarations.join("\n")}`).match(
|
|
|
10071
10083
|
buffer = this.device.createBuffer({
|
|
10072
10084
|
id: `${this.id}-${layout.name}-constant`,
|
|
10073
10085
|
byteLength: bytes.byteLength,
|
|
10074
|
-
usage:
|
|
10086
|
+
usage: import_core11.Buffer.VERTEX | import_core11.Buffer.COPY_DST | import_core11.Buffer.COPY_SRC
|
|
10075
10087
|
});
|
|
10076
10088
|
this.constantBuffers[layout.name] = buffer;
|
|
10077
10089
|
}
|
|
@@ -10108,7 +10120,7 @@ ${declarations.join("\n")}`).match(
|
|
|
10108
10120
|
const chunk = vector.data[0];
|
|
10109
10121
|
if (!chunk) return;
|
|
10110
10122
|
const byteOffset = chunk.byteOffset - layoutOffset;
|
|
10111
|
-
(0,
|
|
10123
|
+
(0, import_core11.assert)(byteOffset >= 0);
|
|
10112
10124
|
this.buffers[name] = chunk.buffer;
|
|
10113
10125
|
this.byteOffsets[name] = byteOffset;
|
|
10114
10126
|
}
|
|
@@ -10117,7 +10129,7 @@ ${declarations.join("\n")}`).match(
|
|
|
10117
10129
|
return Boolean(column && "isConstant" in column && column.isConstant);
|
|
10118
10130
|
}
|
|
10119
10131
|
function getShaderConstant(column) {
|
|
10120
|
-
const information =
|
|
10132
|
+
const information = import_core11.vertexFormatDecoder.getVertexFormatInfo(column.format);
|
|
10121
10133
|
if (column.format === "unorm10-10-10-2") {
|
|
10122
10134
|
const word = column.value[0];
|
|
10123
10135
|
return new Float32Array([
|
|
@@ -10187,13 +10199,13 @@ ${declarations.join("\n")}`).match(
|
|
|
10187
10199
|
}
|
|
10188
10200
|
|
|
10189
10201
|
// src/shader-inputs.ts
|
|
10190
|
-
var
|
|
10202
|
+
var import_core12 = __toESM(require_core(), 1);
|
|
10191
10203
|
var import_shaders2 = __toESM(require_shaders(), 1);
|
|
10192
10204
|
|
|
10193
10205
|
// src/model/split-uniforms-and-bindings.ts
|
|
10194
10206
|
function isUniformValue(value) {
|
|
10195
|
-
const
|
|
10196
|
-
return
|
|
10207
|
+
const isNumericArray2 = Array.isArray(value) ? value.length === 0 || typeof value[0] === "number" : ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
10208
|
+
return isNumericArray2 || typeof value === "number" || typeof value === "boolean";
|
|
10197
10209
|
}
|
|
10198
10210
|
function splitUniformsAndBindings(uniforms, uniformTypes2 = {}) {
|
|
10199
10211
|
const result = { bindings: {}, uniforms: {} };
|
|
@@ -10237,7 +10249,7 @@ ${declarations.join("\n")}`).match(
|
|
|
10237
10249
|
for (const resolvedModule of resolvedModules) {
|
|
10238
10250
|
modules[resolvedModule.name] = resolvedModule;
|
|
10239
10251
|
}
|
|
10240
|
-
|
|
10252
|
+
import_core12.log.log(1, "Creating ShaderInputs with modules", Object.keys(modules))();
|
|
10241
10253
|
this.modules = modules;
|
|
10242
10254
|
this.moduleUniforms = {};
|
|
10243
10255
|
this.moduleBindings = {};
|
|
@@ -10245,7 +10257,7 @@ ${declarations.join("\n")}`).match(
|
|
|
10245
10257
|
if (module) {
|
|
10246
10258
|
this._addModule(module);
|
|
10247
10259
|
if (module.name && name !== module.name && !this.options.disableWarnings) {
|
|
10248
|
-
|
|
10260
|
+
import_core12.log.warn(`Module name: ${name} vs ${module.name}`)();
|
|
10249
10261
|
}
|
|
10250
10262
|
}
|
|
10251
10263
|
}
|
|
@@ -10269,7 +10281,7 @@ ${declarations.join("\n")}`).match(
|
|
|
10269
10281
|
const module = this.modules[moduleName];
|
|
10270
10282
|
if (!module) {
|
|
10271
10283
|
if (!this.options.disableWarnings) {
|
|
10272
|
-
|
|
10284
|
+
import_core12.log.warn(`Module ${name} not found`)();
|
|
10273
10285
|
}
|
|
10274
10286
|
} else {
|
|
10275
10287
|
const oldUniforms = this.moduleUniforms[moduleName];
|
|
@@ -13644,13 +13656,13 @@ ${declarations.join("\n")}`).match(
|
|
|
13644
13656
|
var GPUVectorModel = class _GPUVectorModel {
|
|
13645
13657
|
/** Creates a model while allowing the backend to compile its render pipeline asynchronously. */
|
|
13646
13658
|
static async createAsync(device, props) {
|
|
13647
|
-
const ownsCompilation = !
|
|
13648
|
-
const asyncCompilation = ownsCompilation ?
|
|
13659
|
+
const ownsCompilation = !import_core13.PipelineFactory.getAsyncCompilation(device);
|
|
13660
|
+
const asyncCompilation = ownsCompilation ? import_core13.PipelineFactory.beginAsyncCompilation(device) : import_core13.PipelineFactory.getAsyncCompilation(device);
|
|
13649
13661
|
let model;
|
|
13650
13662
|
try {
|
|
13651
13663
|
model = new this(device, props);
|
|
13652
13664
|
} finally {
|
|
13653
|
-
if (ownsCompilation)
|
|
13665
|
+
if (ownsCompilation) import_core13.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
|
|
13654
13666
|
}
|
|
13655
13667
|
try {
|
|
13656
13668
|
if (ownsCompilation) {
|
|
@@ -13665,7 +13677,7 @@ ${declarations.join("\n")}`).match(
|
|
|
13665
13677
|
}
|
|
13666
13678
|
}
|
|
13667
13679
|
static defaultProps = {
|
|
13668
|
-
...
|
|
13680
|
+
...import_core13.RenderPipeline.defaultProps,
|
|
13669
13681
|
inferDrawCount: "no",
|
|
13670
13682
|
enforceMatchingVectorLengths: true,
|
|
13671
13683
|
geometry: null,
|
|
@@ -13849,7 +13861,7 @@ ${declarations.join("\n")}`).match(
|
|
|
13849
13861
|
const isWebGPU = this.device.type === "webgpu";
|
|
13850
13862
|
if (isWebGPU && this.props.source) {
|
|
13851
13863
|
const shaderAssembler = this.props.shaderAssembler;
|
|
13852
|
-
(0,
|
|
13864
|
+
(0, import_core13.assert)(isShaderAssemblerForLanguage(shaderAssembler, "wgsl"));
|
|
13853
13865
|
const {
|
|
13854
13866
|
source: source4,
|
|
13855
13867
|
getUniforms: getUniforms2,
|
|
@@ -13886,7 +13898,7 @@ ${declarations.join("\n")}`).match(
|
|
|
13886
13898
|
this.props.shaderLayout = mergeShaderModuleBindingsIntoLayout(shaderLayout || null, modules) || null;
|
|
13887
13899
|
} else {
|
|
13888
13900
|
const shaderAssembler = this.props.shaderAssembler;
|
|
13889
|
-
(0,
|
|
13901
|
+
(0, import_core13.assert)(isShaderAssemblerForLanguage(shaderAssembler, "glsl"));
|
|
13890
13902
|
const { vs: vs4, fs: fs4, getUniforms: getUniforms2 } = shaderAssembler.assembleGLSLShaderPair({
|
|
13891
13903
|
platformInfo,
|
|
13892
13904
|
...this.props,
|
|
@@ -13902,9 +13914,9 @@ ${declarations.join("\n")}`).match(
|
|
|
13902
13914
|
this._getModuleUniforms = getUniforms2;
|
|
13903
13915
|
this._bindingTable = [];
|
|
13904
13916
|
}
|
|
13905
|
-
this.pipelineFactory = props.pipelineFactory ||
|
|
13906
|
-
this.shaderFactory = props.shaderFactory ||
|
|
13907
|
-
const asyncCompilation =
|
|
13917
|
+
this.pipelineFactory = props.pipelineFactory || import_core13.PipelineFactory.getDefaultPipelineFactory(this.device);
|
|
13918
|
+
this.shaderFactory = props.shaderFactory || import_core13.ShaderFactory.getDefaultShaderFactory(this.device);
|
|
13919
|
+
const asyncCompilation = import_core13.PipelineFactory.getAsyncCompilation(this.device);
|
|
13908
13920
|
if (asyncCompilation) {
|
|
13909
13921
|
this._pipelineInitialization = this._initializePipelineAsync(props);
|
|
13910
13922
|
asyncCompilation.push(this._pipelineInitialization);
|
|
@@ -14039,12 +14051,12 @@ ${declarations.join("\n")}`).match(
|
|
|
14039
14051
|
return this.drawVectorGroups(renderPass);
|
|
14040
14052
|
}
|
|
14041
14053
|
if (this._drawBlockedReason && !this._pipelineNeedsUpdate) {
|
|
14042
|
-
|
|
14054
|
+
import_core13.log.info(LOG_DRAW_PRIORITY, `>>> DRAWING ABORTED ${this.id}: ${this._drawBlockedReason}`)();
|
|
14043
14055
|
return false;
|
|
14044
14056
|
}
|
|
14045
14057
|
const loadingBinding = this._areBindingsLoading();
|
|
14046
14058
|
if (loadingBinding) {
|
|
14047
|
-
|
|
14059
|
+
import_core13.log.info(LOG_DRAW_PRIORITY, `>>> DRAWING ABORTED ${this.id}: ${loadingBinding} not loaded`)();
|
|
14048
14060
|
return false;
|
|
14049
14061
|
}
|
|
14050
14062
|
this._syncAttachmentFormats(renderPass);
|
|
@@ -14068,7 +14080,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14068
14080
|
this.pipeline = this._updatePipeline();
|
|
14069
14081
|
pipelineErrored = this.pipeline.isErrored;
|
|
14070
14082
|
if (pipelineErrored) {
|
|
14071
|
-
|
|
14083
|
+
import_core13.log.info(
|
|
14072
14084
|
LOG_DRAW_PRIORITY,
|
|
14073
14085
|
`>>> DRAWING ABORTED ${this.id}: ${PIPELINE_INITIALIZATION_FAILED}`
|
|
14074
14086
|
)();
|
|
@@ -14076,7 +14088,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14076
14088
|
} else {
|
|
14077
14089
|
const drawValidationError = this.vertexArray.getDrawValidationError();
|
|
14078
14090
|
if (drawValidationError) {
|
|
14079
|
-
|
|
14091
|
+
import_core13.log.info(LOG_DRAW_PRIORITY, `>>> DRAWING ABORTED ${this.id}: ${drawValidationError}`)();
|
|
14080
14092
|
this._drawBlockedReason = drawValidationError;
|
|
14081
14093
|
drawSuccess = false;
|
|
14082
14094
|
} else {
|
|
@@ -14151,7 +14163,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14151
14163
|
this.claimVectorLayouts(this.geometryVectorBindings);
|
|
14152
14164
|
this.syncVectorBindings();
|
|
14153
14165
|
const rowCount = this.geometryVectorBindings.rowCount;
|
|
14154
|
-
(0,
|
|
14166
|
+
(0, import_core13.assert)(
|
|
14155
14167
|
rowCount === void 0 || this.attributeVectorBindings.vertexCount === void 0 || rowCount === this.attributeVectorBindings.vertexCount
|
|
14156
14168
|
);
|
|
14157
14169
|
if (this.props.inferDrawCount === "vertex")
|
|
@@ -14188,7 +14200,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14188
14200
|
const vertexCount = this.attributeVectorBindings.vertexCount;
|
|
14189
14201
|
if (vertexCount !== void 0 && this.props.inferDrawCount === "vertex") {
|
|
14190
14202
|
const geometryRowCount = this.geometryVectorBindings.rowCount;
|
|
14191
|
-
(0,
|
|
14203
|
+
(0, import_core13.assert)(geometryRowCount === void 0 || geometryRowCount === vertexCount);
|
|
14192
14204
|
if (geometryRowCount === void 0) this.setVertexCount(vertexCount);
|
|
14193
14205
|
}
|
|
14194
14206
|
}
|
|
@@ -14199,9 +14211,9 @@ ${declarations.join("\n")}`).match(
|
|
|
14199
14211
|
/** Replaces the borrowed contiguous uint16/uint32 index vector. */
|
|
14200
14212
|
setIndexVector(vector) {
|
|
14201
14213
|
if (vector) {
|
|
14202
|
-
(0,
|
|
14203
|
-
(0,
|
|
14204
|
-
(0,
|
|
14214
|
+
(0, import_core13.assert)(vector.format === "uint8" || vector.format === "uint16" || vector.format === "uint32");
|
|
14215
|
+
(0, import_core13.assert)(vector.data.length <= 1);
|
|
14216
|
+
(0, import_core13.assert)(
|
|
14205
14217
|
vector.byteStride === (vector.format === "uint32" ? 4 : vector.format === "uint16" ? 2 : 1)
|
|
14206
14218
|
);
|
|
14207
14219
|
}
|
|
@@ -14213,7 +14225,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14213
14225
|
const chunk = vector?.data[0];
|
|
14214
14226
|
if (chunk && this.indexVector) {
|
|
14215
14227
|
const buffer = chunk.buffer instanceof DynamicBuffer ? chunk.buffer.buffer : chunk.buffer;
|
|
14216
|
-
(0,
|
|
14228
|
+
(0, import_core13.assert)(
|
|
14217
14229
|
buffer.indexType === this.indexVector.format && chunk.byteOffset % this.indexVector.byteStride === 0
|
|
14218
14230
|
);
|
|
14219
14231
|
}
|
|
@@ -14287,7 +14299,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14287
14299
|
/** Binds contiguous borrowed vectors; use drawBatches() for multi-chunk inputs. */
|
|
14288
14300
|
setGPUVectors(vectors, options) {
|
|
14289
14301
|
const batches = getGPUVectorModelBatches(this.id, vectors);
|
|
14290
|
-
(0,
|
|
14302
|
+
(0, import_core13.assert)(batches.length <= 1);
|
|
14291
14303
|
validateGPUVectorModelLayouts(this.id, vectors, this.bufferLayout);
|
|
14292
14304
|
if (batches[0]) this.setGPUData(batches[0].data);
|
|
14293
14305
|
this.setBatchDrawCount(batches[0]?.rowCount ?? 0, options?.count);
|
|
@@ -14326,7 +14338,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14326
14338
|
const batches = getGPUVectorModelBatches(this.id, vectors);
|
|
14327
14339
|
validateGPUVectorModelLayouts(this.id, vectors, this.bufferLayout);
|
|
14328
14340
|
for (const name of Object.keys(vectors)) {
|
|
14329
|
-
(0,
|
|
14341
|
+
(0, import_core13.assert)(!vectors[name] || this.currentAttributes[name]);
|
|
14330
14342
|
}
|
|
14331
14343
|
const previousAttributes = { ...this.currentAttributes };
|
|
14332
14344
|
const previousAttributeByteOffsets = { ...this.currentAttributeByteOffsets };
|
|
@@ -14336,7 +14348,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14336
14348
|
const previousIsInstanced = this.isInstanced;
|
|
14337
14349
|
const previousVertexCountSet = this._vertexCountSet;
|
|
14338
14350
|
const drawingVectorBatches = this.drawingVectorBatches;
|
|
14339
|
-
const batchUniformStore = this.device.type === "webgpu" && batches.length ? new
|
|
14351
|
+
const batchUniformStore = this.device.type === "webgpu" && batches.length ? new import_core13.UniformStore(this.device, this.shaderInputs.modules) : void 0;
|
|
14340
14352
|
if (batchUniformStore && this._uniformStore.uniformBuffers.size) {
|
|
14341
14353
|
this.batchUniformBuffer ??= new BatchUniformBuffer(this.device);
|
|
14342
14354
|
let batchByteLength = 0;
|
|
@@ -14397,7 +14409,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14397
14409
|
Object.entries(data).map(([name, chunk]) => {
|
|
14398
14410
|
const layout = this.bufferLayout.find((layout2) => layout2.name === name);
|
|
14399
14411
|
const byteOffset = chunk.byteOffset - (layout?.attributes?.[0]?.byteOffset ?? 0);
|
|
14400
|
-
(0,
|
|
14412
|
+
(0, import_core13.assert)(byteOffset >= 0);
|
|
14401
14413
|
return [name, byteOffset];
|
|
14402
14414
|
})
|
|
14403
14415
|
)
|
|
@@ -14405,7 +14417,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14405
14417
|
);
|
|
14406
14418
|
}
|
|
14407
14419
|
validateVectorLengthPolicy() {
|
|
14408
|
-
(0,
|
|
14420
|
+
(0, import_core13.assert)(this.props.enforceMatchingVectorLengths !== false || this.props.inferDrawCount === "no");
|
|
14409
14421
|
}
|
|
14410
14422
|
setBatchDrawCount(rowCount, count = this.props.inferDrawCount === "no" ? "none" : this.props.inferDrawCount) {
|
|
14411
14423
|
if (count === "instance") {
|
|
@@ -14528,7 +14540,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14528
14540
|
/** Set the shader inputs */
|
|
14529
14541
|
setShaderInputs(shaderInputs) {
|
|
14530
14542
|
this.shaderInputs = shaderInputs;
|
|
14531
|
-
this._uniformStore = new
|
|
14543
|
+
this._uniformStore = new import_core13.UniformStore(this.device, this.shaderInputs.modules);
|
|
14532
14544
|
for (const [moduleName, module] of Object.entries(this.shaderInputs.modules)) {
|
|
14533
14545
|
if (shaderModuleHasUniforms(module) && this._usesManagedUniformBuffer(moduleName)) {
|
|
14534
14546
|
const uniformBuffer = this._uniformStore.getManagedUniformBuffer(moduleName);
|
|
@@ -14599,7 +14611,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14599
14611
|
this._drawBlockedReason = false;
|
|
14600
14612
|
const disableWarnings = options?.disableWarnings ?? this.props.disableWarnings;
|
|
14601
14613
|
if (buffers["indices"]) {
|
|
14602
|
-
|
|
14614
|
+
import_core13.log.warn(
|
|
14603
14615
|
`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`
|
|
14604
14616
|
)();
|
|
14605
14617
|
}
|
|
@@ -14613,7 +14625,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14613
14625
|
const bufferLayout = bufferLayoutHelper.getBufferLayout(bufferName);
|
|
14614
14626
|
if (!bufferLayout) {
|
|
14615
14627
|
if (!disableWarnings) {
|
|
14616
|
-
|
|
14628
|
+
import_core13.log.warn(`Model(${this.id}): Missing layout for buffer "${bufferName}".`)();
|
|
14617
14629
|
}
|
|
14618
14630
|
continue;
|
|
14619
14631
|
}
|
|
@@ -14625,7 +14637,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14625
14637
|
const bufferSlot = this.device.type === "webgpu" ? this.vertexArray.getBufferSlot(attributeInfo.bufferName) : attributeInfo.location;
|
|
14626
14638
|
if (bufferSlot === null) {
|
|
14627
14639
|
if (!disableWarnings) {
|
|
14628
|
-
|
|
14640
|
+
import_core13.log.warn(
|
|
14629
14641
|
`Model(${this.id}): Missing vertex array slot for buffer "${attributeInfo.bufferName}".`
|
|
14630
14642
|
)();
|
|
14631
14643
|
}
|
|
@@ -14646,7 +14658,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14646
14658
|
}
|
|
14647
14659
|
}
|
|
14648
14660
|
if (!set2 && !disableWarnings) {
|
|
14649
|
-
|
|
14661
|
+
import_core13.log.warn(
|
|
14650
14662
|
`Model(${this.id}): Ignoring buffer "${resolvedBuffer.id}" for unknown attribute "${bufferName}"`
|
|
14651
14663
|
)();
|
|
14652
14664
|
}
|
|
@@ -14667,7 +14679,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14667
14679
|
if (attributeInfo) {
|
|
14668
14680
|
this.vertexArray.setConstantWebGL(attributeInfo.location, value);
|
|
14669
14681
|
} else if (!(options?.disableWarnings ?? this.props.disableWarnings)) {
|
|
14670
|
-
|
|
14682
|
+
import_core13.log.warn(
|
|
14671
14683
|
`Model "${this.id}: Ignoring constant supplied for unknown attribute "${attributeName}"`
|
|
14672
14684
|
)();
|
|
14673
14685
|
}
|
|
@@ -14704,7 +14716,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14704
14716
|
* @param bindings GPUVectorModel bindings already resolved for this draw preparation.
|
|
14705
14717
|
*/
|
|
14706
14718
|
_getBindGroups(shaderLayout = this._getCurrentShaderLayout(), bindings = this._getBindings(shaderLayout)) {
|
|
14707
|
-
return shaderLayout.bindings.length ? (0,
|
|
14719
|
+
return shaderLayout.bindings.length ? (0, import_core13.normalizeBindingsByGroup)(shaderLayout, bindings) : { 0: bindings };
|
|
14708
14720
|
}
|
|
14709
14721
|
_getBindGroupCacheKeys() {
|
|
14710
14722
|
return {};
|
|
@@ -14719,9 +14731,9 @@ ${declarations.join("\n")}`).match(
|
|
|
14719
14731
|
timestamp = Math.max(timestamp, entry.source.updateTimestamp);
|
|
14720
14732
|
}
|
|
14721
14733
|
for (const binding of Object.values(this.bindings)) {
|
|
14722
|
-
if (binding instanceof
|
|
14734
|
+
if (binding instanceof import_core13.TextureView) {
|
|
14723
14735
|
timestamp = Math.max(timestamp, binding.texture.updateTimestamp);
|
|
14724
|
-
} else if (binding instanceof
|
|
14736
|
+
} else if (binding instanceof import_core13.Buffer || binding instanceof import_core13.Texture || binding instanceof import_core13.ExternalTexture) {
|
|
14725
14737
|
timestamp = Math.max(timestamp, binding.updateTimestamp);
|
|
14726
14738
|
} else if (binding instanceof DynamicBuffer) {
|
|
14727
14739
|
timestamp = Math.max(timestamp, binding.updateTimestamp);
|
|
@@ -14780,7 +14792,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14780
14792
|
const previousVertexShader = this.pipeline?.vs ?? null;
|
|
14781
14793
|
const previousFragmentShader = this.pipeline?.fs ?? null;
|
|
14782
14794
|
if (this.pipeline) {
|
|
14783
|
-
|
|
14795
|
+
import_core13.log.log(
|
|
14784
14796
|
1,
|
|
14785
14797
|
`GPUVectorModel ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`
|
|
14786
14798
|
)();
|
|
@@ -14830,7 +14842,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14830
14842
|
};
|
|
14831
14843
|
}
|
|
14832
14844
|
_finishPipelineUpdate(update) {
|
|
14833
|
-
this._attributeInfos = (0,
|
|
14845
|
+
this._attributeInfos = (0, import_core13.getAttributeInfosFromLayouts)(
|
|
14834
14846
|
this.pipeline.shaderLayout,
|
|
14835
14847
|
this.bufferLayout
|
|
14836
14848
|
);
|
|
@@ -14846,24 +14858,24 @@ ${declarations.join("\n")}`).match(
|
|
|
14846
14858
|
_lastLogTime = 0;
|
|
14847
14859
|
_logOpen = false;
|
|
14848
14860
|
_logDrawCallStart() {
|
|
14849
|
-
const logDrawTimeout =
|
|
14850
|
-
if (
|
|
14861
|
+
const logDrawTimeout = import_core13.log.level > 3 ? 0 : LOG_DRAW_TIMEOUT;
|
|
14862
|
+
if (import_core13.log.level < 2 || Date.now() - this._lastLogTime < logDrawTimeout) {
|
|
14851
14863
|
return;
|
|
14852
14864
|
}
|
|
14853
14865
|
this._lastLogTime = Date.now();
|
|
14854
14866
|
this._logOpen = true;
|
|
14855
|
-
|
|
14867
|
+
import_core13.log.group(LOG_DRAW_PRIORITY, `>>> DRAWING MODEL ${this.id}`, { collapsed: import_core13.log.level <= 2 })();
|
|
14856
14868
|
}
|
|
14857
14869
|
_logDrawCallEnd() {
|
|
14858
14870
|
if (this._logOpen) {
|
|
14859
14871
|
const shaderLayoutTable = getDebugTableForShaderLayout(this.pipeline.shaderLayout, this.id);
|
|
14860
|
-
|
|
14872
|
+
import_core13.log.table(LOG_DRAW_PRIORITY, shaderLayoutTable)();
|
|
14861
14873
|
const uniformTable = this.shaderInputs.getDebugTable();
|
|
14862
|
-
|
|
14874
|
+
import_core13.log.table(LOG_DRAW_PRIORITY, uniformTable)();
|
|
14863
14875
|
const attributeTable = this._getAttributeDebugTable();
|
|
14864
|
-
|
|
14865
|
-
|
|
14866
|
-
|
|
14876
|
+
import_core13.log.table(LOG_DRAW_PRIORITY, this._attributeInfos)();
|
|
14877
|
+
import_core13.log.table(LOG_DRAW_PRIORITY, attributeTable)();
|
|
14878
|
+
import_core13.log.groupEnd(LOG_DRAW_PRIORITY)();
|
|
14867
14879
|
this._logOpen = false;
|
|
14868
14880
|
}
|
|
14869
14881
|
}
|
|
@@ -14903,8 +14915,8 @@ ${declarations.join("\n")}`).match(
|
|
|
14903
14915
|
}
|
|
14904
14916
|
// TODO - fix typing of luma data types
|
|
14905
14917
|
_getBufferOrConstantValues(attribute, dataType) {
|
|
14906
|
-
const TypedArrayConstructor =
|
|
14907
|
-
const typedArray = attribute instanceof
|
|
14918
|
+
const TypedArrayConstructor = import_core13.dataTypeDecoder.getTypedArrayConstructor(dataType);
|
|
14919
|
+
const typedArray = attribute instanceof import_core13.Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;
|
|
14908
14920
|
return typedArray.toString();
|
|
14909
14921
|
}
|
|
14910
14922
|
/** Returns the current reflected shader layout or the pre-reflection empty layout. */
|
|
@@ -14988,7 +15000,7 @@ ${declarations.join("\n")}`).match(
|
|
|
14988
15000
|
}
|
|
14989
15001
|
|
|
14990
15002
|
// src/geometry/gpu-geometry.ts
|
|
14991
|
-
var
|
|
15003
|
+
var import_core14 = __toESM(require_core(), 1);
|
|
14992
15004
|
var GPUGeometry = class {
|
|
14993
15005
|
/** Application-provided or generated identifier. */
|
|
14994
15006
|
id;
|
|
@@ -15013,7 +15025,7 @@ ${declarations.join("\n")}`).match(
|
|
|
15013
15025
|
this.vertexCount = props.vertexCount;
|
|
15014
15026
|
this.bufferLayout = props.bufferLayout || [];
|
|
15015
15027
|
if (this.indices) {
|
|
15016
|
-
if (!(this.indices.usage &
|
|
15028
|
+
if (!(this.indices.usage & import_core14.Buffer.INDEX)) {
|
|
15017
15029
|
throw new Error("Index buffer must have INDEX usage");
|
|
15018
15030
|
}
|
|
15019
15031
|
}
|
|
@@ -15062,7 +15074,7 @@ ${declarations.join("\n")}`).match(
|
|
|
15062
15074
|
return void 0;
|
|
15063
15075
|
}
|
|
15064
15076
|
const data = geometry.indices.value;
|
|
15065
|
-
return device.createBuffer({ usage:
|
|
15077
|
+
return device.createBuffer({ usage: import_core14.Buffer.INDEX, data });
|
|
15066
15078
|
}
|
|
15067
15079
|
function getAttributeBuffersFromGeometry(device, geometry) {
|
|
15068
15080
|
const attributes = {};
|
|
@@ -15102,7 +15114,7 @@ ${declarations.join("\n")}`).match(
|
|
|
15102
15114
|
};
|
|
15103
15115
|
|
|
15104
15116
|
// src/geometry/gpu-vector-geometry-adapter.ts
|
|
15105
|
-
var
|
|
15117
|
+
var import_core15 = __toESM(require_core(), 1);
|
|
15106
15118
|
function makeGPUVectorGeometry(device, geometry) {
|
|
15107
15119
|
const gpuGeometry = makeGPUGeometry(device, geometry);
|
|
15108
15120
|
try {
|
|
@@ -15119,7 +15131,7 @@ ${declarations.join("\n")}`).match(
|
|
|
15119
15131
|
for (const [name, buffer2] of Object.entries(geometry.attributes)) {
|
|
15120
15132
|
const bufferLayout = geometry.bufferLayout.find((layout) => layout.name === name);
|
|
15121
15133
|
const format = bufferLayout?.format;
|
|
15122
|
-
const byteStride2 = bufferLayout?.byteStride ?? (format ?
|
|
15134
|
+
const byteStride2 = bufferLayout?.byteStride ?? (format ? import_core15.vertexFormatDecoder.getVertexFormatInfo(format).byteLength : 0);
|
|
15123
15135
|
const length5 = geometry.indices && byteStride2 ? Math.floor(buffer2.byteLength / byteStride2) : geometry.vertexCount;
|
|
15124
15136
|
attributes[name] = {
|
|
15125
15137
|
name,
|
|
@@ -15282,7 +15294,7 @@ ${declarations.join("\n")}`).match(
|
|
|
15282
15294
|
};
|
|
15283
15295
|
|
|
15284
15296
|
// src/material/material.ts
|
|
15285
|
-
var
|
|
15297
|
+
var import_core16 = __toESM(require_core(), 1);
|
|
15286
15298
|
|
|
15287
15299
|
// src/material/material-factory.ts
|
|
15288
15300
|
var MATERIAL_BIND_GROUP = 3;
|
|
@@ -15386,7 +15398,7 @@ ${declarations.join("\n")}`).match(
|
|
|
15386
15398
|
])
|
|
15387
15399
|
);
|
|
15388
15400
|
this.shaderInputs = props.shaderInputs || new ShaderInputs(moduleMap);
|
|
15389
|
-
this._uniformStore = new
|
|
15401
|
+
this._uniformStore = new import_core16.UniformStore(this.device, this.shaderInputs.modules);
|
|
15390
15402
|
for (const [moduleName, module] of Object.entries(this.shaderInputs.modules)) {
|
|
15391
15403
|
if (this.ownsModule(moduleName) && shaderModuleHasUniforms(module)) {
|
|
15392
15404
|
const uniformBuffer = this._uniformStore.getManagedUniformBuffer(moduleName);
|
|
@@ -15501,9 +15513,9 @@ ${declarations.join("\n")}`).match(
|
|
|
15501
15513
|
getBindingsUpdateTimestamp() {
|
|
15502
15514
|
let timestamp = 0;
|
|
15503
15515
|
for (const binding of Object.values(this.bindings)) {
|
|
15504
|
-
if (binding instanceof
|
|
15516
|
+
if (binding instanceof import_core16.TextureView) {
|
|
15505
15517
|
timestamp = Math.max(timestamp, binding.texture.updateTimestamp);
|
|
15506
|
-
} else if (binding instanceof
|
|
15518
|
+
} else if (binding instanceof import_core16.Buffer || binding instanceof import_core16.Texture || binding instanceof import_core16.ExternalTexture) {
|
|
15507
15519
|
timestamp = Math.max(timestamp, binding.updateTimestamp);
|
|
15508
15520
|
} else if (binding instanceof DynamicBuffer) {
|
|
15509
15521
|
timestamp = Math.max(timestamp, binding.updateTimestamp);
|
|
@@ -15571,7 +15583,7 @@ ${declarations.join("\n")}`).match(
|
|
|
15571
15583
|
}
|
|
15572
15584
|
|
|
15573
15585
|
// src/compute/buffer-transform.ts
|
|
15574
|
-
var
|
|
15586
|
+
var import_core17 = __toESM(require_core(), 1);
|
|
15575
15587
|
var import_shaders4 = __toESM(require_shaders(), 1);
|
|
15576
15588
|
var GL_INTERLEAVED_ATTRIBS = 35980;
|
|
15577
15589
|
var GL_SEPARATE_ATTRIBS = 35981;
|
|
@@ -15645,14 +15657,14 @@ ${declarations.join("\n")}`).match(
|
|
|
15645
15657
|
/** Binds borrowed output ranges without taking ownership or repacking vector chunks. */
|
|
15646
15658
|
setOutputVectors(vectors) {
|
|
15647
15659
|
const batches = getGPUVectorModelBatches(this.model.id, vectors);
|
|
15648
|
-
(0,
|
|
15649
|
-
(0,
|
|
15660
|
+
(0, import_core17.assert)(batches.length === 0 || this.model.pipeline.props.bufferMode !== GL_INTERLEAVED_ATTRIBS);
|
|
15661
|
+
(0, import_core17.assert)(batches.length <= 1);
|
|
15650
15662
|
this.outputVectorBindings = vectors;
|
|
15651
15663
|
this.transformFeedback.setBuffers({
|
|
15652
15664
|
...this.outputBuffers,
|
|
15653
15665
|
...Object.fromEntries(
|
|
15654
15666
|
Object.entries(batches[0]?.data ?? {}).map(([name, data]) => {
|
|
15655
|
-
(0,
|
|
15667
|
+
(0, import_core17.assert)(data.byteStride === data.rowByteLength);
|
|
15656
15668
|
return [
|
|
15657
15669
|
name,
|
|
15658
15670
|
{
|
|
@@ -15676,7 +15688,7 @@ ${declarations.join("\n")}`).match(
|
|
|
15676
15688
|
if (!result) {
|
|
15677
15689
|
throw new Error("BufferTransform#getBuffer");
|
|
15678
15690
|
}
|
|
15679
|
-
if (result instanceof
|
|
15691
|
+
if (result instanceof import_core17.Buffer) {
|
|
15680
15692
|
return result.readAsync();
|
|
15681
15693
|
}
|
|
15682
15694
|
const { buffer, byteOffset = 0, byteLength = buffer.byteLength } = result;
|
|
@@ -16873,7 +16885,7 @@ void main(void) {
|
|
|
16873
16885
|
};
|
|
16874
16886
|
|
|
16875
16887
|
// src/scenegraph/group-node.ts
|
|
16876
|
-
var
|
|
16888
|
+
var import_core18 = __toESM(require_core(), 1);
|
|
16877
16889
|
|
|
16878
16890
|
// src/scenegraph/scenegraph-bounds.ts
|
|
16879
16891
|
function makeEmptyScenegraphBounds() {
|
|
@@ -16915,7 +16927,7 @@ void main(void) {
|
|
|
16915
16927
|
constructor(props = {}) {
|
|
16916
16928
|
props = Array.isArray(props) ? { children: props } : props;
|
|
16917
16929
|
const { children = [] } = props;
|
|
16918
|
-
|
|
16930
|
+
import_core18.log.assert(
|
|
16919
16931
|
children.every((child) => child instanceof ScenegraphNode),
|
|
16920
16932
|
"every child must an instance of ScenegraphNode"
|
|
16921
16933
|
);
|
|
@@ -16986,7 +16998,7 @@ void main(void) {
|
|
|
16986
16998
|
const pending = [{ node: this, depth: 0 }];
|
|
16987
16999
|
while (pending.length) {
|
|
16988
17000
|
const { node, depth } = pending.pop();
|
|
16989
|
-
(0,
|
|
17001
|
+
(0, import_core18.assert)(!visited.has(node));
|
|
16990
17002
|
visited.add(node);
|
|
16991
17003
|
ancestors.length = depth;
|
|
16992
17004
|
ancestors.push(node.id);
|
|
@@ -17122,12 +17134,12 @@ void main(void) {
|
|
|
17122
17134
|
}
|
|
17123
17135
|
|
|
17124
17136
|
// src/geometry/edge-geometry.ts
|
|
17125
|
-
var
|
|
17137
|
+
var import_core19 = __toESM(require_core(), 1);
|
|
17126
17138
|
function makeEdgeGeometry(geometry, options = {}) {
|
|
17127
17139
|
const { angleThreshold = 30, weldTolerance = 0, positionAttribute = "POSITION" } = options;
|
|
17128
17140
|
const positions = getTrianglePositions(geometry, positionAttribute);
|
|
17129
|
-
(0,
|
|
17130
|
-
(0,
|
|
17141
|
+
(0, import_core19.assert)(Number.isFinite(weldTolerance) && weldTolerance >= 0);
|
|
17142
|
+
(0, import_core19.assert)(Number.isFinite(angleThreshold) && angleThreshold >= 0 && angleThreshold <= 180);
|
|
17131
17143
|
const sourceIndices = geometry.indices?.value;
|
|
17132
17144
|
const sourceCount = positions.value.length / 3;
|
|
17133
17145
|
const representatives = /* @__PURE__ */ new Map();
|
|
@@ -17146,9 +17158,9 @@ void main(void) {
|
|
|
17146
17158
|
function weldPosition(index) {
|
|
17147
17159
|
const cached = representatives.get(index);
|
|
17148
17160
|
if (cached !== void 0) return cached;
|
|
17149
|
-
(0,
|
|
17161
|
+
(0, import_core19.assert)(Number.isInteger(index) && index >= 0 && index < sourceCount);
|
|
17150
17162
|
const position = readPosition(index);
|
|
17151
|
-
(0,
|
|
17163
|
+
(0, import_core19.assert)(position.every(Number.isFinite));
|
|
17152
17164
|
const cell = weldTolerance > 0 ? position.map((value) => Math.floor(value / weldTolerance)) : position;
|
|
17153
17165
|
const radius = weldTolerance > 0 ? 1 : 0;
|
|
17154
17166
|
for (let east = -radius; east <= radius; east++) {
|
|
@@ -17222,11 +17234,11 @@ void main(void) {
|
|
|
17222
17234
|
});
|
|
17223
17235
|
}
|
|
17224
17236
|
function makeEdgeGeometryFromGeometries(geometries, options = {}) {
|
|
17225
|
-
(0,
|
|
17237
|
+
(0, import_core19.assert)(geometries.length > 0);
|
|
17226
17238
|
const positionAttribute = options.positionAttribute ?? "POSITION";
|
|
17227
17239
|
const attributes = geometries.map((geometry) => getTrianglePositions(geometry, positionAttribute));
|
|
17228
17240
|
const firstAttribute = attributes[0];
|
|
17229
|
-
(0,
|
|
17241
|
+
(0, import_core19.assert)(
|
|
17230
17242
|
attributes.every(
|
|
17231
17243
|
(attribute) => attribute.value.constructor === firstAttribute.value.constructor && Boolean(attribute["normalized"]) === Boolean(firstAttribute["normalized"])
|
|
17232
17244
|
)
|
|
@@ -17245,7 +17257,7 @@ void main(void) {
|
|
|
17245
17257
|
positions.set(attribute.value, positionOffset);
|
|
17246
17258
|
for (let offset = 0; offset < geometry.vertexCount; offset++) {
|
|
17247
17259
|
const index = geometry.indices?.value[offset] ?? offset;
|
|
17248
|
-
(0,
|
|
17260
|
+
(0, import_core19.assert)(Number.isInteger(index) && index >= 0 && index < attribute.value.length / 3);
|
|
17249
17261
|
indices[indexOffset++] = index + positionOffset / 3;
|
|
17250
17262
|
}
|
|
17251
17263
|
positionOffset += attribute.value.length;
|
|
@@ -17262,26 +17274,26 @@ void main(void) {
|
|
|
17262
17274
|
}
|
|
17263
17275
|
function getTrianglePositions(geometry, positionAttribute) {
|
|
17264
17276
|
const positions = geometry.attributes[positionAttribute];
|
|
17265
|
-
(0,
|
|
17266
|
-
(0,
|
|
17267
|
-
(0,
|
|
17277
|
+
(0, import_core19.assert)(geometry.topology === "triangle-list" && positions?.size === 3);
|
|
17278
|
+
(0, import_core19.assert)(positions.value.length % 3 === 0 && geometry.vertexCount % 3 === 0);
|
|
17279
|
+
(0, import_core19.assert)(
|
|
17268
17280
|
!positions["byteStride"] || positions["byteStride"] === positions.value.BYTES_PER_ELEMENT * 3
|
|
17269
17281
|
);
|
|
17270
|
-
(0,
|
|
17282
|
+
(0, import_core19.assert)(
|
|
17271
17283
|
geometry.vertexCount >= 0 && geometry.vertexCount <= (geometry.indices?.value.length ?? positions.value.length / 3)
|
|
17272
17284
|
);
|
|
17273
17285
|
return positions;
|
|
17274
17286
|
}
|
|
17275
17287
|
|
|
17276
17288
|
// src/geometry/stroke-geometry.ts
|
|
17277
|
-
var
|
|
17289
|
+
var import_core20 = __toESM(require_core(), 1);
|
|
17278
17290
|
function makeStrokeGeometry(path, options = {}) {
|
|
17279
17291
|
const { width = 1, cap = "butt", join = "miter", miterLimit = 4, roundSegments = 16 } = options;
|
|
17280
|
-
(0,
|
|
17281
|
-
(0,
|
|
17292
|
+
(0, import_core20.assert)(Number.isFinite(width) && width >= 0 && Number.isFinite(miterLimit) && miterLimit >= 1);
|
|
17293
|
+
(0, import_core20.assert)(Number.isInteger(roundSegments) && roundSegments >= 2 && roundSegments <= 256);
|
|
17282
17294
|
const points = [];
|
|
17283
17295
|
for (const position of path) {
|
|
17284
|
-
(0,
|
|
17296
|
+
(0, import_core20.assert)(
|
|
17285
17297
|
Number.isFinite(position[0]) && Number.isFinite(position[1]) && Number.isFinite(position[2] ?? 0)
|
|
17286
17298
|
);
|
|
17287
17299
|
const previous = points.at(-1);
|
|
@@ -17441,12 +17453,12 @@ void main(void) {
|
|
|
17441
17453
|
}
|
|
17442
17454
|
|
|
17443
17455
|
// src/geometry/mesh-simplification.ts
|
|
17444
|
-
var
|
|
17456
|
+
var import_core21 = __toESM(require_core(), 1);
|
|
17445
17457
|
var QUADRIC_COMPONENTS = 10;
|
|
17446
17458
|
var BOUNDARY_COLLINEAR_TOLERANCE = 1e-10;
|
|
17447
17459
|
function simplifyMesh(options) {
|
|
17448
17460
|
const { positions, indices, attributes = [], preserveBoundary = true } = options;
|
|
17449
|
-
(0,
|
|
17461
|
+
(0, import_core21.assert)(indices.length % 3 === 0 && positions.length % 3 === 0);
|
|
17450
17462
|
const targetIndexCount = Math.max(
|
|
17451
17463
|
0,
|
|
17452
17464
|
Math.min(
|
|
@@ -17539,7 +17551,7 @@ void main(void) {
|
|
|
17539
17551
|
const firstVertex = indices[indexOffset2];
|
|
17540
17552
|
const secondVertex = indices[indexOffset2 + 1];
|
|
17541
17553
|
const thirdVertex = indices[indexOffset2 + 2];
|
|
17542
|
-
(0,
|
|
17554
|
+
(0, import_core21.assert)(firstVertex < vertexCount && secondVertex < vertexCount && thirdVertex < vertexCount);
|
|
17543
17555
|
const triangle = {
|
|
17544
17556
|
vertices: [firstVertex, secondVertex, thirdVertex],
|
|
17545
17557
|
active: false
|
|
@@ -17874,7 +17886,7 @@ void main(void) {
|
|
|
17874
17886
|
}
|
|
17875
17887
|
|
|
17876
17888
|
// src/dynamic-texture/video-texture.ts
|
|
17877
|
-
var
|
|
17889
|
+
var import_core22 = __toESM(require_core(), 1);
|
|
17878
17890
|
var VideoTexture = class {
|
|
17879
17891
|
/** Device used to create copied and native external texture bindings. */
|
|
17880
17892
|
device;
|
|
@@ -17923,7 +17935,7 @@ void main(void) {
|
|
|
17923
17935
|
* @param props Live video source and copied texture options.
|
|
17924
17936
|
*/
|
|
17925
17937
|
constructor(device, props) {
|
|
17926
|
-
(0,
|
|
17938
|
+
(0, import_core22.assert)(isHTMLVideoElementSource(props?.source) || isVideoFrameSource(props?.source));
|
|
17927
17939
|
this.device = device;
|
|
17928
17940
|
this.id = props.id || uid("video-texture");
|
|
17929
17941
|
this._source = props.source;
|
|
@@ -17937,7 +17949,7 @@ void main(void) {
|
|
|
17937
17949
|
* @param source Next caller-owned video source to follow.
|
|
17938
17950
|
*/
|
|
17939
17951
|
setSource(source4) {
|
|
17940
|
-
(0,
|
|
17952
|
+
(0, import_core22.assert)(isHTMLVideoElementSource(source4) || isVideoFrameSource(source4));
|
|
17941
17953
|
this._destroyExternalTexture();
|
|
17942
17954
|
this._source = source4;
|
|
17943
17955
|
this._sourceVersion++;
|
|
@@ -18015,7 +18027,7 @@ void main(void) {
|
|
|
18015
18027
|
width: size.width,
|
|
18016
18028
|
height: size.height,
|
|
18017
18029
|
format: "rgba8unorm",
|
|
18018
|
-
usage:
|
|
18030
|
+
usage: import_core22.Texture.SAMPLE | import_core22.Texture.COPY_DST,
|
|
18019
18031
|
mipLevels: 1,
|
|
18020
18032
|
sampler: this._sampler
|
|
18021
18033
|
});
|
|
@@ -18050,7 +18062,7 @@ void main(void) {
|
|
|
18050
18062
|
*/
|
|
18051
18063
|
_getResolvedSize() {
|
|
18052
18064
|
const size = getVideoTextureSourceSize(this._source);
|
|
18053
|
-
(0,
|
|
18065
|
+
(0, import_core22.assert)(size.width > 0 && size.height > 0);
|
|
18054
18066
|
return size;
|
|
18055
18067
|
}
|
|
18056
18068
|
/** Observes current source readiness and frame identity before binding resolution. */
|
|
@@ -18115,11 +18127,11 @@ void main(void) {
|
|
|
18115
18127
|
}
|
|
18116
18128
|
|
|
18117
18129
|
// src/passes/shader-pass-renderer.ts
|
|
18118
|
-
var
|
|
18130
|
+
var import_core25 = __toESM(require_core(), 1);
|
|
18119
18131
|
var import_shaders7 = __toESM(require_shaders(), 1);
|
|
18120
18132
|
|
|
18121
18133
|
// src/compute/swap.ts
|
|
18122
|
-
var
|
|
18134
|
+
var import_core23 = __toESM(require_core(), 1);
|
|
18123
18135
|
var Swap = class {
|
|
18124
18136
|
id;
|
|
18125
18137
|
/** The current resource - usually the source for renders or computations */
|
|
@@ -18151,7 +18163,7 @@ void main(void) {
|
|
|
18151
18163
|
(colorAttachment) => typeof colorAttachment !== "string" ? colorAttachment : device.createTexture({
|
|
18152
18164
|
id: `${props.id}-texture-0`,
|
|
18153
18165
|
format: colorAttachment,
|
|
18154
|
-
usage:
|
|
18166
|
+
usage: import_core23.Texture.SAMPLE | import_core23.Texture.RENDER | import_core23.Texture.COPY_SRC | import_core23.Texture.COPY_DST,
|
|
18155
18167
|
width,
|
|
18156
18168
|
height
|
|
18157
18169
|
})
|
|
@@ -18161,7 +18173,7 @@ void main(void) {
|
|
|
18161
18173
|
(colorAttachment) => typeof colorAttachment !== "string" ? colorAttachment : device.createTexture({
|
|
18162
18174
|
id: `${props.id}-texture-1`,
|
|
18163
18175
|
format: colorAttachment,
|
|
18164
|
-
usage:
|
|
18176
|
+
usage: import_core23.Texture.SAMPLE | import_core23.Texture.RENDER | import_core23.Texture.COPY_SRC | import_core23.Texture.COPY_DST,
|
|
18165
18177
|
width,
|
|
18166
18178
|
height
|
|
18167
18179
|
})
|
|
@@ -18225,7 +18237,7 @@ void main(void) {
|
|
|
18225
18237
|
};
|
|
18226
18238
|
|
|
18227
18239
|
// src/compute/computation.ts
|
|
18228
|
-
var
|
|
18240
|
+
var import_core24 = __toESM(require_core(), 1);
|
|
18229
18241
|
var import_shaders6 = __toESM(require_shaders(), 1);
|
|
18230
18242
|
var LOG_DRAW_PRIORITY2 = 2;
|
|
18231
18243
|
var LOG_DRAW_TIMEOUT2 = 1e4;
|
|
@@ -18237,13 +18249,13 @@ void main(void) {
|
|
|
18237
18249
|
* constructor remains the synchronous compatibility path.
|
|
18238
18250
|
*/
|
|
18239
18251
|
static async createAsync(device, props) {
|
|
18240
|
-
const ownsCompilation = !
|
|
18241
|
-
const asyncCompilation = ownsCompilation ?
|
|
18252
|
+
const ownsCompilation = !import_core24.PipelineFactory.getAsyncCompilation(device);
|
|
18253
|
+
const asyncCompilation = ownsCompilation ? import_core24.PipelineFactory.beginAsyncCompilation(device) : import_core24.PipelineFactory.getAsyncCompilation(device);
|
|
18242
18254
|
let computation;
|
|
18243
18255
|
try {
|
|
18244
18256
|
computation = new _Computation(device, props);
|
|
18245
18257
|
} finally {
|
|
18246
|
-
if (ownsCompilation)
|
|
18258
|
+
if (ownsCompilation) import_core24.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
|
|
18247
18259
|
}
|
|
18248
18260
|
try {
|
|
18249
18261
|
if (ownsCompilation) {
|
|
@@ -18258,7 +18270,7 @@ void main(void) {
|
|
|
18258
18270
|
}
|
|
18259
18271
|
}
|
|
18260
18272
|
static defaultProps = {
|
|
18261
|
-
...
|
|
18273
|
+
...import_core24.ComputePipeline.defaultProps,
|
|
18262
18274
|
id: "unnamed",
|
|
18263
18275
|
handle: void 0,
|
|
18264
18276
|
userData: {},
|
|
@@ -18333,10 +18345,10 @@ void main(void) {
|
|
|
18333
18345
|
const modules = mergeShaderModules(this.props.modules, this.shaderInputs?.getModules());
|
|
18334
18346
|
const defines = { ...resolvedPlugins.defines, ...this.props.defines };
|
|
18335
18347
|
this.props.shaderLayout = mergeShaderModuleBindingsIntoLayout(this.props.shaderLayout, modules) || null;
|
|
18336
|
-
this.pipelineFactory = props.pipelineFactory ||
|
|
18337
|
-
this.shaderFactory = props.shaderFactory ||
|
|
18348
|
+
this.pipelineFactory = props.pipelineFactory || import_core24.PipelineFactory.getDefaultPipelineFactory(this.device);
|
|
18349
|
+
this.shaderFactory = props.shaderFactory || import_core24.ShaderFactory.getDefaultShaderFactory(this.device);
|
|
18338
18350
|
const shaderAssembler = this.props.shaderAssembler;
|
|
18339
|
-
(0,
|
|
18351
|
+
(0, import_core24.assert)(shaderAssembler instanceof WGSLShaderAssembler);
|
|
18340
18352
|
const {
|
|
18341
18353
|
source: source4,
|
|
18342
18354
|
getUniforms: getUniforms2,
|
|
@@ -18360,7 +18372,7 @@ void main(void) {
|
|
|
18360
18372
|
this.props.shaderLayout || inferredShaderLayout || null,
|
|
18361
18373
|
modules
|
|
18362
18374
|
) || null;
|
|
18363
|
-
const asyncCompilation =
|
|
18375
|
+
const asyncCompilation = import_core24.PipelineFactory.getAsyncCompilation(this.device);
|
|
18364
18376
|
if (asyncCompilation) {
|
|
18365
18377
|
this._pipelineInitialization = this._updatePipelineAsync();
|
|
18366
18378
|
asyncCompilation.push(this._pipelineInitialization);
|
|
@@ -18427,7 +18439,7 @@ void main(void) {
|
|
|
18427
18439
|
}
|
|
18428
18440
|
setShaderInputs(shaderInputs) {
|
|
18429
18441
|
this.shaderInputs = shaderInputs;
|
|
18430
|
-
this._uniformStore = new
|
|
18442
|
+
this._uniformStore = new import_core24.UniformStore(this.device, this.shaderInputs.modules);
|
|
18431
18443
|
for (const [moduleName, module] of Object.entries(this.shaderInputs.modules)) {
|
|
18432
18444
|
if (shaderModuleHasUniforms(module)) {
|
|
18433
18445
|
const uniformBuffer = this._uniformStore.getManagedUniformBuffer(moduleName);
|
|
@@ -18496,7 +18508,7 @@ void main(void) {
|
|
|
18496
18508
|
if (!this._pipelineNeedsUpdate) return null;
|
|
18497
18509
|
const previousShader = this.pipeline ? this.shader : null;
|
|
18498
18510
|
if (this.pipeline) {
|
|
18499
|
-
|
|
18511
|
+
import_core24.log.log(1, `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
|
|
18500
18512
|
}
|
|
18501
18513
|
this._pipelineNeedsUpdate = false;
|
|
18502
18514
|
this.shader = this.shaderFactory.createShader({
|
|
@@ -18514,27 +18526,27 @@ void main(void) {
|
|
|
18514
18526
|
_lastLogTime = 0;
|
|
18515
18527
|
_logOpen = false;
|
|
18516
18528
|
_logDrawCallStart() {
|
|
18517
|
-
const logDrawTimeout =
|
|
18518
|
-
if (
|
|
18529
|
+
const logDrawTimeout = import_core24.log.level > 3 ? 0 : LOG_DRAW_TIMEOUT2;
|
|
18530
|
+
if (import_core24.log.level < 2 || Date.now() - this._lastLogTime < logDrawTimeout) {
|
|
18519
18531
|
return;
|
|
18520
18532
|
}
|
|
18521
18533
|
this._lastLogTime = Date.now();
|
|
18522
18534
|
this._logOpen = true;
|
|
18523
|
-
|
|
18535
|
+
import_core24.log.group(LOG_DRAW_PRIORITY2, `>>> DRAWING MODEL ${this.id}`, { collapsed: import_core24.log.level <= 2 })();
|
|
18524
18536
|
}
|
|
18525
18537
|
_logDrawCallEnd() {
|
|
18526
18538
|
if (this._logOpen) {
|
|
18527
18539
|
const uniformTable = this.shaderInputs.getDebugTable();
|
|
18528
|
-
|
|
18529
|
-
|
|
18540
|
+
import_core24.log.table(LOG_DRAW_PRIORITY2, uniformTable)();
|
|
18541
|
+
import_core24.log.groupEnd(LOG_DRAW_PRIORITY2)();
|
|
18530
18542
|
this._logOpen = false;
|
|
18531
18543
|
}
|
|
18532
18544
|
}
|
|
18533
18545
|
_drawCount = 0;
|
|
18534
18546
|
// TODO - fix typing of luma data types
|
|
18535
18547
|
_getBufferOrConstantValues(attribute, dataType) {
|
|
18536
|
-
const TypedArrayConstructor =
|
|
18537
|
-
const typedArray = attribute instanceof
|
|
18548
|
+
const TypedArrayConstructor = import_core24.dataTypeDecoder.getTypedArrayConstructor(dataType);
|
|
18549
|
+
const typedArray = attribute instanceof import_core24.Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;
|
|
18538
18550
|
return typedArray.toString();
|
|
18539
18551
|
}
|
|
18540
18552
|
};
|
|
@@ -19091,7 +19103,7 @@ vec2 shaderPassRenderer_getRenderTargetUV(vec2 textureUV) {
|
|
|
19091
19103
|
this.parameterBuffer = device.createBuffer({
|
|
19092
19104
|
id: `${optimization.name}-parameters`,
|
|
19093
19105
|
byteLength: Math.max(Math.ceil(optimization.uniformNames.length / 4) * 16, 16),
|
|
19094
|
-
usage:
|
|
19106
|
+
usage: import_core25.Buffer.UNIFORM | import_core25.Buffer.COPY_DST
|
|
19095
19107
|
});
|
|
19096
19108
|
const outputBindings = Object.entries(optimization.outputs).map(
|
|
19097
19109
|
([bindingName, targetName], outputIndex) => ({
|
|
@@ -19376,7 +19388,7 @@ vec2 shaderPassRenderer_getRenderTargetUV(vec2 textureUV) {
|
|
|
19376
19388
|
width: targetSize[0],
|
|
19377
19389
|
height: targetSize[1],
|
|
19378
19390
|
format: spec.format || device.preferredColorFormat,
|
|
19379
|
-
usage:
|
|
19391
|
+
usage: import_core25.Texture.SAMPLE | import_core25.Texture.RENDER | import_core25.Texture.COPY_SRC | import_core25.Texture.COPY_DST | (spec.storage && device.type === "webgpu" && device.getTextureFormatCapabilities(spec.format || device.preferredColorFormat).store ? import_core25.Texture.STORAGE : 0),
|
|
19380
19392
|
...spec.sampler ? { sampler: spec.sampler } : {}
|
|
19381
19393
|
});
|
|
19382
19394
|
const framebuffer = device.createFramebuffer({
|
|
@@ -19431,7 +19443,7 @@ vec2 shaderPassRenderer_getRenderTargetUV(vec2 textureUV) {
|
|
|
19431
19443
|
}
|
|
19432
19444
|
|
|
19433
19445
|
// src/modules/picking/picking-manager.ts
|
|
19434
|
-
var
|
|
19446
|
+
var import_core26 = __toESM(require_core(), 1);
|
|
19435
19447
|
|
|
19436
19448
|
// src/modules/picking/picking-uniforms.ts
|
|
19437
19449
|
var DEFAULT_HIGHLIGHT_COLOR = [0, 1, 1, 1];
|
|
@@ -19695,13 +19707,13 @@ layout(std140) uniform pickingUniforms {
|
|
|
19695
19707
|
format: "rgba8unorm",
|
|
19696
19708
|
width: 1,
|
|
19697
19709
|
height: 1,
|
|
19698
|
-
usage:
|
|
19710
|
+
usage: import_core26.Texture.RENDER_ATTACHMENT
|
|
19699
19711
|
});
|
|
19700
19712
|
const pickingTexture = this.device.createTexture({
|
|
19701
19713
|
format: "rg32sint",
|
|
19702
19714
|
width: 1,
|
|
19703
19715
|
height: 1,
|
|
19704
|
-
usage:
|
|
19716
|
+
usage: import_core26.Texture.RENDER_ATTACHMENT | import_core26.Texture.COPY_SRC
|
|
19705
19717
|
});
|
|
19706
19718
|
return this.device.createFramebuffer({
|
|
19707
19719
|
colorAttachments: [colorTexture, pickingTexture],
|
|
@@ -19713,7 +19725,7 @@ layout(std140) uniform pickingUniforms {
|
|
|
19713
19725
|
format: "rgba8unorm",
|
|
19714
19726
|
width: 1,
|
|
19715
19727
|
height: 1,
|
|
19716
|
-
usage:
|
|
19728
|
+
usage: import_core26.Texture.RENDER_ATTACHMENT | import_core26.Texture.COPY_SRC
|
|
19717
19729
|
});
|
|
19718
19730
|
return this.device.createFramebuffer({
|
|
19719
19731
|
colorAttachments: [pickingTexture],
|
|
@@ -19735,7 +19747,7 @@ layout(std140) uniform pickingUniforms {
|
|
|
19735
19747
|
const layout = pickTexture.computeMemoryLayout({ width: 1, height: 1 });
|
|
19736
19748
|
const readBuffer = this.device.createBuffer({
|
|
19737
19749
|
byteLength: layout.byteLength,
|
|
19738
|
-
usage:
|
|
19750
|
+
usage: import_core26.Buffer.COPY_DST | import_core26.Buffer.MAP_READ
|
|
19739
19751
|
});
|
|
19740
19752
|
try {
|
|
19741
19753
|
pickTexture.readBuffer(
|
|
@@ -19771,7 +19783,7 @@ layout(std140) uniform pickingUniforms {
|
|
|
19771
19783
|
const layout = pickTexture.computeMemoryLayout({ width: 1, height: 1 });
|
|
19772
19784
|
const readBuffer = this.device.createBuffer({
|
|
19773
19785
|
byteLength: layout.byteLength,
|
|
19774
|
-
usage:
|
|
19786
|
+
usage: import_core26.Buffer.COPY_DST | import_core26.Buffer.MAP_READ
|
|
19775
19787
|
});
|
|
19776
19788
|
try {
|
|
19777
19789
|
pickTexture.readBuffer(
|
|
@@ -20453,9 +20465,11 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
20453
20465
|
}
|
|
20454
20466
|
|
|
20455
20467
|
// src/scenegraph/controllers/skin-controller.ts
|
|
20456
|
-
var
|
|
20468
|
+
var import_core27 = __toESM(require_core(), 1);
|
|
20457
20469
|
var SkinController = class {
|
|
20458
20470
|
bindings;
|
|
20471
|
+
/** Palettes owned by a GPU producer for the duration of their binding. */
|
|
20472
|
+
gpuDriven = /* @__PURE__ */ new Set();
|
|
20459
20473
|
scenes;
|
|
20460
20474
|
constructor(props) {
|
|
20461
20475
|
this.scenes = props.scenes;
|
|
@@ -20464,7 +20478,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
20464
20478
|
}
|
|
20465
20479
|
/** Re-evaluates every source skin after its animated node transforms have changed. */
|
|
20466
20480
|
update() {
|
|
20467
|
-
if (this.
|
|
20481
|
+
if (this.gpuDriven.size === this.bindings.length) {
|
|
20468
20482
|
return;
|
|
20469
20483
|
}
|
|
20470
20484
|
const worldMatrices = /* @__PURE__ */ new Map();
|
|
@@ -20476,6 +20490,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
20476
20490
|
});
|
|
20477
20491
|
}
|
|
20478
20492
|
for (const binding of this.bindings) {
|
|
20493
|
+
if (this.gpuDriven.has(binding)) continue;
|
|
20479
20494
|
updateSkinJointMatrices({
|
|
20480
20495
|
joints: binding.joints,
|
|
20481
20496
|
meshNode: binding.node,
|
|
@@ -20484,7 +20499,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
20484
20499
|
target: binding.jointMatrices
|
|
20485
20500
|
});
|
|
20486
20501
|
if (binding.skinJointMatrices) {
|
|
20487
|
-
if (binding.skinJointMatrices instanceof
|
|
20502
|
+
if (binding.skinJointMatrices instanceof import_core27.Buffer) {
|
|
20488
20503
|
binding.skinJointMatrices.write(binding.jointMatrices);
|
|
20489
20504
|
} else {
|
|
20490
20505
|
binding.skinJointMatrices.writeData(binding.jointMatrices, {
|
|
@@ -20500,6 +20515,19 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
20500
20515
|
}
|
|
20501
20516
|
}
|
|
20502
20517
|
}
|
|
20518
|
+
/** Borrow a WebGPU storage palette and suspend CPU writes until the lease is released. */
|
|
20519
|
+
claimGPUPalette(binding) {
|
|
20520
|
+
if (!this.bindings.includes(binding) || !(binding.skinJointMatrices instanceof import_core27.Buffer))
|
|
20521
|
+
throw new Error("GPU skinning requires an owned storage palette");
|
|
20522
|
+
if (this.gpuDriven.has(binding)) throw new Error("Skin palette already has a GPU producer");
|
|
20523
|
+
this.gpuDriven.add(binding);
|
|
20524
|
+
let released = false;
|
|
20525
|
+
return () => {
|
|
20526
|
+
if (released) return;
|
|
20527
|
+
released = true;
|
|
20528
|
+
this.gpuDriven.delete(binding);
|
|
20529
|
+
};
|
|
20530
|
+
}
|
|
20503
20531
|
/** Finds the palette driven by a scenegraph node. */
|
|
20504
20532
|
getBinding(node) {
|
|
20505
20533
|
return this.bindings.find((binding) => binding.node === node);
|
|
@@ -20516,7 +20544,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
20516
20544
|
return device.createBuffer({
|
|
20517
20545
|
id: `${id}-skin-joint-matrices`,
|
|
20518
20546
|
byteLength: jointMatrices.byteLength,
|
|
20519
|
-
usage:
|
|
20547
|
+
usage: import_core27.Buffer.STORAGE | import_core27.Buffer.COPY_DST
|
|
20520
20548
|
});
|
|
20521
20549
|
}
|
|
20522
20550
|
const width = jointMatrices.length / 4;
|
|
@@ -20528,7 +20556,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
20528
20556
|
format: "rgba32float",
|
|
20529
20557
|
width,
|
|
20530
20558
|
height: 1,
|
|
20531
|
-
usage:
|
|
20559
|
+
usage: import_core27.Texture.SAMPLE | import_core27.Texture.COPY_DST,
|
|
20532
20560
|
sampler: { minFilter: "nearest", magFilter: "nearest", mipmapFilter: "nearest" }
|
|
20533
20561
|
});
|
|
20534
20562
|
}
|
|
@@ -20571,7 +20599,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
20571
20599
|
};
|
|
20572
20600
|
|
|
20573
20601
|
// src/scenegraph/controllers/billboard-controller.ts
|
|
20574
|
-
var
|
|
20602
|
+
var import_core28 = __toESM(require_core(), 1);
|
|
20575
20603
|
var BillboardController = class {
|
|
20576
20604
|
scenes;
|
|
20577
20605
|
bindings = /* @__PURE__ */ new Map();
|
|
@@ -20582,8 +20610,8 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
20582
20610
|
const { definition } = binding;
|
|
20583
20611
|
const forward = new Vector3(definition.viewDirection || [0, 0, 1]);
|
|
20584
20612
|
const up = new Vector3(definition.up || [0, 1, 0]);
|
|
20585
|
-
(0,
|
|
20586
|
-
(0,
|
|
20613
|
+
(0, import_core28.assert)(forward.magnitude() > 0 && up.magnitude() > 0);
|
|
20614
|
+
(0, import_core28.assert)(
|
|
20587
20615
|
new Vector3(forward).normalize().cross(new Vector3(up).normalize()).magnitude() > 1e-6
|
|
20588
20616
|
);
|
|
20589
20617
|
this.bindings.set(binding.node, binding);
|
|
@@ -20593,7 +20621,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
20593
20621
|
getDrawEntries(options) {
|
|
20594
20622
|
const { sceneIndex = 0, cameraId = "default" } = options;
|
|
20595
20623
|
const scene = this.scenes[sceneIndex];
|
|
20596
|
-
(0,
|
|
20624
|
+
(0, import_core28.assert)(scene);
|
|
20597
20625
|
const viewMatrix = new Matrix4(options.viewMatrix);
|
|
20598
20626
|
const cameraMatrix = new Matrix4(viewMatrix).invert();
|
|
20599
20627
|
const cameraPosition = new Vector3(cameraMatrix.getTranslation());
|
|
@@ -20793,7 +20821,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
20793
20821
|
}
|
|
20794
20822
|
|
|
20795
20823
|
// src/scenegraph/controllers/area-light-controller.ts
|
|
20796
|
-
var
|
|
20824
|
+
var import_core29 = __toESM(require_core(), 1);
|
|
20797
20825
|
var AreaLightController = class {
|
|
20798
20826
|
scenes;
|
|
20799
20827
|
matrixAuthoredNodes = /* @__PURE__ */ new Set();
|
|
@@ -20803,11 +20831,11 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
20803
20831
|
for (const node of matrixNodes) this.matrixAuthoredNodes.add(node);
|
|
20804
20832
|
for (const { node, definition, matrixAuthored } of bindings) {
|
|
20805
20833
|
if (matrixAuthored) this.matrixAuthoredNodes.add(node);
|
|
20806
|
-
(0,
|
|
20807
|
-
(0,
|
|
20808
|
-
(0,
|
|
20809
|
-
(0,
|
|
20810
|
-
(0,
|
|
20834
|
+
(0, import_core29.assert)(definition && (definition.type === "rect" || definition.type === "disk"));
|
|
20835
|
+
(0, import_core29.assert)(Number.isFinite(definition.height ?? 1) && (definition.height ?? 1) > 0);
|
|
20836
|
+
(0, import_core29.assert)(Number.isFinite(definition.intensity ?? 1e3) && (definition.intensity ?? 1e3) > 0);
|
|
20837
|
+
(0, import_core29.assert)(Number.isFinite(definition.width ?? 1) && (definition.width ?? 1) > 0);
|
|
20838
|
+
(0, import_core29.assert)(
|
|
20811
20839
|
(definition.color || [1, 1, 1]).every(
|
|
20812
20840
|
(component) => Number.isFinite(component) && component >= 0
|
|
20813
20841
|
)
|
|
@@ -20873,17 +20901,17 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
20873
20901
|
function getMatrixRotation(matrix) {
|
|
20874
20902
|
const horizontal = new Vector3(matrix[0], matrix[1], matrix[2]);
|
|
20875
20903
|
const vertical = new Vector3(matrix[4], matrix[5], matrix[6]);
|
|
20876
|
-
(0,
|
|
20904
|
+
(0, import_core29.assert)(horizontal.magnitude() > 0 && vertical.magnitude() > 0);
|
|
20877
20905
|
horizontal.normalize();
|
|
20878
20906
|
vertical.normalize();
|
|
20879
20907
|
vertical.subtract(new Vector3(horizontal).scale(vertical.dot(horizontal)));
|
|
20880
|
-
(0,
|
|
20908
|
+
(0, import_core29.assert)(vertical.magnitude() > 1e-8);
|
|
20881
20909
|
vertical.normalize();
|
|
20882
20910
|
const forward = new Vector3(horizontal).cross(vertical).normalize();
|
|
20883
20911
|
const authoredForward = new Vector3(matrix[8], matrix[9], matrix[10]);
|
|
20884
|
-
(0,
|
|
20912
|
+
(0, import_core29.assert)(authoredForward.magnitude() > 0);
|
|
20885
20913
|
authoredForward.normalize();
|
|
20886
|
-
(0,
|
|
20914
|
+
(0, import_core29.assert)(Math.abs(forward.dot(authoredForward)) > 1e-8);
|
|
20887
20915
|
if (forward.dot(authoredForward) < 0) forward.negate();
|
|
20888
20916
|
return new Matrix4([
|
|
20889
20917
|
horizontal[0],
|
|
@@ -21441,15 +21469,15 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21441
21469
|
};
|
|
21442
21470
|
|
|
21443
21471
|
// src/audio/audio-graph.ts
|
|
21444
|
-
var
|
|
21472
|
+
var import_core30 = __toESM(require_core(), 1);
|
|
21445
21473
|
var AudioGraph = class {
|
|
21446
21474
|
constructor(definition, context, destination, getEmitterInputs) {
|
|
21447
21475
|
this.definition = definition;
|
|
21448
21476
|
for (const node of definition.nodes)
|
|
21449
|
-
(0,
|
|
21477
|
+
(0, import_core30.assert)(!node.bypass || node.kind !== "splitter" && node.kind !== "channelmerger");
|
|
21450
21478
|
const validateEndpoint = (index, port = 0) => {
|
|
21451
|
-
(0,
|
|
21452
|
-
(0,
|
|
21479
|
+
(0, import_core30.assert)(Number.isInteger(index) && Boolean(definition.nodes[index]));
|
|
21480
|
+
(0, import_core30.assert)(Number.isInteger(port) && port >= 0);
|
|
21453
21481
|
};
|
|
21454
21482
|
for (const edge of definition.connections) {
|
|
21455
21483
|
validateEndpoint(edge.from.node, edge.from.output);
|
|
@@ -21457,16 +21485,16 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21457
21485
|
}
|
|
21458
21486
|
for (const input of definition.inputs || []) {
|
|
21459
21487
|
validateEndpoint(input.node, input.input);
|
|
21460
|
-
(0,
|
|
21488
|
+
(0, import_core30.assert)(Number.isInteger(input.source) && input.source >= 0);
|
|
21461
21489
|
}
|
|
21462
21490
|
for (const output of definition.outputs || []) {
|
|
21463
21491
|
validateEndpoint(output.node, output.output);
|
|
21464
|
-
(0,
|
|
21492
|
+
(0, import_core30.assert)(Number.isInteger(output.emitter) && output.emitter >= 0);
|
|
21465
21493
|
}
|
|
21466
21494
|
const visiting = /* @__PURE__ */ new Set();
|
|
21467
21495
|
const visited = /* @__PURE__ */ new Set();
|
|
21468
21496
|
const visit = (index) => {
|
|
21469
|
-
(0,
|
|
21497
|
+
(0, import_core30.assert)(definition.nodes[index] && !visiting.has(index));
|
|
21470
21498
|
if (visited.has(index)) return;
|
|
21471
21499
|
visiting.add(index);
|
|
21472
21500
|
for (const edge of definition.connections) if (edge.from.node === index) visit(edge.to.node);
|
|
@@ -21527,7 +21555,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21527
21555
|
/** Apply a scene-driven gain change using the authored transition shape. */
|
|
21528
21556
|
setGain(index, gain, time = this.nodes[index].context.currentTime) {
|
|
21529
21557
|
const definition = this.definition.nodes[index];
|
|
21530
|
-
(0,
|
|
21558
|
+
(0, import_core30.assert)(definition.kind === "gain" && !definition.bypass && gain >= 0);
|
|
21531
21559
|
const parameter = this.nodes[index].gain;
|
|
21532
21560
|
const duration = definition.params.duration ?? 0;
|
|
21533
21561
|
const initialGain = parameter.value;
|
|
@@ -21537,7 +21565,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21537
21565
|
parameter.setValueAtTime(gain, time);
|
|
21538
21566
|
} else if (definition.params.interpolation === "custom") {
|
|
21539
21567
|
const curve = definition.params.curve;
|
|
21540
|
-
(0,
|
|
21568
|
+
(0, import_core30.assert)(curve && curve.length >= 2 && curve.every((value) => value >= 0 && value <= 1));
|
|
21541
21569
|
parameter.setValueCurveAtTime(
|
|
21542
21570
|
Float32Array.from(curve, (value) => value * gain),
|
|
21543
21571
|
time,
|
|
@@ -21622,7 +21650,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21622
21650
|
}
|
|
21623
21651
|
|
|
21624
21652
|
// src/audio/audio-environment.ts
|
|
21625
|
-
var
|
|
21653
|
+
var import_core31 = __toESM(require_core(), 1);
|
|
21626
21654
|
function selectAudioEnvironmentZone(zones, position) {
|
|
21627
21655
|
let selected;
|
|
21628
21656
|
for (const zone of zones) {
|
|
@@ -21715,7 +21743,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21715
21743
|
}
|
|
21716
21744
|
};
|
|
21717
21745
|
function createParametricAudioResponse(context, parameters) {
|
|
21718
|
-
(0,
|
|
21746
|
+
(0, import_core31.assert)((parameters.density ?? 1) === 1 && (parameters.diffusion ?? 1) === 1);
|
|
21719
21747
|
const presets = {
|
|
21720
21748
|
generic: [1.49, 0.83, 7e-3, 0.011],
|
|
21721
21749
|
smallRoom: [0.4, 0.83, 2e-3, 3e-3],
|
|
@@ -21732,12 +21760,12 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21732
21760
|
underwater: [1.49, 0.1, 7e-3, 0.011]
|
|
21733
21761
|
};
|
|
21734
21762
|
const preset = parameters.preset ? presets[parameters.preset] : void 0;
|
|
21735
|
-
(0,
|
|
21763
|
+
(0, import_core31.assert)(!parameters.preset || preset);
|
|
21736
21764
|
const decay = parameters.decayTime ?? preset?.[0] ?? 1.5;
|
|
21737
21765
|
const highFrequencyDecay = decay * (parameters.decayHFRatio ?? preset?.[1] ?? 0.83);
|
|
21738
21766
|
const earlyDelay = parameters.reflectionsDelay ?? preset?.[2] ?? 0.02;
|
|
21739
21767
|
const tailDelay = earlyDelay + (parameters.reverbDelay ?? preset?.[3] ?? 0.04);
|
|
21740
|
-
(0,
|
|
21768
|
+
(0, import_core31.assert)(decay > 0 && highFrequencyDecay > 0 && earlyDelay >= 0 && tailDelay >= earlyDelay);
|
|
21741
21769
|
const response = context.createBuffer(
|
|
21742
21770
|
2,
|
|
21743
21771
|
Math.ceil((tailDelay + Math.max(decay, highFrequencyDecay)) * context.sampleRate),
|
|
@@ -21761,7 +21789,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21761
21789
|
}
|
|
21762
21790
|
|
|
21763
21791
|
// src/audio/audio-controller.ts
|
|
21764
|
-
var
|
|
21792
|
+
var import_core32 = __toESM(require_core(), 1);
|
|
21765
21793
|
var AudioController = class {
|
|
21766
21794
|
gain;
|
|
21767
21795
|
definition;
|
|
@@ -21871,25 +21899,25 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21871
21899
|
/** Change a graph gain using its authored interpolation and duration. */
|
|
21872
21900
|
setGraphGain(graphIndex, nodeIndex, gain) {
|
|
21873
21901
|
const graph = this.graphs.get(graphIndex);
|
|
21874
|
-
(0,
|
|
21902
|
+
(0, import_core32.assert)(!this.destroyed && graph);
|
|
21875
21903
|
graph.setGain(nodeIndex, gain);
|
|
21876
21904
|
}
|
|
21877
21905
|
startSource(sourceIndex, startTime, autoplayOnly, connect) {
|
|
21878
21906
|
const definition = this.definition.sources[sourceIndex];
|
|
21879
|
-
(0,
|
|
21907
|
+
(0, import_core32.assert)(definition);
|
|
21880
21908
|
if (autoplayOnly && !definition.autoPlay) return;
|
|
21881
21909
|
const context = this.options.audioContext;
|
|
21882
21910
|
const extended = definition.graph;
|
|
21883
21911
|
const oscillator = extended?.oscillator;
|
|
21884
|
-
(0,
|
|
21912
|
+
(0, import_core32.assert)(!(definition.audio !== void 0 && oscillator));
|
|
21885
21913
|
let source4;
|
|
21886
21914
|
if (oscillator) {
|
|
21887
21915
|
const node = context.createOscillator();
|
|
21888
21916
|
node.frequency.value = oscillator.frequency ?? 440;
|
|
21889
21917
|
node.detune.value = oscillator.detune ?? 0;
|
|
21890
|
-
(0,
|
|
21918
|
+
(0, import_core32.assert)(oscillator.pulseWidth === void 0 || oscillator.pulseWidth === 0.5);
|
|
21891
21919
|
if (oscillator.type === "custom") {
|
|
21892
|
-
(0,
|
|
21920
|
+
(0, import_core32.assert)(oscillator.periodicWave);
|
|
21893
21921
|
node.setPeriodicWave(
|
|
21894
21922
|
context.createPeriodicWave(
|
|
21895
21923
|
new Float32Array(oscillator.periodicWave.real),
|
|
@@ -21900,7 +21928,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21900
21928
|
source4 = node;
|
|
21901
21929
|
} else {
|
|
21902
21930
|
const node = context.createBufferSource();
|
|
21903
|
-
(0,
|
|
21931
|
+
(0, import_core32.assert)(definition.audio !== void 0);
|
|
21904
21932
|
node.buffer = this.buffers.get(definition.audio);
|
|
21905
21933
|
node.loop = definition.loop ?? false;
|
|
21906
21934
|
node.loopStart = extended?.loopStart ?? 0;
|
|
@@ -22045,15 +22073,15 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
22045
22073
|
}
|
|
22046
22074
|
addEmitter(index, node) {
|
|
22047
22075
|
const definition = this.definition.emitters[index];
|
|
22048
|
-
(0,
|
|
22076
|
+
(0, import_core32.assert)(
|
|
22049
22077
|
definition && (definition.type === "global" || definition.type === "positional" && node)
|
|
22050
22078
|
);
|
|
22051
|
-
(0,
|
|
22079
|
+
(0, import_core32.assert)(
|
|
22052
22080
|
!definition.positional?.shapeType || ["cone", "omnidirectional"].includes(definition.positional.shapeType)
|
|
22053
22081
|
);
|
|
22054
22082
|
for (const sourceIndex of this.graphEmitters.has(index) ? [] : definition.sources || []) {
|
|
22055
22083
|
const source4 = this.definition.sources[sourceIndex];
|
|
22056
|
-
(0,
|
|
22084
|
+
(0, import_core32.assert)(
|
|
22057
22085
|
source4 && (source4.audio !== void 0 ? this.definition.audio[source4.audio] : source4.graph?.oscillator)
|
|
22058
22086
|
);
|
|
22059
22087
|
}
|
|
@@ -22098,7 +22126,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
22098
22126
|
const audioIndices = new Set(
|
|
22099
22127
|
[...sourceIndices].map((index) => {
|
|
22100
22128
|
const source4 = this.definition.sources[index];
|
|
22101
|
-
(0,
|
|
22129
|
+
(0, import_core32.assert)(
|
|
22102
22130
|
source4 && (source4.audio !== void 0 ? this.definition.audio[source4.audio] : source4.graph?.oscillator)
|
|
22103
22131
|
);
|
|
22104
22132
|
return source4.audio;
|
|
@@ -22135,7 +22163,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
22135
22163
|
const reverb = environment.reverb;
|
|
22136
22164
|
if (!reverb) return;
|
|
22137
22165
|
const response = reverb.type === "impulseResponse" ? this.buffers.get(reverb.audio) : createParametricAudioResponse(audioContext, reverb);
|
|
22138
|
-
(0,
|
|
22166
|
+
(0, import_core32.assert)(response);
|
|
22139
22167
|
const bus = new AudioReverbBus(audioContext, response, this.gain, {
|
|
22140
22168
|
...reverb,
|
|
22141
22169
|
normalize: reverb.type === "impulseResponse" ? reverb.normalize : false
|
|
@@ -22244,7 +22272,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
22244
22272
|
var legacyColorPicking = import_shaders9.picking;
|
|
22245
22273
|
|
|
22246
22274
|
// src/geometry/ring-geometry.ts
|
|
22247
|
-
var
|
|
22275
|
+
var import_core33 = __toESM(require_core(), 1);
|
|
22248
22276
|
var RingGeometry = class extends Geometry2 {
|
|
22249
22277
|
constructor(props = {}) {
|
|
22250
22278
|
const {
|
|
@@ -22255,7 +22283,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
22255
22283
|
startAngle = 0,
|
|
22256
22284
|
angle: angle2 = Math.PI * 2
|
|
22257
22285
|
} = props;
|
|
22258
|
-
(0,
|
|
22286
|
+
(0, import_core33.assert)(
|
|
22259
22287
|
Number.isFinite(innerRadius) && innerRadius >= 0 && Number.isFinite(outerRadius) && outerRadius > innerRadius && Number.isFinite(height) && height > 0 && Number.isFinite(startAngle) && Number.isFinite(angle2) && angle2 > 0 && angle2 <= Math.PI * 2 && Number.isInteger(segments) && segments >= 3
|
|
22260
22288
|
);
|
|
22261
22289
|
const halfHeight = height / 2;
|
|
@@ -22439,7 +22467,7 @@ struct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}
|
|
|
22439
22467
|
};
|
|
22440
22468
|
|
|
22441
22469
|
// src/scenegraph/controllers/morph-controller.ts
|
|
22442
|
-
var
|
|
22470
|
+
var import_core34 = __toESM(require_core(), 1);
|
|
22443
22471
|
function setMorphWeights(node, weights) {
|
|
22444
22472
|
node.userData["morphWeights"] = [...weights];
|
|
22445
22473
|
const meshes = node.userData["morphMeshes"] || [];
|
|
@@ -22466,7 +22494,7 @@ struct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}
|
|
|
22466
22494
|
function updateMorphWeights(state, weights) {
|
|
22467
22495
|
state.values.fill(0);
|
|
22468
22496
|
state.values.set(weights.slice(0, state.values.length));
|
|
22469
|
-
if (state.data instanceof
|
|
22497
|
+
if (state.data instanceof import_core34.Buffer) {
|
|
22470
22498
|
state.data.write(state.values);
|
|
22471
22499
|
} else {
|
|
22472
22500
|
state.data.writeData(state.values, { width: state.packedTargetCount, height: 1 });
|
|
@@ -55630,6 +55658,42 @@ struct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}
|
|
|
55630
55658
|
};
|
|
55631
55659
|
}
|
|
55632
55660
|
|
|
55661
|
+
// src/shader-plugins/depth-interval.ts
|
|
55662
|
+
function makeDepthIntervalPlugin(sampleCount, bindGroup = 1) {
|
|
55663
|
+
const multisampled = sampleCount > 1;
|
|
55664
|
+
const textureType = multisampled ? "texture_depth_multisampled_2d" : "texture_depth_2d";
|
|
55665
|
+
const sampleLimit = multisampled ? "textureNumSamples(depthIntervalBound)" : "1u";
|
|
55666
|
+
const loadIndex = multisampled ? "sampleIndex" : "0";
|
|
55667
|
+
return {
|
|
55668
|
+
name: "depthInterval",
|
|
55669
|
+
module: {
|
|
55670
|
+
name: "depthInterval",
|
|
55671
|
+
bindingLayout: [
|
|
55672
|
+
{ name: "depthIntervalBound", group: bindGroup, visibility: 2 },
|
|
55673
|
+
{ name: "depthIntervalCompare", group: bindGroup, visibility: 2 }
|
|
55674
|
+
],
|
|
55675
|
+
source: (
|
|
55676
|
+
/* wgsl */
|
|
55677
|
+
`
|
|
55678
|
+
@group(${bindGroup}) @binding(auto) var depthIntervalBound: ${textureType};
|
|
55679
|
+
@group(${bindGroup}) @binding(auto) var<uniform> depthIntervalCompare: vec4<u32>;
|
|
55680
|
+
|
|
55681
|
+
fn filterDepthInterval(pixel: vec2<i32>, depth: f32, coverage: u32) -> u32 {
|
|
55682
|
+
let keepGreater = depthIntervalCompare.x != 0u;
|
|
55683
|
+
var mask = 0u;
|
|
55684
|
+
for (var sampleIndex = 0u; sampleIndex < ${sampleLimit}; sampleIndex++) {
|
|
55685
|
+
if ((depth > textureLoad(depthIntervalBound, pixel, ${loadIndex})) == keepGreater) {
|
|
55686
|
+
mask |= 1u << sampleIndex;
|
|
55687
|
+
}
|
|
55688
|
+
}
|
|
55689
|
+
return coverage & mask;
|
|
55690
|
+
}
|
|
55691
|
+
`
|
|
55692
|
+
)
|
|
55693
|
+
}
|
|
55694
|
+
};
|
|
55695
|
+
}
|
|
55696
|
+
|
|
55633
55697
|
// src/index.ts
|
|
55634
55698
|
var AsyncTexture = DynamicTexture;
|
|
55635
55699
|
return __toCommonJS(bundle_exports);
|