@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
|
@@ -0,0 +1,95 @@
|
|
|
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 physics_transforms_exports = {};
|
|
19
|
+
__export(physics_transforms_exports, {
|
|
20
|
+
decomposePhysicsTransform: () => decomposePhysicsTransform,
|
|
21
|
+
readPhysicsRotation: () => readPhysicsRotation,
|
|
22
|
+
readPhysicsVector: () => readPhysicsVector,
|
|
23
|
+
transformPhysicsVector: () => transformPhysicsVector
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(physics_transforms_exports);
|
|
26
|
+
var import_core = require("@math.gl/core");
|
|
27
|
+
function readPhysicsVector(value, fallback) {
|
|
28
|
+
if (value === void 0)
|
|
29
|
+
return [...fallback];
|
|
30
|
+
if (!Array.isArray(value) || value.length !== 3 || !value.every(Number.isFinite))
|
|
31
|
+
throw new Error("Expected a finite three-component vector");
|
|
32
|
+
return [value[0], value[1], value[2]];
|
|
33
|
+
}
|
|
34
|
+
function readPhysicsRotation(value) {
|
|
35
|
+
if (value === void 0)
|
|
36
|
+
return [0, 0, 0, 1];
|
|
37
|
+
if (!Array.isArray(value) || value.length !== 4 || !value.every(Number.isFinite))
|
|
38
|
+
throw new Error("Expected a finite quaternion");
|
|
39
|
+
const length = Math.hypot(...value);
|
|
40
|
+
if (length === 0)
|
|
41
|
+
throw new Error("Quaternion must be nonzero");
|
|
42
|
+
return [value[0] / length, value[1] / length, value[2] / length, value[3] / length];
|
|
43
|
+
}
|
|
44
|
+
function transformPhysicsVector(matrix, vector, point = false) {
|
|
45
|
+
const result = point ? matrix.transformAsPoint(vector) : matrix.transformAsVector(vector);
|
|
46
|
+
return [result[0], result[1], result[2]];
|
|
47
|
+
}
|
|
48
|
+
function decomposePhysicsTransform(matrix) {
|
|
49
|
+
if (!matrix.every(Number.isFinite) || Math.abs(matrix[3]) + Math.abs(matrix[7]) + Math.abs(matrix[11]) > 1e-7 || Math.abs(matrix[15] - 1) > 1e-7)
|
|
50
|
+
throw new Error("Expected an affine transform");
|
|
51
|
+
const scale = [
|
|
52
|
+
Math.hypot(matrix[0], matrix[1], matrix[2]),
|
|
53
|
+
Math.hypot(matrix[4], matrix[5], matrix[6]),
|
|
54
|
+
Math.hypot(matrix[8], matrix[9], matrix[10])
|
|
55
|
+
];
|
|
56
|
+
if (scale.every((value) => value === 0))
|
|
57
|
+
return { position: [matrix[12], matrix[13], matrix[14]], rotation: [0, 0, 0, 1], scale };
|
|
58
|
+
if (scale.some((value) => value < 1e-10))
|
|
59
|
+
throw new Error("Singular collider transforms are unsupported");
|
|
60
|
+
if (matrix.determinant() < 0)
|
|
61
|
+
scale[0] = -scale[0];
|
|
62
|
+
const axes = [
|
|
63
|
+
matrix[0] / scale[0],
|
|
64
|
+
matrix[1] / scale[0],
|
|
65
|
+
matrix[2] / scale[0],
|
|
66
|
+
matrix[4] / scale[1],
|
|
67
|
+
matrix[5] / scale[1],
|
|
68
|
+
matrix[6] / scale[1],
|
|
69
|
+
matrix[8] / scale[2],
|
|
70
|
+
matrix[9] / scale[2],
|
|
71
|
+
matrix[10] / scale[2]
|
|
72
|
+
];
|
|
73
|
+
for (const [first, second] of [
|
|
74
|
+
[0, 1],
|
|
75
|
+
[0, 2],
|
|
76
|
+
[1, 2]
|
|
77
|
+
]) {
|
|
78
|
+
const product = axes[first * 3] * axes[second * 3] + axes[first * 3 + 1] * axes[second * 3 + 1] + axes[first * 3 + 2] * axes[second * 3 + 2];
|
|
79
|
+
if (Math.abs(product) > 1e-5)
|
|
80
|
+
throw new Error("Sheared collider transforms are unsupported");
|
|
81
|
+
}
|
|
82
|
+
const quaternion = new import_core.Quaternion().fromMatrix3(axes).normalize();
|
|
83
|
+
return {
|
|
84
|
+
position: [matrix[12], matrix[13], matrix[14]],
|
|
85
|
+
rotation: [quaternion[0], quaternion[1], quaternion[2], quaternion[3]],
|
|
86
|
+
scale
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
90
|
+
0 && (module.exports = {
|
|
91
|
+
decomposePhysicsTransform,
|
|
92
|
+
readPhysicsRotation,
|
|
93
|
+
readPhysicsVector,
|
|
94
|
+
transformPhysicsVector
|
|
95
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Matrix4 } from '@math.gl/core';
|
|
2
|
+
export type PhysicsVector = [number, number, number];
|
|
3
|
+
export type PhysicsRotation = [number, number, number, number];
|
|
4
|
+
export declare function readPhysicsVector(value: unknown, fallback: PhysicsVector): PhysicsVector;
|
|
5
|
+
export declare function readPhysicsRotation(value: unknown): PhysicsRotation;
|
|
6
|
+
export declare function transformPhysicsVector(matrix: Matrix4, vector: readonly number[], point?: boolean): PhysicsVector;
|
|
7
|
+
/** Resolve affine TRS; reflection stays in signed scale and shear is rejected. */
|
|
8
|
+
export declare function decomposePhysicsTransform(matrix: Matrix4): {
|
|
9
|
+
position: PhysicsVector;
|
|
10
|
+
rotation: PhysicsRotation;
|
|
11
|
+
scale: PhysicsVector;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=physics-transforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"physics-transforms.d.ts","sourceRoot":"","sources":["../../src/scenegraph/physics-transforms.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,OAAO,EAAa,MAAM,eAAe,CAAC;AAElD,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACrD,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,GAAG,aAAa,CAKxF;AACD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAOnE;AACD,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,KAAK,UAAQ,GACZ,aAAa,CAGf;AACD,kFAAkF;AAClF,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,OAAO,GAAG;IAC1D,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,aAAa,CAAC;CACtB,CA6CA"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
import { Quaternion } from '@math.gl/core';
|
|
5
|
+
export function readPhysicsVector(value, fallback) {
|
|
6
|
+
if (value === undefined)
|
|
7
|
+
return [...fallback];
|
|
8
|
+
if (!Array.isArray(value) || value.length !== 3 || !value.every(Number.isFinite))
|
|
9
|
+
throw new Error('Expected a finite three-component vector');
|
|
10
|
+
return [value[0], value[1], value[2]];
|
|
11
|
+
}
|
|
12
|
+
export function readPhysicsRotation(value) {
|
|
13
|
+
if (value === undefined)
|
|
14
|
+
return [0, 0, 0, 1];
|
|
15
|
+
if (!Array.isArray(value) || value.length !== 4 || !value.every(Number.isFinite))
|
|
16
|
+
throw new Error('Expected a finite quaternion');
|
|
17
|
+
const length = Math.hypot(...value);
|
|
18
|
+
if (length === 0)
|
|
19
|
+
throw new Error('Quaternion must be nonzero');
|
|
20
|
+
return [value[0] / length, value[1] / length, value[2] / length, value[3] / length];
|
|
21
|
+
}
|
|
22
|
+
export function transformPhysicsVector(matrix, vector, point = false) {
|
|
23
|
+
const result = point ? matrix.transformAsPoint(vector) : matrix.transformAsVector(vector);
|
|
24
|
+
return [result[0], result[1], result[2]];
|
|
25
|
+
}
|
|
26
|
+
/** Resolve affine TRS; reflection stays in signed scale and shear is rejected. */
|
|
27
|
+
export function decomposePhysicsTransform(matrix) {
|
|
28
|
+
if (!matrix.every(Number.isFinite) ||
|
|
29
|
+
Math.abs(matrix[3]) + Math.abs(matrix[7]) + Math.abs(matrix[11]) > 1e-7 ||
|
|
30
|
+
Math.abs(matrix[15] - 1) > 1e-7)
|
|
31
|
+
throw new Error('Expected an affine transform');
|
|
32
|
+
const scale = [
|
|
33
|
+
Math.hypot(matrix[0], matrix[1], matrix[2]),
|
|
34
|
+
Math.hypot(matrix[4], matrix[5], matrix[6]),
|
|
35
|
+
Math.hypot(matrix[8], matrix[9], matrix[10])
|
|
36
|
+
];
|
|
37
|
+
if (scale.every(value => value === 0))
|
|
38
|
+
return { position: [matrix[12], matrix[13], matrix[14]], rotation: [0, 0, 0, 1], scale };
|
|
39
|
+
if (scale.some(value => value < 1e-10))
|
|
40
|
+
throw new Error('Singular collider transforms are unsupported');
|
|
41
|
+
if (matrix.determinant() < 0)
|
|
42
|
+
scale[0] = -scale[0];
|
|
43
|
+
const axes = [
|
|
44
|
+
matrix[0] / scale[0],
|
|
45
|
+
matrix[1] / scale[0],
|
|
46
|
+
matrix[2] / scale[0],
|
|
47
|
+
matrix[4] / scale[1],
|
|
48
|
+
matrix[5] / scale[1],
|
|
49
|
+
matrix[6] / scale[1],
|
|
50
|
+
matrix[8] / scale[2],
|
|
51
|
+
matrix[9] / scale[2],
|
|
52
|
+
matrix[10] / scale[2]
|
|
53
|
+
];
|
|
54
|
+
for (const [first, second] of [
|
|
55
|
+
[0, 1],
|
|
56
|
+
[0, 2],
|
|
57
|
+
[1, 2]
|
|
58
|
+
]) {
|
|
59
|
+
const product = axes[first * 3] * axes[second * 3] +
|
|
60
|
+
axes[first * 3 + 1] * axes[second * 3 + 1] +
|
|
61
|
+
axes[first * 3 + 2] * axes[second * 3 + 2];
|
|
62
|
+
if (Math.abs(product) > 1e-5)
|
|
63
|
+
throw new Error('Sheared collider transforms are unsupported');
|
|
64
|
+
}
|
|
65
|
+
const quaternion = new Quaternion().fromMatrix3(axes).normalize();
|
|
66
|
+
return {
|
|
67
|
+
position: [matrix[12], matrix[13], matrix[14]],
|
|
68
|
+
rotation: [quaternion[0], quaternion[1], quaternion[2], quaternion[3]],
|
|
69
|
+
scale
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=physics-transforms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"physics-transforms.js","sourceRoot":"","sources":["../../src/scenegraph/physics-transforms.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 published_transforms_exports = {};
|
|
19
|
+
__export(published_transforms_exports, {
|
|
20
|
+
publishedTransforms: () => publishedTransforms
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(published_transforms_exports);
|
|
23
|
+
const publishedTransforms = {
|
|
24
|
+
name: "publishedTransforms",
|
|
25
|
+
uniformTypes: { bodyIndex: "i32", viewProjection: "mat4x4<f32>" },
|
|
26
|
+
defaultUniforms: { bodyIndex: -1 },
|
|
27
|
+
source: `
|
|
28
|
+
struct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}
|
|
29
|
+
@group(0) @binding(auto) var<uniform> publishedTransforms:PublishedTransforms;
|
|
30
|
+
@group(0) @binding(auto) var<storage,read> publishedBodyMatrices:array<mat4x4f>;
|
|
31
|
+
`,
|
|
32
|
+
bindingLayout: [{ name: "publishedBodyMatrices", group: 0 }]
|
|
33
|
+
};
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
publishedTransforms
|
|
37
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Borrowed rigid transforms, published by a GPU producer before rendering. */
|
|
2
|
+
export declare const publishedTransforms: {
|
|
3
|
+
readonly name: "publishedTransforms";
|
|
4
|
+
readonly uniformTypes: {
|
|
5
|
+
readonly bodyIndex: "i32";
|
|
6
|
+
readonly viewProjection: "mat4x4<f32>";
|
|
7
|
+
};
|
|
8
|
+
readonly defaultUniforms: {
|
|
9
|
+
readonly bodyIndex: -1;
|
|
10
|
+
};
|
|
11
|
+
readonly source: "\nstruct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}\n@group(0) @binding(auto) var<uniform> publishedTransforms:PublishedTransforms;\n@group(0) @binding(auto) var<storage,read> publishedBodyMatrices:array<mat4x4f>;\n";
|
|
12
|
+
readonly bindingLayout: readonly [{
|
|
13
|
+
readonly name: "publishedBodyMatrices";
|
|
14
|
+
readonly group: 0;
|
|
15
|
+
}];
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=published-transforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"published-transforms.d.ts","sourceRoot":"","sources":["../../src/scenegraph/published-transforms.ts"],"names":[],"mappings":"AAMA,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;CAUC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
/** Borrowed rigid transforms, published by a GPU producer before rendering. */
|
|
5
|
+
export const publishedTransforms = {
|
|
6
|
+
name: 'publishedTransforms',
|
|
7
|
+
uniformTypes: { bodyIndex: 'i32', viewProjection: 'mat4x4<f32>' },
|
|
8
|
+
defaultUniforms: { bodyIndex: -1 },
|
|
9
|
+
source: `
|
|
10
|
+
struct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}
|
|
11
|
+
@group(0) @binding(auto) var<uniform> publishedTransforms:PublishedTransforms;
|
|
12
|
+
@group(0) @binding(auto) var<storage,read> publishedBodyMatrices:array<mat4x4f>;
|
|
13
|
+
`,
|
|
14
|
+
bindingLayout: [{ name: 'publishedBodyMatrices', group: 0 }]
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=published-transforms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"published-transforms.js","sourceRoot":"","sources":["../../src/scenegraph/published-transforms.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAI5D,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,qBAAqB;IAC3B,YAAY,EAAE,EAAC,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE,aAAa,EAAC;IAC/D,eAAe,EAAE,EAAC,SAAS,EAAE,CAAC,CAAC,EAAC;IAChC,MAAM,EAAE;;;;CAIT;IACC,aAAa,EAAE,CAAC,EAAC,IAAI,EAAE,uBAAuB,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC;CAC3B,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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 scenegraph_bounds_exports = {};
|
|
19
|
+
__export(scenegraph_bounds_exports, {
|
|
20
|
+
areScenegraphBoundsDefined: () => areScenegraphBoundsDefined,
|
|
21
|
+
expandScenegraphBounds: () => expandScenegraphBounds,
|
|
22
|
+
makeEmptyScenegraphBounds: () => makeEmptyScenegraphBounds
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(scenegraph_bounds_exports);
|
|
25
|
+
var import_core = require("@math.gl/core");
|
|
26
|
+
function makeEmptyScenegraphBounds() {
|
|
27
|
+
return [
|
|
28
|
+
[Infinity, Infinity, Infinity],
|
|
29
|
+
[-Infinity, -Infinity, -Infinity]
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
function expandScenegraphBounds(targetBounds, sourceBounds, transform) {
|
|
33
|
+
const transformMatrix = new import_core.Matrix4(transform);
|
|
34
|
+
for (let cornerIndex = 0; cornerIndex < 8; cornerIndex++) {
|
|
35
|
+
const corner = new import_core.Vector3(sourceBounds[cornerIndex & 1 ? 1 : 0][0], sourceBounds[cornerIndex & 2 ? 1 : 0][1], sourceBounds[cornerIndex & 4 ? 1 : 0][2]);
|
|
36
|
+
transformMatrix.transformAsPoint(corner, corner);
|
|
37
|
+
for (let componentIndex = 0; componentIndex < 3; componentIndex++) {
|
|
38
|
+
targetBounds[0][componentIndex] = Math.min(targetBounds[0][componentIndex], corner[componentIndex]);
|
|
39
|
+
targetBounds[1][componentIndex] = Math.max(targetBounds[1][componentIndex], corner[componentIndex]);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function areScenegraphBoundsDefined(bounds) {
|
|
44
|
+
return Number.isFinite(bounds[0][0]);
|
|
45
|
+
}
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
areScenegraphBoundsDefined,
|
|
49
|
+
expandScenegraphBounds,
|
|
50
|
+
makeEmptyScenegraphBounds
|
|
51
|
+
});
|
|
@@ -0,0 +1,182 @@
|
|
|
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 scenegraph_node_exports = {};
|
|
19
|
+
__export(scenegraph_node_exports, {
|
|
20
|
+
ScenegraphNode: () => ScenegraphNode
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(scenegraph_node_exports);
|
|
23
|
+
var import_core = require("@math.gl/core");
|
|
24
|
+
var import_uid = require("../utils/uid.cjs");
|
|
25
|
+
function assert(condition, message) {
|
|
26
|
+
if (!condition) {
|
|
27
|
+
throw new Error(message);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
class ScenegraphNode {
|
|
31
|
+
id;
|
|
32
|
+
matrix = new import_core.Matrix4();
|
|
33
|
+
display = true;
|
|
34
|
+
position = new import_core.Vector3();
|
|
35
|
+
rotation = new import_core.Vector3();
|
|
36
|
+
scale = new import_core.Vector3(1, 1, 1);
|
|
37
|
+
userData = {};
|
|
38
|
+
props = {};
|
|
39
|
+
constructor(props = {}) {
|
|
40
|
+
const { id } = props;
|
|
41
|
+
this.id = id || (0, import_uid.uid)(this.constructor.name);
|
|
42
|
+
this._setScenegraphNodeProps(props);
|
|
43
|
+
}
|
|
44
|
+
getBounds() {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
destroy() {
|
|
48
|
+
}
|
|
49
|
+
/** @deprecated use .destroy() */
|
|
50
|
+
delete() {
|
|
51
|
+
this.destroy();
|
|
52
|
+
}
|
|
53
|
+
setProps(props) {
|
|
54
|
+
this._setScenegraphNodeProps(props);
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
toString() {
|
|
58
|
+
return `{type: ScenegraphNode, id: ${this.id})}`;
|
|
59
|
+
}
|
|
60
|
+
setPosition(position) {
|
|
61
|
+
assert(position.length === 3, "setPosition requires vector argument");
|
|
62
|
+
this.position = position;
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
setRotation(rotation) {
|
|
66
|
+
assert(rotation.length === 3 || rotation.length === 4, "setRotation requires vector argument");
|
|
67
|
+
this.rotation = rotation;
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
setScale(scale) {
|
|
71
|
+
assert(scale.length === 3, "setScale requires vector argument");
|
|
72
|
+
this.scale = scale;
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
setMatrix(matrix, copyMatrix = true) {
|
|
76
|
+
if (copyMatrix) {
|
|
77
|
+
this.matrix.copy(matrix);
|
|
78
|
+
} else {
|
|
79
|
+
this.matrix = matrix;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
setMatrixComponents(components) {
|
|
83
|
+
const { position, rotation, scale, update = true } = components;
|
|
84
|
+
if (position) {
|
|
85
|
+
this.setPosition(position);
|
|
86
|
+
}
|
|
87
|
+
if (rotation) {
|
|
88
|
+
this.setRotation(rotation);
|
|
89
|
+
}
|
|
90
|
+
if (scale) {
|
|
91
|
+
this.setScale(scale);
|
|
92
|
+
}
|
|
93
|
+
if (update) {
|
|
94
|
+
this.updateMatrix();
|
|
95
|
+
}
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
updateMatrix() {
|
|
99
|
+
this.matrix.identity();
|
|
100
|
+
this.matrix.translate(this.position);
|
|
101
|
+
if (this.rotation.length === 4) {
|
|
102
|
+
const rotationMatrix = new import_core.Matrix4().fromQuaternion(this.rotation);
|
|
103
|
+
this.matrix.multiplyRight(rotationMatrix);
|
|
104
|
+
} else {
|
|
105
|
+
this.matrix.rotateXYZ(this.rotation);
|
|
106
|
+
}
|
|
107
|
+
this.matrix.scale(this.scale);
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
110
|
+
update({ position, rotation, scale } = {}) {
|
|
111
|
+
if (position) {
|
|
112
|
+
this.setPosition(position);
|
|
113
|
+
}
|
|
114
|
+
if (rotation) {
|
|
115
|
+
this.setRotation(rotation);
|
|
116
|
+
}
|
|
117
|
+
if (scale) {
|
|
118
|
+
this.setScale(scale);
|
|
119
|
+
}
|
|
120
|
+
this.updateMatrix();
|
|
121
|
+
return this;
|
|
122
|
+
}
|
|
123
|
+
getCoordinateUniforms(viewMatrix, modelMatrix) {
|
|
124
|
+
modelMatrix = modelMatrix || this.matrix;
|
|
125
|
+
const worldMatrix = new import_core.Matrix4(viewMatrix).multiplyRight(modelMatrix);
|
|
126
|
+
const worldInverse = worldMatrix.invert();
|
|
127
|
+
const worldInverseTranspose = worldInverse.transpose();
|
|
128
|
+
return {
|
|
129
|
+
viewMatrix,
|
|
130
|
+
modelMatrix,
|
|
131
|
+
objectMatrix: modelMatrix,
|
|
132
|
+
worldMatrix,
|
|
133
|
+
worldInverseMatrix: worldInverse,
|
|
134
|
+
worldInverseTransposeMatrix: worldInverseTranspose
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
// TODO - copied code, not yet vetted
|
|
138
|
+
/*
|
|
139
|
+
transform() {
|
|
140
|
+
if (!this.parent) {
|
|
141
|
+
this.endPosition.set(this.position);
|
|
142
|
+
this.endRotation.set(this.rotation);
|
|
143
|
+
this.endScale.set(this.scale);
|
|
144
|
+
} else {
|
|
145
|
+
const parent = this.parent;
|
|
146
|
+
this.endPosition.set(this.position.add(parent.endPosition));
|
|
147
|
+
this.endRotation.set(this.rotation.add(parent.endRotation));
|
|
148
|
+
this.endScale.set(this.scale.add(parent.endScale));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const ch = this.children;
|
|
152
|
+
for (let i = 0; i < ch.length; ++i) {
|
|
153
|
+
ch[i].transform();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return this;
|
|
157
|
+
}
|
|
158
|
+
*/
|
|
159
|
+
_setScenegraphNodeProps(props) {
|
|
160
|
+
if (props.display !== void 0) {
|
|
161
|
+
this.display = props.display;
|
|
162
|
+
}
|
|
163
|
+
if (props == null ? void 0 : props.position) {
|
|
164
|
+
this.setPosition(props.position);
|
|
165
|
+
}
|
|
166
|
+
if (props == null ? void 0 : props.rotation) {
|
|
167
|
+
this.setRotation(props.rotation);
|
|
168
|
+
}
|
|
169
|
+
if (props == null ? void 0 : props.scale) {
|
|
170
|
+
this.setScale(props.scale);
|
|
171
|
+
}
|
|
172
|
+
this.updateMatrix();
|
|
173
|
+
if (props == null ? void 0 : props.matrix) {
|
|
174
|
+
this.setMatrix(props.matrix);
|
|
175
|
+
}
|
|
176
|
+
Object.assign(this.props, props);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
180
|
+
0 && (module.exports = {
|
|
181
|
+
ScenegraphNode
|
|
182
|
+
});
|