@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
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
import { assert, Buffer, Texture } from '@luma.gl/core';
|
|
5
|
+
import { encodeSceneCapturePass } from "../../passes/scene-capture-pass.js";
|
|
6
|
+
import { DEFAULT_KERNEL_SHARPNESS, DEFAULT_RESPONSIVENESS } from "./temporal-math.js";
|
|
7
|
+
import { temporalUpscaleVertex, temporalUpscaleAccumulate, temporalUpscaleSharpen } from "./temporal-upscale-shaders.js";
|
|
8
|
+
const temporalUpscaleAccumulationPass = {
|
|
9
|
+
name: 'temporal-upscale-accumulation',
|
|
10
|
+
target: 'history',
|
|
11
|
+
pass: { clearColor: false, clearDepth: false, clearStencil: false },
|
|
12
|
+
getPassProps: ({ outputSize }) => ({ parameters: { viewport: [0, 0, ...outputSize] } }),
|
|
13
|
+
draw: (renderPass, { pipeline, bindings }) => {
|
|
14
|
+
renderPass.setPipeline(pipeline);
|
|
15
|
+
renderPass.setBindings(bindings);
|
|
16
|
+
renderPass.draw({ vertexCount: 3 });
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const temporalUpscaleSharpenPass = {
|
|
20
|
+
name: 'temporal-upscale-sharpen',
|
|
21
|
+
target: 'output',
|
|
22
|
+
pass: { clearDepth: false, clearStencil: false },
|
|
23
|
+
getPassProps: ({ outputSize, clear }) => ({
|
|
24
|
+
parameters: { viewport: [0, 0, ...outputSize] },
|
|
25
|
+
clearColor: clear === false ? false : [0, 0, 0, 0]
|
|
26
|
+
}),
|
|
27
|
+
draw: temporalUpscaleAccumulationPass.draw
|
|
28
|
+
};
|
|
29
|
+
/** Raw-core WebGPU implementation inspired by AMD FSR 2; independently authored, non-neural. */
|
|
30
|
+
export class TemporalUpscaler {
|
|
31
|
+
/** Device owning all resources. */
|
|
32
|
+
device;
|
|
33
|
+
/** Resource label prefix. */
|
|
34
|
+
id;
|
|
35
|
+
/** Current input dimensions. */
|
|
36
|
+
renderSize;
|
|
37
|
+
/** Current output dimensions. */
|
|
38
|
+
outputSize;
|
|
39
|
+
/** Hand-packed four-vec4 uniform block. */
|
|
40
|
+
uniformBuffer;
|
|
41
|
+
/** Clamped bilinear history sampler. */
|
|
42
|
+
sampler;
|
|
43
|
+
/** Owned shader modules. */
|
|
44
|
+
shaders;
|
|
45
|
+
/** Accumulation pipeline with two color attachments. */
|
|
46
|
+
accumulatePipeline;
|
|
47
|
+
/** Final single-target pipelines, one for each attachment state of a target. */
|
|
48
|
+
sharpenPipelines = new Map();
|
|
49
|
+
/** Binding layout of the final pass. */
|
|
50
|
+
sharpenShaderLayout;
|
|
51
|
+
/** Color format of a `null` target. */
|
|
52
|
+
outputFormat;
|
|
53
|
+
/** Ping-pong history pair. */
|
|
54
|
+
histories = [];
|
|
55
|
+
/** Index of the most recently accumulated frame. */
|
|
56
|
+
historyIndex = 0;
|
|
57
|
+
/** Whether the next frame must start from current color. */
|
|
58
|
+
needsReset = true;
|
|
59
|
+
/** Whether owned resources have been released. */
|
|
60
|
+
destroyed = false;
|
|
61
|
+
/** Returns true for WebGPU devices; no WebGL implementation is provided. */
|
|
62
|
+
static isSupported(device) {
|
|
63
|
+
return device.info.type === 'webgpu';
|
|
64
|
+
}
|
|
65
|
+
/** Allocates pipelines. Direct rendering allocates its private history on first use. */
|
|
66
|
+
constructor(device, props) {
|
|
67
|
+
if (!TemporalUpscaler.isSupported(device))
|
|
68
|
+
throw new Error('WebGPU required');
|
|
69
|
+
this.device = device;
|
|
70
|
+
this.id = props.id ?? 'temporal-upscaler';
|
|
71
|
+
this.renderSize = [...props.renderSize];
|
|
72
|
+
this.outputSize = [...props.outputSize];
|
|
73
|
+
this.uniformBuffer = device.createBuffer({
|
|
74
|
+
id: `${this.id}-settings`,
|
|
75
|
+
byteLength: 64,
|
|
76
|
+
usage: Buffer.UNIFORM | Buffer.COPY_DST
|
|
77
|
+
});
|
|
78
|
+
this.sampler = device.createSampler({
|
|
79
|
+
minFilter: 'linear',
|
|
80
|
+
magFilter: 'linear',
|
|
81
|
+
addressModeU: 'clamp-to-edge',
|
|
82
|
+
addressModeV: 'clamp-to-edge'
|
|
83
|
+
});
|
|
84
|
+
this.shaders = [
|
|
85
|
+
device.createShader({
|
|
86
|
+
id: `${this.id}-vertex`,
|
|
87
|
+
stage: 'vertex',
|
|
88
|
+
source: temporalUpscaleVertex
|
|
89
|
+
}),
|
|
90
|
+
device.createShader({
|
|
91
|
+
id: `${this.id}-accumulate`,
|
|
92
|
+
stage: 'fragment',
|
|
93
|
+
source: temporalUpscaleAccumulate
|
|
94
|
+
}),
|
|
95
|
+
device.createShader({
|
|
96
|
+
id: `${this.id}-sharpen`,
|
|
97
|
+
stage: 'fragment',
|
|
98
|
+
source: temporalUpscaleSharpen
|
|
99
|
+
})
|
|
100
|
+
];
|
|
101
|
+
const bindings = [
|
|
102
|
+
{ name: 'settings', type: 'uniform', group: 0, location: 0, minBindingSize: 64 },
|
|
103
|
+
{ name: 'colorTexture', type: 'texture', group: 0, location: 1, sampleType: 'float' },
|
|
104
|
+
{ name: 'depthTexture', type: 'texture', group: 0, location: 2, sampleType: 'depth' },
|
|
105
|
+
{ name: 'velocityTexture', type: 'texture', group: 0, location: 3, sampleType: 'float' },
|
|
106
|
+
{ name: 'historyColor', type: 'texture', group: 0, location: 4, sampleType: 'float' },
|
|
107
|
+
{ name: 'historyAux', type: 'texture', group: 0, location: 5, sampleType: 'float' },
|
|
108
|
+
{ name: 'linearSampler', type: 'sampler', group: 0, location: 6, samplerType: 'filtering' }
|
|
109
|
+
];
|
|
110
|
+
this.accumulatePipeline = device.createRenderPipeline({
|
|
111
|
+
id: `${this.id}-accumulate`,
|
|
112
|
+
vs: this.shaders[0],
|
|
113
|
+
fs: this.shaders[1],
|
|
114
|
+
topology: 'triangle-list',
|
|
115
|
+
shaderLayout: { attributes: [], bindings },
|
|
116
|
+
colorAttachmentFormats: ['rgba16float', 'rg16float']
|
|
117
|
+
});
|
|
118
|
+
this.sharpenShaderLayout = {
|
|
119
|
+
attributes: [],
|
|
120
|
+
bindings: [
|
|
121
|
+
...bindings,
|
|
122
|
+
{ name: 'resolvedColor', type: 'texture', group: 0, location: 7, sampleType: 'float' }
|
|
123
|
+
]
|
|
124
|
+
};
|
|
125
|
+
// The public API accepts TextureFormat; the target contract requires a color format.
|
|
126
|
+
this.outputFormat = (props.outputFormat ?? 'rgba8unorm');
|
|
127
|
+
}
|
|
128
|
+
/** Releases direct-render histories and resets accumulation. Submit pending work first. */
|
|
129
|
+
setSize(renderSize, outputSize) {
|
|
130
|
+
this.destroyHistories();
|
|
131
|
+
this.renderSize = [...renderSize];
|
|
132
|
+
this.outputSize = [...outputSize];
|
|
133
|
+
this.historyIndex = 0;
|
|
134
|
+
this.resetHistory();
|
|
135
|
+
}
|
|
136
|
+
ensureHistories() {
|
|
137
|
+
assert(!this.destroyed);
|
|
138
|
+
if (this.histories.length)
|
|
139
|
+
return;
|
|
140
|
+
const outputSize = this.outputSize;
|
|
141
|
+
this.histories = [0, 1].map(index => {
|
|
142
|
+
const common = {
|
|
143
|
+
width: outputSize[0],
|
|
144
|
+
height: outputSize[1],
|
|
145
|
+
usage: Texture.TEXTURE | Texture.RENDER_ATTACHMENT
|
|
146
|
+
};
|
|
147
|
+
const color = this.device.createTexture({
|
|
148
|
+
...common,
|
|
149
|
+
id: `${this.id}-color-${index}`,
|
|
150
|
+
format: 'rgba16float'
|
|
151
|
+
});
|
|
152
|
+
const auxiliary = this.device.createTexture({
|
|
153
|
+
...common,
|
|
154
|
+
id: `${this.id}-auxiliary-${index}`,
|
|
155
|
+
format: 'rg16float'
|
|
156
|
+
});
|
|
157
|
+
const framebuffer = this.device.createFramebuffer({
|
|
158
|
+
id: `${this.id}-history-${index}`,
|
|
159
|
+
width: outputSize[0],
|
|
160
|
+
height: outputSize[1],
|
|
161
|
+
colorAttachments: [color, auxiliary]
|
|
162
|
+
});
|
|
163
|
+
return { color, auxiliary, framebuffer };
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Encodes accumulation then sharpening. The caller must submit before the next render,
|
|
168
|
+
* resize or destruction (uniform writes use the device queue). No submission occurs here.
|
|
169
|
+
* Each pass ends before a sampled texture becomes an attachment in a later frame;
|
|
170
|
+
* separate WebGPU render-pass usage scopes need no intermediate submission.
|
|
171
|
+
*/
|
|
172
|
+
render(options) {
|
|
173
|
+
this.ensureHistories();
|
|
174
|
+
const previous = this.histories[this.historyIndex];
|
|
175
|
+
const nextIndex = 1 - this.historyIndex;
|
|
176
|
+
const next = this.histories[nextIndex];
|
|
177
|
+
this.uniformBuffer.write(this.getUniforms(options, this.needsReset || Boolean(options.resetHistory)));
|
|
178
|
+
const bindings = {
|
|
179
|
+
settings: this.uniformBuffer,
|
|
180
|
+
colorTexture: options.colorTexture,
|
|
181
|
+
depthTexture: options.depthTexture,
|
|
182
|
+
velocityTexture: options.velocityTexture,
|
|
183
|
+
historyColor: previous.color,
|
|
184
|
+
historyAux: previous.auxiliary,
|
|
185
|
+
linearSampler: this.sampler
|
|
186
|
+
};
|
|
187
|
+
const commandEncoder = this.device.commandEncoder;
|
|
188
|
+
encodeSceneCapturePass(temporalUpscaleAccumulationPass, {
|
|
189
|
+
commandEncoder,
|
|
190
|
+
framebuffers: { history: next.framebuffer },
|
|
191
|
+
frame: { pipeline: this.accumulatePipeline, outputSize: this.outputSize, bindings }
|
|
192
|
+
});
|
|
193
|
+
// A color-only view of the target avoids coupling this pipeline to a caller's
|
|
194
|
+
// depth format or additional MRT attachments. These borrowed views remain caller-owned.
|
|
195
|
+
const target = options.target ??
|
|
196
|
+
this.device.getDefaultCanvasContext().getCurrentFramebuffer({ depthStencilFormat: false });
|
|
197
|
+
const colorTarget = target.depthStencilAttachment || target.colorAttachments.length > 1
|
|
198
|
+
? this.device.createFramebuffer({
|
|
199
|
+
width: this.outputSize[0],
|
|
200
|
+
height: this.outputSize[1],
|
|
201
|
+
colorAttachments: [target.colorAttachments[0]]
|
|
202
|
+
})
|
|
203
|
+
: target;
|
|
204
|
+
try {
|
|
205
|
+
encodeSceneCapturePass(temporalUpscaleSharpenPass, {
|
|
206
|
+
commandEncoder,
|
|
207
|
+
framebuffers: { output: colorTarget },
|
|
208
|
+
frame: {
|
|
209
|
+
pipeline: this.getSharpenPipeline(colorTarget),
|
|
210
|
+
outputSize: this.outputSize,
|
|
211
|
+
bindings: { ...bindings, resolvedColor: next.color },
|
|
212
|
+
clear: options.clear
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
finally {
|
|
217
|
+
if (colorTarget !== target)
|
|
218
|
+
colorTarget.destroy();
|
|
219
|
+
}
|
|
220
|
+
this.historyIndex = nextIndex;
|
|
221
|
+
this.needsReset = false;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Appends accumulation and sharpening to a WebGPU command graph. The compiled graph
|
|
225
|
+
* borrows this upscaler's pipelines and the supplied history roles. Set resetHistory
|
|
226
|
+
* on the first frame and camera cuts. Bind and advance both history pairs together
|
|
227
|
+
* after submission. Rebuild the graph after setSize and destroy it before the upscaler.
|
|
228
|
+
*/
|
|
229
|
+
addToGraph(graph, views) {
|
|
230
|
+
const { color, depth, velocity, colorHistory, auxiliaryHistory, output } = views;
|
|
231
|
+
const inputs = [color, depth, velocity];
|
|
232
|
+
const outputs = [
|
|
233
|
+
colorHistory.previous,
|
|
234
|
+
colorHistory.current,
|
|
235
|
+
auxiliaryHistory.previous,
|
|
236
|
+
auxiliaryHistory.current,
|
|
237
|
+
output
|
|
238
|
+
];
|
|
239
|
+
// Shader coordinates are relative to the render and output sizes configured on this upscaler.
|
|
240
|
+
assert(graph.device === this.device &&
|
|
241
|
+
inputs.every(view => view.width === this.renderSize[0] && view.height === this.renderSize[1]));
|
|
242
|
+
assert(outputs.every(view => view.width === this.outputSize[0] && view.height === this.outputSize[1]));
|
|
243
|
+
const sampled = [...inputs, colorHistory.previous, auxiliaryHistory.previous].map(texture => ({
|
|
244
|
+
texture,
|
|
245
|
+
usage: 'sampled'
|
|
246
|
+
}));
|
|
247
|
+
const getBindings = (getTextureView) => ({
|
|
248
|
+
settings: this.uniformBuffer,
|
|
249
|
+
colorTexture: getTextureView(color),
|
|
250
|
+
depthTexture: getTextureView(depth),
|
|
251
|
+
velocityTexture: getTextureView(velocity),
|
|
252
|
+
historyColor: getTextureView(colorHistory.previous),
|
|
253
|
+
historyAux: getTextureView(auxiliaryHistory.previous),
|
|
254
|
+
linearSampler: this.sampler
|
|
255
|
+
});
|
|
256
|
+
graph.addRenderPass({
|
|
257
|
+
id: this.id + '/accumulate',
|
|
258
|
+
resources: sampled,
|
|
259
|
+
attachments: { colorAttachments: [colorHistory.current, auxiliaryHistory.current] },
|
|
260
|
+
compile: () => ({
|
|
261
|
+
prepare: ({ commandEncoder, parameters }) => {
|
|
262
|
+
this.device.writeBufferViaCommandEncoder(commandEncoder, this.uniformBuffer, this.getUniforms(parameters, Boolean(parameters.resetHistory)));
|
|
263
|
+
},
|
|
264
|
+
getRenderPassProps: () => temporalUpscaleAccumulationPass.pass,
|
|
265
|
+
encode: ({ renderPass, getTextureView }) => temporalUpscaleAccumulationPass.draw(renderPass, {
|
|
266
|
+
pipeline: this.accumulatePipeline,
|
|
267
|
+
outputSize: this.outputSize,
|
|
268
|
+
bindings: getBindings(getTextureView)
|
|
269
|
+
})
|
|
270
|
+
})
|
|
271
|
+
});
|
|
272
|
+
graph.addRenderPass({
|
|
273
|
+
id: this.id + '/sharpen',
|
|
274
|
+
resources: [...sampled, { texture: colorHistory.current, usage: 'sampled' }],
|
|
275
|
+
attachments: { colorAttachments: [output] },
|
|
276
|
+
compile: () => {
|
|
277
|
+
const pipeline = this.getSharpenPipelineForFormat(output.format);
|
|
278
|
+
return {
|
|
279
|
+
getRenderPassProps: ({ parameters }) => ({
|
|
280
|
+
...temporalUpscaleSharpenPass.pass,
|
|
281
|
+
clearColor: parameters.clear === false ? false : [0, 0, 0, 0]
|
|
282
|
+
}),
|
|
283
|
+
encode: ({ renderPass, getTextureView }) => temporalUpscaleSharpenPass.draw(renderPass, {
|
|
284
|
+
pipeline,
|
|
285
|
+
outputSize: this.outputSize,
|
|
286
|
+
bindings: {
|
|
287
|
+
...getBindings(getTextureView),
|
|
288
|
+
resolvedColor: getTextureView(colorHistory.current)
|
|
289
|
+
}
|
|
290
|
+
})
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
getUniforms(options, reset) {
|
|
296
|
+
const debugMode = { none: 0, velocity: 1, disocclusion: 2, 'history-weight': 3 }[options.debugView ?? 'none'];
|
|
297
|
+
return new Float32Array([
|
|
298
|
+
...this.renderSize,
|
|
299
|
+
...this.outputSize,
|
|
300
|
+
options.currentJitter[0] * this.renderSize[0],
|
|
301
|
+
options.currentJitter[1] * this.renderSize[1],
|
|
302
|
+
Number(reset),
|
|
303
|
+
options.sharpness ?? 0,
|
|
304
|
+
options.historyWeightMax ?? 0.95,
|
|
305
|
+
debugMode,
|
|
306
|
+
Number(options.sampleValidation ?? true),
|
|
307
|
+
options.kernelSharpness ?? DEFAULT_KERNEL_SHARPNESS,
|
|
308
|
+
options.responsiveness ?? DEFAULT_RESPONSIVENESS,
|
|
309
|
+
0,
|
|
310
|
+
0,
|
|
311
|
+
0
|
|
312
|
+
]);
|
|
313
|
+
}
|
|
314
|
+
/** Discards history on the next render, without GPU work or clearing textures. */
|
|
315
|
+
resetHistory() {
|
|
316
|
+
this.needsReset = true;
|
|
317
|
+
}
|
|
318
|
+
/** Latest unsharpened output-sized rgba16float history; borrowed, never destroy it externally. */
|
|
319
|
+
get historyTexture() {
|
|
320
|
+
this.ensureHistories();
|
|
321
|
+
return this.histories[this.historyIndex].color;
|
|
322
|
+
}
|
|
323
|
+
/** Releases all owned GPU resources; call after submitting pending rendering. Idempotent. */
|
|
324
|
+
destroy() {
|
|
325
|
+
if (this.destroyed)
|
|
326
|
+
return;
|
|
327
|
+
this.destroyed = true;
|
|
328
|
+
this.destroyHistories();
|
|
329
|
+
this.accumulatePipeline.destroy();
|
|
330
|
+
for (const pipeline of this.sharpenPipelines.values())
|
|
331
|
+
pipeline.destroy();
|
|
332
|
+
this.sharpenPipelines.clear();
|
|
333
|
+
for (const shader of this.shaders)
|
|
334
|
+
shader.destroy();
|
|
335
|
+
this.sampler.destroy();
|
|
336
|
+
this.uniformBuffer.destroy();
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Gets the final pipeline for the attachment state of a target. A WebGPU pipeline must name
|
|
340
|
+
* the color format and the depth-stencil format of the render pass. A canvas framebuffer has
|
|
341
|
+
* a depth-stencil attachment, and an offscreen target usually has none.
|
|
342
|
+
*/
|
|
343
|
+
getSharpenPipeline(target) {
|
|
344
|
+
const colorAttachment = target?.colorAttachments[0];
|
|
345
|
+
const colorFormat = (colorAttachment?.props.format ??
|
|
346
|
+
colorAttachment?.texture.props.format ??
|
|
347
|
+
this.outputFormat);
|
|
348
|
+
const depthFormat = target
|
|
349
|
+
? target.depthStencilAttachment?.texture.props.format
|
|
350
|
+
: this.device.preferredDepthFormat;
|
|
351
|
+
return this.getSharpenPipelineForFormat(colorFormat, depthFormat);
|
|
352
|
+
}
|
|
353
|
+
getSharpenPipelineForFormat(colorFormat, depthFormat) {
|
|
354
|
+
const key = `${colorFormat}/${depthFormat ?? 'none'}`;
|
|
355
|
+
let pipeline = this.sharpenPipelines.get(key);
|
|
356
|
+
if (!pipeline) {
|
|
357
|
+
pipeline = this.device.createRenderPipeline({
|
|
358
|
+
id: `${this.id}-sharpen-${key}`,
|
|
359
|
+
vs: this.shaders[0],
|
|
360
|
+
fs: this.shaders[2],
|
|
361
|
+
topology: 'triangle-list',
|
|
362
|
+
shaderLayout: this.sharpenShaderLayout,
|
|
363
|
+
colorAttachmentFormats: [colorFormat],
|
|
364
|
+
...(depthFormat
|
|
365
|
+
? {
|
|
366
|
+
depthStencilAttachmentFormat: depthFormat,
|
|
367
|
+
parameters: { depthWriteEnabled: false, depthCompare: 'always' }
|
|
368
|
+
}
|
|
369
|
+
: {})
|
|
370
|
+
});
|
|
371
|
+
this.sharpenPipelines.set(key, pipeline);
|
|
372
|
+
}
|
|
373
|
+
return pipeline;
|
|
374
|
+
}
|
|
375
|
+
/** Releases framebuffers and their explicitly owned attachments. */
|
|
376
|
+
destroyHistories() {
|
|
377
|
+
for (const history of this.histories) {
|
|
378
|
+
history.framebuffer.destroy();
|
|
379
|
+
history.color.destroy();
|
|
380
|
+
history.auxiliary.destroy();
|
|
381
|
+
}
|
|
382
|
+
this.histories = [];
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
//# sourceMappingURL=temporal-upscaler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temporal-upscaler.js","sourceRoot":"","sources":["../../../src/effects/temporal-upscale/temporal-upscaler.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,EAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AActD,OAAO,EACL,sBAAsB,EAEvB,2CAAwC;AAIzC,OAAO,EAAC,wBAAwB,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,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,oEAAoE;IAC5D,gBAAgB;QACtB,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACrC,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;YAC9B,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACxB,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QAC9B,CAAC;QACD,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -26,6 +26,8 @@ var import_core = require("@luma.gl/core");
|
|
|
26
26
|
var import_engine2 = require("@luma.gl/engine");
|
|
27
27
|
var import_dynamic = require("@luma.gl/core/dynamic");
|
|
28
28
|
var import_shaders = require("@luma.gl/shaders");
|
|
29
|
+
var import_scenegraph_gpu_animation_layout = require("../../animation/scenegraph-gpu-animation-layout.cjs");
|
|
30
|
+
var import_scenegraph_gpu_animation = require("../../animation/scenegraph-gpu-animation.cjs");
|
|
29
31
|
const SHADER = (
|
|
30
32
|
/* WGSL */
|
|
31
33
|
`
|
|
@@ -520,15 +522,20 @@ function createGLTFModel(device, options) {
|
|
|
520
522
|
const instanceBufferLayout = [];
|
|
521
523
|
const transformBuffers = [];
|
|
522
524
|
const transformColumns = [];
|
|
523
|
-
const
|
|
524
|
-
|
|
525
|
+
const sceneAnimation = options.scenegraphGPUAnimation;
|
|
526
|
+
const animationLayout = (sceneAnimation == null ? void 0 : sceneAnimation.layout) || (crowd == null ? void 0 : crowd.gpuAnimation);
|
|
527
|
+
const hasGPUAnimation = Boolean(animationLayout);
|
|
528
|
+
const instanced = Boolean(instanceMatrices || crowd || sceneAnimation);
|
|
529
|
+
if (instanced) {
|
|
525
530
|
for (let columnIndex = 0; columnIndex < 4; columnIndex++) {
|
|
526
|
-
const values = new Float32Array(((crowd == null ? void 0 : crowd.capacity) || (instanceMatrices == null ? void 0 : instanceMatrices.length) ||
|
|
531
|
+
const values = new Float32Array(((crowd == null ? void 0 : crowd.capacity) || (instanceMatrices == null ? void 0 : instanceMatrices.length) || 1) * 4);
|
|
527
532
|
instanceMatrices == null ? void 0 : instanceMatrices.forEach((matrix, instanceIndex) => {
|
|
528
533
|
for (let rowIndex = 0; rowIndex < 4; rowIndex++) {
|
|
529
534
|
values[instanceIndex * 4 + rowIndex] = matrix[columnIndex * 4 + rowIndex];
|
|
530
535
|
}
|
|
531
536
|
});
|
|
537
|
+
if (sceneAnimation)
|
|
538
|
+
values[columnIndex] = 1;
|
|
532
539
|
const attributeName = `instanceModelMatrixCol${columnIndex}`;
|
|
533
540
|
const buffer = device.createBuffer({
|
|
534
541
|
id: `${id || "gltf"}-${attributeName}`,
|
|
@@ -542,34 +549,8 @@ function createGLTFModel(device, options) {
|
|
|
542
549
|
transformColumns.push(values);
|
|
543
550
|
}
|
|
544
551
|
}
|
|
545
|
-
let animationParameters;
|
|
546
|
-
let animationParameterBuffer;
|
|
547
|
-
let animationBlend;
|
|
548
|
-
let animationBlendBuffer;
|
|
549
|
-
if (crowd && hasGPUAnimation) {
|
|
550
|
-
animationParameters = new Float32Array(crowd.capacity * 4);
|
|
551
|
-
animationBlend = new Float32Array(crowd.capacity * 4);
|
|
552
|
-
for (const [attributeName, values] of [
|
|
553
|
-
["instanceAnimationFrames", animationParameters],
|
|
554
|
-
["instanceAnimationBlend", animationBlend]
|
|
555
|
-
]) {
|
|
556
|
-
const buffer = device.createBuffer({
|
|
557
|
-
id: `${id || "gltf"}-${attributeName}`,
|
|
558
|
-
data: values,
|
|
559
|
-
usage: import_core.Buffer.VERTEX | import_core.Buffer.COPY_DST
|
|
560
|
-
});
|
|
561
|
-
instanceAttributes[attributeName] = buffer;
|
|
562
|
-
instanceBufferLayout.push({ name: attributeName, format: "float32x4", stepMode: "instance" });
|
|
563
|
-
managedResources.push(buffer);
|
|
564
|
-
if (attributeName === "instanceAnimationFrames") {
|
|
565
|
-
animationParameterBuffer = buffer;
|
|
566
|
-
} else {
|
|
567
|
-
animationBlendBuffer = buffer;
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
552
|
const hasSkin = Boolean(parsedPPBRMaterial.defines["HAS_SKIN"]);
|
|
572
|
-
const hasLargeSkinPalette = Boolean(usesLargeSkinPalette && hasSkin && !crowd);
|
|
553
|
+
const hasLargeSkinPalette = Boolean(usesLargeSkinPalette && hasSkin && !crowd && !hasGPUAnimation);
|
|
573
554
|
const hasInstancedSkin = Boolean(crowd && hasSkin && !hasGPUAnimation);
|
|
574
555
|
let skinJointMatrices;
|
|
575
556
|
let jointMatrices;
|
|
@@ -612,24 +593,24 @@ function createGLTFModel(device, options) {
|
|
|
612
593
|
}
|
|
613
594
|
}
|
|
614
595
|
}
|
|
615
|
-
morphTargetData =
|
|
596
|
+
morphTargetData = (0, import_scenegraph_gpu_animation.createScenegraphGPUAnimationStorage)(device, `${id || "gltf"}-crowd-morph-targets`, targetValues, morphVertexCount, morphTargetCount * 3);
|
|
616
597
|
managedResources.push(morphTargetData);
|
|
617
598
|
if (!hasGPUAnimation) {
|
|
618
599
|
const packedTargetCount = Math.ceil(morphTargetCount / 4);
|
|
619
600
|
const morphInstanceCount = (crowd == null ? void 0 : crowd.capacity) || 1;
|
|
620
601
|
morphWeights = new Float32Array(morphInstanceCount * packedTargetCount * 4);
|
|
621
|
-
morphWeightData =
|
|
602
|
+
morphWeightData = (0, import_scenegraph_gpu_animation.createScenegraphGPUAnimationStorage)(device, `${id || "gltf"}-crowd-morph-weights`, morphWeights, packedTargetCount, morphInstanceCount);
|
|
622
603
|
managedResources.push(morphWeightData);
|
|
623
604
|
}
|
|
624
605
|
}
|
|
625
|
-
const animationJointCount = hasSkin
|
|
626
|
-
const animationFrameStride =
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
if (
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
managedResources.push(
|
|
606
|
+
const animationJointCount = hasSkin ? (sceneAnimation == null ? void 0 : sceneAnimation.jointCount) || (crowd == null ? void 0 : crowd.jointsPerInstance) || 0 : 0;
|
|
607
|
+
const animationFrameStride = (0, import_scenegraph_gpu_animation_layout.getScenegraphGPUAnimationFrameStride)(animationJointCount, morphTargetCount);
|
|
608
|
+
const animationResources = animationLayout ? new import_scenegraph_gpu_animation.ScenegraphGPUAnimationResources(device, animationLayout, animationJointCount, morphTargetCount, (crowd == null ? void 0 : crowd.capacity) || 1, id) : void 0;
|
|
609
|
+
const animationFrames = animationResources == null ? void 0 : animationResources.animationFrames;
|
|
610
|
+
if (animationResources) {
|
|
611
|
+
Object.assign(instanceAttributes, animationResources.attributes);
|
|
612
|
+
instanceBufferLayout.push(...animationResources.bufferLayout);
|
|
613
|
+
managedResources.push(animationResources);
|
|
633
614
|
}
|
|
634
615
|
let source = SHADER;
|
|
635
616
|
for (const [name, value] of [
|
|
@@ -652,26 +633,26 @@ function createGLTFModel(device, options) {
|
|
|
652
633
|
modules: [
|
|
653
634
|
import_shaders.pbrMaterial,
|
|
654
635
|
import_shaders.skin,
|
|
655
|
-
...
|
|
636
|
+
...animationResources || morphTargetData ? [import_shaders.gpuAnimation] : [],
|
|
656
637
|
...options.publishedTransforms ? [import_engine.publishedTransforms] : []
|
|
657
638
|
],
|
|
658
639
|
...modelOptions,
|
|
659
|
-
...
|
|
640
|
+
...instanced ? {
|
|
660
641
|
attributes: { ...modelOptions.attributes, ...instanceAttributes },
|
|
661
642
|
bufferLayout: [...modelOptions.bufferLayout || [], ...instanceBufferLayout],
|
|
662
|
-
instanceCount: (instanceMatrices == null ? void 0 : instanceMatrices.length) || 0,
|
|
643
|
+
instanceCount: sceneAnimation ? 1 : (instanceMatrices == null ? void 0 : instanceMatrices.length) || 0,
|
|
663
644
|
isInstanced: true
|
|
664
645
|
} : {},
|
|
665
646
|
defines: {
|
|
666
647
|
...parsedPPBRMaterial.defines,
|
|
667
648
|
...options.publishedTransforms ? { HAS_PUBLISHED_TRANSFORMS: true } : {},
|
|
668
649
|
...modelOptions.defines,
|
|
669
|
-
...
|
|
650
|
+
...instanced ? { HAS_GLTF_INSTANCING: true } : {},
|
|
670
651
|
...hasInstancedSkin ? { HAS_INSTANCED_SKIN: true, CROWD_JOINTS_PER_INSTANCE: crowd.jointsPerInstance } : {},
|
|
671
652
|
...hasLargeSkinPalette ? { HAS_LARGE_SKIN: true } : {},
|
|
672
|
-
...
|
|
653
|
+
...animationResources == null ? void 0 : animationResources.defines,
|
|
673
654
|
...morphTargetData ? { HAS_INSTANCED_MORPH: true, CROWD_MORPH_TARGET_COUNT: morphTargetCount } : {},
|
|
674
|
-
...
|
|
655
|
+
...animationResources || morphTargetData ? { CROWD_ANIMATION_JOINT_COUNT: animationJointCount } : {}
|
|
675
656
|
},
|
|
676
657
|
parameters: { ...parameters, ...parsedPPBRMaterial.parameters, ...modelOptions.parameters }
|
|
677
658
|
};
|
|
@@ -699,13 +680,14 @@ function createGLTFModel(device, options) {
|
|
|
699
680
|
if (animationFrames || morphTargetData || morphWeightData) {
|
|
700
681
|
model.shaderInputs.setProps({
|
|
701
682
|
gpuAnimation: {
|
|
702
|
-
...
|
|
683
|
+
...animationResources == null ? void 0 : animationResources.bindings,
|
|
703
684
|
...morphTargetData ? { gpuMorphTargets: morphTargetData } : {},
|
|
704
685
|
...morphWeightData ? { gpuMorphWeights: morphWeightData } : {}
|
|
705
686
|
}
|
|
706
687
|
});
|
|
707
688
|
}
|
|
708
689
|
const modelNode = new import_engine2.ModelNode({
|
|
690
|
+
gpuAnimation: animationResources,
|
|
709
691
|
managedResources,
|
|
710
692
|
model,
|
|
711
693
|
bounds: options.bounds,
|
|
@@ -731,36 +713,17 @@ function createGLTFModel(device, options) {
|
|
|
731
713
|
morphWeights,
|
|
732
714
|
morphWeightData,
|
|
733
715
|
animationFrames,
|
|
734
|
-
animationFrameValues,
|
|
716
|
+
animationFrameValues: animationResources == null ? void 0 : animationResources.animationFrameValues,
|
|
735
717
|
animationFrameStride,
|
|
736
718
|
animationJointCount,
|
|
737
|
-
animationParameters,
|
|
738
|
-
animationParameterBuffer,
|
|
739
|
-
animationBlend,
|
|
740
|
-
animationBlendBuffer
|
|
719
|
+
animationParameters: animationResources == null ? void 0 : animationResources.animationParameters,
|
|
720
|
+
animationParameterBuffer: animationResources == null ? void 0 : animationResources.animationParameterBuffer,
|
|
721
|
+
animationBlend: animationResources == null ? void 0 : animationResources.animationBlend,
|
|
722
|
+
animationBlendBuffer: animationResources == null ? void 0 : animationResources.animationBlendBuffer
|
|
741
723
|
};
|
|
742
724
|
}
|
|
743
725
|
return modelNode;
|
|
744
726
|
}
|
|
745
|
-
function createGPUAnimationResource(device, id, values, width, height) {
|
|
746
|
-
if (device.type === "webgpu") {
|
|
747
|
-
return device.createBuffer({
|
|
748
|
-
id,
|
|
749
|
-
data: values,
|
|
750
|
-
usage: import_core.Buffer.STORAGE | import_core.Buffer.COPY_DST
|
|
751
|
-
});
|
|
752
|
-
}
|
|
753
|
-
const texture = device.createTexture({
|
|
754
|
-
id,
|
|
755
|
-
format: "rgba32float",
|
|
756
|
-
width,
|
|
757
|
-
height,
|
|
758
|
-
usage: import_core.Texture.SAMPLE | import_core.Texture.COPY_DST,
|
|
759
|
-
sampler: { minFilter: "nearest", magFilter: "nearest", mipmapFilter: "nearest" }
|
|
760
|
-
});
|
|
761
|
-
texture.writeData(values, { width, height });
|
|
762
|
-
return texture;
|
|
763
|
-
}
|
|
764
727
|
function isMaterialBindingResource(value) {
|
|
765
728
|
return value instanceof import_core.Buffer || value instanceof import_dynamic.DynamicTexture || value instanceof import_core.Sampler || value instanceof import_core.Texture || value instanceof import_core.TextureView;
|
|
766
729
|
}
|
|
@@ -3,6 +3,7 @@ import { Geometry, Material, MaterialFactory, ModelNode, type ModelProps, type M
|
|
|
3
3
|
import type { NumericArray } from '@math.gl/core/types';
|
|
4
4
|
import { type ParsedPBRMaterial } from "../pbr/pbr-material.js";
|
|
5
5
|
import type { GLTFCrowdGPUAnimationLayout } from "./gltf-gpu-animation.js";
|
|
6
|
+
import { type ScenegraphGPUAnimationModelOptions } from "../../animation/scenegraph-gpu-animation-layout.js";
|
|
6
7
|
/** Options used to instantiate a `ModelNode` for one glTF primitive. */
|
|
7
8
|
export type CreateGLTFModelOptions = {
|
|
8
9
|
/** Borrowed GPU rigid matrices; enable per draw with publishedTransforms.bodyIndex. */
|
|
@@ -19,6 +20,8 @@ export type CreateGLTFModelOptions = {
|
|
|
19
20
|
material?: Material | null;
|
|
20
21
|
/** Additional model props merged into the generated model. */
|
|
21
22
|
modelOptions?: Partial<ModelProps>;
|
|
23
|
+
/** Resolved scenegraph playback requested for an ordinary primitive. */
|
|
24
|
+
scenegraphGPUAnimation?: ScenegraphGPUAnimationModelOptions;
|
|
22
25
|
/** Source primitive bounds before node and optional instance transforms. */
|
|
23
26
|
bounds?: ScenegraphBounds;
|
|
24
27
|
/** Source-authored local transforms for `EXT_mesh_gpu_instancing`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-gltf-model.d.ts","sourceRoot":"","sources":["../../../src/gltf/gltf/create-gltf-model.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,MAAM,EAEN,MAAM,EAIN,OAAO,EAER,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,eAAe,EAEf,SAAS,EACT,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,KAAK,iBAAiB,EAAC,+BAA4B;AAC3D,OAAO,KAAK,EAAC,2BAA2B,EAAC,gCAA6B;
|
|
1
|
+
{"version":3,"file":"create-gltf-model.d.ts","sourceRoot":"","sources":["../../../src/gltf/gltf/create-gltf-model.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,MAAM,EAEN,MAAM,EAIN,OAAO,EAER,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