@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,288 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {ShaderModule, ShaderPlugin} from '@luma.gl/shadertools';
|
|
6
|
+
import {opticalLighting} from './optical-lighting';
|
|
7
|
+
|
|
8
|
+
/** Maximum number of local lights carried by the portable fixed-size uniform block. */
|
|
9
|
+
export const MAX_OPTICAL_POINT_LIGHTS = 16;
|
|
10
|
+
|
|
11
|
+
/** Local colored light emitted from a world-space position. */
|
|
12
|
+
export type OpticalPointLight = {
|
|
13
|
+
/** Position in the same world-space coordinate system as the illuminated geometry. */
|
|
14
|
+
position: [number, number, number];
|
|
15
|
+
/** Linear RGB light color. */
|
|
16
|
+
color: [number, number, number];
|
|
17
|
+
/** Optional per-light intensity multiplier. */
|
|
18
|
+
intensity?: number;
|
|
19
|
+
/** World-space distance at which illumination falls smoothly to zero. */
|
|
20
|
+
radius?: number;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** Runtime properties for a bounded set of local optical lights. */
|
|
24
|
+
export type OpticalPointLightsProps = {
|
|
25
|
+
/** Active local lights; additional lights beyond the fixed capacity are ignored. */
|
|
26
|
+
lights?: readonly OpticalPointLight[];
|
|
27
|
+
/** Multiplier applied to the complete set of lights. */
|
|
28
|
+
intensity?: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** One packed entry in the cross-backend optical-light uniform array. */
|
|
32
|
+
export type OpticalPointLightUniform = {
|
|
33
|
+
position: [number, number, number];
|
|
34
|
+
radius: number;
|
|
35
|
+
color: [number, number, number];
|
|
36
|
+
intensity: number;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** Uniform values consumed by {@link opticalPointLights}. */
|
|
40
|
+
export type OpticalPointLightsUniforms = {
|
|
41
|
+
lightCount: number;
|
|
42
|
+
intensity: number;
|
|
43
|
+
lights: readonly OpticalPointLightUniform[];
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const OPTICAL_POINT_LIGHT_UNIFORM_TYPE = {
|
|
47
|
+
position: 'vec3<f32>',
|
|
48
|
+
radius: 'f32',
|
|
49
|
+
color: 'vec3<f32>',
|
|
50
|
+
intensity: 'f32'
|
|
51
|
+
} as const;
|
|
52
|
+
|
|
53
|
+
const OPTICAL_POINT_LIGHTS_WGSL = /* wgsl */ `\
|
|
54
|
+
struct OpticalPointLightUniform {
|
|
55
|
+
position: vec3<f32>,
|
|
56
|
+
radius: f32,
|
|
57
|
+
color: vec3<f32>,
|
|
58
|
+
intensity: f32,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
struct opticalPointLightsUniforms {
|
|
62
|
+
lightCount: i32,
|
|
63
|
+
intensity: f32,
|
|
64
|
+
lights: array<OpticalPointLightUniform, ${MAX_OPTICAL_POINT_LIGHTS}>,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
@group(0) @binding(auto) var<uniform> opticalPointLights: opticalPointLightsUniforms;
|
|
68
|
+
|
|
69
|
+
fn opticalPointLights_getColor(
|
|
70
|
+
normal: vec3<f32>,
|
|
71
|
+
worldPosition: vec3<f32>,
|
|
72
|
+
cameraPosition: vec3<f32>
|
|
73
|
+
) -> vec3<f32> {
|
|
74
|
+
let viewDirection = normalize(cameraPosition - worldPosition);
|
|
75
|
+
let normalFacingCamera = opticalLighting_faceNormal(normalize(normal), viewDirection);
|
|
76
|
+
var accumulatedColor = vec3<f32>(0.0);
|
|
77
|
+
|
|
78
|
+
for (var lightIndex = 0; lightIndex < ${MAX_OPTICAL_POINT_LIGHTS}; lightIndex++) {
|
|
79
|
+
if (lightIndex >= opticalPointLights.lightCount) {
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
let light = opticalPointLights.lights[lightIndex];
|
|
84
|
+
let lightOffset = light.position - worldPosition;
|
|
85
|
+
let distanceSquared = dot(lightOffset, lightOffset);
|
|
86
|
+
let radius = max(light.radius, 0.0001);
|
|
87
|
+
let normalizedDistance = clamp(sqrt(distanceSquared) / radius, 0.0, 1.0);
|
|
88
|
+
let attenuation = pow(1.0 - normalizedDistance * normalizedDistance, 2.0);
|
|
89
|
+
let lightDirection = lightOffset * inverseSqrt(max(distanceSquared, 0.00001));
|
|
90
|
+
let halfVector = normalize(lightDirection + viewDirection + vec3<f32>(0.00001));
|
|
91
|
+
let diffuse = max(dot(normalFacingCamera, lightDirection), 0.0);
|
|
92
|
+
let specular = pow(max(dot(normalFacingCamera, halfVector), 0.0), 28.0);
|
|
93
|
+
let surfaceResponse = 0.08 + diffuse * 0.52 + specular * 0.4;
|
|
94
|
+
accumulatedColor += light.color * light.intensity * attenuation * surfaceResponse;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return accumulatedColor * opticalPointLights.intensity;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
fn opticalPointLights_getSpecularColor(
|
|
101
|
+
normal: vec3<f32>,
|
|
102
|
+
worldPosition: vec3<f32>,
|
|
103
|
+
cameraPosition: vec3<f32>,
|
|
104
|
+
roughness: f32
|
|
105
|
+
) -> vec3<f32> {
|
|
106
|
+
let viewDirection = normalize(cameraPosition - worldPosition);
|
|
107
|
+
let normalFacingCamera = opticalLighting_faceNormal(normalize(normal), viewDirection);
|
|
108
|
+
let shininess = mix(118.0, 34.0, clamp(roughness, 0.0, 1.0));
|
|
109
|
+
let fresnel = opticalLighting_getFresnel(
|
|
110
|
+
clamp(dot(normalFacingCamera, viewDirection), 0.0, 1.0),
|
|
111
|
+
0.04,
|
|
112
|
+
5.0
|
|
113
|
+
);
|
|
114
|
+
var accumulatedColor = vec3<f32>(0.0);
|
|
115
|
+
|
|
116
|
+
for (var lightIndex = 0; lightIndex < ${MAX_OPTICAL_POINT_LIGHTS}; lightIndex++) {
|
|
117
|
+
if (lightIndex >= opticalPointLights.lightCount) {
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
let light = opticalPointLights.lights[lightIndex];
|
|
122
|
+
let lightOffset = light.position - worldPosition;
|
|
123
|
+
let distanceSquared = dot(lightOffset, lightOffset);
|
|
124
|
+
let radius = max(light.radius, 0.0001);
|
|
125
|
+
let normalizedDistance = clamp(sqrt(distanceSquared) / radius, 0.0, 1.0);
|
|
126
|
+
let attenuation = pow(1.0 - normalizedDistance * normalizedDistance, 2.0);
|
|
127
|
+
let lightDirection = lightOffset * inverseSqrt(max(distanceSquared, 0.00001));
|
|
128
|
+
let reflectionDirection = reflect(-viewDirection, normalFacingCamera);
|
|
129
|
+
let reflectionAlignment = max(dot(reflectionDirection, lightDirection), 0.0);
|
|
130
|
+
let specular = pow(reflectionAlignment, shininess);
|
|
131
|
+
let softSpecular = pow(reflectionAlignment, max(shininess * 0.34, 10.0)) * 0.045;
|
|
132
|
+
accumulatedColor += light.color * light.intensity * attenuation *
|
|
133
|
+
(specular * 1.45 + softSpecular) *
|
|
134
|
+
(0.35 + fresnel * 1.65);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return accumulatedColor * opticalPointLights.intensity;
|
|
138
|
+
}
|
|
139
|
+
`;
|
|
140
|
+
|
|
141
|
+
const OPTICAL_POINT_LIGHTS_GLSL = /* glsl */ `\
|
|
142
|
+
struct OpticalPointLightUniform {
|
|
143
|
+
vec3 position;
|
|
144
|
+
float radius;
|
|
145
|
+
vec3 color;
|
|
146
|
+
float intensity;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
layout(std140) uniform opticalPointLightsUniforms {
|
|
150
|
+
int lightCount;
|
|
151
|
+
float intensity;
|
|
152
|
+
OpticalPointLightUniform lights[${MAX_OPTICAL_POINT_LIGHTS}];
|
|
153
|
+
} opticalPointLights;
|
|
154
|
+
|
|
155
|
+
vec3 opticalPointLights_getColor(
|
|
156
|
+
vec3 normal,
|
|
157
|
+
vec3 worldPosition,
|
|
158
|
+
vec3 cameraPosition
|
|
159
|
+
) {
|
|
160
|
+
vec3 viewDirection = normalize(cameraPosition - worldPosition);
|
|
161
|
+
vec3 normalFacingCamera = opticalLighting_faceNormal(normalize(normal), viewDirection);
|
|
162
|
+
vec3 accumulatedColor = vec3(0.0);
|
|
163
|
+
|
|
164
|
+
for (int lightIndex = 0; lightIndex < ${MAX_OPTICAL_POINT_LIGHTS}; lightIndex++) {
|
|
165
|
+
if (lightIndex >= opticalPointLights.lightCount) {
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
OpticalPointLightUniform light = opticalPointLights.lights[lightIndex];
|
|
170
|
+
vec3 lightOffset = light.position - worldPosition;
|
|
171
|
+
float distanceSquared = dot(lightOffset, lightOffset);
|
|
172
|
+
float radius = max(light.radius, 0.0001);
|
|
173
|
+
float normalizedDistance = clamp(sqrt(distanceSquared) / radius, 0.0, 1.0);
|
|
174
|
+
float attenuation = pow(1.0 - normalizedDistance * normalizedDistance, 2.0);
|
|
175
|
+
vec3 lightDirection = lightOffset * inversesqrt(max(distanceSquared, 0.00001));
|
|
176
|
+
vec3 halfVector = normalize(lightDirection + viewDirection + vec3(0.00001));
|
|
177
|
+
float diffuse = max(dot(normalFacingCamera, lightDirection), 0.0);
|
|
178
|
+
float specular = pow(max(dot(normalFacingCamera, halfVector), 0.0), 28.0);
|
|
179
|
+
float surfaceResponse = 0.08 + diffuse * 0.52 + specular * 0.4;
|
|
180
|
+
accumulatedColor += light.color * light.intensity * attenuation * surfaceResponse;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return accumulatedColor * opticalPointLights.intensity;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
vec3 opticalPointLights_getSpecularColor(
|
|
187
|
+
vec3 normal,
|
|
188
|
+
vec3 worldPosition,
|
|
189
|
+
vec3 cameraPosition,
|
|
190
|
+
float roughness
|
|
191
|
+
) {
|
|
192
|
+
vec3 viewDirection = normalize(cameraPosition - worldPosition);
|
|
193
|
+
vec3 normalFacingCamera = opticalLighting_faceNormal(normalize(normal), viewDirection);
|
|
194
|
+
float shininess = mix(118.0, 34.0, clamp(roughness, 0.0, 1.0));
|
|
195
|
+
float fresnel = opticalLighting_getFresnel(
|
|
196
|
+
clamp(dot(normalFacingCamera, viewDirection), 0.0, 1.0),
|
|
197
|
+
0.04,
|
|
198
|
+
5.0
|
|
199
|
+
);
|
|
200
|
+
vec3 accumulatedColor = vec3(0.0);
|
|
201
|
+
|
|
202
|
+
for (int lightIndex = 0; lightIndex < ${MAX_OPTICAL_POINT_LIGHTS}; lightIndex++) {
|
|
203
|
+
if (lightIndex >= opticalPointLights.lightCount) {
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
OpticalPointLightUniform light = opticalPointLights.lights[lightIndex];
|
|
208
|
+
vec3 lightOffset = light.position - worldPosition;
|
|
209
|
+
float distanceSquared = dot(lightOffset, lightOffset);
|
|
210
|
+
float radius = max(light.radius, 0.0001);
|
|
211
|
+
float normalizedDistance = clamp(sqrt(distanceSquared) / radius, 0.0, 1.0);
|
|
212
|
+
float attenuation = pow(1.0 - normalizedDistance * normalizedDistance, 2.0);
|
|
213
|
+
vec3 lightDirection = lightOffset * inversesqrt(max(distanceSquared, 0.00001));
|
|
214
|
+
vec3 reflectionDirection = reflect(-viewDirection, normalFacingCamera);
|
|
215
|
+
float reflectionAlignment = max(dot(reflectionDirection, lightDirection), 0.0);
|
|
216
|
+
float specular = pow(reflectionAlignment, shininess);
|
|
217
|
+
float softSpecular = pow(reflectionAlignment, max(shininess * 0.34, 10.0)) * 0.045;
|
|
218
|
+
accumulatedColor += light.color * light.intensity * attenuation *
|
|
219
|
+
(specular * 1.45 + softSpecular) *
|
|
220
|
+
(0.35 + fresnel * 1.65);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return accumulatedColor * opticalPointLights.intensity;
|
|
224
|
+
}
|
|
225
|
+
`;
|
|
226
|
+
|
|
227
|
+
function getOpticalPointLightsUniforms(
|
|
228
|
+
props: Partial<OpticalPointLightsProps> = {},
|
|
229
|
+
previousUniforms?: OpticalPointLightsUniforms
|
|
230
|
+
): OpticalPointLightsUniforms {
|
|
231
|
+
const suppliedLights = props.lights;
|
|
232
|
+
|
|
233
|
+
return {
|
|
234
|
+
lightCount: suppliedLights
|
|
235
|
+
? Math.min(suppliedLights.length, MAX_OPTICAL_POINT_LIGHTS)
|
|
236
|
+
: (previousUniforms?.lightCount ?? 0),
|
|
237
|
+
intensity: props.intensity ?? previousUniforms?.intensity ?? 1,
|
|
238
|
+
lights: suppliedLights
|
|
239
|
+
? makeOpticalPointLightUniforms(suppliedLights)
|
|
240
|
+
: (previousUniforms?.lights ?? makeOpticalPointLightUniforms([]))
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function makeOpticalPointLightUniforms(
|
|
245
|
+
lights: readonly OpticalPointLight[]
|
|
246
|
+
): OpticalPointLightUniform[] {
|
|
247
|
+
return Array.from({length: MAX_OPTICAL_POINT_LIGHTS}, (_, lightIndex) => {
|
|
248
|
+
const light = lights[lightIndex];
|
|
249
|
+
|
|
250
|
+
return light
|
|
251
|
+
? {
|
|
252
|
+
position: light.position,
|
|
253
|
+
radius: light.radius ?? 1,
|
|
254
|
+
color: light.color,
|
|
255
|
+
intensity: light.intensity ?? 1
|
|
256
|
+
}
|
|
257
|
+
: {
|
|
258
|
+
position: [0, 0, 0],
|
|
259
|
+
radius: 1,
|
|
260
|
+
color: [0, 0, 0],
|
|
261
|
+
intensity: 0
|
|
262
|
+
};
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** Portable bounded point lights for glass and reflective optical materials. */
|
|
267
|
+
export const opticalPointLights = {
|
|
268
|
+
name: 'opticalPointLights',
|
|
269
|
+
source: OPTICAL_POINT_LIGHTS_WGSL,
|
|
270
|
+
fs: OPTICAL_POINT_LIGHTS_GLSL,
|
|
271
|
+
defines: {
|
|
272
|
+
LUMA_OPTICAL_POINT_LIGHTS: true
|
|
273
|
+
},
|
|
274
|
+
dependencies: [opticalLighting],
|
|
275
|
+
uniformTypes: {
|
|
276
|
+
lightCount: 'i32',
|
|
277
|
+
intensity: 'f32',
|
|
278
|
+
lights: [OPTICAL_POINT_LIGHT_UNIFORM_TYPE, MAX_OPTICAL_POINT_LIGHTS]
|
|
279
|
+
},
|
|
280
|
+
defaultUniforms: getOpticalPointLightsUniforms(),
|
|
281
|
+
getUniforms: getOpticalPointLightsUniforms
|
|
282
|
+
} as const satisfies ShaderModule<OpticalPointLightsProps, OpticalPointLightsUniforms, {}>;
|
|
283
|
+
|
|
284
|
+
/** Explicitly installs bounded point lights and enables illuminated material helpers. */
|
|
285
|
+
export const opticalPointLightsPlugin = {
|
|
286
|
+
name: 'opticalPointLights',
|
|
287
|
+
modules: [opticalPointLights as ShaderModule]
|
|
288
|
+
} as const satisfies ShaderPlugin;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {ShaderModule, ShaderPlugin} from '@luma.gl/shadertools';
|
|
6
|
+
import {opticalLighting} from './optical-lighting';
|
|
7
|
+
|
|
8
|
+
/** Runtime properties for the portable reflective-surface shader module. */
|
|
9
|
+
export type ReflectiveMaterialProps = {
|
|
10
|
+
/** Surface roughness in the inclusive zero-to-one range. */
|
|
11
|
+
roughness?: number;
|
|
12
|
+
/** Intensity of environment reflections around the Fresnel rim. */
|
|
13
|
+
reflectionStrength?: number;
|
|
14
|
+
/** Intensity of the key and fill light specular highlights. */
|
|
15
|
+
specularStrength?: number;
|
|
16
|
+
/** Multiplier applied to the incoming material opacity. */
|
|
17
|
+
opacityScale?: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** Uniform values consumed by {@link reflectiveMaterial}. */
|
|
21
|
+
export type ReflectiveMaterialUniforms = Required<ReflectiveMaterialProps>;
|
|
22
|
+
|
|
23
|
+
const REFLECTIVE_MATERIAL_WGSL = /* wgsl */ `\
|
|
24
|
+
struct ReflectiveMaterialUniforms {
|
|
25
|
+
roughness: f32,
|
|
26
|
+
reflectionStrength: f32,
|
|
27
|
+
specularStrength: f32,
|
|
28
|
+
opacityScale: f32,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
@group(0) @binding(auto) var<uniform> reflectiveMaterial: ReflectiveMaterialUniforms;
|
|
32
|
+
|
|
33
|
+
fn reflectiveMaterial_getColor(
|
|
34
|
+
normal: vec3<f32>,
|
|
35
|
+
worldPosition: vec3<f32>,
|
|
36
|
+
baseColor: vec4<f32>,
|
|
37
|
+
cameraPosition: vec3<f32>
|
|
38
|
+
) -> vec4<f32> {
|
|
39
|
+
let viewDirection = normalize(cameraPosition - worldPosition);
|
|
40
|
+
let normalFacingCamera = opticalLighting_faceNormal(normalize(normal), viewDirection);
|
|
41
|
+
let viewAlignment = clamp(dot(normalFacingCamera, viewDirection), 0.0, 1.0);
|
|
42
|
+
let fresnel = opticalLighting_getFresnel(viewAlignment, 0.08, 4.0);
|
|
43
|
+
let keyLight = opticalLighting_getKeyLight();
|
|
44
|
+
let fillLight = opticalLighting_getFillLight();
|
|
45
|
+
let keyHalfVector = normalize(keyLight + viewDirection);
|
|
46
|
+
let fillHalfVector = normalize(fillLight + viewDirection);
|
|
47
|
+
let diffuse = 0.36 + 0.64 * max(dot(normalFacingCamera, keyLight), 0.0);
|
|
48
|
+
let filteredRoughness = opticalLighting_getFilteredRoughness(
|
|
49
|
+
normalFacingCamera,
|
|
50
|
+
reflectiveMaterial.roughness
|
|
51
|
+
);
|
|
52
|
+
let specularExponent = mix(96.0, 12.0, filteredRoughness);
|
|
53
|
+
let keySpecular = pow(max(dot(normalFacingCamera, keyHalfVector), 0.0), specularExponent);
|
|
54
|
+
let fillSpecular = pow(
|
|
55
|
+
max(dot(normalFacingCamera, fillHalfVector), 0.0),
|
|
56
|
+
specularExponent * 0.545
|
|
57
|
+
);
|
|
58
|
+
let reflectionDirection = reflect(-viewDirection, normalFacingCamera);
|
|
59
|
+
let reflectedColor = opticalLighting_sampleEnvironment(
|
|
60
|
+
reflectionDirection,
|
|
61
|
+
vec3<f32>(0.08, 0.14, 0.25),
|
|
62
|
+
vec3<f32>(0.52, 0.7, 0.95),
|
|
63
|
+
0.0
|
|
64
|
+
);
|
|
65
|
+
let color = baseColor.rgb * diffuse +
|
|
66
|
+
reflectedColor * fresnel * reflectiveMaterial.reflectionStrength +
|
|
67
|
+
vec3<f32>(1.0, 0.94, 0.8) * keySpecular * reflectiveMaterial.specularStrength +
|
|
68
|
+
vec3<f32>(0.4, 0.67, 1.0) * fillSpecular * reflectiveMaterial.specularStrength * 0.524;
|
|
69
|
+
let opacity = clamp(
|
|
70
|
+
baseColor.a * reflectiveMaterial.opacityScale *
|
|
71
|
+
(0.85 + fresnel * 0.2 + (keySpecular + fillSpecular) * 0.35),
|
|
72
|
+
0.0,
|
|
73
|
+
1.0
|
|
74
|
+
);
|
|
75
|
+
return vec4<f32>(color, opacity);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#ifdef LUMA_OPTICAL_POINT_LIGHTS
|
|
79
|
+
fn reflectiveMaterial_getIlluminatedColor(
|
|
80
|
+
normal: vec3<f32>,
|
|
81
|
+
worldPosition: vec3<f32>,
|
|
82
|
+
baseColor: vec4<f32>,
|
|
83
|
+
cameraPosition: vec3<f32>
|
|
84
|
+
) -> vec4<f32> {
|
|
85
|
+
let reflectedColor = reflectiveMaterial_getColor(
|
|
86
|
+
normal,
|
|
87
|
+
worldPosition,
|
|
88
|
+
baseColor,
|
|
89
|
+
cameraPosition
|
|
90
|
+
);
|
|
91
|
+
let pointLightColor = opticalPointLights_getColor(normal, worldPosition, cameraPosition);
|
|
92
|
+
return vec4<f32>(
|
|
93
|
+
reflectedColor.rgb + pointLightColor * reflectiveMaterial.specularStrength,
|
|
94
|
+
reflectedColor.a
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
#endif
|
|
98
|
+
`;
|
|
99
|
+
|
|
100
|
+
const REFLECTIVE_MATERIAL_GLSL = /* glsl */ `\
|
|
101
|
+
layout(std140) uniform reflectiveMaterialUniforms {
|
|
102
|
+
float roughness;
|
|
103
|
+
float reflectionStrength;
|
|
104
|
+
float specularStrength;
|
|
105
|
+
float opacityScale;
|
|
106
|
+
} reflectiveMaterial;
|
|
107
|
+
|
|
108
|
+
vec4 reflectiveMaterial_getColor(
|
|
109
|
+
vec3 normal,
|
|
110
|
+
vec3 worldPosition,
|
|
111
|
+
vec4 baseColor,
|
|
112
|
+
vec3 cameraPosition
|
|
113
|
+
) {
|
|
114
|
+
vec3 viewDirection = normalize(cameraPosition - worldPosition);
|
|
115
|
+
vec3 normalFacingCamera = opticalLighting_faceNormal(normalize(normal), viewDirection);
|
|
116
|
+
float viewAlignment = clamp(dot(normalFacingCamera, viewDirection), 0.0, 1.0);
|
|
117
|
+
float fresnel = opticalLighting_getFresnel(viewAlignment, 0.08, 4.0);
|
|
118
|
+
vec3 keyLight = opticalLighting_getKeyLight();
|
|
119
|
+
vec3 fillLight = opticalLighting_getFillLight();
|
|
120
|
+
vec3 keyHalfVector = normalize(keyLight + viewDirection);
|
|
121
|
+
vec3 fillHalfVector = normalize(fillLight + viewDirection);
|
|
122
|
+
float diffuse = 0.36 + 0.64 * max(dot(normalFacingCamera, keyLight), 0.0);
|
|
123
|
+
float filteredRoughness = opticalLighting_getFilteredRoughness(
|
|
124
|
+
normalFacingCamera,
|
|
125
|
+
reflectiveMaterial.roughness
|
|
126
|
+
);
|
|
127
|
+
float specularExponent = mix(96.0, 12.0, filteredRoughness);
|
|
128
|
+
float keySpecular = pow(max(dot(normalFacingCamera, keyHalfVector), 0.0), specularExponent);
|
|
129
|
+
float fillSpecular = pow(
|
|
130
|
+
max(dot(normalFacingCamera, fillHalfVector), 0.0),
|
|
131
|
+
specularExponent * 0.545
|
|
132
|
+
);
|
|
133
|
+
vec3 reflectionDirection = reflect(-viewDirection, normalFacingCamera);
|
|
134
|
+
vec3 reflectedColor = opticalLighting_sampleEnvironment(
|
|
135
|
+
reflectionDirection,
|
|
136
|
+
vec3(0.08, 0.14, 0.25),
|
|
137
|
+
vec3(0.52, 0.7, 0.95),
|
|
138
|
+
0.0
|
|
139
|
+
);
|
|
140
|
+
vec3 color = baseColor.rgb * diffuse +
|
|
141
|
+
reflectedColor * fresnel * reflectiveMaterial.reflectionStrength +
|
|
142
|
+
vec3(1.0, 0.94, 0.8) * keySpecular * reflectiveMaterial.specularStrength +
|
|
143
|
+
vec3(0.4, 0.67, 1.0) * fillSpecular * reflectiveMaterial.specularStrength * 0.524;
|
|
144
|
+
float opacity = clamp(
|
|
145
|
+
baseColor.a * reflectiveMaterial.opacityScale *
|
|
146
|
+
(0.85 + fresnel * 0.2 + (keySpecular + fillSpecular) * 0.35),
|
|
147
|
+
0.0,
|
|
148
|
+
1.0
|
|
149
|
+
);
|
|
150
|
+
return vec4(color, opacity);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
#ifdef LUMA_OPTICAL_POINT_LIGHTS
|
|
154
|
+
vec3 opticalPointLights_getColor(vec3 normal, vec3 worldPosition, vec3 cameraPosition);
|
|
155
|
+
|
|
156
|
+
vec4 reflectiveMaterial_getIlluminatedColor(
|
|
157
|
+
vec3 normal,
|
|
158
|
+
vec3 worldPosition,
|
|
159
|
+
vec4 baseColor,
|
|
160
|
+
vec3 cameraPosition
|
|
161
|
+
) {
|
|
162
|
+
vec4 reflectedColor = reflectiveMaterial_getColor(
|
|
163
|
+
normal,
|
|
164
|
+
worldPosition,
|
|
165
|
+
baseColor,
|
|
166
|
+
cameraPosition
|
|
167
|
+
);
|
|
168
|
+
vec3 pointLightColor = opticalPointLights_getColor(normal, worldPosition, cameraPosition);
|
|
169
|
+
return vec4(
|
|
170
|
+
reflectedColor.rgb + pointLightColor * reflectiveMaterial.specularStrength,
|
|
171
|
+
reflectedColor.a
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
#endif
|
|
175
|
+
`;
|
|
176
|
+
|
|
177
|
+
function getReflectiveMaterialUniforms(
|
|
178
|
+
props: Partial<ReflectiveMaterialProps> = {},
|
|
179
|
+
previousUniforms?: ReflectiveMaterialUniforms
|
|
180
|
+
): ReflectiveMaterialUniforms {
|
|
181
|
+
return {
|
|
182
|
+
roughness: props.roughness ?? previousUniforms?.roughness ?? 0.62,
|
|
183
|
+
reflectionStrength: props.reflectionStrength ?? previousUniforms?.reflectionStrength ?? 0.32,
|
|
184
|
+
specularStrength: props.specularStrength ?? previousUniforms?.specularStrength ?? 0.42,
|
|
185
|
+
opacityScale: props.opacityScale ?? previousUniforms?.opacityScale ?? 1
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** Portable glossy surface shading with Fresnel edges and key/fill specular highlights. */
|
|
190
|
+
export const reflectiveMaterial = {
|
|
191
|
+
name: 'reflectiveMaterial',
|
|
192
|
+
source: REFLECTIVE_MATERIAL_WGSL,
|
|
193
|
+
fs: REFLECTIVE_MATERIAL_GLSL,
|
|
194
|
+
dependencies: [opticalLighting],
|
|
195
|
+
uniformTypes: {
|
|
196
|
+
roughness: 'f32',
|
|
197
|
+
reflectionStrength: 'f32',
|
|
198
|
+
specularStrength: 'f32',
|
|
199
|
+
opacityScale: 'f32'
|
|
200
|
+
},
|
|
201
|
+
defaultUniforms: {
|
|
202
|
+
roughness: 0.62,
|
|
203
|
+
reflectionStrength: 0.32,
|
|
204
|
+
specularStrength: 0.42,
|
|
205
|
+
opacityScale: 1
|
|
206
|
+
},
|
|
207
|
+
getUniforms: getReflectiveMaterialUniforms
|
|
208
|
+
} as const satisfies ShaderModule<ReflectiveMaterialProps, ReflectiveMaterialUniforms, {}>;
|
|
209
|
+
|
|
210
|
+
/** Installs portable reflective surface shading and shared optical-lighting helpers. */
|
|
211
|
+
export const reflectiveMaterialPlugin = {
|
|
212
|
+
name: 'reflectiveMaterial',
|
|
213
|
+
modules: [reflectiveMaterial as ShaderModule]
|
|
214
|
+
} as const satisfies ShaderPlugin;
|