@luma.gl/engine 10.0.0-rc.1 → 10.0.0-rc.2
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/THIRD-PARTY-NOTICES.md +82 -0
- package/dist/animation/animation-track.d.ts +7 -0
- package/dist/animation/animation-track.d.ts.map +1 -1
- package/dist/animation/animation-track.js.map +1 -1
- package/dist/animation/node-animation-binding.cjs +1 -0
- package/dist/animation/node-animation-binding.d.ts +2 -1
- package/dist/animation/node-animation-binding.d.ts.map +1 -1
- package/dist/animation/node-animation-binding.js +6 -0
- package/dist/animation/node-animation-binding.js.map +1 -1
- package/dist/animation/scenegraph-gpu-animation-layout.cjs +99 -0
- package/dist/animation/scenegraph-gpu-animation-layout.d.ts +69 -0
- package/dist/animation/scenegraph-gpu-animation-layout.d.ts.map +1 -0
- package/dist/animation/scenegraph-gpu-animation-layout.js +90 -0
- package/dist/animation/scenegraph-gpu-animation-layout.js.map +1 -0
- package/dist/animation/scenegraph-gpu-animation.cjs +281 -0
- package/dist/animation/scenegraph-gpu-animation.d.ts +54 -0
- package/dist/animation/scenegraph-gpu-animation.d.ts.map +1 -0
- package/dist/animation/scenegraph-gpu-animation.js +274 -0
- package/dist/animation/scenegraph-gpu-animation.js.map +1 -0
- package/dist/arrow/arrow-picking.cjs +4 -3
- package/dist/arrow/arrow-picking.d.ts +15 -5
- package/dist/arrow/arrow-picking.d.ts.map +1 -1
- package/dist/arrow/arrow-picking.js +16 -5
- package/dist/arrow/arrow-picking.js.map +1 -1
- package/dist/arrow/index.cjs.map +1 -1
- package/dist/dist.dev.js +1671 -1105
- package/dist/dist.min.js +69 -70
- package/dist/effects/glfx-effects.cjs +261 -0
- package/dist/effects/glfx-effects.d.ts +959 -0
- package/dist/effects/glfx-effects.d.ts.map +1 -0
- package/dist/effects/glfx-effects.js +200 -0
- package/dist/effects/glfx-effects.js.map +1 -0
- package/dist/effects/graph/gpu-effect-operation.cjs +402 -0
- package/dist/effects/graph/gpu-effect-operation.d.ts +101 -0
- package/dist/effects/graph/gpu-effect-operation.d.ts.map +1 -0
- package/dist/effects/graph/gpu-effect-operation.js +410 -0
- package/dist/effects/graph/gpu-effect-operation.js.map +1 -0
- package/dist/effects/graph/temporal-graph-history.cjs +48 -0
- package/dist/effects/graph/temporal-graph-history.d.ts +17 -0
- package/dist/effects/graph/temporal-graph-history.d.ts.map +1 -0
- package/dist/effects/graph/temporal-graph-history.js +30 -0
- package/dist/effects/graph/temporal-graph-history.js.map +1 -0
- package/dist/effects/index.cjs +117 -30
- package/dist/effects/index.cjs.map +3 -3
- package/dist/effects/index.d.ts +34 -18
- package/dist/effects/index.d.ts.map +1 -1
- package/dist/effects/index.js +31 -18
- package/dist/effects/index.js.map +1 -1
- package/dist/effects/passes/postprocessing/fxaa/fxaa.cjs +9 -2
- package/dist/effects/passes/postprocessing/fxaa/fxaa.d.ts +19 -0
- package/dist/effects/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/fxaa/fxaa.js +6 -0
- package/dist/effects/passes/postprocessing/fxaa/fxaa.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.cjs +9 -2
- package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.d.ts +41 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.js +6 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.cjs +200 -13
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.d.ts +992 -6
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.js +199 -10
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.d.ts +3 -3
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.js.map +1 -1
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.cjs +41 -40
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.d.ts +116 -8
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.js +38 -37
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.js.map +1 -1
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.cjs +83 -66
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.d.ts +470 -2
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.js +80 -62
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.js.map +1 -1
- package/dist/effects/passes/screen-space/copy-pass.cjs +7 -0
- package/dist/effects/passes/screen-space/copy-pass.d.ts +1 -0
- package/dist/effects/passes/screen-space/copy-pass.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/copy-pass.js +4 -0
- package/dist/effects/passes/screen-space/copy-pass.js.map +1 -1
- package/dist/effects/passes/screen-space/depth-aware-blur.cjs +14 -5
- package/dist/effects/passes/screen-space/depth-aware-blur.d.ts +125 -17
- package/dist/effects/passes/screen-space/depth-aware-blur.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/depth-aware-blur.js +11 -3
- package/dist/effects/passes/screen-space/depth-aware-blur.js.map +1 -1
- package/dist/effects/passes/screen-space/dof.cjs +19 -3
- package/dist/effects/passes/screen-space/dof.d.ts +181 -0
- package/dist/effects/passes/screen-space/dof.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/dof.js +17 -3
- package/dist/effects/passes/screen-space/dof.js.map +1 -1
- package/dist/effects/passes/screen-space/gtao.cjs +82 -62
- package/dist/effects/passes/screen-space/gtao.d.ts +608 -3
- package/dist/effects/passes/screen-space/gtao.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/gtao.js +83 -60
- package/dist/effects/passes/screen-space/gtao.js.map +1 -1
- package/dist/effects/passes/screen-space/hdr-auto-exposure.cjs +103 -79
- package/dist/effects/passes/screen-space/hdr-auto-exposure.d.ts +225 -3
- package/dist/effects/passes/screen-space/hdr-auto-exposure.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/hdr-auto-exposure.js +102 -77
- package/dist/effects/passes/screen-space/hdr-auto-exposure.js.map +1 -1
- package/dist/effects/passes/screen-space/height-fog.cjs +14 -0
- package/dist/effects/passes/screen-space/height-fog.d.ts +71 -0
- package/dist/effects/passes/screen-space/height-fog.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/height-fog.js +16 -3
- package/dist/effects/passes/screen-space/height-fog.js.map +1 -1
- package/dist/effects/passes/screen-space/motion-blur.cjs +7 -8
- package/dist/effects/passes/screen-space/motion-blur.d.ts +41 -2
- package/dist/effects/passes/screen-space/motion-blur.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/motion-blur.js +6 -6
- package/dist/effects/passes/screen-space/motion-blur.js.map +1 -1
- package/dist/effects/passes/screen-space/outlines.cjs +143 -18
- package/dist/effects/passes/screen-space/outlines.d.ts +162 -3
- package/dist/effects/passes/screen-space/outlines.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/outlines.js +137 -15
- package/dist/effects/passes/screen-space/outlines.js.map +1 -1
- package/dist/effects/passes/screen-space/screen-space-global-illumination.cjs +70 -61
- package/dist/effects/passes/screen-space/screen-space-global-illumination.d.ts +309 -2
- package/dist/effects/passes/screen-space/screen-space-global-illumination.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/screen-space-global-illumination.js +69 -59
- package/dist/effects/passes/screen-space/screen-space-global-illumination.js.map +1 -1
- package/dist/effects/passes/screen-space/screen-space-reflections.cjs +151 -83
- package/dist/effects/passes/screen-space/screen-space-reflections.d.ts +778 -7
- package/dist/effects/passes/screen-space/screen-space-reflections.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/screen-space-reflections.js +148 -79
- package/dist/effects/passes/screen-space/screen-space-reflections.js.map +1 -1
- package/dist/effects/passes/screen-space/selection-outline.cjs +12 -2
- package/dist/effects/passes/screen-space/selection-outline.d.ts +44 -0
- package/dist/effects/passes/screen-space/selection-outline.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/selection-outline.js +9 -0
- package/dist/effects/passes/screen-space/selection-outline.js.map +1 -1
- package/dist/effects/passes/screen-space/ssao.cjs +66 -43
- package/dist/effects/passes/screen-space/ssao.d.ts +647 -2
- package/dist/effects/passes/screen-space/ssao.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/ssao.js +64 -41
- package/dist/effects/passes/screen-space/ssao.js.map +1 -1
- package/dist/effects/passes/screen-space/temporal-antialiasing.cjs +42 -30
- package/dist/effects/passes/screen-space/temporal-antialiasing.d.ts +107 -6
- package/dist/effects/passes/screen-space/temporal-antialiasing.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/temporal-antialiasing.js +40 -27
- package/dist/effects/passes/screen-space/temporal-antialiasing.js.map +1 -1
- package/dist/effects/passes/screen-space/temporal-frame.cjs +34 -0
- package/dist/effects/passes/screen-space/temporal-frame.d.ts +23 -0
- package/dist/effects/passes/screen-space/temporal-frame.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/temporal-frame.js +16 -0
- package/dist/effects/passes/screen-space/temporal-frame.js.map +1 -0
- package/dist/effects/passes/screen-space/volumetric-fog.cjs +25 -22
- package/dist/effects/passes/screen-space/volumetric-fog.d.ts +161 -2
- package/dist/effects/passes/screen-space/volumetric-fog.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/volumetric-fog.js +27 -21
- package/dist/effects/passes/screen-space/volumetric-fog.js.map +1 -1
- package/dist/effects/temporal-upscale/index.cjs +40 -0
- package/dist/effects/temporal-upscale/index.d.ts +5 -0
- package/dist/effects/temporal-upscale/index.d.ts.map +1 -0
- package/dist/effects/temporal-upscale/index.js +6 -0
- package/dist/effects/temporal-upscale/index.js.map +1 -0
- package/dist/effects/temporal-upscale/temporal-math.cjs +202 -0
- package/dist/effects/temporal-upscale/temporal-math.d.ts +101 -0
- package/dist/effects/temporal-upscale/temporal-math.d.ts.map +1 -0
- package/dist/effects/temporal-upscale/temporal-math.js +202 -0
- package/dist/effects/temporal-upscale/temporal-math.js.map +1 -0
- package/dist/effects/temporal-upscale/temporal-upscale-shaders.cjs +353 -0
- package/dist/effects/temporal-upscale/temporal-upscale-shaders.d.ts +7 -0
- package/dist/effects/temporal-upscale/temporal-upscale-shaders.d.ts.map +1 -0
- package/dist/effects/temporal-upscale/temporal-upscale-shaders.js +321 -0
- package/dist/effects/temporal-upscale/temporal-upscale-shaders.js.map +1 -0
- package/dist/effects/temporal-upscale/temporal-upscaler.cjs +392 -0
- package/dist/effects/temporal-upscale/temporal-upscaler.d.ts +143 -0
- package/dist/effects/temporal-upscale/temporal-upscaler.d.ts.map +1 -0
- package/dist/effects/temporal-upscale/temporal-upscaler.js +385 -0
- package/dist/effects/temporal-upscale/temporal-upscaler.js.map +1 -0
- package/dist/gltf/gltf/create-gltf-model.cjs +34 -71
- package/dist/gltf/gltf/create-gltf-model.d.ts +3 -0
- package/dist/gltf/gltf/create-gltf-model.d.ts.map +1 -1
- package/dist/gltf/gltf/create-gltf-model.js +40 -74
- package/dist/gltf/gltf/create-gltf-model.js.map +1 -1
- package/dist/gltf/gltf/create-scenegraph-from-gltf.cjs +46 -4
- package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts +9 -1
- package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts.map +1 -1
- package/dist/gltf/gltf/create-scenegraph-from-gltf.js +54 -4
- package/dist/gltf/gltf/create-scenegraph-from-gltf.js.map +1 -1
- package/dist/gltf/gltf/gltf-animated-crowd.cjs +25 -136
- package/dist/gltf/gltf/gltf-animated-crowd.d.ts +4 -8
- package/dist/gltf/gltf/gltf-animated-crowd.d.ts.map +1 -1
- package/dist/gltf/gltf/gltf-animated-crowd.js +27 -139
- package/dist/gltf/gltf/gltf-animated-crowd.js.map +1 -1
- package/dist/gltf/gltf/gltf-animation-nodes.cjs +84 -0
- package/dist/gltf/gltf/gltf-animation-nodes.d.ts +11 -0
- package/dist/gltf/gltf/gltf-animation-nodes.d.ts.map +1 -0
- package/dist/gltf/gltf/gltf-animation-nodes.js +62 -0
- package/dist/gltf/gltf/gltf-animation-nodes.js.map +1 -0
- package/dist/gltf/gltf/gltf-animator.cjs +8 -2
- package/dist/gltf/gltf/gltf-animator.d.ts +6 -1
- package/dist/gltf/gltf/gltf-animator.d.ts.map +1 -1
- package/dist/gltf/gltf/gltf-animator.js +10 -2
- package/dist/gltf/gltf/gltf-animator.js.map +1 -1
- package/dist/gltf/gltf/gltf-gpu-animation-controller.cjs +81 -0
- package/dist/gltf/gltf/gltf-gpu-animation-controller.d.ts +9 -0
- package/dist/gltf/gltf/gltf-gpu-animation-controller.d.ts.map +1 -0
- package/dist/gltf/gltf/gltf-gpu-animation-controller.js +67 -0
- package/dist/gltf/gltf/gltf-gpu-animation-controller.js.map +1 -0
- package/dist/gltf/gltf/gltf-gpu-animation.cjs +33 -28
- package/dist/gltf/gltf/gltf-gpu-animation.d.ts +7 -26
- package/dist/gltf/gltf/gltf-gpu-animation.d.ts.map +1 -1
- package/dist/gltf/gltf/gltf-gpu-animation.js +29 -28
- package/dist/gltf/gltf/gltf-gpu-animation.js.map +1 -1
- package/dist/gltf/index.cjs.map +3 -3
- package/dist/gltf/index.d.ts +2 -2
- package/dist/gltf/index.d.ts.map +1 -1
- package/dist/gltf/index.js.map +1 -1
- package/dist/gltf/parsers/parse-gltf.cjs +4 -2
- package/dist/gltf/parsers/parse-gltf.d.ts +3 -0
- package/dist/gltf/parsers/parse-gltf.d.ts.map +1 -1
- package/dist/gltf/parsers/parse-gltf.js +7 -2
- package/dist/gltf/parsers/parse-gltf.js.map +1 -1
- package/dist/graph/models/index.cjs.map +2 -2
- package/dist/graph/physics/index.cjs +5 -0
- package/dist/graph/physics/index.cjs.map +3 -3
- package/dist/graph/physics/index.d.ts +1 -0
- package/dist/graph/physics/index.d.ts.map +1 -1
- package/dist/graph/physics/index.js +1 -0
- package/dist/graph/physics/index.js.map +1 -1
- package/dist/graph/physics/physics-controller-geometry.cjs +21 -0
- package/dist/graph/physics/physics-controller-geometry.d.ts +8 -1
- package/dist/graph/physics/physics-controller-geometry.d.ts.map +1 -1
- package/dist/graph/physics/physics-controller-geometry.js +22 -0
- package/dist/graph/physics/physics-controller-geometry.js.map +1 -1
- package/dist/graph/physics/scenegraph-session.d.ts +1 -1
- package/dist/graph/physics/scenegraph-session.d.ts.map +1 -1
- package/dist/graph/tables/index.cjs.map +2 -2
- package/dist/index.cjs +16 -0
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/lighting/ambient-occlusion-pass.cjs +47 -28
- package/dist/lighting/ambient-occlusion-pass.d.ts +12 -0
- package/dist/lighting/ambient-occlusion-pass.d.ts.map +1 -1
- package/dist/lighting/ambient-occlusion-pass.js +45 -26
- package/dist/lighting/ambient-occlusion-pass.js.map +1 -1
- package/dist/lighting/clustered-light-grid.cjs +71 -20
- package/dist/lighting/clustered-light-grid.d.ts +37 -0
- package/dist/lighting/clustered-light-grid.d.ts.map +1 -1
- package/dist/lighting/clustered-light-grid.js +68 -18
- package/dist/lighting/clustered-light-grid.js.map +1 -1
- package/dist/lighting/contact-shadow-composite.cjs +72 -51
- package/dist/lighting/contact-shadow-composite.d.ts +274 -3
- package/dist/lighting/contact-shadow-composite.d.ts.map +1 -1
- package/dist/lighting/contact-shadow-composite.js +72 -50
- package/dist/lighting/contact-shadow-composite.js.map +1 -1
- package/dist/lighting/contact-shadow-pass.cjs +50 -39
- package/dist/lighting/contact-shadow-pass.d.ts +8 -0
- package/dist/lighting/contact-shadow-pass.d.ts.map +1 -1
- package/dist/lighting/contact-shadow-pass.js +47 -37
- package/dist/lighting/contact-shadow-pass.js.map +1 -1
- package/dist/lighting/cortao/cortao-occluder-lookup-table.cjs +96 -0
- package/dist/lighting/cortao/cortao-occluder-lookup-table.d.ts +41 -0
- package/dist/lighting/cortao/cortao-occluder-lookup-table.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-occluder-lookup-table.js +94 -0
- package/dist/lighting/cortao/cortao-occluder-lookup-table.js.map +1 -0
- package/dist/lighting/cortao/cortao-parameters.cjs +127 -0
- package/dist/lighting/cortao/cortao-parameters.d.ts +95 -0
- package/dist/lighting/cortao/cortao-parameters.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-parameters.js +122 -0
- package/dist/lighting/cortao/cortao-parameters.js.map +1 -0
- package/dist/lighting/cortao/cortao-pass.cjs +100 -0
- package/dist/lighting/cortao/cortao-pass.d.ts +33 -0
- package/dist/lighting/cortao/cortao-pass.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-pass.js +84 -0
- package/dist/lighting/cortao/cortao-pass.js.map +1 -0
- package/dist/lighting/cortao/cortao-passes.cjs +42 -0
- package/dist/lighting/cortao/cortao-passes.d.ts +38 -0
- package/dist/lighting/cortao/cortao-passes.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-passes.js +19 -0
- package/dist/lighting/cortao/cortao-passes.js.map +1 -0
- package/dist/lighting/cortao/cortao-shaders-wgsl.cjs +606 -0
- package/dist/lighting/cortao/cortao-shaders-wgsl.d.ts +49 -0
- package/dist/lighting/cortao/cortao-shaders-wgsl.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-shaders-wgsl.js +610 -0
- package/dist/lighting/cortao/cortao-shaders-wgsl.js.map +1 -0
- package/dist/lighting/cortao/cortao-shaders.cjs +667 -0
- package/dist/lighting/cortao/cortao-shaders.d.ts +118 -0
- package/dist/lighting/cortao/cortao-shaders.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-shaders.js +657 -0
- package/dist/lighting/cortao/cortao-shaders.js.map +1 -0
- package/dist/lighting/cortao/cortao-upsample.cjs +191 -0
- package/dist/lighting/cortao/cortao-upsample.d.ts +16 -0
- package/dist/lighting/cortao/cortao-upsample.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-upsample.js +159 -0
- package/dist/lighting/cortao/cortao-upsample.js.map +1 -0
- package/dist/lighting/cortao/cortao-webgl-passes.cjs +229 -0
- package/dist/lighting/cortao/cortao-webgl-passes.d.ts +28 -0
- package/dist/lighting/cortao/cortao-webgl-passes.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-webgl-passes.js +212 -0
- package/dist/lighting/cortao/cortao-webgl-passes.js.map +1 -0
- package/dist/lighting/cortao/cortao-webgpu-passes.cjs +348 -0
- package/dist/lighting/cortao/cortao-webgpu-passes.d.ts +31 -0
- package/dist/lighting/cortao/cortao-webgpu-passes.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-webgpu-passes.js +335 -0
- package/dist/lighting/cortao/cortao-webgpu-passes.js.map +1 -0
- package/dist/lighting/index.cjs +13 -2
- package/dist/lighting/index.cjs.map +3 -3
- package/dist/lighting/index.d.ts +11 -6
- package/dist/lighting/index.d.ts.map +1 -1
- package/dist/lighting/index.js +6 -5
- package/dist/lighting/index.js.map +1 -1
- package/dist/lighting/shadow-map-renderer.cjs +40 -37
- package/dist/lighting/shadow-map-renderer.d.ts +15 -0
- package/dist/lighting/shadow-map-renderer.d.ts.map +1 -1
- package/dist/lighting/shadow-map-renderer.js +37 -35
- package/dist/lighting/shadow-map-renderer.js.map +1 -1
- package/dist/model/gpu-vector-model.cjs +39 -16
- package/dist/model/gpu-vector-model.d.ts +8 -0
- package/dist/model/gpu-vector-model.d.ts.map +1 -1
- package/dist/model/gpu-vector-model.js +46 -18
- package/dist/model/gpu-vector-model.js.map +1 -1
- package/dist/passes/effect-renderer.cjs +155 -0
- package/dist/passes/effect-renderer.d.ts +158 -0
- package/dist/passes/effect-renderer.d.ts.map +1 -0
- package/dist/passes/effect-renderer.js +143 -0
- package/dist/passes/effect-renderer.js.map +1 -0
- package/dist/passes/scene-capture-pass.cjs +42 -0
- package/dist/passes/scene-capture-pass.d.ts +29 -0
- package/dist/passes/scene-capture-pass.d.ts.map +1 -0
- package/dist/passes/scene-capture-pass.js +21 -0
- package/dist/passes/scene-capture-pass.js.map +1 -0
- package/dist/passes/shader-pass-renderer.cjs +94 -68
- package/dist/passes/shader-pass-renderer.d.ts +32 -15
- package/dist/passes/shader-pass-renderer.d.ts.map +1 -1
- package/dist/passes/shader-pass-renderer.js +104 -76
- package/dist/passes/shader-pass-renderer.js.map +1 -1
- package/dist/scenegraph/model-node.cjs +2 -0
- package/dist/scenegraph/model-node.d.ts +4 -0
- package/dist/scenegraph/model-node.d.ts.map +1 -1
- package/dist/scenegraph/model-node.js +2 -0
- package/dist/scenegraph/model-node.js.map +1 -1
- package/dist/splats/gpu-paged-splat-renderer.cjs +52 -8
- package/dist/splats/gpu-paged-splat-renderer.d.ts +16 -3
- package/dist/splats/gpu-paged-splat-renderer.d.ts.map +1 -1
- package/dist/splats/gpu-paged-splat-renderer.js +55 -9
- package/dist/splats/gpu-paged-splat-renderer.js.map +1 -1
- package/dist/splats/gpu-paged-splat-shaders.cjs +3 -1
- package/dist/splats/gpu-paged-splat-shaders.d.ts.map +1 -1
- package/dist/splats/gpu-paged-splat-shaders.js +3 -1
- package/dist/splats/gpu-paged-splat-shaders.js.map +1 -1
- package/dist/splats/index.cjs.map +2 -2
- package/dist/text/fonts/atlas/browser-font-atlas.cjs +10 -1
- package/dist/text/fonts/atlas/browser-font-atlas.d.ts +3 -1
- package/dist/text/fonts/atlas/browser-font-atlas.d.ts.map +1 -1
- package/dist/text/fonts/atlas/browser-font-atlas.js +10 -2
- package/dist/text/fonts/atlas/browser-font-atlas.js.map +1 -1
- package/dist/text/fonts/atlas/lru-cache.cjs +4 -0
- package/dist/text/fonts/atlas/lru-cache.d.ts +3 -1
- package/dist/text/fonts/atlas/lru-cache.d.ts.map +1 -1
- package/dist/text/fonts/atlas/lru-cache.js +4 -0
- package/dist/text/fonts/atlas/lru-cache.js.map +1 -1
- package/dist/text/fonts/index.cjs +2 -0
- package/dist/text/fonts/index.cjs.map +1 -1
- package/dist/text/fonts/index.d.ts +1 -1
- package/dist/text/fonts/index.d.ts.map +1 -1
- package/dist/text/fonts/index.js +1 -1
- package/dist/text/fonts/index.js.map +1 -1
- package/dist/text/index.cjs.map +1 -1
- package/package.json +8 -8
- package/src/animation/animation-track.ts +5 -0
- package/src/animation/node-animation-binding.ts +9 -8
- package/src/animation/scenegraph-gpu-animation-layout.ts +195 -0
- package/src/animation/scenegraph-gpu-animation.ts +340 -0
- package/src/arrow/arrow-picking.ts +23 -11
- package/src/effects/README.md +38 -14
- package/src/effects/glfx-effects.ts +227 -0
- package/src/effects/graph/gpu-effect-operation.ts +601 -0
- package/src/effects/graph/temporal-graph-history.ts +46 -0
- package/src/effects/index.ts +81 -19
- package/src/effects/passes/postprocessing/fxaa/fxaa.ts +8 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/tone-mapping.ts +8 -0
- package/src/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.ts +219 -19
- package/src/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.ts +6 -6
- package/src/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.ts +45 -45
- package/src/effects/passes/screen-space/clustered-volumetric-lighting.ts +88 -68
- package/src/effects/passes/screen-space/copy-pass.ts +4 -0
- package/src/effects/passes/screen-space/depth-aware-blur.ts +13 -3
- package/src/effects/passes/screen-space/dof.ts +20 -3
- package/src/effects/passes/screen-space/gtao.ts +91 -65
- package/src/effects/passes/screen-space/hdr-auto-exposure.ts +109 -84
- package/src/effects/passes/screen-space/height-fog.ts +18 -3
- package/src/effects/passes/screen-space/motion-blur.ts +8 -7
- package/src/effects/passes/screen-space/outlines.ts +143 -17
- package/src/effects/passes/screen-space/screen-space-global-illumination.ts +75 -64
- package/src/effects/passes/screen-space/screen-space-reflections.ts +158 -95
- package/src/effects/passes/screen-space/selection-outline.ts +11 -0
- package/src/effects/passes/screen-space/ssao.ts +76 -45
- package/src/effects/passes/screen-space/temporal-antialiasing.ts +43 -33
- package/src/effects/passes/screen-space/temporal-frame.ts +33 -0
- package/src/effects/passes/screen-space/volumetric-fog.ts +30 -24
- package/src/effects/temporal-upscale/index.ts +20 -0
- package/src/effects/temporal-upscale/temporal-math.ts +308 -0
- package/src/effects/temporal-upscale/temporal-upscale-shaders.ts +326 -0
- package/src/effects/temporal-upscale/temporal-upscaler.ts +538 -0
- package/src/gltf/gltf/create-gltf-model.ts +59 -90
- package/src/gltf/gltf/create-scenegraph-from-gltf.ts +71 -5
- package/src/gltf/gltf/gltf-animated-crowd.ts +30 -177
- package/src/gltf/gltf/gltf-animation-nodes.ts +82 -0
- package/src/gltf/gltf/gltf-animator.ts +15 -4
- package/src/gltf/gltf/gltf-gpu-animation-controller.ts +88 -0
- package/src/gltf/gltf/gltf-gpu-animation.ts +53 -60
- package/src/gltf/index.ts +5 -0
- package/src/gltf/parsers/parse-gltf.ts +12 -2
- package/src/graph/physics/index.ts +4 -0
- package/src/graph/physics/physics-controller-geometry.ts +33 -1
- package/src/index.ts +25 -0
- package/src/lighting/ambient-occlusion-pass.ts +62 -28
- package/src/lighting/clustered-light-grid.ts +87 -30
- package/src/lighting/contact-shadow-composite.ts +80 -52
- package/src/lighting/contact-shadow-pass.ts +59 -39
- package/src/lighting/cortao/cortao-occluder-lookup-table.ts +138 -0
- package/src/lighting/cortao/cortao-parameters.ts +218 -0
- package/src/lighting/cortao/cortao-pass.ts +136 -0
- package/src/lighting/cortao/cortao-passes.ts +50 -0
- package/src/lighting/cortao/cortao-shaders-wgsl.ts +633 -0
- package/src/lighting/cortao/cortao-shaders.ts +674 -0
- package/src/lighting/cortao/cortao-upsample.ts +177 -0
- package/src/lighting/cortao/cortao-webgl-passes.ts +284 -0
- package/src/lighting/cortao/cortao-webgpu-passes.ts +430 -0
- package/src/lighting/index.ts +12 -3
- package/src/lighting/shadow-map-renderer.ts +57 -43
- package/src/model/gpu-vector-model.ts +47 -18
- package/src/passes/effect-renderer.ts +332 -0
- package/src/passes/scene-capture-pass.ts +51 -0
- package/src/passes/shader-pass-renderer.ts +164 -115
- package/src/scenegraph/model-node.ts +5 -0
- package/src/splats/gpu-paged-splat-renderer.ts +77 -9
- package/src/splats/gpu-paged-splat-shaders.ts +7 -1
- package/src/text/fonts/atlas/browser-font-atlas.ts +12 -2
- package/src/text/fonts/atlas/lru-cache.ts +6 -1
- package/src/text/fonts/index.ts +1 -0
|
@@ -705,7 +705,20 @@ export class GPUVectorModel {
|
|
|
705
705
|
}
|
|
706
706
|
}
|
|
707
707
|
|
|
708
|
-
|
|
708
|
+
/**
|
|
709
|
+
* Draws one caller-owned WebGPU indirect record in the open pass. The active index buffer
|
|
710
|
+
* selects the indexed (20-byte) or non-indexed (16-byte) layout. The record supplies all
|
|
711
|
+
* counts and offsets for this call. Subsequent direct draws use the model's own counts.
|
|
712
|
+
* @param byteOffset Four-byte-aligned start of the record in a buffer with INDIRECT usage.
|
|
713
|
+
* @returns Whether the draw completed using the same readiness rules as draw().
|
|
714
|
+
*/
|
|
715
|
+
drawIndirect(renderPass: RenderPass, buffer: Buffer, byteOffset = 0): boolean {
|
|
716
|
+
// Indirect commands require WebGPU and a buffer created for indirect use.
|
|
717
|
+
assert(this.device.type === 'webgpu' && (buffer.usage & Buffer.INDIRECT) !== 0);
|
|
718
|
+
return this._draw(renderPass, buffer, byteOffset);
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
private _draw(renderPass: RenderPass, indirectBuffer?: Buffer, byteOffset = 0): boolean {
|
|
709
722
|
if (this.indexVector?.length === 0) {
|
|
710
723
|
this._lastDrawTimestamp = this.device.timestamp;
|
|
711
724
|
this._needsRedraw = false;
|
|
@@ -716,6 +729,13 @@ export class GPUVectorModel {
|
|
|
716
729
|
(this.geometryVectorBindings.batchCount !== 1 ||
|
|
717
730
|
this.attributeVectorBindings.batchCount !== 1)
|
|
718
731
|
) {
|
|
732
|
+
if (indirectBuffer) {
|
|
733
|
+
// A single command cannot describe multiple physical vector batches.
|
|
734
|
+
assert(
|
|
735
|
+
this.geometryVectorBindings.batchCount <= 1 &&
|
|
736
|
+
this.attributeVectorBindings.batchCount <= 1
|
|
737
|
+
);
|
|
738
|
+
}
|
|
719
739
|
return this.drawVectorGroups(renderPass);
|
|
720
740
|
}
|
|
721
741
|
if (this._drawBlockedReason && !this._pipelineNeedsUpdate) {
|
|
@@ -791,23 +811,32 @@ export class GPUVectorModel {
|
|
|
791
811
|
_bindGroupCacheKeys: this._getBindGroupCacheKeys()
|
|
792
812
|
});
|
|
793
813
|
renderPass.setVertexArray(this.vertexArray);
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
814
|
+
if (indirectBuffer) {
|
|
815
|
+
if (indexBuffer) {
|
|
816
|
+
renderPass.drawIndexedIndirect(indirectBuffer, byteOffset);
|
|
817
|
+
} else {
|
|
818
|
+
renderPass.drawIndirect(indirectBuffer, byteOffset);
|
|
819
|
+
}
|
|
820
|
+
drawSuccess = true;
|
|
821
|
+
} else {
|
|
822
|
+
const hasNoInstances = this.isInstanced === true && this.instanceCount === 0;
|
|
823
|
+
drawSuccess = hasNoInstances
|
|
824
|
+
? true
|
|
825
|
+
: renderPass.draw({
|
|
826
|
+
isInstanced: this.isInstanced,
|
|
827
|
+
vertexCount: this.vertexCount,
|
|
828
|
+
instanceCount: this.isInstanced ? this.instanceCount : undefined,
|
|
829
|
+
indexCount,
|
|
830
|
+
firstVertex: this.firstVertex,
|
|
831
|
+
firstIndex: this.firstIndex,
|
|
832
|
+
transformFeedback: this.transformFeedback || undefined,
|
|
833
|
+
uniforms: this.props.uniforms,
|
|
834
|
+
// WebGL shares underlying cached programs even for models that have different
|
|
835
|
+
// parameters and topology, so those compatibility overrides remain per draw.
|
|
836
|
+
parameters: this.parameters,
|
|
837
|
+
topology: this.topology
|
|
838
|
+
});
|
|
839
|
+
}
|
|
811
840
|
}
|
|
812
841
|
}
|
|
813
842
|
} finally {
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {CommandEncoder, Device, Framebuffer, Texture} from '@luma.gl/core';
|
|
6
|
+
import type {CompositeShaderPass, ShaderModule} from '@luma.gl/shaders';
|
|
7
|
+
import {
|
|
8
|
+
ShaderPassRenderer,
|
|
9
|
+
type ShaderPassRendererProps,
|
|
10
|
+
type ShaderPassRendererRenderOptions
|
|
11
|
+
} from './shader-pass-renderer';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A fullscreen draw in an effect. The shader supplies the filtering or sampling
|
|
15
|
+
* implementation. Inputs route textures to its bindings and output selects the
|
|
16
|
+
* destination. Uniform values here provide defaults for this draw.
|
|
17
|
+
*/
|
|
18
|
+
export type EffectPass<TargetName extends string = string> =
|
|
19
|
+
| (CompositeShaderPass<TargetName>['steps'][number] & {kind: 'fullscreen'})
|
|
20
|
+
| (Omit<CompositeShaderPass<TargetName>['steps'][number], 'shaderPass'> & {
|
|
21
|
+
kind: 'filter' | 'sample';
|
|
22
|
+
module: ShaderModule;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A reusable, device-independent description of a fullscreen effect.
|
|
27
|
+
*
|
|
28
|
+
* An effect receives the preceding color image and can sample additional textures
|
|
29
|
+
* supplied for the frame. Passes write either private named targets or the shared
|
|
30
|
+
* color chain. Each use of a definition gets its own render targets and history.
|
|
31
|
+
*
|
|
32
|
+
* Use `EffectDefinition<'targetA' | 'targetB'>` to check local target
|
|
33
|
+
* references when declaring an effect as a module-level constant. Treat the
|
|
34
|
+
* definition as immutable once a renderer uses it.
|
|
35
|
+
*
|
|
36
|
+
* @typeParam TargetName - Names of textures owned by this effect.
|
|
37
|
+
*/
|
|
38
|
+
export type EffectDefinition<TargetName extends string = string> = {
|
|
39
|
+
/** Label used to identify the effect and its GPU resources in diagnostics. */
|
|
40
|
+
name: string;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Textures owned by each occurrence of this effect. A target's scale is relative
|
|
44
|
+
* to the renderer size. History targets retain their prior frame value and may
|
|
45
|
+
* declare how to initialize it. Use an empty object for an effect that only
|
|
46
|
+
* writes to the shared color chain.
|
|
47
|
+
*/
|
|
48
|
+
resources?: NonNullable<CompositeShaderPass<TargetName>['renderTargets']>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Optional backend alternatives for a stage before the shared passes. Both
|
|
52
|
+
* implementations must produce the named textures the shared passes consume.
|
|
53
|
+
* The renderer selects the implementation once when constructed.
|
|
54
|
+
*/
|
|
55
|
+
initialPasses?: {
|
|
56
|
+
/**
|
|
57
|
+
* A fused WebGPU dispatch. Declare each storage output by binding name, and
|
|
58
|
+
* mark the corresponding resource with `storage: true`. The first listed
|
|
59
|
+
* output determines dispatch dimensions. The renderer checks device limits
|
|
60
|
+
* and storage-format support and chooses the fragment sequence if needed.
|
|
61
|
+
*/
|
|
62
|
+
compute?: NonNullable<CompositeShaderPass<TargetName>['initialPasses']>['compute'];
|
|
63
|
+
|
|
64
|
+
/** Portable fullscreen draws in execution order. */
|
|
65
|
+
fragment: EffectPass<TargetName>[];
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Shared fullscreen draws in execution order. Use `previous` to read or
|
|
70
|
+
* update the color chain, `original` to read the stack's input image, and a
|
|
71
|
+
* local resource name to route a texture between draws within the effect.
|
|
72
|
+
*/
|
|
73
|
+
passes: EffectPass<TargetName>[];
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
type EffectOptionKey<Options> = Options extends unknown ? Extract<keyof Options, string> : never;
|
|
77
|
+
|
|
78
|
+
/** Value accepted by a fullscreen pass uniform. */
|
|
79
|
+
type EffectUniform = NonNullable<EffectPass['uniforms']>[string];
|
|
80
|
+
|
|
81
|
+
/** Reads a construction option directly or through a lookup table. */
|
|
82
|
+
type EffectOptionValue<Options, Value = unknown> = {
|
|
83
|
+
option: EffectOptionKey<Options>;
|
|
84
|
+
values?: Readonly<Record<string, Value>>;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* A reusable effect whose resource descriptors or pass sequence depend on options.
|
|
89
|
+
* Configure it when constructing the stack or when topology changes. Per-frame
|
|
90
|
+
* uniforms and external textures are supplied to the renderer separately.
|
|
91
|
+
*/
|
|
92
|
+
export type ConfigurableEffectDefinition<Options, TargetName extends string = string> =
|
|
93
|
+
| {
|
|
94
|
+
/** Name of the effect being configured. */
|
|
95
|
+
name: string;
|
|
96
|
+
|
|
97
|
+
/** Returns resources and passes for one configuration. */
|
|
98
|
+
configure(options?: Options): EffectDefinition<TargetName>;
|
|
99
|
+
}
|
|
100
|
+
| (EffectDefinition<TargetName> & {
|
|
101
|
+
optionDefaults: Options;
|
|
102
|
+
/** A numeric option used for both dimensions of the listed render targets. */
|
|
103
|
+
scaleResources?: EffectOptionValue<Options, number> & {
|
|
104
|
+
targets: readonly TargetName[];
|
|
105
|
+
fallback?: EffectOptionValue<Options, number>;
|
|
106
|
+
defaultScale?: number;
|
|
107
|
+
minimum?: number;
|
|
108
|
+
factors?: Partial<Record<TargetName, number>>;
|
|
109
|
+
};
|
|
110
|
+
/** Initialize a history texture’s red channel from a numeric option. */
|
|
111
|
+
historyClearOptions?: Partial<
|
|
112
|
+
Record<TargetName, {option: EffectOptionKey<Options>; minimum?: number}>
|
|
113
|
+
>;
|
|
114
|
+
/** Map options to uniform defaults by shader module and uniform name. */
|
|
115
|
+
optionUniforms?: Record<string, Record<string, EffectOptionValue<Options, EffectUniform>>>;
|
|
116
|
+
/** Map option choices to logical inputs by shader module and binding name. */
|
|
117
|
+
optionInputs?: Record<
|
|
118
|
+
string,
|
|
119
|
+
Record<string, EffectOptionValue<Options, 'previous' | 'original' | TargetName>>
|
|
120
|
+
>;
|
|
121
|
+
/** Select replacement passes and resources using the value of an option. */
|
|
122
|
+
variants?: {
|
|
123
|
+
option: EffectOptionKey<Options>;
|
|
124
|
+
values: Record<
|
|
125
|
+
string,
|
|
126
|
+
Partial<Pick<EffectDefinition<TargetName>, 'name' | 'resources' | 'passes'>>
|
|
127
|
+
>;
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
/** @internal Resolves construction options into the executable effect. */
|
|
132
|
+
export function resolveEffectOptions<Options, TargetName extends string>(
|
|
133
|
+
effect: ConfigurableEffectDefinition<Options, TargetName>,
|
|
134
|
+
options?: NoInfer<Options>
|
|
135
|
+
): EffectDefinition<TargetName> {
|
|
136
|
+
if ('configure' in effect) return effect.configure(options);
|
|
137
|
+
const {
|
|
138
|
+
scaleResources,
|
|
139
|
+
variants,
|
|
140
|
+
optionDefaults,
|
|
141
|
+
optionUniforms,
|
|
142
|
+
optionInputs,
|
|
143
|
+
historyClearOptions
|
|
144
|
+
} = effect;
|
|
145
|
+
const overrides = options as Partial<Record<EffectOptionKey<Options>, unknown>> | undefined;
|
|
146
|
+
const defaults = optionDefaults as Partial<Record<EffectOptionKey<Options>, unknown>>;
|
|
147
|
+
const readOption = (key: EffectOptionKey<Options>) => overrides?.[key] ?? defaults[key];
|
|
148
|
+
const readValue = (mapping: EffectOptionValue<Options>) => {
|
|
149
|
+
const option = readOption(mapping.option);
|
|
150
|
+
if (!mapping.values) return option;
|
|
151
|
+
const key = String(option);
|
|
152
|
+
return Object.hasOwn(mapping.values, key) ? mapping.values[key] : undefined;
|
|
153
|
+
};
|
|
154
|
+
const value = variants && String(readOption(variants.option));
|
|
155
|
+
const variant =
|
|
156
|
+
variants && value !== undefined && Object.hasOwn(variants.values, value)
|
|
157
|
+
? variants.values[value]
|
|
158
|
+
: undefined;
|
|
159
|
+
const resolved = {...effect, ...variant};
|
|
160
|
+
const resources = {...resolved.resources} as NonNullable<
|
|
161
|
+
EffectDefinition<TargetName>['resources']
|
|
162
|
+
>;
|
|
163
|
+
if (scaleResources) {
|
|
164
|
+
const scale =
|
|
165
|
+
readValue(scaleResources) ??
|
|
166
|
+
(scaleResources.fallback && readValue(scaleResources.fallback)) ??
|
|
167
|
+
scaleResources.defaultScale;
|
|
168
|
+
if (
|
|
169
|
+
typeof scale !== 'number' ||
|
|
170
|
+
!Number.isFinite(scale) ||
|
|
171
|
+
(scale <= 0 && !scaleResources.minimum)
|
|
172
|
+
) {
|
|
173
|
+
throw new Error(effect.name + ': resource scale must be a finite positive number');
|
|
174
|
+
}
|
|
175
|
+
for (const name of scaleResources.targets) {
|
|
176
|
+
const resource = resources[name];
|
|
177
|
+
if (!resource?.scale) continue;
|
|
178
|
+
const factor = scaleResources.factors?.[name] ?? 1;
|
|
179
|
+
const size = Math.max(scale, scaleResources.minimum ?? 0) * factor;
|
|
180
|
+
resources[name] = {...resource, scale: [size, size]};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
for (const name of Object.keys(historyClearOptions ?? {}) as TargetName[]) {
|
|
184
|
+
const mapping = historyClearOptions?.[name];
|
|
185
|
+
const resource = resources[name];
|
|
186
|
+
const initial = resource?.initialize;
|
|
187
|
+
if (!mapping || !initial || initial === 'original') continue;
|
|
188
|
+
const value = readOption(mapping.option);
|
|
189
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
190
|
+
const [, green, blue, alpha] = initial.clearColor;
|
|
191
|
+
resources[name] = {
|
|
192
|
+
...resource,
|
|
193
|
+
initialize: {
|
|
194
|
+
clearColor: [Math.max(value, mapping.minimum ?? -Infinity), green, blue, alpha]
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
const passes = resolved.passes.map(pass => {
|
|
200
|
+
const moduleName = pass.kind === 'fullscreen' ? pass.shaderPass.name : pass.module.name;
|
|
201
|
+
const uniformOptions = optionUniforms?.[moduleName];
|
|
202
|
+
const inputOptions = optionInputs?.[moduleName];
|
|
203
|
+
if (!uniformOptions && !inputOptions) return pass;
|
|
204
|
+
const uniforms = {...pass.uniforms};
|
|
205
|
+
const inputs = {...pass.inputs};
|
|
206
|
+
for (const [name, mapping] of Object.entries(uniformOptions ?? {})) {
|
|
207
|
+
const value = readValue(mapping) as EffectUniform | undefined;
|
|
208
|
+
if (value !== undefined) uniforms[name] = value;
|
|
209
|
+
}
|
|
210
|
+
for (const [name, mapping] of Object.entries(inputOptions ?? {})) {
|
|
211
|
+
const value = readValue(mapping);
|
|
212
|
+
if (typeof value === 'string') inputs[name] = value as 'previous' | 'original' | TargetName;
|
|
213
|
+
}
|
|
214
|
+
return {...pass, uniforms, ...(inputOptions ? {inputs} : {})};
|
|
215
|
+
});
|
|
216
|
+
return {...resolved, resources, passes};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** @internal Lowers an effect definition to the fullscreen renderer's execution format. */
|
|
220
|
+
export function resolveEffect<TargetName extends string>(
|
|
221
|
+
effect: EffectDefinition<TargetName>
|
|
222
|
+
): CompositeShaderPass<TargetName> {
|
|
223
|
+
return {
|
|
224
|
+
name: effect.name,
|
|
225
|
+
renderTargets: effect.resources,
|
|
226
|
+
initialPasses: effect.initialPasses && {
|
|
227
|
+
...effect.initialPasses,
|
|
228
|
+
fragment: effect.initialPasses.fragment.map(lowerEffectPass)
|
|
229
|
+
},
|
|
230
|
+
steps: effect.passes.map(lowerEffectPass)
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function lowerEffectPass<TargetName extends string>(
|
|
235
|
+
pass: EffectPass<TargetName>
|
|
236
|
+
): CompositeShaderPass<TargetName>['steps'][number] {
|
|
237
|
+
if (pass.kind === 'fullscreen') return pass;
|
|
238
|
+
const {kind, module, ...routing} = pass;
|
|
239
|
+
return {...routing, shaderPass: {...module, passes: [{action: kind}]}};
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** Ordered effect definitions and their individually typed construction options. */
|
|
243
|
+
export type EffectEntries<Options extends readonly unknown[]> = {
|
|
244
|
+
readonly [Index in keyof Options]:
|
|
245
|
+
| EffectDefinition
|
|
246
|
+
| {
|
|
247
|
+
effect: ConfigurableEffectDefinition<Options[Index]>;
|
|
248
|
+
options?: NoInfer<Options[Index]>;
|
|
249
|
+
}
|
|
250
|
+
| {
|
|
251
|
+
effect: EffectDefinition & {configure?: never; optionDefaults?: never};
|
|
252
|
+
options?: never;
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
export type EffectRendererProps<Options extends readonly unknown[] = readonly unknown[]> = Omit<
|
|
257
|
+
ShaderPassRendererProps,
|
|
258
|
+
'shaderPasses'
|
|
259
|
+
> & {
|
|
260
|
+
/**
|
|
261
|
+
* Effects run in array order, with each color output feeding the next effect.
|
|
262
|
+
* Configure reusable effects inline by supplying their definition and options.
|
|
263
|
+
* Each configuration is checked against the options declared by its effect.
|
|
264
|
+
*/
|
|
265
|
+
effects: EffectEntries<Options>;
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
/** Inputs and destination for a single effects frame. */
|
|
269
|
+
export type EffectRenderOptions = ShaderPassRendererRenderOptions & {
|
|
270
|
+
/** Omit to return the texture, pass null to present, or supply a borrowed framebuffer. */
|
|
271
|
+
target?: Framebuffer | null;
|
|
272
|
+
/** Defaults to the device encoder. The renderer records work without submitting it. */
|
|
273
|
+
commandEncoder?: CommandEncoder;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
/** @internal Normalizes the public effect entries for either executor. */
|
|
277
|
+
export function resolveEffectEntries<Options extends readonly unknown[]>(
|
|
278
|
+
effects: EffectEntries<Options>
|
|
279
|
+
): CompositeShaderPass[] {
|
|
280
|
+
return effects.map(entry => {
|
|
281
|
+
if (!('effect' in entry)) return resolveEffect(entry);
|
|
282
|
+
const {effect} = entry;
|
|
283
|
+
if (('configure' in effect && effect.configure) || 'optionDefaults' in effect) {
|
|
284
|
+
return resolveEffect(
|
|
285
|
+
resolveEffectOptions(effect as ConfigurableEffectDefinition<Options[number]>, entry.options)
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
return resolveEffect(effect);
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Runs a chain of reusable fullscreen effects for a single device.
|
|
294
|
+
*
|
|
295
|
+
* Resize to the desired output size before rendering. Supply scene textures and
|
|
296
|
+
* per-frame uniforms to the render call. Reset history when the camera cuts or
|
|
297
|
+
* scene changes invalidate temporal data, and destroy the renderer when the
|
|
298
|
+
* chain is no longer needed.
|
|
299
|
+
*/
|
|
300
|
+
export class EffectRenderer<
|
|
301
|
+
Options extends readonly unknown[] = readonly unknown[]
|
|
302
|
+
> extends ShaderPassRenderer {
|
|
303
|
+
constructor(device: Device, {effects, ...props}: EffectRendererProps<Options>) {
|
|
304
|
+
super(device, {
|
|
305
|
+
...props,
|
|
306
|
+
shaderPasses: resolveEffectEntries(effects)
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/** Records a frame and returns a borrowed texture, or whether presentation was recorded. */
|
|
311
|
+
render(options: EffectRenderOptions & {target?: undefined}): Texture | null;
|
|
312
|
+
render(options: EffectRenderOptions & {target: Framebuffer | null}): boolean;
|
|
313
|
+
render(options: EffectRenderOptions): Texture | null | boolean;
|
|
314
|
+
render({
|
|
315
|
+
target,
|
|
316
|
+
commandEncoder = this.device.commandEncoder,
|
|
317
|
+
...frame
|
|
318
|
+
}: EffectRenderOptions): Texture | null | boolean {
|
|
319
|
+
if (target && target.device !== this.device) {
|
|
320
|
+
throw new Error('EffectRenderer target must belong to the renderer device');
|
|
321
|
+
}
|
|
322
|
+
const output = this.encodeToTexture(commandEncoder, frame);
|
|
323
|
+
if (target === undefined) {
|
|
324
|
+
return output;
|
|
325
|
+
}
|
|
326
|
+
if (!output) {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
this.drawOutput(commandEncoder, output, target);
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {CommandEncoder, Framebuffer, RenderPass, RenderPassProps} from '@luma.gl/core';
|
|
6
|
+
|
|
7
|
+
type SceneCapturePassProps = Omit<RenderPassProps, 'framebuffer' | 'id'>;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A scene draw into a named framebuffer. The scene owns the framebuffer and its
|
|
11
|
+
* attachments, so a definition can run against different views or slices on each frame.
|
|
12
|
+
*/
|
|
13
|
+
export type SceneCapturePassDefinition<Frame, Target extends string, DrawResult = void> = {
|
|
14
|
+
/** Default GPU command label. A caller can supply a label for a particular view. */
|
|
15
|
+
name: string;
|
|
16
|
+
/** Name of the framebuffer bound for this draw. */
|
|
17
|
+
target: Target;
|
|
18
|
+
/** Static attachment clear, load, and access settings. */
|
|
19
|
+
pass?: SceneCapturePassProps;
|
|
20
|
+
/** Frame-dependent settings, such as a slice scissor rectangle or attachment clear value. */
|
|
21
|
+
getPassProps?: (frame: Frame) => SceneCapturePassProps;
|
|
22
|
+
/** Prepare GPU resources before the render pass opens. */
|
|
23
|
+
prepare?: (commandEncoder: CommandEncoder, frame: Frame) => void;
|
|
24
|
+
/** Records geometry using the active render pass. */
|
|
25
|
+
draw: (renderPass: RenderPass, frame: Frame) => DrawResult;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** Records a capture pass and returns its synchronous draw result. */
|
|
29
|
+
export function encodeSceneCapturePass<Frame, Target extends string, DrawResult>(
|
|
30
|
+
definition: SceneCapturePassDefinition<Frame, Target, DrawResult>,
|
|
31
|
+
options: {
|
|
32
|
+
commandEncoder: CommandEncoder;
|
|
33
|
+
framebuffers: Record<Target, Framebuffer>;
|
|
34
|
+
frame: Frame;
|
|
35
|
+
id?: string;
|
|
36
|
+
}
|
|
37
|
+
): DrawResult {
|
|
38
|
+
const {commandEncoder, frame} = options;
|
|
39
|
+
definition.prepare?.(commandEncoder, frame);
|
|
40
|
+
const renderPass = commandEncoder.beginRenderPass({
|
|
41
|
+
...definition.pass,
|
|
42
|
+
...definition.getPassProps?.(frame),
|
|
43
|
+
id: options.id ?? definition.name,
|
|
44
|
+
framebuffer: options.framebuffers[definition.target]
|
|
45
|
+
});
|
|
46
|
+
try {
|
|
47
|
+
return definition.draw(renderPass, frame);
|
|
48
|
+
} finally {
|
|
49
|
+
renderPass.end();
|
|
50
|
+
}
|
|
51
|
+
}
|