@luma.gl/engine 10.0.0-alpha.4 → 10.0.0-alpha.5
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/README.md +9 -0
- package/dist/animation/animation-clip.cjs +36 -0
- package/dist/animation/animation-interpolation.cjs +115 -0
- package/dist/animation/animation-mixer.cjs +302 -0
- package/dist/animation/animation-track.cjs +55 -0
- package/dist/animation/animator.cjs +75 -0
- package/dist/animation/deform-positions.cjs +69 -0
- package/dist/animation/deform-positions.d.ts +13 -0
- package/dist/animation/deform-positions.d.ts.map +1 -0
- package/dist/animation/deform-positions.js +49 -0
- package/dist/animation/deform-positions.js.map +1 -0
- package/dist/animation/key-frames.cjs +81 -0
- package/dist/animation/morph-targets.cjs +162 -0
- package/dist/animation/node-animation-binding.cjs +67 -0
- package/dist/animation/node-animation-binding.d.ts +9 -0
- package/dist/animation/node-animation-binding.d.ts.map +1 -0
- package/dist/animation/node-animation-binding.js +45 -0
- package/dist/animation/node-animation-binding.js.map +1 -0
- package/dist/animation/property-animation-binding.cjs +159 -0
- package/dist/animation/property-animation-binding.d.ts +29 -0
- package/dist/animation/property-animation-binding.d.ts.map +1 -0
- package/dist/animation/property-animation-binding.js +138 -0
- package/dist/animation/property-animation-binding.js.map +1 -0
- package/dist/animation/scenegraph-animator.cjs +122 -0
- package/dist/animation/scenegraph-animator.d.ts +37 -0
- package/dist/animation/scenegraph-animator.d.ts.map +1 -0
- package/dist/animation/scenegraph-animator.js +99 -0
- package/dist/animation/scenegraph-animator.js.map +1 -0
- package/dist/animation/skin.cjs +49 -0
- package/dist/animation/texture-transform.cjs +41 -0
- package/dist/animation/texture-transform.d.ts +8 -0
- package/dist/animation/texture-transform.d.ts.map +1 -0
- package/dist/animation/texture-transform.js +17 -0
- package/dist/animation/texture-transform.js.map +1 -0
- package/dist/animation/timeline.cjs +129 -0
- package/dist/animation-loop/animation-loop-template.cjs +33 -0
- package/dist/animation-loop/animation-loop.cjs +498 -0
- package/dist/animation-loop/animation-loop.d.ts +2 -1
- package/dist/animation-loop/animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/animation-loop.js +9 -3
- package/dist/animation-loop/animation-loop.js.map +1 -1
- package/dist/animation-loop/animation-props.cjs +15 -0
- package/dist/animation-loop/make-animation-loop.cjs +104 -0
- package/dist/animation-loop/request-animation-frame.cjs +43 -0
- package/dist/application-utils/load-file.cjs +77 -0
- package/dist/application-utils/random.cjs +38 -0
- package/dist/audio/audio-controller.cjs +429 -0
- package/dist/audio/audio-controller.d.ts +146 -0
- package/dist/audio/audio-controller.d.ts.map +1 -0
- package/dist/audio/audio-controller.js +445 -0
- package/dist/audio/audio-controller.js.map +1 -0
- package/dist/audio/audio-environment.cjs +157 -0
- package/dist/audio/audio-environment.d.ts +49 -0
- package/dist/audio/audio-environment.d.ts.map +1 -0
- package/dist/audio/audio-environment.js +148 -0
- package/dist/audio/audio-environment.js.map +1 -0
- package/dist/audio/audio-graph.cjs +182 -0
- package/dist/audio/audio-graph.d.ts +58 -0
- package/dist/audio/audio-graph.d.ts.map +1 -0
- package/dist/audio/audio-graph.js +181 -0
- package/dist/audio/audio-graph.js.map +1 -0
- package/dist/compute/buffer-transform.cjs +146 -0
- package/dist/compute/buffer-transform.d.ts +15 -5
- package/dist/compute/buffer-transform.d.ts.map +1 -1
- package/dist/compute/buffer-transform.js +56 -12
- package/dist/compute/buffer-transform.js.map +1 -1
- package/dist/compute/computation.cjs +331 -0
- package/dist/compute/computation.d.ts +2 -4
- package/dist/compute/computation.d.ts.map +1 -1
- package/dist/compute/computation.js +3 -14
- package/dist/compute/computation.js.map +1 -1
- package/dist/compute/swap.cjs +132 -0
- package/dist/compute/texture-transform.cjs +142 -0
- package/dist/compute/texture-transform.d.ts +11 -7
- package/dist/compute/texture-transform.d.ts.map +1 -1
- package/dist/compute/texture-transform.js +16 -6
- package/dist/compute/texture-transform.js.map +1 -1
- package/dist/controls/orbit-controls.cjs +283 -0
- package/dist/controls/orbit-controls.d.ts +2 -0
- package/dist/controls/orbit-controls.d.ts.map +1 -1
- package/dist/controls/orbit-controls.js +2 -1
- package/dist/controls/orbit-controls.js.map +1 -1
- package/dist/debug/copy-texture-to-image.cjs +84 -0
- package/dist/debug/debug-framebuffer.cjs +113 -0
- package/dist/debug/debug-shader-layout.cjs +45 -0
- package/dist/debug/pixel-data-utils.cjs +54 -0
- package/dist/dist.dev.js +11756 -5632
- package/dist/dist.min.js +39 -35
- package/dist/dynamic-buffer/dynamic-buffer.cjs +39 -0
- package/dist/dynamic-buffer/dynamic-buffer.d.ts +1 -170
- package/dist/dynamic-buffer/dynamic-buffer.d.ts.map +1 -1
- package/dist/dynamic-buffer/dynamic-buffer.js +2 -312
- package/dist/dynamic-buffer/dynamic-buffer.js.map +1 -1
- package/dist/dynamic-texture/dynamic-texture.cjs +27 -0
- package/dist/dynamic-texture/dynamic-texture.d.ts +1 -114
- package/dist/dynamic-texture/dynamic-texture.d.ts.map +1 -1
- package/dist/dynamic-texture/dynamic-texture.js +2 -584
- package/dist/dynamic-texture/dynamic-texture.js.map +1 -1
- package/dist/dynamic-texture/texture-binding-source.cjs +31 -0
- package/dist/dynamic-texture/texture-binding-source.d.ts +1 -54
- package/dist/dynamic-texture/texture-binding-source.d.ts.map +1 -1
- package/dist/dynamic-texture/texture-binding-source.js +2 -51
- package/dist/dynamic-texture/texture-binding-source.js.map +1 -1
- package/dist/dynamic-texture/texture-data.cjs +53 -0
- package/dist/dynamic-texture/texture-data.d.ts +1 -145
- package/dist/dynamic-texture/texture-data.d.ts.map +1 -1
- package/dist/dynamic-texture/texture-data.js +2 -209
- package/dist/dynamic-texture/texture-data.js.map +1 -1
- package/dist/dynamic-texture/video-texture.cjs +269 -0
- package/dist/dynamic-texture/video-texture.d.ts +1 -1
- package/dist/dynamic-texture/video-texture.d.ts.map +1 -1
- package/dist/experimental/controls/comparison-splitter.cjs +231 -0
- package/dist/experimental/controls/comparison-splitter.d.ts +54 -0
- package/dist/experimental/controls/comparison-splitter.d.ts.map +1 -0
- package/dist/experimental/controls/comparison-splitter.js +215 -0
- package/dist/experimental/controls/comparison-splitter.js.map +1 -0
- package/dist/experimental/controls/flat-controller.cjs +301 -0
- package/dist/experimental/controls/flat-controller.d.ts +80 -0
- package/dist/experimental/controls/flat-controller.d.ts.map +1 -0
- package/dist/experimental/controls/flat-controller.js +295 -0
- package/dist/experimental/controls/flat-controller.js.map +1 -0
- package/dist/experimental/controls/index.cjs +35 -0
- package/dist/experimental/controls/index.cjs.map +6 -0
- package/dist/experimental/controls/index.d.ts +7 -0
- package/dist/experimental/controls/index.d.ts.map +1 -0
- package/dist/experimental/controls/index.js +7 -0
- package/dist/experimental/controls/index.js.map +1 -0
- package/dist/experimental/controls/orbit-controls.cjs +27 -0
- package/dist/experimental/controls/orbit-controls.d.ts +3 -0
- package/dist/experimental/controls/orbit-controls.d.ts.map +1 -0
- package/dist/experimental/controls/orbit-controls.js +5 -0
- package/dist/experimental/controls/orbit-controls.js.map +1 -0
- package/dist/experimental/materials/emissive-material.cjs +126 -0
- package/dist/experimental/materials/emissive-material.d.ts +38 -0
- package/dist/experimental/materials/emissive-material.d.ts.map +1 -0
- package/dist/experimental/materials/emissive-material.js +100 -0
- package/dist/experimental/materials/emissive-material.js.map +1 -0
- package/dist/experimental/materials/glass-material.cjs +570 -0
- package/dist/experimental/materials/glass-material.d.ts +107 -0
- package/dist/experimental/materials/glass-material.d.ts.map +1 -0
- package/dist/experimental/materials/glass-material.js +544 -0
- package/dist/experimental/materials/glass-material.js.map +1 -0
- package/dist/experimental/materials/glass-transmission.cjs +954 -0
- package/dist/experimental/materials/glass-transmission.d.ts +193 -0
- package/dist/experimental/materials/glass-transmission.d.ts.map +1 -0
- package/dist/experimental/materials/glass-transmission.js +928 -0
- package/dist/experimental/materials/glass-transmission.js.map +1 -0
- package/dist/experimental/materials/index.cjs +61 -0
- package/dist/experimental/materials/index.cjs.map +6 -0
- package/dist/experimental/materials/index.d.ts +14 -0
- package/dist/experimental/materials/index.d.ts.map +1 -0
- package/dist/experimental/materials/index.js +11 -0
- package/dist/experimental/materials/index.js.map +1 -0
- package/dist/experimental/materials/optical-caustics.cjs +201 -0
- package/dist/experimental/materials/optical-caustics.d.ts +69 -0
- package/dist/experimental/materials/optical-caustics.d.ts.map +1 -0
- package/dist/experimental/materials/optical-caustics.js +180 -0
- package/dist/experimental/materials/optical-caustics.js.map +1 -0
- package/dist/experimental/materials/optical-lighting.cjs +169 -0
- package/dist/experimental/materials/optical-lighting.d.ts +7 -0
- package/dist/experimental/materials/optical-lighting.d.ts.map +1 -0
- package/dist/experimental/materials/optical-lighting.js +144 -0
- package/dist/experimental/materials/optical-lighting.js.map +1 -0
- package/dist/experimental/materials/optical-point-lights.cjs +258 -0
- package/dist/experimental/materials/optical-point-lights.d.ts +68 -0
- package/dist/experimental/materials/optical-point-lights.d.ts.map +1 -0
- package/dist/experimental/materials/optical-point-lights.js +237 -0
- package/dist/experimental/materials/optical-point-lights.js.map +1 -0
- package/dist/experimental/materials/reflective-material.cjs +216 -0
- package/dist/experimental/materials/reflective-material.d.ts +46 -0
- package/dist/experimental/materials/reflective-material.d.ts.map +1 -0
- package/dist/experimental/materials/reflective-material.js +190 -0
- package/dist/experimental/materials/reflective-material.js.map +1 -0
- package/dist/experimental/textures/html-texture.cjs +221 -0
- package/dist/experimental/textures/html-texture.d.ts +85 -0
- package/dist/experimental/textures/html-texture.d.ts.map +1 -0
- package/dist/experimental/textures/html-texture.js +206 -0
- package/dist/experimental/textures/html-texture.js.map +1 -0
- package/dist/experimental/textures/index.cjs +33 -0
- package/dist/experimental/textures/index.cjs.map +6 -0
- package/dist/experimental/textures/index.d.ts +5 -0
- package/dist/experimental/textures/index.d.ts.map +1 -0
- package/dist/experimental/textures/index.js +7 -0
- package/dist/experimental/textures/index.js.map +1 -0
- package/dist/experimental/textures/packed-pixels.cjs +248 -0
- package/dist/experimental/textures/packed-pixels.d.ts +17 -0
- package/dist/experimental/textures/packed-pixels.d.ts.map +1 -0
- package/dist/experimental/textures/packed-pixels.js +237 -0
- package/dist/experimental/textures/packed-pixels.js.map +1 -0
- package/dist/experimental/textures/rgba-decoder.cjs +60 -0
- package/dist/experimental/textures/rgba-decoder.d.ts +29 -0
- package/dist/experimental/textures/rgba-decoder.d.ts.map +1 -0
- package/dist/experimental/textures/rgba-decoder.js +43 -0
- package/dist/experimental/textures/rgba-decoder.js.map +1 -0
- package/dist/experimental/webxr/index.cjs +38 -0
- package/dist/experimental/webxr/index.cjs.map +6 -0
- package/dist/experimental/webxr/index.d.ts +9 -0
- package/dist/experimental/webxr/index.d.ts.map +1 -0
- package/dist/experimental/webxr/index.js +8 -0
- package/dist/experimental/webxr/index.js.map +1 -0
- package/dist/experimental/webxr/webxr-animation-frame-provider.cjs +38 -0
- package/dist/experimental/webxr/webxr-animation-frame-provider.d.ts +9 -0
- package/dist/experimental/webxr/webxr-animation-frame-provider.d.ts.map +1 -0
- package/dist/experimental/webxr/webxr-animation-frame-provider.js +17 -0
- package/dist/experimental/webxr/webxr-animation-frame-provider.js.map +1 -0
- package/dist/experimental/webxr/webxr-camera-texture.cjs +157 -0
- package/dist/experimental/webxr/webxr-camera-texture.d.ts +48 -0
- package/dist/experimental/webxr/webxr-camera-texture.d.ts.map +1 -0
- package/dist/experimental/webxr/webxr-camera-texture.js +144 -0
- package/dist/experimental/webxr/webxr-camera-texture.js.map +1 -0
- package/dist/experimental/webxr/webxr-input.cjs +93 -0
- package/dist/experimental/webxr/webxr-input.d.ts +24 -0
- package/dist/experimental/webxr/webxr-input.d.ts.map +1 -0
- package/dist/experimental/webxr/webxr-input.js +70 -0
- package/dist/experimental/webxr/webxr-input.js.map +1 -0
- package/dist/experimental/webxr/webxr-manager.cjs +356 -0
- package/dist/experimental/webxr/webxr-manager.d.ts +91 -0
- package/dist/experimental/webxr/webxr-manager.d.ts.map +1 -0
- package/dist/experimental/webxr/webxr-manager.js +354 -0
- package/dist/experimental/webxr/webxr-manager.js.map +1 -0
- package/dist/experimental/webxr/webxr-types.cjs +15 -0
- package/dist/experimental/webxr/webxr-types.d.ts +152 -0
- package/dist/experimental/webxr/webxr-types.d.ts.map +1 -0
- package/dist/experimental/webxr/webxr-types.js +5 -0
- package/dist/experimental/webxr/webxr-types.js.map +1 -0
- package/dist/geometry/edge-geometry.cjs +171 -0
- package/dist/geometry/geometry-primitives.cjs +189 -0
- package/dist/geometry/geometry-primitives.d.ts +6 -0
- package/dist/geometry/geometry-primitives.d.ts.map +1 -1
- package/dist/geometry/geometry-primitives.js +8 -0
- package/dist/geometry/geometry-primitives.js.map +1 -1
- package/dist/geometry/geometry-table.cjs +15 -0
- package/dist/geometry/geometry-utils.cjs +147 -0
- package/dist/geometry/geometry.cjs +90 -0
- package/dist/geometry/gpu-geometry.cjs +130 -0
- package/dist/geometry/gpu-vector-geometry-adapter.cjs +88 -0
- package/dist/geometry/gpu-vector-geometry-adapter.d.ts +5 -0
- package/dist/geometry/gpu-vector-geometry-adapter.d.ts.map +1 -0
- package/dist/geometry/gpu-vector-geometry-adapter.js +73 -0
- package/dist/geometry/gpu-vector-geometry-adapter.js.map +1 -0
- package/dist/geometry/gpu-vector-geometry.cjs +40 -0
- package/dist/geometry/gpu-vector-geometry.d.ts +21 -0
- package/dist/geometry/gpu-vector-geometry.d.ts.map +1 -0
- package/dist/geometry/gpu-vector-geometry.js +19 -0
- package/dist/geometry/gpu-vector-geometry.js.map +1 -0
- package/dist/geometry/mesh-simplification.cjs +385 -0
- package/dist/geometry/ring-geometry.cjs +104 -0
- package/dist/geometry/ring-geometry.d.ts +17 -0
- package/dist/geometry/ring-geometry.d.ts.map +1 -0
- package/dist/geometry/ring-geometry.js +94 -0
- package/dist/geometry/ring-geometry.js.map +1 -0
- package/dist/geometry/stroke-geometry.cjs +171 -0
- package/dist/graph/models/index.cjs +66 -0
- package/dist/graph/models/index.cjs.map +6 -0
- package/dist/graph/models/index.d.ts +7 -0
- package/dist/graph/models/index.d.ts.map +1 -0
- package/dist/graph/models/index.js +10 -0
- package/dist/graph/models/index.js.map +1 -0
- package/dist/graph/models/path/path-attribute-model.cjs +421 -0
- package/dist/graph/models/path/path-attribute-model.d.ts +142 -0
- package/dist/graph/models/path/path-attribute-model.d.ts.map +1 -0
- package/dist/graph/models/path/path-attribute-model.js +409 -0
- package/dist/graph/models/path/path-attribute-model.js.map +1 -0
- package/dist/graph/models/path/path-storage-model.cjs +711 -0
- package/dist/graph/models/path/path-storage-model.d.ts +174 -0
- package/dist/graph/models/path/path-storage-model.d.ts.map +1 -0
- package/dist/graph/models/path/path-storage-model.js +720 -0
- package/dist/graph/models/path/path-storage-model.js.map +1 -0
- package/dist/graph/models/path/path-trips-storage-model.cjs +271 -0
- package/dist/graph/models/path/path-trips-storage-model.d.ts +58 -0
- package/dist/graph/models/path/path-trips-storage-model.d.ts.map +1 -0
- package/dist/graph/models/path/path-trips-storage-model.js +248 -0
- package/dist/graph/models/path/path-trips-storage-model.js.map +1 -0
- package/dist/graph/models/polygon/polygon-attribute-model.cjs +117 -0
- package/dist/graph/models/polygon/polygon-attribute-model.d.ts +53 -0
- package/dist/graph/models/polygon/polygon-attribute-model.d.ts.map +1 -0
- package/dist/graph/models/polygon/polygon-attribute-model.js +101 -0
- package/dist/graph/models/polygon/polygon-attribute-model.js.map +1 -0
- package/dist/graph/models/polygon/polygon-shaders.cjs +283 -0
- package/dist/graph/models/polygon/polygon-shaders.d.ts +77 -0
- package/dist/graph/models/polygon/polygon-shaders.d.ts.map +1 -0
- package/dist/graph/models/polygon/polygon-shaders.js +242 -0
- package/dist/graph/models/polygon/polygon-shaders.js.map +1 -0
- package/dist/graph/models/polygon/polygon-storage-model.cjs +111 -0
- package/dist/graph/models/polygon/polygon-storage-model.d.ts +53 -0
- package/dist/graph/models/polygon/polygon-storage-model.d.ts.map +1 -0
- package/dist/graph/models/polygon/polygon-storage-model.js +92 -0
- package/dist/graph/models/polygon/polygon-storage-model.js.map +1 -0
- package/dist/graph/physics/index.cjs +50 -0
- package/dist/graph/physics/index.cjs.map +6 -0
- package/dist/graph/physics/index.d.ts +12 -0
- package/dist/graph/physics/index.d.ts.map +1 -0
- package/dist/graph/physics/index.js +12 -0
- package/dist/graph/physics/index.js.map +1 -0
- package/dist/graph/physics/physics-scenegraph.cjs +92 -0
- package/dist/graph/physics/physics-scenegraph.d.ts +35 -0
- package/dist/graph/physics/physics-scenegraph.d.ts.map +1 -0
- package/dist/graph/physics/physics-scenegraph.js +80 -0
- package/dist/graph/physics/physics-scenegraph.js.map +1 -0
- package/dist/graph/physics/scenegraph-behaviors.cjs +164 -0
- package/dist/graph/physics/scenegraph-behaviors.d.ts +37 -0
- package/dist/graph/physics/scenegraph-behaviors.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-behaviors.js +145 -0
- package/dist/graph/physics/scenegraph-behaviors.js.map +1 -0
- package/dist/graph/physics/scenegraph-instance.cjs +246 -0
- package/dist/graph/physics/scenegraph-instance.d.ts +59 -0
- package/dist/graph/physics/scenegraph-instance.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-instance.js +241 -0
- package/dist/graph/physics/scenegraph-instance.js.map +1 -0
- package/dist/graph/physics/scenegraph-joints.cjs +51 -0
- package/dist/graph/physics/scenegraph-joints.d.ts +5 -0
- package/dist/graph/physics/scenegraph-joints.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-joints.js +31 -0
- package/dist/graph/physics/scenegraph-joints.js.map +1 -0
- package/dist/graph/physics/scenegraph-motion.cjs +177 -0
- package/dist/graph/physics/scenegraph-motion.d.ts +37 -0
- package/dist/graph/physics/scenegraph-motion.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-motion.js +168 -0
- package/dist/graph/physics/scenegraph-motion.js.map +1 -0
- package/dist/graph/physics/scenegraph-properties.cjs +170 -0
- package/dist/graph/physics/scenegraph-properties.d.ts +37 -0
- package/dist/graph/physics/scenegraph-properties.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-properties.js +186 -0
- package/dist/graph/physics/scenegraph-properties.js.map +1 -0
- package/dist/graph/physics/scenegraph-publication.cjs +112 -0
- package/dist/graph/physics/scenegraph-publication.d.ts +23 -0
- package/dist/graph/physics/scenegraph-publication.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-publication.js +99 -0
- package/dist/graph/physics/scenegraph-publication.js.map +1 -0
- package/dist/graph/physics/scenegraph-session.cjs +256 -0
- package/dist/graph/physics/scenegraph-session.d.ts +68 -0
- package/dist/graph/physics/scenegraph-session.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-session.js +249 -0
- package/dist/graph/physics/scenegraph-session.js.map +1 -0
- package/dist/graph/tables/gpu-table-geometry.cjs +84 -0
- package/dist/graph/tables/gpu-table-geometry.d.ts +32 -0
- package/dist/graph/tables/gpu-table-geometry.d.ts.map +1 -0
- package/dist/graph/tables/gpu-table-geometry.js +67 -0
- package/dist/graph/tables/gpu-table-geometry.js.map +1 -0
- package/dist/graph/tables/gpu-table-model.cjs +459 -0
- package/dist/graph/tables/gpu-table-model.d.ts +67 -0
- package/dist/graph/tables/gpu-table-model.d.ts.map +1 -0
- package/dist/graph/tables/gpu-table-model.js +457 -0
- package/dist/graph/tables/gpu-table-model.js.map +1 -0
- package/dist/graph/tables/gpu-table-transform.cjs +341 -0
- package/dist/graph/tables/gpu-table-transform.d.ts +61 -0
- package/dist/graph/tables/gpu-table-transform.d.ts.map +1 -0
- package/dist/graph/tables/gpu-table-transform.js +333 -0
- package/dist/graph/tables/gpu-table-transform.js.map +1 -0
- package/dist/graph/tables/index.cjs +33 -0
- package/dist/graph/tables/index.cjs.map +6 -0
- package/dist/graph/tables/index.d.ts +4 -0
- package/dist/graph/tables/index.d.ts.map +1 -0
- package/dist/graph/tables/index.js +7 -0
- package/dist/graph/tables/index.js.map +1 -0
- package/dist/index.cjs +303 -9569
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +32 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/dist/interactivity/interactivity.cjs +570 -0
- package/dist/interactivity/interactivity.d.ts +107 -0
- package/dist/interactivity/interactivity.d.ts.map +1 -0
- package/dist/interactivity/interactivity.js +575 -0
- package/dist/interactivity/interactivity.js.map +1 -0
- package/dist/interactivity/physics.cjs +15 -0
- package/dist/interactivity/physics.d.ts +12 -0
- package/dist/interactivity/physics.d.ts.map +1 -0
- package/dist/interactivity/physics.js +5 -0
- package/dist/interactivity/physics.js.map +1 -0
- package/dist/material/material-factory.cjs +99 -0
- package/dist/material/material-factory.d.ts +1 -1
- package/dist/material/material-factory.d.ts.map +1 -1
- package/dist/material/material.cjs +239 -0
- package/dist/material/material.d.ts +2 -2
- package/dist/material/material.d.ts.map +1 -1
- package/dist/material/material.js +2 -2
- package/dist/material/material.js.map +1 -1
- package/dist/model/gpu-vector-bindings.cjs +226 -0
- package/dist/model/gpu-vector-bindings.d.ts +36 -0
- package/dist/model/gpu-vector-bindings.d.ts.map +1 -0
- package/dist/model/gpu-vector-bindings.js +217 -0
- package/dist/model/gpu-vector-bindings.js.map +1 -0
- package/dist/model/gpu-vector-draw-batches.cjs +82 -0
- package/dist/model/gpu-vector-draw-batches.d.ts +5 -0
- package/dist/model/gpu-vector-draw-batches.d.ts.map +1 -0
- package/dist/model/gpu-vector-draw-batches.js +73 -0
- package/dist/model/gpu-vector-draw-batches.js.map +1 -0
- package/dist/model/gpu-vector-model-batches.cjs +94 -0
- package/dist/model/gpu-vector-model-batches.d.ts +41 -0
- package/dist/model/gpu-vector-model-batches.d.ts.map +1 -0
- package/dist/model/gpu-vector-model-batches.js +77 -0
- package/dist/model/gpu-vector-model-batches.js.map +1 -0
- package/dist/model/gpu-vector-model.cjs +1264 -0
- package/dist/model/gpu-vector-model.d.ts +352 -0
- package/dist/model/gpu-vector-model.d.ts.map +1 -0
- package/dist/model/gpu-vector-model.js +1375 -0
- package/dist/model/gpu-vector-model.js.map +1 -0
- package/dist/model/model.cjs +134 -0
- package/dist/model/model.d.ts +21 -305
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +68 -1092
- package/dist/model/model.js.map +1 -1
- package/dist/model/split-uniforms-and-bindings.cjs +44 -0
- package/dist/model/split-uniforms-and-bindings.d.ts +1 -1
- package/dist/model/split-uniforms-and-bindings.d.ts.map +1 -1
- package/dist/model/split-uniforms-and-bindings.js +5 -2
- package/dist/model/split-uniforms-and-bindings.js.map +1 -1
- package/dist/models/billboard-texture-model.cjs +167 -0
- package/dist/models/billboard-texture-model.d.ts +1 -1
- package/dist/models/billboard-texture-model.d.ts.map +1 -1
- package/dist/models/billboard-texture-model.js +1 -1
- package/dist/models/billboard-texture-model.js.map +1 -1
- package/dist/models/billboard-texture-module.cjs +61 -0
- package/dist/models/clip-space.cjs +103 -0
- package/dist/models/directional-light-model.cjs +45 -0
- package/dist/models/light-model-utils.cjs +426 -0
- package/dist/models/point-light-model.cjs +44 -0
- package/dist/models/spot-light-model.cjs +45 -0
- package/dist/modules/picking/color-picking.cjs +209 -0
- package/dist/modules/picking/color-picking.d.ts +1 -1
- package/dist/modules/picking/index-color-picking.cjs +230 -0
- package/dist/modules/picking/index-color-picking.d.ts +1 -1
- package/dist/modules/picking/index-picking.cjs +201 -0
- package/dist/modules/picking/index-picking.d.ts +1 -1
- package/dist/modules/picking/legacy-color-picking.cjs +28 -0
- package/dist/modules/picking/legacy-color-picking.d.ts +1 -1
- package/dist/modules/picking/legacy-picking-manager.cjs +92 -0
- package/dist/modules/picking/picking-manager.cjs +360 -0
- package/dist/modules/picking/picking-uniforms.cjs +140 -0
- 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.cjs +43 -0
- package/dist/modules/picking/picking.d.ts +1 -1
- package/dist/passes/get-fragment-shader.cjs +119 -0
- package/dist/passes/shader-pass-renderer.cjs +722 -0
- package/dist/passes/shader-pass-renderer.d.ts +2 -2
- package/dist/passes/shader-pass-renderer.d.ts.map +1 -1
- package/dist/passes/shader-pass-renderer.js +1 -1
- package/dist/passes/shader-pass-renderer.js.map +1 -1
- package/dist/passes/texture-transform-module.cjs +78 -0
- package/dist/scenegraph/controllers/area-light-controller.cjs +143 -0
- package/dist/scenegraph/controllers/area-light-controller.d.ts +31 -0
- package/dist/scenegraph/controllers/area-light-controller.d.ts.map +1 -0
- package/dist/scenegraph/controllers/area-light-controller.js +130 -0
- package/dist/scenegraph/controllers/area-light-controller.js.map +1 -0
- package/dist/scenegraph/controllers/billboard-controller.cjs +156 -0
- package/dist/scenegraph/controllers/billboard-controller.d.ts +45 -0
- package/dist/scenegraph/controllers/billboard-controller.d.ts.map +1 -0
- package/dist/scenegraph/controllers/billboard-controller.js +156 -0
- package/dist/scenegraph/controllers/billboard-controller.js.map +1 -0
- package/dist/scenegraph/controllers/joint-controller.cjs +71 -0
- package/dist/scenegraph/controllers/joint-controller.d.ts +30 -0
- package/dist/scenegraph/controllers/joint-controller.d.ts.map +1 -0
- package/dist/scenegraph/controllers/joint-controller.js +53 -0
- package/dist/scenegraph/controllers/joint-controller.js.map +1 -0
- package/dist/scenegraph/controllers/material-variants.cjs +61 -0
- package/dist/scenegraph/controllers/material-variants.d.ts +42 -0
- package/dist/scenegraph/controllers/material-variants.d.ts.map +1 -0
- package/dist/scenegraph/controllers/material-variants.js +40 -0
- package/dist/scenegraph/controllers/material-variants.js.map +1 -0
- package/dist/scenegraph/controllers/morph-controller.cjs +61 -0
- package/dist/scenegraph/controllers/morph-controller.d.ts +19 -0
- package/dist/scenegraph/controllers/morph-controller.d.ts.map +1 -0
- package/dist/scenegraph/controllers/morph-controller.js +41 -0
- package/dist/scenegraph/controllers/morph-controller.js.map +1 -0
- package/dist/scenegraph/controllers/skin-controller.cjs +111 -0
- package/dist/scenegraph/controllers/skin-controller.d.ts +36 -0
- package/dist/scenegraph/controllers/skin-controller.d.ts.map +1 -0
- package/dist/scenegraph/controllers/skin-controller.js +90 -0
- package/dist/scenegraph/controllers/skin-controller.js.map +1 -0
- package/dist/scenegraph/group-node.cjs +129 -0
- package/dist/scenegraph/model-node.cjs +68 -0
- package/dist/scenegraph/physics-transforms.cjs +95 -0
- package/dist/scenegraph/physics-transforms.d.ts +13 -0
- package/dist/scenegraph/physics-transforms.d.ts.map +1 -0
- package/dist/scenegraph/physics-transforms.js +72 -0
- package/dist/scenegraph/physics-transforms.js.map +1 -0
- package/dist/scenegraph/published-transforms.cjs +37 -0
- package/dist/scenegraph/published-transforms.d.ts +17 -0
- package/dist/scenegraph/published-transforms.d.ts.map +1 -0
- package/dist/scenegraph/published-transforms.js +16 -0
- package/dist/scenegraph/published-transforms.js.map +1 -0
- package/dist/scenegraph/scenegraph-bounds.cjs +51 -0
- package/dist/scenegraph/scenegraph-node.cjs +182 -0
- package/dist/shader-inputs.cjs +231 -0
- package/dist/shader-inputs.d.ts +1 -1
- package/dist/shader-inputs.d.ts.map +1 -1
- package/dist/utils/buffer-layout-helper.cjs +52 -0
- package/dist/utils/buffer-layout-order.cjs +37 -0
- package/dist/utils/deep-equal.cjs +65 -0
- package/dist/utils/get-platform-info.cjs +21 -0
- package/dist/utils/get-platform-info.d.ts +2 -0
- package/dist/utils/get-platform-info.d.ts.map +1 -0
- package/dist/utils/get-platform-info.js +5 -0
- package/dist/utils/get-platform-info.js.map +1 -0
- package/dist/utils/gpu-vector-batch-structure.cjs +45 -0
- package/dist/utils/gpu-vector-batch-structure.d.ts +12 -0
- package/dist/utils/gpu-vector-batch-structure.d.ts.map +1 -0
- package/dist/utils/gpu-vector-batch-structure.js +27 -0
- package/dist/utils/gpu-vector-batch-structure.js.map +1 -0
- package/dist/utils/shader-module-utils.cjs +148 -0
- package/dist/utils/uid.cjs +32 -0
- package/package.json +45 -7
- package/src/animation/deform-positions.ts +62 -0
- package/src/animation/node-animation-binding.ts +54 -0
- package/src/animation/property-animation-binding.ts +212 -0
- package/src/animation/scenegraph-animator.ts +117 -0
- package/src/animation/texture-transform.ts +59 -0
- package/src/animation-loop/animation-loop.ts +10 -3
- package/src/audio/audio-controller.ts +583 -0
- package/src/audio/audio-environment.ts +202 -0
- package/src/audio/audio-graph.ts +253 -0
- package/src/compute/buffer-transform.ts +71 -16
- package/src/compute/computation.ts +4 -19
- package/src/compute/texture-transform.ts +25 -12
- package/src/controls/orbit-controls.ts +4 -1
- package/src/dynamic-buffer/dynamic-buffer.ts +15 -449
- package/src/dynamic-texture/dynamic-texture.ts +5 -760
- package/src/dynamic-texture/texture-binding-source.ts +8 -90
- package/src/dynamic-texture/texture-data.ts +31 -340
- package/src/dynamic-texture/video-texture.ts +1 -1
- package/src/experimental/controls/comparison-splitter.ts +269 -0
- package/src/experimental/controls/flat-controller.ts +403 -0
- package/src/experimental/controls/index.ts +16 -0
- package/src/experimental/controls/orbit-controls.ts +6 -0
- package/src/experimental/materials/emissive-material.ts +120 -0
- package/src/experimental/materials/glass-material.ts +607 -0
- package/src/experimental/materials/glass-transmission.ts +1023 -0
- package/src/experimental/materials/index.ts +49 -0
- package/src/experimental/materials/optical-caustics.ts +234 -0
- package/src/experimental/materials/optical-lighting.ts +148 -0
- package/src/experimental/materials/optical-point-lights.ts +288 -0
- package/src/experimental/materials/reflective-material.ts +214 -0
- package/src/experimental/textures/html-texture.ts +285 -0
- package/src/experimental/textures/index.ts +8 -0
- package/src/experimental/textures/packed-pixels.ts +351 -0
- package/src/experimental/textures/rgba-decoder.ts +79 -0
- package/src/experimental/webxr/index.ts +21 -0
- package/src/experimental/webxr/webxr-animation-frame-provider.ts +22 -0
- package/src/experimental/webxr/webxr-camera-texture.ts +195 -0
- package/src/experimental/webxr/webxr-input.ts +117 -0
- package/src/experimental/webxr/webxr-manager.ts +524 -0
- package/src/experimental/webxr/webxr-types.ts +192 -0
- package/src/geometry/geometry-primitives.ts +11 -0
- package/src/geometry/gpu-vector-geometry-adapter.ts +78 -0
- package/src/geometry/gpu-vector-geometry.ts +33 -0
- package/src/geometry/ring-geometry.ts +117 -0
- package/src/graph/models/index.ts +45 -0
- package/src/graph/models/path/path-attribute-model.ts +563 -0
- package/src/graph/models/path/path-storage-model.ts +996 -0
- package/src/graph/models/path/path-trips-storage-model.ts +286 -0
- package/src/graph/models/polygon/polygon-attribute-model.ts +165 -0
- package/src/graph/models/polygon/polygon-shaders.ts +279 -0
- package/src/graph/models/polygon/polygon-storage-model.ts +146 -0
- package/src/graph/physics/index.ts +24 -0
- package/src/graph/physics/physics-scenegraph.ts +112 -0
- package/src/graph/physics/scenegraph-behaviors.ts +169 -0
- package/src/graph/physics/scenegraph-instance.ts +296 -0
- package/src/graph/physics/scenegraph-joints.ts +37 -0
- package/src/graph/physics/scenegraph-motion.ts +175 -0
- package/src/graph/physics/scenegraph-properties.ts +241 -0
- package/src/graph/physics/scenegraph-publication.ts +116 -0
- package/src/graph/physics/scenegraph-session.ts +317 -0
- package/src/graph/tables/gpu-table-geometry.ts +88 -0
- package/src/graph/tables/gpu-table-model.ts +661 -0
- package/src/graph/tables/gpu-table-transform.ts +497 -0
- package/src/graph/tables/index.ts +18 -0
- package/src/index.ts +130 -13
- package/src/interactivity/interactivity.ts +670 -0
- package/src/interactivity/physics.ts +19 -0
- package/src/material/material-factory.ts +1 -1
- package/src/material/material.ts +2 -2
- package/src/model/gpu-vector-bindings.ts +276 -0
- package/src/model/gpu-vector-draw-batches.ts +116 -0
- package/src/model/gpu-vector-model-batches.ts +142 -0
- package/src/model/gpu-vector-model.ts +1819 -0
- package/src/model/model.ts +91 -1444
- package/src/model/split-uniforms-and-bindings.ts +6 -3
- package/src/models/billboard-texture-model.ts +1 -1
- package/src/modules/picking/legacy-picking-manager.ts +1 -1
- package/src/modules/picking/picking-uniforms.ts +1 -1
- package/src/passes/shader-pass-renderer.ts +2 -2
- package/src/scenegraph/controllers/area-light-controller.ts +152 -0
- package/src/scenegraph/controllers/billboard-controller.ts +204 -0
- package/src/scenegraph/controllers/joint-controller.ts +81 -0
- package/src/scenegraph/controllers/material-variants.ts +70 -0
- package/src/scenegraph/controllers/morph-controller.ts +61 -0
- package/src/scenegraph/controllers/skin-controller.ts +125 -0
- package/src/scenegraph/physics-transforms.ts +82 -0
- package/src/scenegraph/published-transforms.ts +18 -0
- package/src/shader-inputs.ts +1 -1
- package/src/utils/get-platform-info.ts +5 -0
- package/src/utils/gpu-vector-batch-structure.ts +36 -0
- package/dist/compute/kernel.d.ts +0 -54
- package/dist/compute/kernel.d.ts.map +0 -1
- package/dist/compute/kernel.js +0 -103
- package/dist/compute/kernel.js.map +0 -1
- package/dist/compute/render-kernel.d.ts +0 -65
- package/dist/compute/render-kernel.d.ts.map +0 -1
- package/dist/compute/render-kernel.js +0 -129
- package/dist/compute/render-kernel.js.map +0 -1
- package/src/compute/kernel.ts +0 -146
- package/src/compute/render-kernel.ts +0 -192
|
@@ -17,7 +17,7 @@ export declare const legacyColorPicking: {
|
|
|
17
17
|
readonly isHighlightActive: false;
|
|
18
18
|
readonly useByteColors: true;
|
|
19
19
|
readonly highlightedObjectColor: [0, 0, 0];
|
|
20
|
-
readonly highlightColor: import("@math.gl/
|
|
20
|
+
readonly highlightColor: import("@math.gl/core").NumberArray4;
|
|
21
21
|
};
|
|
22
22
|
readonly vs: "layout(std140) uniform pickingUniforms {\n float isActive;\n float isAttribute;\n float isHighlightActive;\n float useByteColors;\n vec3 highlightedObjectColor;\n vec4 highlightColor;\n} picking;\n\nout vec4 picking_vRGBcolor_Avalid;\n\n// Normalize unsigned byte color to 0-1 range\nvec3 picking_normalizeColor(vec3 color) {\n return picking.useByteColors > 0.5 ? color / 255.0 : color;\n}\n\n// Normalize unsigned byte color to 0-1 range\nvec4 picking_normalizeColor(vec4 color) {\n return picking.useByteColors > 0.5 ? color / 255.0 : color;\n}\n\nbool picking_isColorZero(vec3 color) {\n return dot(color, vec3(1.0)) < 0.00001;\n}\n\nbool picking_isColorValid(vec3 color) {\n return dot(color, vec3(1.0)) > 0.00001;\n}\n\n// Check if this vertex is highlighted \nbool isVertexHighlighted(vec3 vertexColor) {\n vec3 highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor);\n return\n bool(picking.isHighlightActive) && picking_isColorZero(abs(vertexColor - highlightedObjectColor));\n}\n\n// Set the current picking color\nvoid picking_setPickingColor(vec3 pickingColor) {\n pickingColor = picking_normalizeColor(pickingColor);\n\n if (bool(picking.isActive)) {\n // Use alpha as the validity flag. If pickingColor is [0, 0, 0] fragment is non-pickable\n picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor));\n\n if (!bool(picking.isAttribute)) {\n // Stores the picking color so that the fragment shader can render it during picking\n picking_vRGBcolor_Avalid.rgb = pickingColor;\n }\n } else {\n // Do the comparison with selected item color in vertex shader as it should mean fewer compares\n picking_vRGBcolor_Avalid.a = float(isVertexHighlighted(pickingColor));\n }\n}\n\nvoid picking_setPickingAttribute(float value) {\n if (bool(picking.isAttribute)) {\n picking_vRGBcolor_Avalid.r = value;\n }\n}\n\nvoid picking_setPickingAttribute(vec2 value) {\n if (bool(picking.isAttribute)) {\n picking_vRGBcolor_Avalid.rg = value;\n }\n}\n\nvoid picking_setPickingAttribute(vec3 value) {\n if (bool(picking.isAttribute)) {\n picking_vRGBcolor_Avalid.rgb = value;\n }\n}\n";
|
|
23
23
|
readonly fs: "layout(std140) uniform pickingUniforms {\n float isActive;\n float isAttribute;\n float isHighlightActive;\n float useByteColors;\n vec3 highlightedObjectColor;\n vec4 highlightColor;\n} picking;\n\nin vec4 picking_vRGBcolor_Avalid;\n\n/*\n * Returns highlight color if this item is selected.\n */\nvec4 picking_filterHighlightColor(vec4 color) {\n // If we are still picking, we don't highlight\n if (picking.isActive > 0.5) {\n return color;\n }\n\n bool selected = bool(picking_vRGBcolor_Avalid.a);\n\n if (selected) {\n // Blend in highlight color based on its alpha value\n float highLightAlpha = picking.highlightColor.a;\n float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);\n float highLightRatio = highLightAlpha / blendedAlpha;\n\n vec3 blendedRGB = mix(color.rgb, picking.highlightColor.rgb, highLightRatio);\n return vec4(blendedRGB, blendedAlpha);\n } else {\n return color;\n }\n}\n\n/*\n * Returns picking color if picking enabled else unmodified argument.\n */\nvec4 picking_filterPickingColor(vec4 color) {\n if (bool(picking.isActive)) {\n if (picking_vRGBcolor_Avalid.a == 0.0) {\n discard;\n }\n return picking_vRGBcolor_Avalid;\n }\n return color;\n}\n\n/*\n * Returns picking color if picking is enabled if not\n * highlight color if this item is selected, otherwise unmodified argument.\n */\nvec4 picking_filterColor(vec4 color) {\n vec4 highlightColor = picking_filterHighlightColor(color);\n return picking_filterPickingColor(highlightColor);\n}\n";
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var legacy_picking_manager_exports = {};
|
|
19
|
+
__export(legacy_picking_manager_exports, {
|
|
20
|
+
LegacyPickingManager: () => LegacyPickingManager
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(legacy_picking_manager_exports);
|
|
23
|
+
class LegacyPickingManager {
|
|
24
|
+
device;
|
|
25
|
+
framebuffer = null;
|
|
26
|
+
shaderInputs;
|
|
27
|
+
constructor(device, shaderInputs) {
|
|
28
|
+
this.device = device;
|
|
29
|
+
this.shaderInputs = shaderInputs;
|
|
30
|
+
}
|
|
31
|
+
destroy() {
|
|
32
|
+
var _a;
|
|
33
|
+
(_a = this.framebuffer) == null ? void 0 : _a.destroy();
|
|
34
|
+
}
|
|
35
|
+
getFramebuffer() {
|
|
36
|
+
if (!this.framebuffer) {
|
|
37
|
+
this.framebuffer = this.device.createFramebuffer({
|
|
38
|
+
colorAttachments: ["rgba8unorm"],
|
|
39
|
+
depthStencilAttachment: "depth24plus"
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return this.framebuffer;
|
|
43
|
+
}
|
|
44
|
+
/** Clear highlighted / picked object */
|
|
45
|
+
clearPickState() {
|
|
46
|
+
this.shaderInputs.setProps({ picking: { highlightedObjectColor: null } });
|
|
47
|
+
}
|
|
48
|
+
/** Prepare for rendering picking colors */
|
|
49
|
+
beginRenderPass() {
|
|
50
|
+
const framebuffer = this.getFramebuffer();
|
|
51
|
+
framebuffer.resize(this.device.getCanvasContext().getDevicePixelSize());
|
|
52
|
+
this.shaderInputs.setProps({ picking: { isActive: true } });
|
|
53
|
+
const pickingPass = this.device.beginRenderPass({
|
|
54
|
+
framebuffer,
|
|
55
|
+
clearColor: [0, 0, 0, 0],
|
|
56
|
+
clearDepth: 1
|
|
57
|
+
});
|
|
58
|
+
return pickingPass;
|
|
59
|
+
}
|
|
60
|
+
updatePickState(mousePosition) {
|
|
61
|
+
const framebuffer = this.getFramebuffer();
|
|
62
|
+
const [pickX, pickY] = this.getPickPosition(mousePosition);
|
|
63
|
+
const color255 = this.device.readPixelsToArrayWebGL(framebuffer, {
|
|
64
|
+
sourceX: pickX,
|
|
65
|
+
sourceY: pickY,
|
|
66
|
+
sourceWidth: 1,
|
|
67
|
+
sourceHeight: 1
|
|
68
|
+
});
|
|
69
|
+
let highlightedObjectColor = [...color255].map((x) => x / 255);
|
|
70
|
+
const isHighlightActive = highlightedObjectColor[0] + highlightedObjectColor[1] + highlightedObjectColor[2] > 0;
|
|
71
|
+
if (!isHighlightActive) {
|
|
72
|
+
highlightedObjectColor = null;
|
|
73
|
+
}
|
|
74
|
+
this.shaderInputs.setProps({
|
|
75
|
+
picking: { isActive: false, highlightedObjectColor }
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get pick position in device pixel range
|
|
80
|
+
* use the center pixel location in device pixel range
|
|
81
|
+
*/
|
|
82
|
+
getPickPosition(mousePosition) {
|
|
83
|
+
const devicePixels = this.device.getCanvasContext().cssToDevicePixels(mousePosition);
|
|
84
|
+
const pickX = devicePixels.x + Math.floor(devicePixels.width / 2);
|
|
85
|
+
const pickY = devicePixels.y + Math.floor(devicePixels.height / 2);
|
|
86
|
+
return [pickX, pickY];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
90
|
+
0 && (module.exports = {
|
|
91
|
+
LegacyPickingManager
|
|
92
|
+
});
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var picking_manager_exports = {};
|
|
19
|
+
__export(picking_manager_exports, {
|
|
20
|
+
COLOR_PICKING_MAX_BATCH_INDEX: () => COLOR_PICKING_MAX_BATCH_INDEX,
|
|
21
|
+
COLOR_PICKING_MAX_OBJECT_INDEX: () => COLOR_PICKING_MAX_OBJECT_INDEX,
|
|
22
|
+
PickingManager: () => PickingManager,
|
|
23
|
+
decodeColorPickInfo: () => decodeColorPickInfo,
|
|
24
|
+
decodeIndexPickInfo: () => decodeIndexPickInfo,
|
|
25
|
+
resolvePickingBackend: () => resolvePickingBackend,
|
|
26
|
+
resolvePickingMode: () => resolvePickingMode,
|
|
27
|
+
supportsIndexPicking: () => supportsIndexPicking
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(picking_manager_exports);
|
|
30
|
+
var import_core = require("@luma.gl/core");
|
|
31
|
+
var import_picking_uniforms = require("./picking-uniforms.cjs");
|
|
32
|
+
const INDEX_PICKING_ATTACHMENT_INDEX = 1;
|
|
33
|
+
const INDEX_PICKING_CLEAR_COLOR = new Int32Array([import_picking_uniforms.INVALID_INDEX, import_picking_uniforms.INVALID_INDEX, 0, 0]);
|
|
34
|
+
const COLOR_PICKING_MAX_OBJECT_INDEX = 16777214;
|
|
35
|
+
const COLOR_PICKING_MAX_BATCH_INDEX = 254;
|
|
36
|
+
const TOOLTIP_OFFSET_PIXELS = 14;
|
|
37
|
+
const TOOLTIP_MARGIN_PIXELS = 8;
|
|
38
|
+
function resolvePickingMode(deviceType, mode = "color", indexPickingSupported = deviceType === "webgpu") {
|
|
39
|
+
if (mode === "auto") {
|
|
40
|
+
return indexPickingSupported ? "index" : "color";
|
|
41
|
+
}
|
|
42
|
+
if (mode === "index" && !indexPickingSupported) {
|
|
43
|
+
throw new Error(`Picking mode "${mode}" requires WebGPU or a WebGL device that supports renderable rg32sint textures.`);
|
|
44
|
+
}
|
|
45
|
+
return mode;
|
|
46
|
+
}
|
|
47
|
+
function supportsIndexPicking(device) {
|
|
48
|
+
return device.type === "webgpu" || device.type === "webgl" && device.isTextureFormatRenderable("rg32sint");
|
|
49
|
+
}
|
|
50
|
+
const resolvePickingBackend = resolvePickingMode;
|
|
51
|
+
function decodeIndexPickInfo(pixelData) {
|
|
52
|
+
return {
|
|
53
|
+
objectIndex: pixelData[0] === import_picking_uniforms.INVALID_INDEX ? null : pixelData[0],
|
|
54
|
+
batchIndex: pixelData[1] === import_picking_uniforms.INVALID_INDEX ? null : pixelData[1]
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function decodeColorPickInfo(pixelData) {
|
|
58
|
+
const encodedObjectIndex = pixelData[0] + pixelData[1] * 256 + pixelData[2] * 65536;
|
|
59
|
+
if (encodedObjectIndex === 0) {
|
|
60
|
+
return { objectIndex: null, batchIndex: null };
|
|
61
|
+
}
|
|
62
|
+
const batchIndex = pixelData[3] > 0 ? pixelData[3] - 1 : 0;
|
|
63
|
+
return {
|
|
64
|
+
objectIndex: encodedObjectIndex - 1,
|
|
65
|
+
batchIndex
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
class PickingManager {
|
|
69
|
+
device;
|
|
70
|
+
props;
|
|
71
|
+
mode;
|
|
72
|
+
/** Info from latest pick operation */
|
|
73
|
+
pickInfo = { batchIndex: null, objectIndex: null };
|
|
74
|
+
/** Framebuffer used for picking */
|
|
75
|
+
framebuffer = null;
|
|
76
|
+
/** Last cursor position that triggered a picking render/readback. */
|
|
77
|
+
lastMousePosition = null;
|
|
78
|
+
/** Tooltip element created lazily when `getTooltip` returns visible content. */
|
|
79
|
+
tooltipElement = null;
|
|
80
|
+
static defaultProps = {
|
|
81
|
+
shaderInputs: void 0,
|
|
82
|
+
onObjectPicked: () => {
|
|
83
|
+
},
|
|
84
|
+
getTooltip: () => null,
|
|
85
|
+
mode: "color",
|
|
86
|
+
backend: "color"
|
|
87
|
+
};
|
|
88
|
+
constructor(device, props) {
|
|
89
|
+
this.device = device;
|
|
90
|
+
this.props = { ...PickingManager.defaultProps, ...props };
|
|
91
|
+
const requestedMode = props.mode ?? props.backend ?? PickingManager.defaultProps.mode;
|
|
92
|
+
this.props.mode = requestedMode;
|
|
93
|
+
this.props.backend = requestedMode;
|
|
94
|
+
this.mode = resolvePickingMode(this.device.type, requestedMode, supportsIndexPicking(this.device));
|
|
95
|
+
}
|
|
96
|
+
destroy() {
|
|
97
|
+
var _a, _b;
|
|
98
|
+
(_a = this.framebuffer) == null ? void 0 : _a.destroy();
|
|
99
|
+
(_b = this.tooltipElement) == null ? void 0 : _b.remove();
|
|
100
|
+
this.tooltipElement = null;
|
|
101
|
+
}
|
|
102
|
+
// TODO - Ask for a cached framebuffer? a Framebuffer factory?
|
|
103
|
+
getFramebuffer() {
|
|
104
|
+
if (!this.framebuffer) {
|
|
105
|
+
this.framebuffer = this.mode === "index" ? this.createIndexFramebuffer() : this.createColorFramebuffer();
|
|
106
|
+
}
|
|
107
|
+
return this.framebuffer;
|
|
108
|
+
}
|
|
109
|
+
/** Clear highlighted / picked object */
|
|
110
|
+
clearPickState() {
|
|
111
|
+
this.lastMousePosition = null;
|
|
112
|
+
this.setPickingProps({ highlightedBatchIndex: null, highlightedObjectIndex: null });
|
|
113
|
+
this.hideTooltip();
|
|
114
|
+
}
|
|
115
|
+
/** Return whether callers need to render a fresh picking pass for this cursor position. */
|
|
116
|
+
shouldPick(mousePosition, options = {}) {
|
|
117
|
+
if (!mousePosition) {
|
|
118
|
+
if (this.lastMousePosition) {
|
|
119
|
+
this.clearPickState();
|
|
120
|
+
}
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
const [mouseX, mouseY] = mousePosition;
|
|
124
|
+
if (!options.force && this.lastMousePosition && this.lastMousePosition[0] === mouseX && this.lastMousePosition[1] === mouseY) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
this.lastMousePosition = [mouseX, mouseY];
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
/** Prepare for rendering picking colors */
|
|
131
|
+
beginRenderPass() {
|
|
132
|
+
const framebuffer = this.getFramebuffer();
|
|
133
|
+
framebuffer.resize(this.device.getDefaultCanvasContext().getDevicePixelSize());
|
|
134
|
+
this.setPickingProps({ isActive: true });
|
|
135
|
+
return this.mode === "index" ? this.device.beginRenderPass({
|
|
136
|
+
framebuffer,
|
|
137
|
+
clearColors: [new Float32Array([0, 0, 0, 0]), INDEX_PICKING_CLEAR_COLOR],
|
|
138
|
+
clearDepth: 1
|
|
139
|
+
}) : this.device.beginRenderPass({
|
|
140
|
+
framebuffer,
|
|
141
|
+
clearColor: [0, 0, 0, 0],
|
|
142
|
+
clearDepth: 1
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
async updatePickInfo(mousePosition) {
|
|
146
|
+
const framebuffer = this.getFramebuffer();
|
|
147
|
+
const pickPosition = this.getPickPosition(mousePosition);
|
|
148
|
+
const pickInfo = await this.readPickInfo(framebuffer, pickPosition);
|
|
149
|
+
if (!pickInfo) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
if (this.hasPickInfoChanged(pickInfo)) {
|
|
153
|
+
this.pickInfo = pickInfo;
|
|
154
|
+
this.props.onObjectPicked(pickInfo);
|
|
155
|
+
}
|
|
156
|
+
this.updateTooltip(pickInfo, mousePosition);
|
|
157
|
+
this.setPickingProps({
|
|
158
|
+
isActive: false,
|
|
159
|
+
highlightedBatchIndex: pickInfo.batchIndex,
|
|
160
|
+
highlightedObjectIndex: pickInfo.objectIndex
|
|
161
|
+
});
|
|
162
|
+
return this.pickInfo;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Get pick position in device pixel range
|
|
166
|
+
* use the center pixel location in device pixel range
|
|
167
|
+
*/
|
|
168
|
+
getPickPosition(mousePosition) {
|
|
169
|
+
const yInvert = this.device.type !== "webgpu";
|
|
170
|
+
const devicePixels = this.device.getDefaultCanvasContext().cssToDevicePixels(mousePosition, yInvert);
|
|
171
|
+
const pickX = devicePixels.x + Math.floor(devicePixels.width / 2);
|
|
172
|
+
const pickY = devicePixels.y + Math.floor(devicePixels.height / 2);
|
|
173
|
+
return [pickX, pickY];
|
|
174
|
+
}
|
|
175
|
+
createIndexFramebuffer() {
|
|
176
|
+
const colorTexture = this.device.createTexture({
|
|
177
|
+
format: "rgba8unorm",
|
|
178
|
+
width: 1,
|
|
179
|
+
height: 1,
|
|
180
|
+
usage: import_core.Texture.RENDER_ATTACHMENT
|
|
181
|
+
});
|
|
182
|
+
const pickingTexture = this.device.createTexture({
|
|
183
|
+
format: "rg32sint",
|
|
184
|
+
width: 1,
|
|
185
|
+
height: 1,
|
|
186
|
+
usage: import_core.Texture.RENDER_ATTACHMENT | import_core.Texture.COPY_SRC
|
|
187
|
+
});
|
|
188
|
+
return this.device.createFramebuffer({
|
|
189
|
+
colorAttachments: [colorTexture, pickingTexture],
|
|
190
|
+
depthStencilAttachment: "depth24plus"
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
createColorFramebuffer() {
|
|
194
|
+
const pickingTexture = this.device.createTexture({
|
|
195
|
+
format: "rgba8unorm",
|
|
196
|
+
width: 1,
|
|
197
|
+
height: 1,
|
|
198
|
+
usage: import_core.Texture.RENDER_ATTACHMENT | import_core.Texture.COPY_SRC
|
|
199
|
+
});
|
|
200
|
+
return this.device.createFramebuffer({
|
|
201
|
+
colorAttachments: [pickingTexture],
|
|
202
|
+
depthStencilAttachment: "depth24plus"
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
setPickingProps(props) {
|
|
206
|
+
var _a;
|
|
207
|
+
(_a = this.props.shaderInputs) == null ? void 0 : _a.setProps({ picking: props });
|
|
208
|
+
}
|
|
209
|
+
async readPickInfo(framebuffer, pickPosition) {
|
|
210
|
+
return this.mode === "index" ? this.readIndexPickInfo(framebuffer, pickPosition) : this.readColorPickInfo(framebuffer, pickPosition);
|
|
211
|
+
}
|
|
212
|
+
async readIndexPickInfo(framebuffer, [pickX, pickY]) {
|
|
213
|
+
var _a;
|
|
214
|
+
if (this.device.type === "webgpu") {
|
|
215
|
+
const pickTexture = (_a = framebuffer.colorAttachments[INDEX_PICKING_ATTACHMENT_INDEX]) == null ? void 0 : _a.texture;
|
|
216
|
+
if (!pickTexture) {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
const layout = pickTexture.computeMemoryLayout({ width: 1, height: 1 });
|
|
220
|
+
const readBuffer = this.device.createBuffer({
|
|
221
|
+
byteLength: layout.byteLength,
|
|
222
|
+
usage: import_core.Buffer.COPY_DST | import_core.Buffer.MAP_READ
|
|
223
|
+
});
|
|
224
|
+
try {
|
|
225
|
+
pickTexture.readBuffer({
|
|
226
|
+
x: pickX,
|
|
227
|
+
y: pickY,
|
|
228
|
+
width: 1,
|
|
229
|
+
height: 1
|
|
230
|
+
}, readBuffer);
|
|
231
|
+
const pickDataView = await readBuffer.readAsync(0, layout.byteLength);
|
|
232
|
+
return decodeIndexPickInfo(new Int32Array(pickDataView.buffer, pickDataView.byteOffset, 2));
|
|
233
|
+
} finally {
|
|
234
|
+
readBuffer.destroy();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
const pixelData = this.device.readPixelsToArrayWebGL(framebuffer, {
|
|
238
|
+
sourceX: pickX,
|
|
239
|
+
sourceY: pickY,
|
|
240
|
+
sourceWidth: 1,
|
|
241
|
+
sourceHeight: 1,
|
|
242
|
+
sourceAttachment: INDEX_PICKING_ATTACHMENT_INDEX
|
|
243
|
+
});
|
|
244
|
+
return pixelData ? decodeIndexPickInfo(new Int32Array(pixelData.buffer, pixelData.byteOffset, 2)) : null;
|
|
245
|
+
}
|
|
246
|
+
async readColorPickInfo(framebuffer, [pickX, pickY]) {
|
|
247
|
+
var _a;
|
|
248
|
+
if (this.device.type === "webgpu") {
|
|
249
|
+
const pickTexture = (_a = framebuffer.colorAttachments[0]) == null ? void 0 : _a.texture;
|
|
250
|
+
if (!pickTexture) {
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
const layout = pickTexture.computeMemoryLayout({ width: 1, height: 1 });
|
|
254
|
+
const readBuffer = this.device.createBuffer({
|
|
255
|
+
byteLength: layout.byteLength,
|
|
256
|
+
usage: import_core.Buffer.COPY_DST | import_core.Buffer.MAP_READ
|
|
257
|
+
});
|
|
258
|
+
try {
|
|
259
|
+
pickTexture.readBuffer({
|
|
260
|
+
x: pickX,
|
|
261
|
+
y: pickY,
|
|
262
|
+
width: 1,
|
|
263
|
+
height: 1
|
|
264
|
+
}, readBuffer);
|
|
265
|
+
const pickDataView = await readBuffer.readAsync(0, layout.byteLength);
|
|
266
|
+
return decodeColorPickInfo(new Uint8Array(pickDataView.buffer, pickDataView.byteOffset, 4));
|
|
267
|
+
} finally {
|
|
268
|
+
readBuffer.destroy();
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
const pixelData = this.device.readPixelsToArrayWebGL(framebuffer, {
|
|
272
|
+
sourceX: pickX,
|
|
273
|
+
sourceY: pickY,
|
|
274
|
+
sourceWidth: 1,
|
|
275
|
+
sourceHeight: 1,
|
|
276
|
+
sourceAttachment: 0
|
|
277
|
+
});
|
|
278
|
+
return pixelData ? decodeColorPickInfo(new Uint8Array(pixelData.buffer, pixelData.byteOffset, 4)) : null;
|
|
279
|
+
}
|
|
280
|
+
hasPickInfoChanged(pickInfo) {
|
|
281
|
+
return pickInfo.objectIndex !== this.pickInfo.objectIndex || pickInfo.batchIndex !== this.pickInfo.batchIndex;
|
|
282
|
+
}
|
|
283
|
+
updateTooltip(pickInfo, mousePosition) {
|
|
284
|
+
const tooltipText = this.props.getTooltip(pickInfo);
|
|
285
|
+
if (!tooltipText) {
|
|
286
|
+
this.hideTooltip();
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
const tooltipElement = this.getOrCreateTooltipElement();
|
|
290
|
+
if (!tooltipElement) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
tooltipElement.textContent = tooltipText;
|
|
294
|
+
tooltipElement.style.display = "block";
|
|
295
|
+
this.positionTooltip(tooltipElement, mousePosition);
|
|
296
|
+
}
|
|
297
|
+
hideTooltip() {
|
|
298
|
+
if (this.tooltipElement) {
|
|
299
|
+
this.tooltipElement.style.display = "none";
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
getOrCreateTooltipElement() {
|
|
303
|
+
if (this.tooltipElement) {
|
|
304
|
+
return this.tooltipElement;
|
|
305
|
+
}
|
|
306
|
+
if (typeof document === "undefined" || typeof window === "undefined" || typeof HTMLCanvasElement === "undefined" || typeof this.device.getDefaultCanvasContext !== "function") {
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
const canvas = this.device.getDefaultCanvasContext().canvas;
|
|
310
|
+
if (!(canvas instanceof HTMLCanvasElement) || !canvas.parentElement) {
|
|
311
|
+
return null;
|
|
312
|
+
}
|
|
313
|
+
const tooltipElement = document.createElement("div");
|
|
314
|
+
tooltipElement.style.position = "absolute";
|
|
315
|
+
tooltipElement.style.zIndex = "12";
|
|
316
|
+
tooltipElement.style.display = "none";
|
|
317
|
+
tooltipElement.style.maxWidth = "220px";
|
|
318
|
+
tooltipElement.style.padding = "8px 10px";
|
|
319
|
+
tooltipElement.style.borderRadius = "6px";
|
|
320
|
+
tooltipElement.style.background = "rgba(15, 23, 42, 0.92)";
|
|
321
|
+
tooltipElement.style.color = "#f8fafc";
|
|
322
|
+
tooltipElement.style.font = "600 13px/1.35 system-ui, sans-serif";
|
|
323
|
+
tooltipElement.style.pointerEvents = "none";
|
|
324
|
+
tooltipElement.style.whiteSpace = "nowrap";
|
|
325
|
+
tooltipElement.style.boxShadow = "0 10px 24px rgba(15, 23, 42, 0.22)";
|
|
326
|
+
const tooltipParent = canvas.parentElement;
|
|
327
|
+
if (window.getComputedStyle(tooltipParent).position === "static") {
|
|
328
|
+
tooltipParent.style.position = "relative";
|
|
329
|
+
}
|
|
330
|
+
tooltipParent.appendChild(tooltipElement);
|
|
331
|
+
this.tooltipElement = tooltipElement;
|
|
332
|
+
return tooltipElement;
|
|
333
|
+
}
|
|
334
|
+
positionTooltip(tooltipElement, mousePosition) {
|
|
335
|
+
if (typeof HTMLCanvasElement === "undefined" || typeof this.device.getDefaultCanvasContext !== "function") {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
const canvas = this.device.getDefaultCanvasContext().canvas;
|
|
339
|
+
if (!(canvas instanceof HTMLCanvasElement)) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
const maxLeft = Math.max(TOOLTIP_MARGIN_PIXELS, canvas.clientWidth - tooltipElement.offsetWidth - TOOLTIP_MARGIN_PIXELS);
|
|
343
|
+
const maxTop = Math.max(TOOLTIP_MARGIN_PIXELS, canvas.clientHeight - tooltipElement.offsetHeight - TOOLTIP_MARGIN_PIXELS);
|
|
344
|
+
const left = Math.min(mousePosition[0] + TOOLTIP_OFFSET_PIXELS, maxLeft);
|
|
345
|
+
const top = Math.min(mousePosition[1] + TOOLTIP_OFFSET_PIXELS, maxTop);
|
|
346
|
+
tooltipElement.style.left = `${Math.max(TOOLTIP_MARGIN_PIXELS, left)}px`;
|
|
347
|
+
tooltipElement.style.top = `${Math.max(TOOLTIP_MARGIN_PIXELS, top)}px`;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
351
|
+
0 && (module.exports = {
|
|
352
|
+
COLOR_PICKING_MAX_BATCH_INDEX,
|
|
353
|
+
COLOR_PICKING_MAX_OBJECT_INDEX,
|
|
354
|
+
PickingManager,
|
|
355
|
+
decodeColorPickInfo,
|
|
356
|
+
decodeIndexPickInfo,
|
|
357
|
+
resolvePickingBackend,
|
|
358
|
+
resolvePickingMode,
|
|
359
|
+
supportsIndexPicking
|
|
360
|
+
});
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var picking_uniforms_exports = {};
|
|
19
|
+
__export(picking_uniforms_exports, {
|
|
20
|
+
GLSL_UNIFORMS: () => GLSL_UNIFORMS,
|
|
21
|
+
INVALID_INDEX: () => INVALID_INDEX,
|
|
22
|
+
WGSL_UNIFORMS: () => WGSL_UNIFORMS,
|
|
23
|
+
pickingUniforms: () => pickingUniforms
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(picking_uniforms_exports);
|
|
26
|
+
const DEFAULT_HIGHLIGHT_COLOR = [0, 1, 1, 1];
|
|
27
|
+
const INVALID_INDEX = -1;
|
|
28
|
+
const uniformTypes = {
|
|
29
|
+
isActive: "i32",
|
|
30
|
+
indexMode: "i32",
|
|
31
|
+
batchIndex: "i32",
|
|
32
|
+
isHighlightActive: "i32",
|
|
33
|
+
highlightedBatchIndex: "i32",
|
|
34
|
+
highlightedObjectIndex: "i32",
|
|
35
|
+
highlightColor: "vec4<f32>"
|
|
36
|
+
};
|
|
37
|
+
const GLSL_UNIFORMS = (
|
|
38
|
+
/* glsl */
|
|
39
|
+
`precision highp float;
|
|
40
|
+
precision highp int;
|
|
41
|
+
|
|
42
|
+
layout(std140) uniform pickingUniforms {
|
|
43
|
+
int isActive;
|
|
44
|
+
int indexMode;
|
|
45
|
+
int batchIndex;
|
|
46
|
+
|
|
47
|
+
int isHighlightActive;
|
|
48
|
+
int highlightedBatchIndex;
|
|
49
|
+
int highlightedObjectIndex;
|
|
50
|
+
vec4 highlightColor;
|
|
51
|
+
} picking;
|
|
52
|
+
`
|
|
53
|
+
);
|
|
54
|
+
const WGSL_UNIFORMS = (
|
|
55
|
+
/* wgsl */
|
|
56
|
+
`struct pickingUniforms {
|
|
57
|
+
isActive: i32,
|
|
58
|
+
indexMode: i32,
|
|
59
|
+
batchIndex: i32,
|
|
60
|
+
|
|
61
|
+
isHighlightActive: i32,
|
|
62
|
+
highlightedBatchIndex: i32,
|
|
63
|
+
highlightedObjectIndex: i32,
|
|
64
|
+
highlightColor: vec4<f32>,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
@group(0) @binding(auto) var<uniform> picking: pickingUniforms;
|
|
68
|
+
`
|
|
69
|
+
);
|
|
70
|
+
function getUniforms(props = {}, prevUniforms) {
|
|
71
|
+
const uniforms = { ...prevUniforms };
|
|
72
|
+
if (props.isActive !== void 0) {
|
|
73
|
+
uniforms.isActive = Boolean(props.isActive);
|
|
74
|
+
}
|
|
75
|
+
switch (props.indexMode) {
|
|
76
|
+
case "instance":
|
|
77
|
+
uniforms.indexMode = 0;
|
|
78
|
+
break;
|
|
79
|
+
case "attribute":
|
|
80
|
+
uniforms.indexMode = 1;
|
|
81
|
+
break;
|
|
82
|
+
case "vertex":
|
|
83
|
+
uniforms.indexMode = 2;
|
|
84
|
+
break;
|
|
85
|
+
case void 0:
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
if (typeof props.batchIndex === "number") {
|
|
89
|
+
uniforms.batchIndex = props.batchIndex;
|
|
90
|
+
}
|
|
91
|
+
switch (props.highlightedObjectIndex) {
|
|
92
|
+
case void 0:
|
|
93
|
+
break;
|
|
94
|
+
case null:
|
|
95
|
+
uniforms.isHighlightActive = false;
|
|
96
|
+
uniforms.highlightedObjectIndex = INVALID_INDEX;
|
|
97
|
+
break;
|
|
98
|
+
default:
|
|
99
|
+
uniforms.isHighlightActive = true;
|
|
100
|
+
uniforms.highlightedObjectIndex = props.highlightedObjectIndex;
|
|
101
|
+
}
|
|
102
|
+
switch (props.highlightedBatchIndex) {
|
|
103
|
+
case void 0:
|
|
104
|
+
break;
|
|
105
|
+
case null:
|
|
106
|
+
uniforms.isHighlightActive = false;
|
|
107
|
+
uniforms.highlightedBatchIndex = INVALID_INDEX;
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
uniforms.isHighlightActive = true;
|
|
111
|
+
uniforms.highlightedBatchIndex = props.highlightedBatchIndex;
|
|
112
|
+
}
|
|
113
|
+
if (props.highlightColor) {
|
|
114
|
+
uniforms.highlightColor = props.highlightColor;
|
|
115
|
+
}
|
|
116
|
+
return uniforms;
|
|
117
|
+
}
|
|
118
|
+
const pickingUniforms = {
|
|
119
|
+
props: {},
|
|
120
|
+
uniforms: {},
|
|
121
|
+
name: "picking",
|
|
122
|
+
uniformTypes,
|
|
123
|
+
defaultUniforms: {
|
|
124
|
+
isActive: false,
|
|
125
|
+
indexMode: 0,
|
|
126
|
+
batchIndex: 0,
|
|
127
|
+
isHighlightActive: false,
|
|
128
|
+
highlightedBatchIndex: INVALID_INDEX,
|
|
129
|
+
highlightedObjectIndex: INVALID_INDEX,
|
|
130
|
+
highlightColor: DEFAULT_HIGHLIGHT_COLOR
|
|
131
|
+
},
|
|
132
|
+
getUniforms
|
|
133
|
+
};
|
|
134
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
135
|
+
0 && (module.exports = {
|
|
136
|
+
GLSL_UNIFORMS,
|
|
137
|
+
INVALID_INDEX,
|
|
138
|
+
WGSL_UNIFORMS,
|
|
139
|
+
pickingUniforms
|
|
140
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"picking-uniforms.d.ts","sourceRoot":"","sources":["../../../src/modules/picking/picking-uniforms.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"picking-uniforms.d.ts","sourceRoot":"","sources":["../../../src/modules/picking/picking-uniforms.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAMhD,eAAO,MAAM,aAAa,KAAK,CAAC;AAChC,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,CAAC;AAErE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wFAAwF;IACxF,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,0CAA0C;IAC1C,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,uEAAuE;IACvE,sBAAsB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,sDAAsD;IACtD,cAAc,CAAC,EAAE,YAAY,CAAC;CAC/B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB,2FAA2F;IAC3F,SAAS,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACrB,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IAEnB,qCAAqC;IACrC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,gGAAgG;IAChG,cAAc,EAAE,YAAY,CAAC;IAC7B,6DAA6D;IAC7D,qBAAqB,EAAE,MAAM,CAAC;IAC9B,6DAA6D;IAC7D,sBAAsB,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,EAAE,CAAC;AAejC,eAAO,MAAM,aAAa,kRAczB,CAAC;AAEF,eAAO,MAAM,aAAa,yRAazB,CAAC;AAEF,iBAAS,WAAW,CAAC,KAAK,GAAE,YAAiB,EAAE,YAAY,CAAC,EAAE,eAAe,GAAG,eAAe,CA0D9F;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe;oBACb,YAAY;uBACT,eAAe;;;;;;;;;;;;;CAgBgD,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var picking_exports = {};
|
|
19
|
+
__export(picking_exports, {
|
|
20
|
+
getIndexPickingModule: () => getIndexPickingModule,
|
|
21
|
+
picking: () => picking
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(picking_exports);
|
|
24
|
+
var import_picking_uniforms = require("./picking-uniforms.cjs");
|
|
25
|
+
var import_color_picking = require("./color-picking.cjs");
|
|
26
|
+
var import_index_color_picking = require("./index-color-picking.cjs");
|
|
27
|
+
var import_index_picking = require("./index-picking.cjs");
|
|
28
|
+
var import_picking_manager = require("./picking-manager.cjs");
|
|
29
|
+
const picking = {
|
|
30
|
+
...import_picking_uniforms.pickingUniforms,
|
|
31
|
+
name: "picking",
|
|
32
|
+
source: import_index_picking.picking.source,
|
|
33
|
+
vs: import_color_picking.picking.vs,
|
|
34
|
+
fs: import_color_picking.picking.fs
|
|
35
|
+
};
|
|
36
|
+
function getIndexPickingModule(device) {
|
|
37
|
+
return (0, import_picking_manager.supportsIndexPicking)(device) ? import_index_picking.picking : import_index_color_picking.picking;
|
|
38
|
+
}
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
getIndexPickingModule,
|
|
42
|
+
picking
|
|
43
|
+
});
|
|
@@ -20,7 +20,7 @@ export declare const picking: {
|
|
|
20
20
|
readonly isHighlightActive: false;
|
|
21
21
|
readonly highlightedBatchIndex: -1;
|
|
22
22
|
readonly highlightedObjectIndex: -1;
|
|
23
|
-
readonly highlightColor: import("@math.gl/
|
|
23
|
+
readonly highlightColor: import("@math.gl/core").NumberArray4;
|
|
24
24
|
};
|
|
25
25
|
readonly getUniforms: (props?: PickingProps, prevUniforms?: PickingUniforms) => PickingUniforms;
|
|
26
26
|
};
|