@luma.gl/engine 10.0.0-alpha.3 → 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 +11517 -6015
- 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/edge-geometry.d.ts +3 -2
- package/dist/geometry/edge-geometry.d.ts.map +1 -1
- package/dist/geometry/edge-geometry.js.map +1 -1
- package/dist/geometry/geometry-primitives.cjs +189 -0
- package/dist/geometry/geometry-primitives.d.ts +60 -0
- package/dist/geometry/geometry-primitives.d.ts.map +1 -0
- package/dist/geometry/geometry-primitives.js +161 -0
- package/dist/geometry/geometry-primitives.js.map +1 -0
- package/dist/geometry/geometry-table.cjs +15 -0
- package/dist/geometry/geometry-utils.cjs +147 -0
- package/dist/geometry/geometry-utils.d.ts +7 -15
- package/dist/geometry/geometry-utils.d.ts.map +1 -1
- package/dist/geometry/geometry-utils.js +9 -55
- package/dist/geometry/geometry-utils.js.map +1 -1
- package/dist/geometry/geometry.cjs +90 -0
- package/dist/geometry/geometry.d.ts +9 -69
- package/dist/geometry/geometry.d.ts.map +1 -1
- package/dist/geometry/geometry.js +27 -93
- package/dist/geometry/geometry.js.map +1 -1
- package/dist/geometry/gpu-geometry.cjs +130 -0
- package/dist/geometry/gpu-geometry.d.ts +4 -2
- package/dist/geometry/gpu-geometry.d.ts.map +1 -1
- package/dist/geometry/gpu-geometry.js +3 -3
- package/dist/geometry/gpu-geometry.js.map +1 -1
- 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 -10629
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +46 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -10
- 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 +22 -306
- 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/clip-space.d.ts +4 -1
- package/dist/models/clip-space.d.ts.map +1 -1
- package/dist/models/clip-space.js +16 -13
- package/dist/models/clip-space.js.map +1 -1
- package/dist/models/directional-light-model.cjs +45 -0
- package/dist/models/directional-light-model.js +1 -1
- package/dist/models/directional-light-model.js.map +1 -1
- package/dist/models/light-model-utils.cjs +426 -0
- package/dist/models/point-light-model.cjs +44 -0
- package/dist/models/point-light-model.js +1 -1
- package/dist/models/point-light-model.js.map +1 -1
- package/dist/models/spot-light-model.cjs +45 -0
- package/dist/models/spot-light-model.js +1 -1
- package/dist/models/spot-light-model.js.map +1 -1
- 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 +47 -8
- 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/edge-geometry.ts +7 -3
- package/src/geometry/geometry-primitives.ts +226 -0
- package/src/geometry/geometry-utils.ts +16 -71
- package/src/geometry/geometry.ts +36 -163
- package/src/geometry/gpu-geometry.ts +9 -4
- 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 +144 -27
- 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/models/clip-space.ts +21 -14
- package/src/models/directional-light-model.ts +1 -1
- package/src/models/point-light-model.ts +1 -1
- package/src/models/spot-light-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/dist/geometries/cone-geometry.d.ts +0 -12
- package/dist/geometries/cone-geometry.d.ts.map +0 -1
- package/dist/geometries/cone-geometry.js +0 -19
- package/dist/geometries/cone-geometry.js.map +0 -1
- package/dist/geometries/cube-geometry.d.ts +0 -14
- package/dist/geometries/cube-geometry.d.ts.map +0 -1
- package/dist/geometries/cube-geometry.js +0 -222
- package/dist/geometries/cube-geometry.js.map +0 -1
- package/dist/geometries/cylinder-geometry.d.ts +0 -11
- package/dist/geometries/cylinder-geometry.d.ts.map +0 -1
- package/dist/geometries/cylinder-geometry.js +0 -17
- package/dist/geometries/cylinder-geometry.js.map +0 -1
- package/dist/geometries/ico-sphere-geometry.d.ts +0 -11
- package/dist/geometries/ico-sphere-geometry.d.ts.map +0 -1
- package/dist/geometries/ico-sphere-geometry.js +0 -158
- package/dist/geometries/ico-sphere-geometry.js.map +0 -1
- package/dist/geometries/plane-geometry.d.ts +0 -20
- package/dist/geometries/plane-geometry.d.ts.map +0 -1
- package/dist/geometries/plane-geometry.js +0 -106
- package/dist/geometries/plane-geometry.js.map +0 -1
- package/dist/geometries/sphere-geometry.d.ts +0 -12
- package/dist/geometries/sphere-geometry.d.ts.map +0 -1
- package/dist/geometries/sphere-geometry.js +0 -88
- package/dist/geometries/sphere-geometry.js.map +0 -1
- package/dist/geometries/truncated-cone-geometry.d.ts +0 -23
- package/dist/geometries/truncated-cone-geometry.d.ts.map +0 -1
- package/dist/geometries/truncated-cone-geometry.js +0 -112
- package/dist/geometries/truncated-cone-geometry.js.map +0 -1
- package/src/compute/kernel.ts +0 -146
- package/src/compute/render-kernel.ts +0 -192
- package/src/geometries/cone-geometry.ts +0 -31
- package/src/geometries/cube-geometry.ts +0 -258
- package/src/geometries/cylinder-geometry.ts +0 -28
- package/src/geometries/ico-sphere-geometry.ts +0 -193
- package/src/geometries/plane-geometry.ts +0 -142
- package/src/geometries/sphere-geometry.ts +0 -113
- package/src/geometries/truncated-cone-geometry.ts +0 -145
|
@@ -0,0 +1,112 @@
|
|
|
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_publication_exports = {};
|
|
19
|
+
__export(scenegraph_publication_exports, {
|
|
20
|
+
ScenegraphPhysicsPublication: () => ScenegraphPhysicsPublication
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(scenegraph_publication_exports);
|
|
23
|
+
var import_core = require("@math.gl/core");
|
|
24
|
+
var import__ = require("../../index.cjs");
|
|
25
|
+
class ScenegraphPhysicsPublication {
|
|
26
|
+
world;
|
|
27
|
+
roots;
|
|
28
|
+
bodies;
|
|
29
|
+
bindings = /* @__PURE__ */ new Map();
|
|
30
|
+
boundsKey = "";
|
|
31
|
+
constructor(world, roots, bodies) {
|
|
32
|
+
this.world = world;
|
|
33
|
+
this.roots = roots;
|
|
34
|
+
this.bodies = bodies;
|
|
35
|
+
if (!world.poseMatrices || !world.poseBounds)
|
|
36
|
+
throw new Error("Scene publication requires pose and bounds buffers");
|
|
37
|
+
this.update();
|
|
38
|
+
}
|
|
39
|
+
get matrices() {
|
|
40
|
+
return this.world.poseMatrices;
|
|
41
|
+
}
|
|
42
|
+
get bounds() {
|
|
43
|
+
return this.world.poseBounds;
|
|
44
|
+
}
|
|
45
|
+
/** Include instance/deformation bounds supplied by the engine renderer. */
|
|
46
|
+
update() {
|
|
47
|
+
const bounds = Array.from({ length: this.world.count }, () => [
|
|
48
|
+
[Infinity, Infinity, Infinity],
|
|
49
|
+
[-Infinity, -Infinity, -Infinity]
|
|
50
|
+
]);
|
|
51
|
+
const bindings = /* @__PURE__ */ new Map();
|
|
52
|
+
const seen = /* @__PURE__ */ new Set();
|
|
53
|
+
const visit = (node, parent, inheritedBody, inheritedInverse, visible = true) => {
|
|
54
|
+
if (seen.has(node))
|
|
55
|
+
throw new Error("Physics publication scene must be a tree");
|
|
56
|
+
seen.add(node);
|
|
57
|
+
const matrix = new import_core.Matrix4(parent).multiplyRight(node.matrix);
|
|
58
|
+
const body = this.bodies.get(node) ?? inheritedBody;
|
|
59
|
+
let inverse = inheritedInverse;
|
|
60
|
+
if (this.bodies.has(node)) {
|
|
61
|
+
const transform = (0, import__.decomposePhysicsTransform)(matrix);
|
|
62
|
+
inverse = new import_core.Matrix4().translate(transform.position).multiplyRight(new import_core.Matrix4().fromQuaternion(transform.rotation)).invert();
|
|
63
|
+
}
|
|
64
|
+
const displayed = visible && node.display;
|
|
65
|
+
if (body !== void 0 && inverse) {
|
|
66
|
+
const localMatrix = new import_core.Matrix4(inverse).multiplyRight(matrix);
|
|
67
|
+
if (!Number.isInteger(body) || body < 0 || body >= this.world.count)
|
|
68
|
+
throw new Error("Invalid publication body");
|
|
69
|
+
bindings.set(node, { body, localMatrix, visible: displayed });
|
|
70
|
+
const localBounds = node instanceof import__.GroupNode ? null : node.getBounds();
|
|
71
|
+
if (localBounds && (localBounds.length !== 2 || localBounds.some((vector) => vector.length !== 3 || !vector.every(Number.isFinite))))
|
|
72
|
+
throw new Error("Invalid scene bounds");
|
|
73
|
+
if (localBounds)
|
|
74
|
+
for (let corner = 0; corner < 8; corner++) {
|
|
75
|
+
const point = localMatrix.transformAsPoint([
|
|
76
|
+
localBounds[corner & 1][0],
|
|
77
|
+
localBounds[corner >> 1 & 1][1],
|
|
78
|
+
localBounds[corner >> 2 & 1][2]
|
|
79
|
+
]);
|
|
80
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
81
|
+
bounds[body][0][axis] = Math.min(bounds[body][0][axis], point[axis]);
|
|
82
|
+
bounds[body][1][axis] = Math.max(bounds[body][1][axis], point[axis]);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (node instanceof import__.GroupNode)
|
|
87
|
+
for (const child of node.children)
|
|
88
|
+
visit(child, matrix, body, inverse, displayed);
|
|
89
|
+
};
|
|
90
|
+
for (const root of this.roots)
|
|
91
|
+
visit(root, new import_core.Matrix4());
|
|
92
|
+
const publicationBounds = bounds.map(([minimum, maximum]) => Number.isFinite(minimum[0]) ? [
|
|
93
|
+
[minimum[0], minimum[1], minimum[2]],
|
|
94
|
+
[maximum[0], maximum[1], maximum[2]]
|
|
95
|
+
] : [
|
|
96
|
+
[0, 0, 0],
|
|
97
|
+
[0, 0, 0]
|
|
98
|
+
]);
|
|
99
|
+
const key = JSON.stringify(publicationBounds);
|
|
100
|
+
if (key !== this.boundsKey) {
|
|
101
|
+
this.world.setPublicationBounds(publicationBounds);
|
|
102
|
+
this.boundsKey = key;
|
|
103
|
+
}
|
|
104
|
+
this.bindings.clear();
|
|
105
|
+
for (const [node, binding] of bindings)
|
|
106
|
+
this.bindings.set(node, binding);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
110
|
+
0 && (module.exports = {
|
|
111
|
+
ScenegraphPhysicsPublication
|
|
112
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Matrix4 } from '@math.gl/core';
|
|
2
|
+
import { type ScenegraphNode } from "../../index.js";
|
|
3
|
+
import type { GPURigidBodyWorld } from '@luma.gl/graph/gpu-physics';
|
|
4
|
+
export type ScenegraphPhysicsRenderBinding = {
|
|
5
|
+
body: number;
|
|
6
|
+
/** Mesh-to-body-node transform; multiply after the published GPU body matrix. */
|
|
7
|
+
localMatrix: Matrix4;
|
|
8
|
+
visible: boolean;
|
|
9
|
+
};
|
|
10
|
+
/** Authoring transforms feed GPU publication metadata; simulated poses never come back. */
|
|
11
|
+
export declare class ScenegraphPhysicsPublication {
|
|
12
|
+
readonly world: GPURigidBodyWorld;
|
|
13
|
+
readonly roots: readonly ScenegraphNode[];
|
|
14
|
+
readonly bodies: ReadonlyMap<ScenegraphNode, number>;
|
|
15
|
+
readonly bindings: Map<ScenegraphNode, ScenegraphPhysicsRenderBinding>;
|
|
16
|
+
private boundsKey;
|
|
17
|
+
constructor(world: GPURigidBodyWorld, roots: readonly ScenegraphNode[], bodies: ReadonlyMap<ScenegraphNode, number>);
|
|
18
|
+
get matrices(): import("@luma.gl/core").Buffer;
|
|
19
|
+
get bounds(): import("@luma.gl/core").Buffer;
|
|
20
|
+
/** Include instance/deformation bounds supplied by the engine renderer. */
|
|
21
|
+
update(): void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=scenegraph-publication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenegraph-publication.d.ts","sourceRoot":"","sources":["../../../src/graph/physics/scenegraph-publication.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAAuC,KAAK,cAAc,EAAC,uBAAoB;AACtF,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,4BAA4B,CAAC;AAGlE,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,2FAA2F;AAC3F,qBAAa,4BAA4B;IAIrC,QAAQ,CAAC,KAAK,EAAE,iBAAiB;IACjC,QAAQ,CAAC,KAAK,EAAE,SAAS,cAAc,EAAE;IACzC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,cAAc,EAAE,MAAM,CAAC;IALtD,QAAQ,CAAC,QAAQ,sDAA6D;IAC9E,OAAO,CAAC,SAAS,CAAM;gBAEZ,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,MAAM,EAAE,WAAW,CAAC,cAAc,EAAE,MAAM,CAAC;IAOtD,IAAI,QAAQ,mCAEX;IACD,IAAI,MAAM,mCAET;IAED,2EAA2E;IAC3E,MAAM,IAAI,IAAI;CA6Ef"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
import { Matrix4 } from '@math.gl/core';
|
|
5
|
+
import { GroupNode, decomposePhysicsTransform } from "../../index.js";
|
|
6
|
+
/** Authoring transforms feed GPU publication metadata; simulated poses never come back. */
|
|
7
|
+
export class ScenegraphPhysicsPublication {
|
|
8
|
+
world;
|
|
9
|
+
roots;
|
|
10
|
+
bodies;
|
|
11
|
+
bindings = new Map();
|
|
12
|
+
boundsKey = '';
|
|
13
|
+
constructor(world, roots, bodies) {
|
|
14
|
+
this.world = world;
|
|
15
|
+
this.roots = roots;
|
|
16
|
+
this.bodies = bodies;
|
|
17
|
+
if (!world.poseMatrices || !world.poseBounds)
|
|
18
|
+
throw new Error('Scene publication requires pose and bounds buffers');
|
|
19
|
+
this.update();
|
|
20
|
+
}
|
|
21
|
+
get matrices() {
|
|
22
|
+
return this.world.poseMatrices;
|
|
23
|
+
}
|
|
24
|
+
get bounds() {
|
|
25
|
+
return this.world.poseBounds;
|
|
26
|
+
}
|
|
27
|
+
/** Include instance/deformation bounds supplied by the engine renderer. */
|
|
28
|
+
update() {
|
|
29
|
+
const bounds = Array.from({ length: this.world.count }, () => [
|
|
30
|
+
[Infinity, Infinity, Infinity],
|
|
31
|
+
[-Infinity, -Infinity, -Infinity]
|
|
32
|
+
]);
|
|
33
|
+
const bindings = new Map();
|
|
34
|
+
const seen = new Set();
|
|
35
|
+
const visit = (node, parent, inheritedBody, inheritedInverse, visible = true) => {
|
|
36
|
+
if (seen.has(node))
|
|
37
|
+
throw new Error('Physics publication scene must be a tree');
|
|
38
|
+
seen.add(node);
|
|
39
|
+
const matrix = new Matrix4(parent).multiplyRight(node.matrix);
|
|
40
|
+
const body = this.bodies.get(node) ?? inheritedBody;
|
|
41
|
+
let inverse = inheritedInverse;
|
|
42
|
+
if (this.bodies.has(node)) {
|
|
43
|
+
const transform = decomposePhysicsTransform(matrix);
|
|
44
|
+
inverse = new Matrix4()
|
|
45
|
+
.translate(transform.position)
|
|
46
|
+
.multiplyRight(new Matrix4().fromQuaternion(transform.rotation))
|
|
47
|
+
.invert();
|
|
48
|
+
}
|
|
49
|
+
const displayed = visible && node.display;
|
|
50
|
+
if (body !== undefined && inverse) {
|
|
51
|
+
const localMatrix = new Matrix4(inverse).multiplyRight(matrix);
|
|
52
|
+
if (!Number.isInteger(body) || body < 0 || body >= this.world.count)
|
|
53
|
+
throw new Error('Invalid publication body');
|
|
54
|
+
bindings.set(node, { body, localMatrix, visible: displayed });
|
|
55
|
+
// Group bounds include descendants, which may belong to independent child bodies.
|
|
56
|
+
const localBounds = node instanceof GroupNode ? null : node.getBounds();
|
|
57
|
+
if (localBounds &&
|
|
58
|
+
(localBounds.length !== 2 ||
|
|
59
|
+
localBounds.some(vector => vector.length !== 3 || !vector.every(Number.isFinite))))
|
|
60
|
+
throw new Error('Invalid scene bounds');
|
|
61
|
+
if (localBounds)
|
|
62
|
+
for (let corner = 0; corner < 8; corner++) {
|
|
63
|
+
const point = localMatrix.transformAsPoint([
|
|
64
|
+
localBounds[corner & 1][0],
|
|
65
|
+
localBounds[(corner >> 1) & 1][1],
|
|
66
|
+
localBounds[(corner >> 2) & 1][2]
|
|
67
|
+
]);
|
|
68
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
69
|
+
bounds[body][0][axis] = Math.min(bounds[body][0][axis], point[axis]);
|
|
70
|
+
bounds[body][1][axis] = Math.max(bounds[body][1][axis], point[axis]);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (node instanceof GroupNode)
|
|
75
|
+
for (const child of node.children)
|
|
76
|
+
visit(child, matrix, body, inverse, displayed);
|
|
77
|
+
};
|
|
78
|
+
for (const root of this.roots)
|
|
79
|
+
visit(root, new Matrix4());
|
|
80
|
+
const publicationBounds = bounds.map(([minimum, maximum]) => Number.isFinite(minimum[0])
|
|
81
|
+
? [
|
|
82
|
+
[minimum[0], minimum[1], minimum[2]],
|
|
83
|
+
[maximum[0], maximum[1], maximum[2]]
|
|
84
|
+
]
|
|
85
|
+
: [
|
|
86
|
+
[0, 0, 0],
|
|
87
|
+
[0, 0, 0]
|
|
88
|
+
]);
|
|
89
|
+
const key = JSON.stringify(publicationBounds);
|
|
90
|
+
if (key !== this.boundsKey) {
|
|
91
|
+
this.world.setPublicationBounds(publicationBounds);
|
|
92
|
+
this.boundsKey = key;
|
|
93
|
+
}
|
|
94
|
+
this.bindings.clear();
|
|
95
|
+
for (const [node, binding] of bindings)
|
|
96
|
+
this.bindings.set(node, binding);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=scenegraph-publication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenegraph-publication.js","sourceRoot":"","sources":["../../../src/graph/physics/scenegraph-publication.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,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,CAAC,CAAC;IAC3E,CAAC;CACF"}
|
|
@@ -0,0 +1,256 @@
|
|
|
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_session_exports = {};
|
|
19
|
+
__export(scenegraph_session_exports, {
|
|
20
|
+
ScenegraphPhysicsSession: () => ScenegraphPhysicsSession
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(scenegraph_session_exports);
|
|
23
|
+
var import__ = require("../../index.cjs");
|
|
24
|
+
var import_scenegraph_instance = require("./scenegraph-instance.cjs");
|
|
25
|
+
var import_scenegraph_motion = require("./scenegraph-motion.cjs");
|
|
26
|
+
var import_scenegraph_publication = require("./scenegraph-publication.cjs");
|
|
27
|
+
var import_scenegraph_properties = require("./scenegraph-properties.cjs");
|
|
28
|
+
var import_scenegraph_behaviors = require("./scenegraph-behaviors.cjs");
|
|
29
|
+
class ScenegraphPhysicsSession {
|
|
30
|
+
device;
|
|
31
|
+
scene;
|
|
32
|
+
instance;
|
|
33
|
+
pending;
|
|
34
|
+
closing = false;
|
|
35
|
+
revisionValue = 0;
|
|
36
|
+
authored;
|
|
37
|
+
motion;
|
|
38
|
+
publication;
|
|
39
|
+
properties;
|
|
40
|
+
behaviors;
|
|
41
|
+
constructor(device, scene, instance) {
|
|
42
|
+
this.device = device;
|
|
43
|
+
this.scene = scene;
|
|
44
|
+
this.instance = instance;
|
|
45
|
+
this.authored = snapshotNodes(scene.roots);
|
|
46
|
+
const bindings = this.makeBindings();
|
|
47
|
+
this.motion = bindings.motion;
|
|
48
|
+
this.publication = bindings.publication;
|
|
49
|
+
this.properties = bindings.properties;
|
|
50
|
+
this.behaviors = bindings.behaviors;
|
|
51
|
+
}
|
|
52
|
+
static async create(device, scene) {
|
|
53
|
+
snapshotNodes(scene.roots);
|
|
54
|
+
const instance = await import_scenegraph_instance.ScenegraphPhysicsInstance.create(device, withPublication(scene.definition));
|
|
55
|
+
try {
|
|
56
|
+
const session = new ScenegraphPhysicsSession(device, scene, instance);
|
|
57
|
+
await instance.publish();
|
|
58
|
+
return session;
|
|
59
|
+
} catch (error) {
|
|
60
|
+
await instance.destroy();
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
get world() {
|
|
65
|
+
return this.instance.world;
|
|
66
|
+
}
|
|
67
|
+
get graph() {
|
|
68
|
+
return this.instance.graph;
|
|
69
|
+
}
|
|
70
|
+
/** Renderer/event bindings are borrowed for exactly one revision. */
|
|
71
|
+
get revision() {
|
|
72
|
+
return this.revisionValue;
|
|
73
|
+
}
|
|
74
|
+
makeBindings(world = this.world, scene = this.scene) {
|
|
75
|
+
var _a;
|
|
76
|
+
return {
|
|
77
|
+
motion: new import_scenegraph_motion.ScenegraphPhysicsMotion(world, scene.roots, scene.definition.bodies, scene.colliders),
|
|
78
|
+
publication: new import_scenegraph_publication.ScenegraphPhysicsPublication(world, scene.roots, scene.definition.bodies),
|
|
79
|
+
properties: ((_a = scene.properties) == null ? void 0 : _a.call(scene, world)) ?? new import_scenegraph_properties.ScenegraphPhysicsProperties(world, /* @__PURE__ */ new Map()),
|
|
80
|
+
behaviors: scene.behaviors ? new import_scenegraph_behaviors.ScenegraphPhysicsBehaviors(world, scene.behaviors) : void 0
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
refreshBindings(bindings) {
|
|
84
|
+
this.motion = bindings.motion;
|
|
85
|
+
this.publication = bindings.publication;
|
|
86
|
+
this.properties = bindings.properties;
|
|
87
|
+
this.behaviors = bindings.behaviors;
|
|
88
|
+
this.revisionValue++;
|
|
89
|
+
}
|
|
90
|
+
async exclusive(operation) {
|
|
91
|
+
if (this.pending || this.closing)
|
|
92
|
+
throw new Error("Physics session is busy or closed");
|
|
93
|
+
const pending = Promise.resolve().then(operation);
|
|
94
|
+
this.pending = pending;
|
|
95
|
+
try {
|
|
96
|
+
return await pending;
|
|
97
|
+
} finally {
|
|
98
|
+
this.pending = void 0;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/** Sample/blend first; declare active transform tracks, including paused tracks, explicitly. */
|
|
102
|
+
async step(animatedNodes = /* @__PURE__ */ new Set(), sample, encode) {
|
|
103
|
+
return this.exclusive(() => this.instance.advance(() => {
|
|
104
|
+
sample == null ? void 0 : sample();
|
|
105
|
+
this.motion.setAnimatedNodes(animatedNodes);
|
|
106
|
+
this.motion.update();
|
|
107
|
+
this.publication.update();
|
|
108
|
+
}, encode));
|
|
109
|
+
}
|
|
110
|
+
/** Queries and their continuations cannot outlive the world revision they borrow. */
|
|
111
|
+
async withWorld(operation) {
|
|
112
|
+
return this.exclusive(() => this.instance.withWorld(operation));
|
|
113
|
+
}
|
|
114
|
+
async capture() {
|
|
115
|
+
return this.exclusive(async () => ({
|
|
116
|
+
physics: await this.instance.capture(),
|
|
117
|
+
scene: this.scene,
|
|
118
|
+
authored: this.authored.map((state) => ({
|
|
119
|
+
...state,
|
|
120
|
+
matrix: [...state.matrix],
|
|
121
|
+
position: [...state.position],
|
|
122
|
+
rotation: [...state.rotation],
|
|
123
|
+
scale: [...state.scale],
|
|
124
|
+
children: state.children ? [...state.children] : void 0
|
|
125
|
+
})),
|
|
126
|
+
ownership: this.motion.captureOwnership(),
|
|
127
|
+
nodes: snapshotNodes(this.scene.roots)
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
async restore(capture) {
|
|
131
|
+
return this.exclusive(async () => {
|
|
132
|
+
validateNodes(capture.nodes, capture.scene.roots);
|
|
133
|
+
validateNodes(capture.authored, capture.scene.roots);
|
|
134
|
+
await this.replaceBindings(capture.nodes, (prepare) => this.instance.restore(capture.physics, prepare), capture.scene, (bindings) => bindings.motion.restoreOwnership(capture.ownership));
|
|
135
|
+
this.authored = capture.authored;
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
/** Restore authored physics and scene transforms, leaving external cameras alone. */
|
|
139
|
+
async reset() {
|
|
140
|
+
return this.exclusive(() => this.replaceBindings(this.authored, (prepare) => this.instance.reset(prepare)));
|
|
141
|
+
}
|
|
142
|
+
async replaceBindings(nodes, replace, scene = this.scene, prepareBindings) {
|
|
143
|
+
var _a;
|
|
144
|
+
const previousNodes = snapshotNodes(this.scene.roots);
|
|
145
|
+
await ((_a = this.behaviors) == null ? void 0 : _a.destroy());
|
|
146
|
+
let bindings;
|
|
147
|
+
try {
|
|
148
|
+
restoreNodes(nodes);
|
|
149
|
+
await replace((world) => {
|
|
150
|
+
bindings = this.makeBindings(world, scene);
|
|
151
|
+
prepareBindings == null ? void 0 : prepareBindings(bindings);
|
|
152
|
+
});
|
|
153
|
+
this.scene = scene;
|
|
154
|
+
this.refreshBindings(bindings);
|
|
155
|
+
} catch (error) {
|
|
156
|
+
restoreNodes(previousNodes);
|
|
157
|
+
this.behaviors = this.scene.behaviors ? new import_scenegraph_behaviors.ScenegraphPhysicsBehaviors(this.world, this.scene.behaviors) : void 0;
|
|
158
|
+
throw error;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/** Explicit cooking boundary for mesh, skin, morph, topology and arbitrary scene edits. */
|
|
162
|
+
async rebuild(cook, preserveState = true) {
|
|
163
|
+
return this.exclusive(async () => {
|
|
164
|
+
const previousNodes = snapshotNodes(this.scene.roots);
|
|
165
|
+
try {
|
|
166
|
+
const scene = await cook();
|
|
167
|
+
const authored = snapshotNodes(scene.roots);
|
|
168
|
+
await this.replaceBindings(authored, (prepare) => this.instance.rebuild(withPublication(scene.definition), preserveState, prepare), scene);
|
|
169
|
+
this.authored = authored;
|
|
170
|
+
} catch (error) {
|
|
171
|
+
restoreNodes(previousNodes);
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
async destroy() {
|
|
177
|
+
var _a;
|
|
178
|
+
this.closing = true;
|
|
179
|
+
try {
|
|
180
|
+
await this.pending;
|
|
181
|
+
} catch {
|
|
182
|
+
}
|
|
183
|
+
await ((_a = this.behaviors) == null ? void 0 : _a.destroy());
|
|
184
|
+
await this.instance.destroy();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function withPublication(definition) {
|
|
188
|
+
return {
|
|
189
|
+
...definition,
|
|
190
|
+
world: {
|
|
191
|
+
...definition.world,
|
|
192
|
+
publicationBounds: definition.world.publicationBounds ?? definition.world.bodies.map(() => [
|
|
193
|
+
[0, 0, 0],
|
|
194
|
+
[0, 0, 0]
|
|
195
|
+
])
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function snapshotNodes(roots) {
|
|
200
|
+
const result = [];
|
|
201
|
+
const seen = /* @__PURE__ */ new Set();
|
|
202
|
+
const visit = (node) => {
|
|
203
|
+
if (seen.has(node))
|
|
204
|
+
throw new Error("Physics session scene must be a tree");
|
|
205
|
+
seen.add(node);
|
|
206
|
+
result.push({
|
|
207
|
+
node,
|
|
208
|
+
matrix: Array.from(node.matrix),
|
|
209
|
+
position: Array.from(node.position),
|
|
210
|
+
rotation: Array.from(node.rotation),
|
|
211
|
+
scale: Array.from(node.scale),
|
|
212
|
+
children: node instanceof import__.GroupNode ? [...node.children] : void 0,
|
|
213
|
+
display: node.display
|
|
214
|
+
});
|
|
215
|
+
if (node instanceof import__.GroupNode)
|
|
216
|
+
for (const child of node.children)
|
|
217
|
+
visit(child);
|
|
218
|
+
};
|
|
219
|
+
roots.forEach(visit);
|
|
220
|
+
return result;
|
|
221
|
+
}
|
|
222
|
+
function validateNodes(states, roots) {
|
|
223
|
+
const nodes = new Map(states.map((state) => [state.node, state]));
|
|
224
|
+
if (nodes.size !== states.length || states.some((state) => state.matrix.length !== 16 || state.position.length !== 3 || state.scale.length !== 3 || ![3, 4].includes(state.rotation.length) || typeof state.display !== "boolean" || [...state.matrix, ...state.position, ...state.rotation, ...state.scale].some((value) => !Number.isFinite(value)) || (state.node instanceof import__.GroupNode ? !state.children : state.children !== void 0)))
|
|
225
|
+
throw new Error("Incompatible scene capture");
|
|
226
|
+
const visited = /* @__PURE__ */ new Set();
|
|
227
|
+
const visit = (node) => {
|
|
228
|
+
var _a;
|
|
229
|
+
const state = nodes.get(node);
|
|
230
|
+
if (!state || visited.has(node))
|
|
231
|
+
throw new Error("Incompatible captured hierarchy");
|
|
232
|
+
visited.add(node);
|
|
233
|
+
(_a = state.children) == null ? void 0 : _a.forEach(visit);
|
|
234
|
+
};
|
|
235
|
+
roots.forEach(visit);
|
|
236
|
+
if (visited.size !== nodes.size)
|
|
237
|
+
throw new Error("Detached captured node");
|
|
238
|
+
}
|
|
239
|
+
function restoreNodes(states) {
|
|
240
|
+
for (const state of states) {
|
|
241
|
+
state.node.setMatrixComponents({
|
|
242
|
+
position: [...state.position],
|
|
243
|
+
rotation: [...state.rotation],
|
|
244
|
+
scale: [...state.scale],
|
|
245
|
+
update: false
|
|
246
|
+
});
|
|
247
|
+
state.node.setMatrix(state.matrix);
|
|
248
|
+
state.node.display = state.display;
|
|
249
|
+
if (state.node instanceof import__.GroupNode && state.children)
|
|
250
|
+
state.node.children = [...state.children];
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
254
|
+
0 && (module.exports = {
|
|
255
|
+
ScenegraphPhysicsSession
|
|
256
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Device } from '@luma.gl/core';
|
|
2
|
+
import { type ScenegraphNode } from "../../index.js";
|
|
3
|
+
import { ScenegraphPhysicsInstance, type ScenegraphPhysicsDefinition, type ScenegraphPhysicsCapture } from "./scenegraph-instance.js";
|
|
4
|
+
import { ScenegraphPhysicsMotion, type ScenegraphPhysicsColliderTarget } from "./scenegraph-motion.js";
|
|
5
|
+
import { ScenegraphPhysicsPublication } from "./scenegraph-publication.js";
|
|
6
|
+
import { ScenegraphPhysicsProperties } from "./scenegraph-properties.js";
|
|
7
|
+
import { ScenegraphPhysicsBehaviors, type ScenegraphPhysicsBehaviorProps } from "./scenegraph-behaviors.js";
|
|
8
|
+
import type { GPURigidBodyWorld } from '@luma.gl/graph/gpu-physics';
|
|
9
|
+
export type ScenegraphPhysicsScene = {
|
|
10
|
+
roots: readonly ScenegraphNode[];
|
|
11
|
+
definition: ScenegraphPhysicsDefinition;
|
|
12
|
+
colliders?: readonly ScenegraphPhysicsColliderTarget[];
|
|
13
|
+
properties?: (world: GPURigidBodyWorld) => ScenegraphPhysicsProperties;
|
|
14
|
+
behaviors?: ScenegraphPhysicsBehaviorProps;
|
|
15
|
+
};
|
|
16
|
+
type NodeState = {
|
|
17
|
+
node: ScenegraphNode;
|
|
18
|
+
matrix: number[];
|
|
19
|
+
position: number[];
|
|
20
|
+
rotation: number[];
|
|
21
|
+
scale: number[];
|
|
22
|
+
display: boolean;
|
|
23
|
+
children?: ScenegraphNode[];
|
|
24
|
+
};
|
|
25
|
+
export type ScenegraphPhysicsSessionCapture = {
|
|
26
|
+
physics: ScenegraphPhysicsCapture;
|
|
27
|
+
scene: ScenegraphPhysicsScene;
|
|
28
|
+
authored: NodeState[];
|
|
29
|
+
ownership: ReturnType<ScenegraphPhysicsMotion['captureOwnership']>;
|
|
30
|
+
nodes: NodeState[];
|
|
31
|
+
};
|
|
32
|
+
/** Coordinates borrowed engine scenes and owned GPU worlds across edits and asynchronous work. */
|
|
33
|
+
export declare class ScenegraphPhysicsSession {
|
|
34
|
+
readonly device: Device;
|
|
35
|
+
private scene;
|
|
36
|
+
private instance;
|
|
37
|
+
private pending?;
|
|
38
|
+
private closing;
|
|
39
|
+
private revisionValue;
|
|
40
|
+
private authored;
|
|
41
|
+
motion: ScenegraphPhysicsMotion;
|
|
42
|
+
publication: ScenegraphPhysicsPublication;
|
|
43
|
+
properties: ScenegraphPhysicsProperties;
|
|
44
|
+
behaviors?: ScenegraphPhysicsBehaviors;
|
|
45
|
+
private constructor();
|
|
46
|
+
static create(device: Device, scene: ScenegraphPhysicsScene): Promise<ScenegraphPhysicsSession>;
|
|
47
|
+
get world(): GPURigidBodyWorld;
|
|
48
|
+
get graph(): import("@luma.gl/graph/gpu-core").CompiledGPUCommandGraph<void>;
|
|
49
|
+
/** Renderer/event bindings are borrowed for exactly one revision. */
|
|
50
|
+
get revision(): number;
|
|
51
|
+
private makeBindings;
|
|
52
|
+
private refreshBindings;
|
|
53
|
+
private exclusive;
|
|
54
|
+
/** Sample/blend first; declare active transform tracks, including paused tracks, explicitly. */
|
|
55
|
+
step(animatedNodes?: ReadonlySet<ScenegraphNode>, sample?: () => void, encode?: Parameters<ScenegraphPhysicsInstance['advance']>[1]): Promise<void>;
|
|
56
|
+
/** Queries and their continuations cannot outlive the world revision they borrow. */
|
|
57
|
+
withWorld<T>(operation: (world: GPURigidBodyWorld) => Promise<T>): Promise<T>;
|
|
58
|
+
capture(): Promise<ScenegraphPhysicsSessionCapture>;
|
|
59
|
+
restore(capture: ScenegraphPhysicsSessionCapture): Promise<void>;
|
|
60
|
+
/** Restore authored physics and scene transforms, leaving external cameras alone. */
|
|
61
|
+
reset(): Promise<void>;
|
|
62
|
+
private replaceBindings;
|
|
63
|
+
/** Explicit cooking boundary for mesh, skin, morph, topology and arbitrary scene edits. */
|
|
64
|
+
rebuild(cook: () => Promise<ScenegraphPhysicsScene>, preserveState?: boolean): Promise<void>;
|
|
65
|
+
destroy(): Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=scenegraph-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenegraph-session.d.ts","sourceRoot":"","sources":["../../../src/graph/physics/scenegraph-session.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAY,KAAK,cAAc,EAAC,uBAAoB;AAC3D,OAAO,EACL,yBAAyB,EACzB,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC9B,iCAA8B;AAC/B,OAAO,EAAC,uBAAuB,EAAE,KAAK,+BAA+B,EAAC,+BAA4B;AAClG,OAAO,EAAC,4BAA4B,EAAC,oCAAiC;AACtE,OAAO,EAAC,2BAA2B,EAAC,mCAAgC;AACpE,OAAO,EACL,0BAA0B,EAC1B,KAAK,8BAA8B,EACpC,kCAA+B;AAChC,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,4BAA4B,CAAC;AAElE,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;IACjC,UAAU,EAAE,2BAA2B,CAAC;IACxC,SAAS,CAAC,EAAE,SAAS,+BAA+B,EAAE,CAAC;IACvD,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,2BAA2B,CAAC;IACvE,SAAS,CAAC,EAAE,8BAA8B,CAAC;CAC5C,CAAC;AACF,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,OAAO,CA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