@zephyr3d/scene 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/animation/animation.js +149 -27
- package/dist/animation/animation.js.map +1 -1
- package/dist/animation/animationset.js +173 -73
- package/dist/animation/animationset.js.map +1 -1
- package/dist/animation/animationtrack.js +65 -10
- package/dist/animation/animationtrack.js.map +1 -1
- package/dist/animation/eulerrotationtrack.js +41 -20
- package/dist/animation/eulerrotationtrack.js.map +1 -1
- package/dist/animation/morphtarget.js +14 -38
- package/dist/animation/morphtarget.js.map +1 -1
- package/dist/animation/morphtrack.js +59 -22
- package/dist/animation/morphtrack.js.map +1 -1
- package/dist/animation/proptrack.js +190 -0
- package/dist/animation/proptrack.js.map +1 -0
- package/dist/animation/rotationtrack.js +29 -11
- package/dist/animation/rotationtrack.js.map +1 -1
- package/dist/animation/scaletrack.js +29 -11
- package/dist/animation/scaletrack.js.map +1 -1
- package/dist/animation/skeleton.js +241 -78
- package/dist/animation/skeleton.js.map +1 -1
- package/dist/animation/translationtrack.js +30 -11
- package/dist/animation/translationtrack.js.map +1 -1
- package/dist/app/api.js +43 -0
- package/dist/app/api.js.map +1 -0
- package/dist/app/app.js +153 -0
- package/dist/app/app.js.map +1 -0
- package/dist/app/engine.js +312 -0
- package/dist/app/engine.js.map +1 -0
- package/dist/app/inputmgr.js +351 -0
- package/dist/app/inputmgr.js.map +1 -0
- package/dist/app/runtimescript.js +62 -0
- package/dist/app/runtimescript.js.map +1 -0
- package/dist/app/scriptingsystem.js +220 -0
- package/dist/app/scriptingsystem.js.map +1 -0
- package/dist/app/scriptregistry.js +432 -0
- package/dist/app/scriptregistry.js.map +1 -0
- package/dist/asset/assetmanager.js +772 -291
- package/dist/asset/assetmanager.js.map +1 -1
- package/dist/asset/builtin.js +7 -43
- package/dist/asset/builtin.js.map +1 -1
- package/dist/asset/loaders/dds/dds.js +17 -93
- package/dist/asset/loaders/dds/dds.js.map +1 -1
- package/dist/asset/loaders/dds/dds_loader.js +8 -18
- package/dist/asset/loaders/dds/dds_loader.js.map +1 -1
- package/dist/asset/loaders/gltf/gltf_loader.js +36 -42
- package/dist/asset/loaders/gltf/gltf_loader.js.map +1 -1
- package/dist/asset/loaders/gltf/helpers.js +27 -14
- package/dist/asset/loaders/gltf/helpers.js.map +1 -1
- package/dist/asset/loaders/hdr/hdr.js +17 -12
- package/dist/asset/loaders/hdr/hdr.js.map +1 -1
- package/dist/asset/loaders/image/tga_Loader.js +13 -16
- package/dist/asset/loaders/image/tga_Loader.js.map +1 -1
- package/dist/asset/loaders/image/webimage_loader.js +51 -50
- package/dist/asset/loaders/image/webimage_loader.js.map +1 -1
- package/dist/asset/loaders/loader.js.map +1 -1
- package/dist/asset/model.js +158 -4
- package/dist/asset/model.js.map +1 -1
- package/dist/blitter/bilateralblur.js +0 -1
- package/dist/blitter/bilateralblur.js.map +1 -1
- package/dist/blitter/blitter.js +22 -23
- package/dist/blitter/blitter.js.map +1 -1
- package/dist/blitter/box.js.map +1 -1
- package/dist/blitter/copy.js.map +1 -1
- package/dist/blitter/gaussianblur.js +23 -23
- package/dist/blitter/gaussianblur.js.map +1 -1
- package/dist/camera/base.js +141 -34
- package/dist/camera/base.js.map +1 -1
- package/dist/camera/camera.js +653 -149
- package/dist/camera/camera.js.map +1 -1
- package/dist/camera/fps.js +2 -10
- package/dist/camera/fps.js.map +1 -1
- package/dist/camera/orbit.js +132 -59
- package/dist/camera/orbit.js.map +1 -1
- package/dist/camera/orthocamera.js +37 -12
- package/dist/camera/orthocamera.js.map +1 -1
- package/dist/camera/perspectivecamera.js +37 -20
- package/dist/camera/perspectivecamera.js.map +1 -1
- package/dist/index.d.ts +18268 -6982
- package/dist/index.js +49 -16
- package/dist/index.js.map +1 -1
- package/dist/material/blinn.js +5 -0
- package/dist/material/blinn.js.map +1 -1
- package/dist/material/grassmaterial.js +6 -1
- package/dist/material/grassmaterial.js.map +1 -1
- package/dist/material/lambert.js +6 -1
- package/dist/material/lambert.js.map +1 -1
- package/dist/material/material.js +346 -73
- package/dist/material/material.js.map +1 -1
- package/dist/material/meshmaterial.js +498 -156
- package/dist/material/meshmaterial.js.map +1 -1
- package/dist/material/mixins/albedocolor.js +5 -1
- package/dist/material/mixins/albedocolor.js.map +1 -1
- package/dist/material/mixins/foliage.js +3 -3
- package/dist/material/mixins/foliage.js.map +1 -1
- package/dist/material/mixins/lightmodel/blinnphong.js +18 -5
- package/dist/material/mixins/lightmodel/blinnphong.js.map +1 -1
- package/dist/material/mixins/lightmodel/lambert.js +6 -6
- package/dist/material/mixins/lightmodel/lambert.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js +235 -0
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js.map +1 -0
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js +52 -15
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js +27 -9
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -1
- package/dist/material/mixins/lit.js +16 -4
- package/dist/material/mixins/lit.js.map +1 -1
- package/dist/material/mixins/pbr/brdf.js +134 -0
- package/dist/material/mixins/pbr/brdf.js.map +1 -0
- package/dist/material/mixins/pbr/common.js +68 -85
- package/dist/material/mixins/pbr/common.js.map +1 -1
- package/dist/material/mixins/texture.js +98 -83
- package/dist/material/mixins/texture.js.map +1 -1
- package/dist/material/mixins/vertexcolor.js +6 -2
- package/dist/material/mixins/vertexcolor.js.map +1 -1
- package/dist/material/particle.js +272 -0
- package/dist/material/particle.js.map +1 -0
- package/dist/material/pbrblueprint.js +186 -0
- package/dist/material/pbrblueprint.js.map +1 -0
- package/dist/material/pbrmr.js +10 -0
- package/dist/material/pbrmr.js.map +1 -1
- package/dist/material/pbrsg.js +10 -0
- package/dist/material/pbrsg.js.map +1 -1
- package/dist/material/shader/helper.js +521 -287
- package/dist/material/shader/helper.js.map +1 -1
- package/dist/material/terrain-cm.js +607 -0
- package/dist/material/terrain-cm.js.map +1 -0
- package/dist/material/terrainmaterial.js +59 -54
- package/dist/material/terrainmaterial.js.map +1 -1
- package/dist/material/unlit.js +5 -0
- package/dist/material/unlit.js.map +1 -1
- package/dist/material/water.js +415 -0
- package/dist/material/water.js.map +1 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js +38 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js.map +1 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js +10 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js.map +1 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js +127 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js.map +1 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js +263 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js.map +1 -0
- package/dist/node_modules/es-module-lexer/dist/lexer.js +5 -0
- package/dist/node_modules/es-module-lexer/dist/lexer.js.map +1 -0
- package/dist/posteffect/bloom.js +39 -54
- package/dist/posteffect/bloom.js.map +1 -1
- package/dist/posteffect/compositor.js +95 -128
- package/dist/posteffect/compositor.js.map +1 -1
- package/dist/posteffect/fxaa.js +10 -18
- package/dist/posteffect/fxaa.js.map +1 -1
- package/dist/posteffect/grayscale.js +9 -17
- package/dist/posteffect/grayscale.js.map +1 -1
- package/dist/posteffect/motionblur.js +105 -0
- package/dist/posteffect/motionblur.js.map +1 -0
- package/dist/posteffect/posteffect.js +66 -35
- package/dist/posteffect/posteffect.js.map +1 -1
- package/dist/posteffect/sao.js +13 -21
- package/dist/posteffect/sao.js.map +1 -1
- package/dist/posteffect/ssr.js +60 -100
- package/dist/posteffect/ssr.js.map +1 -1
- package/dist/posteffect/taa.js +175 -0
- package/dist/posteffect/taa.js.map +1 -0
- package/dist/posteffect/tonemap.js +12 -20
- package/dist/posteffect/tonemap.js.map +1 -1
- package/dist/render/abuffer_oit.js +30 -19
- package/dist/render/abuffer_oit.js.map +1 -1
- package/dist/render/clipmap.js +429 -101
- package/dist/render/clipmap.js.map +1 -1
- package/dist/render/cluster_light.js +7 -5
- package/dist/render/cluster_light.js.map +1 -1
- package/dist/render/cull_visitor.js +43 -3
- package/dist/render/cull_visitor.js.map +1 -1
- package/dist/render/depthpass.js +14 -5
- package/dist/render/depthpass.js.map +1 -1
- package/dist/render/drawable_mixin.js +113 -40
- package/dist/render/drawable_mixin.js.map +1 -1
- package/dist/render/envlight.js +86 -141
- package/dist/render/envlight.js.map +1 -1
- package/dist/render/fbm_wavegenerator.js +234 -0
- package/dist/render/fbm_wavegenerator.js.map +1 -0
- package/dist/render/fft_wavegenerator.js +64 -50
- package/dist/render/fft_wavegenerator.js.map +1 -1
- package/dist/render/fullscreenquad.js +2 -2
- package/dist/render/fullscreenquad.js.map +1 -1
- package/dist/render/gerstner_wavegenerator.js +98 -48
- package/dist/render/gerstner_wavegenerator.js.map +1 -1
- package/dist/render/globalbindgroup_allocator.js +4 -2
- package/dist/render/globalbindgroup_allocator.js.map +1 -1
- package/dist/render/hzb.js +6 -3
- package/dist/render/hzb.js.map +1 -1
- package/dist/render/lightpass.js +19 -18
- package/dist/render/lightpass.js.map +1 -1
- package/dist/render/objectcolorpass.js +4 -4
- package/dist/render/objectcolorpass.js.map +1 -1
- package/dist/render/primitive.js +213 -104
- package/dist/render/primitive.js.map +1 -1
- package/dist/render/render_queue.js +40 -20
- package/dist/render/render_queue.js.map +1 -1
- package/dist/render/renderbundle_wrapper.js +65 -15
- package/dist/render/renderbundle_wrapper.js.map +1 -1
- package/dist/render/renderer.js +326 -185
- package/dist/render/renderer.js.map +1 -1
- package/dist/render/renderpass.js +20 -36
- package/dist/render/renderpass.js.map +1 -1
- package/dist/render/shadowmap_pass.js +3 -3
- package/dist/render/shadowmap_pass.js.map +1 -1
- package/dist/render/sky.js +864 -541
- package/dist/render/sky.js.map +1 -1
- package/dist/render/weightedblended_oit.js +13 -15
- package/dist/render/weightedblended_oit.js.map +1 -1
- package/dist/scene/batchgroup.js +18 -5
- package/dist/scene/batchgroup.js.map +1 -1
- package/dist/scene/environment.js +78 -48
- package/dist/scene/environment.js.map +1 -1
- package/dist/scene/graph_node.js +2 -3
- package/dist/scene/graph_node.js.map +1 -1
- package/dist/scene/light.js +28 -89
- package/dist/scene/light.js.map +1 -1
- package/dist/scene/mesh.js +218 -87
- package/dist/scene/mesh.js.map +1 -1
- package/dist/scene/octree.js +371 -162
- package/dist/scene/octree.js.map +1 -1
- package/dist/scene/particlesys.js +684 -0
- package/dist/scene/particlesys.js.map +1 -0
- package/dist/scene/raycast_visitor.js +34 -5
- package/dist/scene/raycast_visitor.js.map +1 -1
- package/dist/scene/scene.js +309 -85
- package/dist/scene/scene.js.map +1 -1
- package/dist/scene/scene_node.js +675 -102
- package/dist/scene/scene_node.js.map +1 -1
- package/dist/scene/terrain/grass.js +48 -49
- package/dist/scene/terrain/grass.js.map +1 -1
- package/dist/scene/terrain/heightfield.js +46 -44
- package/dist/scene/terrain/heightfield.js.map +1 -1
- package/dist/scene/terrain/patch.js +20 -29
- package/dist/scene/terrain/patch.js.map +1 -1
- package/dist/scene/terrain/quadtree.js +58 -27
- package/dist/scene/terrain/quadtree.js.map +1 -1
- package/dist/scene/terrain/terrain.js +31 -45
- package/dist/scene/terrain/terrain.js.map +1 -1
- package/dist/scene/terrain-cm/grass.js +603 -0
- package/dist/scene/terrain-cm/grass.js.map +1 -0
- package/dist/scene/terrain-cm/grassmaterial.js +160 -0
- package/dist/scene/terrain-cm/grassmaterial.js.map +1 -0
- package/dist/scene/terrain-cm/terrain-cm.js +533 -0
- package/dist/scene/terrain-cm/terrain-cm.js.map +1 -0
- package/dist/scene/water.js +378 -0
- package/dist/scene/water.js.map +1 -0
- package/dist/shaders/atmosphere.js +957 -0
- package/dist/shaders/atmosphere.js.map +1 -0
- package/dist/shaders/fog.js +116 -0
- package/dist/shaders/fog.js.map +1 -0
- package/dist/shaders/misc.js.map +1 -1
- package/dist/shaders/noise.js +217 -8
- package/dist/shaders/noise.js.map +1 -1
- package/dist/shaders/pbr.js.map +1 -1
- package/dist/shaders/shadow.js +8 -8
- package/dist/shaders/shadow.js.map +1 -1
- package/dist/shaders/ssr.js +87 -39
- package/dist/shaders/ssr.js.map +1 -1
- package/dist/shaders/temporal.js +216 -0
- package/dist/shaders/temporal.js.map +1 -0
- package/dist/shaders/water.js +42 -20
- package/dist/shaders/water.js.map +1 -1
- package/dist/shadow/esm.js +31 -13
- package/dist/shadow/esm.js.map +1 -1
- package/dist/shadow/pcf_opt.js +12 -13
- package/dist/shadow/pcf_opt.js.map +1 -1
- package/dist/shadow/pcf_pd.js +12 -13
- package/dist/shadow/pcf_pd.js.map +1 -1
- package/dist/shadow/shader.js +38 -0
- package/dist/shadow/shader.js.map +1 -0
- package/dist/shadow/shadow_impl.js.map +1 -1
- package/dist/shadow/shadowmapper.js +67 -26
- package/dist/shadow/shadowmapper.js.map +1 -1
- package/dist/shadow/ssm.js +15 -16
- package/dist/shadow/ssm.js.map +1 -1
- package/dist/shadow/vsm.js +33 -16
- package/dist/shadow/vsm.js.map +1 -1
- package/dist/shapes/box.js +181 -83
- package/dist/shapes/box.js.map +1 -1
- package/dist/shapes/cylinder.js +101 -43
- package/dist/shapes/cylinder.js.map +1 -1
- package/dist/shapes/plane.js +70 -29
- package/dist/shapes/plane.js.map +1 -1
- package/dist/shapes/shape.js +120 -17
- package/dist/shapes/shape.js.map +1 -1
- package/dist/shapes/sphere.js +78 -44
- package/dist/shapes/sphere.js.map +1 -1
- package/dist/shapes/tetrahedron.js +256 -0
- package/dist/shapes/tetrahedron.js.map +1 -0
- package/dist/shapes/torus.js +76 -55
- package/dist/shapes/torus.js.map +1 -1
- package/dist/src/animation/animation.js +127 -0
- package/dist/src/animation/animation.js.map +1 -0
- package/dist/src/animation/animationset.js +255 -0
- package/dist/src/animation/animationset.js.map +1 -0
- package/dist/src/animation/animationtrack.js +34 -0
- package/dist/src/animation/animationtrack.js.map +1 -0
- package/dist/src/animation/eulerrotationtrack.js +52 -0
- package/dist/src/animation/eulerrotationtrack.js.map +1 -0
- package/dist/src/animation/morphtarget.js +93 -0
- package/dist/src/animation/morphtarget.js.map +1 -0
- package/dist/src/animation/morphtrack.js +70 -0
- package/dist/src/animation/morphtrack.js.map +1 -0
- package/dist/src/animation/proptrack.js +161 -0
- package/dist/src/animation/proptrack.js.map +1 -0
- package/dist/src/animation/rotationtrack.js +51 -0
- package/dist/src/animation/rotationtrack.js.map +1 -0
- package/dist/src/animation/scaletrack.js +50 -0
- package/dist/src/animation/scaletrack.js.map +1 -0
- package/dist/src/animation/skeleton.js +204 -0
- package/dist/src/animation/skeleton.js.map +1 -0
- package/dist/src/animation/translationtrack.js +50 -0
- package/dist/src/animation/translationtrack.js.map +1 -0
- package/dist/{app.js → src/app/app.js} +18 -40
- package/dist/src/app/app.js.map +1 -0
- package/dist/{input → src/app}/inputmgr.js +41 -16
- package/dist/src/app/inputmgr.js.map +1 -0
- package/dist/src/asset/assetmanager.js +404 -0
- package/dist/src/asset/assetmanager.js.map +1 -0
- package/dist/src/asset/builtin.js +337 -0
- package/dist/src/asset/builtin.js.map +1 -0
- package/dist/src/asset/loaders/dds/dds.js +470 -0
- package/dist/src/asset/loaders/dds/dds.js.map +1 -0
- package/dist/src/asset/loaders/dds/dds_loader.js +28 -0
- package/dist/src/asset/loaders/dds/dds_loader.js.map +1 -0
- package/dist/src/asset/loaders/gltf/gltf_loader.js +1265 -0
- package/dist/src/asset/loaders/gltf/gltf_loader.js.map +1 -0
- package/dist/src/asset/loaders/gltf/helpers.js +327 -0
- package/dist/src/asset/loaders/gltf/helpers.js.map +1 -0
- package/dist/src/asset/loaders/hdr/hdr.js +180 -0
- package/dist/src/asset/loaders/hdr/hdr.js.map +1 -0
- package/dist/src/asset/loaders/image/tga_Loader.js +116 -0
- package/dist/src/asset/loaders/image/tga_Loader.js.map +1 -0
- package/dist/src/asset/loaders/image/webimage_loader.js +63 -0
- package/dist/src/asset/loaders/image/webimage_loader.js.map +1 -0
- package/dist/src/asset/loaders/loader.js +45 -0
- package/dist/src/asset/loaders/loader.js.map +1 -0
- package/dist/src/asset/model.js +414 -0
- package/dist/src/asset/model.js.map +1 -0
- package/dist/{blitter/depthlimitedgaussion.js → src/blitter/bilateralblur.js} +1 -2
- package/dist/src/blitter/bilateralblur.js.map +1 -0
- package/dist/src/blitter/blitter.js +390 -0
- package/dist/src/blitter/blitter.js.map +1 -0
- package/dist/src/blitter/box.js +118 -0
- package/dist/src/blitter/box.js.map +1 -0
- package/dist/src/blitter/copy.js +22 -0
- package/dist/src/blitter/copy.js.map +1 -0
- package/dist/src/blitter/gaussianblur.js +228 -0
- package/dist/src/blitter/gaussianblur.js.map +1 -0
- package/dist/src/camera/base.js +92 -0
- package/dist/src/camera/base.js.map +1 -0
- package/dist/src/camera/camera.js +1005 -0
- package/dist/src/camera/camera.js.map +1 -0
- package/dist/src/camera/fps.js +238 -0
- package/dist/src/camera/fps.js.map +1 -0
- package/dist/src/camera/orbit.js +245 -0
- package/dist/src/camera/orbit.js.map +1 -0
- package/dist/src/camera/orthocamera.js +167 -0
- package/dist/src/camera/orthocamera.js.map +1 -0
- package/dist/src/camera/perspectivecamera.js +141 -0
- package/dist/src/camera/perspectivecamera.js.map +1 -0
- package/dist/src/index.js +120 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/material/blinn.js +81 -0
- package/dist/src/material/blinn.js.map +1 -0
- package/dist/src/material/grassmaterial.js +113 -0
- package/dist/src/material/grassmaterial.js.map +1 -0
- package/dist/src/material/lambert.js +92 -0
- package/dist/src/material/lambert.js.map +1 -0
- package/dist/src/material/material.js +301 -0
- package/dist/src/material/material.js.map +1 -0
- package/dist/src/material/meshmaterial.js +704 -0
- package/dist/src/material/meshmaterial.js.map +1 -0
- package/dist/src/material/mixins/albedocolor.js +76 -0
- package/dist/src/material/mixins/albedocolor.js.map +1 -0
- package/dist/src/material/mixins/foliage.js +47 -0
- package/dist/src/material/mixins/foliage.js.map +1 -0
- package/dist/src/material/mixins/lightmodel/blinnphong.js +112 -0
- package/dist/src/material/mixins/lightmodel/blinnphong.js.map +1 -0
- package/dist/src/material/mixins/lightmodel/lambert.js +58 -0
- package/dist/src/material/mixins/lightmodel/lambert.js.map +1 -0
- package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js +178 -0
- package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -0
- package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js +139 -0
- package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -0
- package/dist/src/material/mixins/lit.js +476 -0
- package/dist/src/material/mixins/lit.js.map +1 -0
- package/dist/src/material/mixins/pbr/common.js +918 -0
- package/dist/src/material/mixins/pbr/common.js.map +1 -0
- package/dist/src/material/mixins/texture.js +172 -0
- package/dist/src/material/mixins/texture.js.map +1 -0
- package/dist/src/material/mixins/vertexcolor.js +56 -0
- package/dist/src/material/mixins/vertexcolor.js.map +1 -0
- package/dist/src/material/particle.js +178 -0
- package/dist/src/material/particle.js.map +1 -0
- package/dist/src/material/pbrmr.js +97 -0
- package/dist/src/material/pbrmr.js.map +1 -0
- package/dist/src/material/pbrsg.js +97 -0
- package/dist/src/material/pbrsg.js.map +1 -0
- package/dist/src/material/shader/helper.js +1209 -0
- package/dist/src/material/shader/helper.js.map +1 -0
- package/dist/src/material/terrain-cm.js +606 -0
- package/dist/src/material/terrain-cm.js.map +1 -0
- package/dist/src/material/terrainmaterial.js +375 -0
- package/dist/src/material/terrainmaterial.js.map +1 -0
- package/dist/src/material/unlit.js +41 -0
- package/dist/src/material/unlit.js.map +1 -0
- package/dist/src/material/water.js +417 -0
- package/dist/src/material/water.js.map +1 -0
- package/dist/src/posteffect/bloom.js +361 -0
- package/dist/src/posteffect/bloom.js.map +1 -0
- package/dist/src/posteffect/compositor.js +226 -0
- package/dist/src/posteffect/compositor.js.map +1 -0
- package/dist/src/posteffect/fxaa.js +273 -0
- package/dist/src/posteffect/fxaa.js.map +1 -0
- package/dist/src/posteffect/grayscale.js +69 -0
- package/dist/src/posteffect/grayscale.js.map +1 -0
- package/dist/src/posteffect/motionblur.js +96 -0
- package/dist/src/posteffect/motionblur.js.map +1 -0
- package/dist/src/posteffect/posteffect.js +126 -0
- package/dist/src/posteffect/posteffect.js.map +1 -0
- package/dist/src/posteffect/sao.js +324 -0
- package/dist/src/posteffect/sao.js.map +1 -0
- package/dist/src/posteffect/ssr.js +489 -0
- package/dist/src/posteffect/ssr.js.map +1 -0
- package/dist/src/posteffect/taa.js +172 -0
- package/dist/src/posteffect/taa.js.map +1 -0
- package/dist/src/posteffect/tonemap.js +94 -0
- package/dist/src/posteffect/tonemap.js.map +1 -0
- package/dist/src/render/abuffer_oit.js +361 -0
- package/dist/src/render/abuffer_oit.js.map +1 -0
- package/dist/src/render/clipmap.js +851 -0
- package/dist/src/render/clipmap.js.map +1 -0
- package/dist/src/render/cluster_light.js +333 -0
- package/dist/src/render/cluster_light.js.map +1 -0
- package/dist/src/render/cull_visitor.js +187 -0
- package/dist/src/render/cull_visitor.js.map +1 -0
- package/dist/src/render/depthpass.js +68 -0
- package/dist/src/render/depthpass.js.map +1 -0
- package/dist/src/render/drawable_mixin.js +227 -0
- package/dist/src/render/drawable_mixin.js.map +1 -0
- package/dist/src/render/envlight.js +463 -0
- package/dist/src/render/envlight.js.map +1 -0
- package/dist/src/render/fbm_wavegenerator.js +251 -0
- package/dist/src/render/fbm_wavegenerator.js.map +1 -0
- package/dist/src/render/fft_wavegenerator.js +1006 -0
- package/dist/src/render/fft_wavegenerator.js.map +1 -0
- package/dist/src/render/fullscreenquad.js +38 -0
- package/dist/src/render/fullscreenquad.js.map +1 -0
- package/dist/src/render/gerstner_wavegenerator.js +314 -0
- package/dist/src/render/gerstner_wavegenerator.js.map +1 -0
- package/dist/src/render/globalbindgroup_allocator.js +60 -0
- package/dist/src/render/globalbindgroup_allocator.js.map +1 -0
- package/dist/src/render/hzb.js +273 -0
- package/dist/src/render/hzb.js.map +1 -0
- package/dist/src/render/lightpass.js +172 -0
- package/dist/src/render/lightpass.js.map +1 -0
- package/dist/src/render/objectcolorpass.js +51 -0
- package/dist/src/render/objectcolorpass.js.map +1 -0
- package/dist/src/render/primitive.js +364 -0
- package/dist/src/render/primitive.js.map +1 -0
- package/dist/src/render/render_queue.js +467 -0
- package/dist/src/render/render_queue.js.map +1 -0
- package/dist/src/render/renderbundle_wrapper.js +152 -0
- package/dist/src/render/renderbundle_wrapper.js.map +1 -0
- package/dist/src/render/renderer.js +455 -0
- package/dist/src/render/renderer.js.map +1 -0
- package/dist/src/render/renderpass.js +200 -0
- package/dist/src/render/renderpass.js.map +1 -0
- package/dist/src/render/shadowmap_pass.js +56 -0
- package/dist/src/render/shadowmap_pass.js.map +1 -0
- package/dist/src/render/sky.js +1103 -0
- package/dist/src/render/sky.js.map +1 -0
- package/dist/src/render/weightedblended_oit.js +168 -0
- package/dist/src/render/weightedblended_oit.js.map +1 -0
- package/dist/src/scene/batchgroup.js +162 -0
- package/dist/src/scene/batchgroup.js.map +1 -0
- package/dist/src/scene/environment.js +209 -0
- package/dist/src/scene/environment.js.map +1 -0
- package/dist/src/scene/graph_node.js +72 -0
- package/dist/src/scene/graph_node.js.map +1 -0
- package/dist/src/scene/light.js +416 -0
- package/dist/src/scene/light.js.map +1 -0
- package/dist/src/scene/mesh.js +341 -0
- package/dist/src/scene/mesh.js.map +1 -0
- package/dist/src/scene/octree.js +649 -0
- package/dist/src/scene/octree.js.map +1 -0
- package/dist/src/scene/particlesys.js +738 -0
- package/dist/src/scene/particlesys.js.map +1 -0
- package/dist/src/scene/raycast_visitor.js +103 -0
- package/dist/src/scene/raycast_visitor.js.map +1 -0
- package/dist/src/scene/scene.js +284 -0
- package/dist/src/scene/scene.js.map +1 -0
- package/dist/src/scene/scene_node.js +732 -0
- package/dist/src/scene/scene_node.js.map +1 -0
- package/dist/src/scene/terrain/grass.js +278 -0
- package/dist/src/scene/terrain/grass.js.map +1 -0
- package/dist/src/scene/terrain/heightfield.js +475 -0
- package/dist/src/scene/terrain/heightfield.js.map +1 -0
- package/dist/src/scene/terrain/patch.js +530 -0
- package/dist/src/scene/terrain/patch.js.map +1 -0
- package/dist/src/scene/terrain/quadtree.js +461 -0
- package/dist/src/scene/terrain/quadtree.js.map +1 -0
- package/dist/src/scene/terrain/terrain.js +246 -0
- package/dist/src/scene/terrain/terrain.js.map +1 -0
- package/dist/src/scene/terrain-cm/grass.js +594 -0
- package/dist/src/scene/terrain-cm/grass.js.map +1 -0
- package/dist/src/scene/terrain-cm/grassmaterial.js +159 -0
- package/dist/src/scene/terrain-cm/grassmaterial.js.map +1 -0
- package/dist/src/scene/terrain-cm/terrain-cm.js +538 -0
- package/dist/src/scene/terrain-cm/terrain-cm.js.map +1 -0
- package/dist/src/scene/water.js +374 -0
- package/dist/src/scene/water.js.map +1 -0
- package/dist/src/shaders/atmosphere.js +957 -0
- package/dist/src/shaders/atmosphere.js.map +1 -0
- package/dist/src/shaders/fog.js +112 -0
- package/dist/src/shaders/fog.js.map +1 -0
- package/dist/src/shaders/misc.js +266 -0
- package/dist/src/shaders/misc.js.map +1 -0
- package/dist/src/shaders/noise.js +222 -0
- package/dist/src/shaders/noise.js.map +1 -0
- package/dist/src/shaders/pbr.js +51 -0
- package/dist/src/shaders/pbr.js.map +1 -0
- package/dist/src/shaders/shadow.js +636 -0
- package/dist/src/shaders/shadow.js.map +1 -0
- package/dist/src/shaders/ssr.js +490 -0
- package/dist/src/shaders/ssr.js.map +1 -0
- package/dist/src/shaders/temporal.js +215 -0
- package/dist/src/shaders/temporal.js.map +1 -0
- package/dist/src/shaders/water.js +756 -0
- package/dist/src/shaders/water.js.map +1 -0
- package/dist/src/shadow/esm.js +237 -0
- package/dist/src/shadow/esm.js.map +1 -0
- package/dist/src/shadow/pcf_opt.js +181 -0
- package/dist/src/shadow/pcf_opt.js.map +1 -0
- package/dist/src/shadow/pcf_pd.js +189 -0
- package/dist/src/shadow/pcf_pd.js.map +1 -0
- package/dist/src/shadow/shader.js +37 -0
- package/dist/src/shadow/shader.js.map +1 -0
- package/dist/src/shadow/shadow_impl.js +15 -0
- package/dist/src/shadow/shadow_impl.js.map +1 -0
- package/dist/src/shadow/shadowmapper.js +790 -0
- package/dist/src/shadow/shadowmapper.js.map +1 -0
- package/dist/src/shadow/ssm.js +159 -0
- package/dist/src/shadow/ssm.js.map +1 -0
- package/dist/src/shadow/vsm.js +297 -0
- package/dist/src/shadow/vsm.js.map +1 -0
- package/dist/src/shapes/box.js +386 -0
- package/dist/src/shapes/box.js.map +1 -0
- package/dist/src/shapes/cylinder.js +125 -0
- package/dist/src/shapes/cylinder.js.map +1 -0
- package/dist/src/shapes/plane.js +88 -0
- package/dist/src/shapes/plane.js.map +1 -0
- package/dist/src/shapes/shape.js +87 -0
- package/dist/src/shapes/shape.js.map +1 -0
- package/dist/src/shapes/sphere.js +114 -0
- package/dist/src/shapes/sphere.js.map +1 -0
- package/dist/src/shapes/tetrahedron.js +188 -0
- package/dist/src/shapes/tetrahedron.js.map +1 -0
- package/dist/src/shapes/torus.js +111 -0
- package/dist/src/shapes/torus.js.map +1 -0
- package/dist/src/utility/aabbtree.js +400 -0
- package/dist/src/utility/aabbtree.js.map +1 -0
- package/dist/src/utility/bounding_volume.js +29 -0
- package/dist/src/utility/bounding_volume.js.map +1 -0
- package/dist/src/utility/debug.js +28 -0
- package/dist/src/utility/debug.js.map +1 -0
- package/dist/src/utility/draco/decoder.js +116 -0
- package/dist/src/utility/draco/decoder.js.map +1 -0
- package/dist/src/utility/misc.js +105 -0
- package/dist/src/utility/misc.js.map +1 -0
- package/dist/src/utility/panorama.js +163 -0
- package/dist/src/utility/panorama.js.map +1 -0
- package/dist/src/utility/pmrem.js +354 -0
- package/dist/src/utility/pmrem.js.map +1 -0
- package/dist/src/utility/rendermipmap.js +115 -0
- package/dist/src/utility/rendermipmap.js.map +1 -0
- package/dist/src/utility/serialization/json.js +402 -0
- package/dist/src/utility/serialization/json.js.map +1 -0
- package/dist/src/utility/serialization/manager.js +623 -0
- package/dist/src/utility/serialization/manager.js.map +1 -0
- package/dist/src/utility/serialization/scene/animation.js +248 -0
- package/dist/src/utility/serialization/scene/animation.js.map +1 -0
- package/dist/src/utility/serialization/scene/batch.js +59 -0
- package/dist/src/utility/serialization/scene/batch.js.map +1 -0
- package/dist/src/utility/serialization/scene/camera.js +790 -0
- package/dist/src/utility/serialization/scene/camera.js.map +1 -0
- package/dist/src/utility/serialization/scene/common.js +222 -0
- package/dist/src/utility/serialization/scene/common.js.map +1 -0
- package/dist/src/utility/serialization/scene/light.js +575 -0
- package/dist/src/utility/serialization/scene/light.js.map +1 -0
- package/dist/src/utility/serialization/scene/material.js +1111 -0
- package/dist/src/utility/serialization/scene/material.js.map +1 -0
- package/dist/src/utility/serialization/scene/mesh.js +148 -0
- package/dist/src/utility/serialization/scene/mesh.js.map +1 -0
- package/dist/src/utility/serialization/scene/misc.js +39 -0
- package/dist/src/utility/serialization/scene/misc.js.map +1 -0
- package/dist/src/utility/serialization/scene/node.js +451 -0
- package/dist/src/utility/serialization/scene/node.js.map +1 -0
- package/dist/src/utility/serialization/scene/particle.js +425 -0
- package/dist/src/utility/serialization/scene/particle.js.map +1 -0
- package/dist/src/utility/serialization/scene/primitive.js +692 -0
- package/dist/src/utility/serialization/scene/primitive.js.map +1 -0
- package/dist/src/utility/serialization/scene/scene.js +704 -0
- package/dist/src/utility/serialization/scene/scene.js.map +1 -0
- package/dist/src/utility/serialization/scene/terrain.js +488 -0
- package/dist/src/utility/serialization/scene/terrain.js.map +1 -0
- package/dist/src/utility/serialization/scene/water.js +465 -0
- package/dist/src/utility/serialization/scene/water.js.map +1 -0
- package/dist/src/utility/shprojector.js +297 -0
- package/dist/src/utility/shprojector.js.map +1 -0
- package/dist/{material/mixins → src/utility/textures}/ggxlut.js +1 -1
- package/dist/src/utility/textures/ggxlut.js.map +1 -0
- package/dist/src/utility/textures/gradientnoise.js +62 -0
- package/dist/src/utility/textures/gradientnoise.js.map +1 -0
- package/dist/src/utility/textures/randomnoise.js +41 -0
- package/dist/src/utility/textures/randomnoise.js.map +1 -0
- package/dist/src/values.js +162 -0
- package/dist/src/values.js.map +1 -0
- package/dist/utility/aabbtree.js +15 -5
- package/dist/utility/aabbtree.js.map +1 -1
- package/dist/utility/blueprint/common/constants.js +851 -0
- package/dist/utility/blueprint/common/constants.js.map +1 -0
- package/dist/utility/blueprint/common/math.js +2045 -0
- package/dist/utility/blueprint/common/math.js.map +1 -0
- package/dist/utility/blueprint/common.js +7 -0
- package/dist/utility/blueprint/common.js.map +1 -0
- package/dist/utility/blueprint/material/common.js +7 -0
- package/dist/utility/blueprint/material/common.js.map +1 -0
- package/dist/utility/blueprint/material/func.js +521 -0
- package/dist/utility/blueprint/material/func.js.map +1 -0
- package/dist/utility/blueprint/material/inputs.js +1659 -0
- package/dist/utility/blueprint/material/inputs.js.map +1 -0
- package/dist/utility/blueprint/material/ir.js +1311 -0
- package/dist/utility/blueprint/material/ir.js.map +1 -0
- package/dist/utility/blueprint/material/pbr.js +362 -0
- package/dist/utility/blueprint/material/pbr.js.map +1 -0
- package/dist/utility/blueprint/material/texture.js +1099 -0
- package/dist/utility/blueprint/material/texture.js.map +1 -0
- package/dist/utility/blueprint/node.js +187 -0
- package/dist/utility/blueprint/node.js.map +1 -0
- package/dist/utility/bounding_volume.js +0 -1
- package/dist/utility/bounding_volume.js.map +1 -1
- package/dist/utility/debug.js +26 -0
- package/dist/utility/debug.js.map +1 -0
- package/dist/utility/draco/decoder.js +1 -1
- package/dist/utility/draco/decoder.js.map +1 -1
- package/dist/utility/misc.js +18 -6
- package/dist/utility/misc.js.map +1 -1
- package/dist/utility/panorama.js +8 -6
- package/dist/utility/panorama.js.map +1 -1
- package/dist/utility/pmrem.js +30 -18
- package/dist/utility/pmrem.js.map +1 -1
- package/dist/utility/rendermipmap.js +116 -0
- package/dist/utility/rendermipmap.js.map +1 -0
- package/dist/utility/serialization/blueprint/constants.js +255 -0
- package/dist/utility/serialization/blueprint/constants.js.map +1 -0
- package/dist/utility/serialization/blueprint/material/constants.js +203 -0
- package/dist/utility/serialization/blueprint/material/constants.js.map +1 -0
- package/dist/utility/serialization/blueprint/material/texture.js +165 -0
- package/dist/utility/serialization/blueprint/material/texture.js.map +1 -0
- package/dist/utility/serialization/json.js +402 -0
- package/dist/utility/serialization/json.js.map +1 -0
- package/dist/utility/serialization/manager.js +1176 -0
- package/dist/utility/serialization/manager.js.map +1 -0
- package/dist/utility/serialization/scene/animation.js +699 -0
- package/dist/utility/serialization/scene/animation.js.map +1 -0
- package/dist/utility/serialization/scene/batch.js +53 -0
- package/dist/utility/serialization/scene/batch.js.map +1 -0
- package/dist/utility/serialization/scene/camera.js +808 -0
- package/dist/utility/serialization/scene/camera.js.map +1 -0
- package/dist/utility/serialization/scene/common.js +224 -0
- package/dist/utility/serialization/scene/common.js.map +1 -0
- package/dist/utility/serialization/scene/light.js +589 -0
- package/dist/utility/serialization/scene/light.js.map +1 -0
- package/dist/utility/serialization/scene/material.js +942 -0
- package/dist/utility/serialization/scene/material.js.map +1 -0
- package/dist/utility/serialization/scene/mesh.js +374 -0
- package/dist/utility/serialization/scene/mesh.js.map +1 -0
- package/dist/utility/serialization/scene/misc.js +39 -0
- package/dist/utility/serialization/scene/misc.js.map +1 -0
- package/dist/utility/serialization/scene/node.js +391 -0
- package/dist/utility/serialization/scene/node.js.map +1 -0
- package/dist/utility/serialization/scene/particle.js +425 -0
- package/dist/utility/serialization/scene/particle.js.map +1 -0
- package/dist/utility/serialization/scene/primitive.js +582 -0
- package/dist/utility/serialization/scene/primitive.js.map +1 -0
- package/dist/utility/serialization/scene/scene.js +763 -0
- package/dist/utility/serialization/scene/scene.js.map +1 -0
- package/dist/utility/serialization/scene/terrain.js +495 -0
- package/dist/utility/serialization/scene/terrain.js.map +1 -0
- package/dist/utility/serialization/scene/water.js +465 -0
- package/dist/utility/serialization/scene/water.js.map +1 -0
- package/dist/utility/shprojector.js +313 -0
- package/dist/utility/shprojector.js.map +1 -0
- package/dist/utility/textures/ggxlut.js +4 -5
- package/dist/utility/textures/ggxlut.js.map +1 -1
- package/dist/utility/textures/gradientnoise.js +2 -1
- package/dist/utility/textures/gradientnoise.js.map +1 -1
- package/dist/utility/textures/randomnoise.js +1 -0
- package/dist/utility/textures/randomnoise.js.map +1 -1
- package/dist/values.js +91 -4
- package/dist/values.js.map +1 -1
- package/package.json +29 -15
- package/dist/app.js.map +0 -1
- package/dist/blitter/depthlimitedgaussion.js.map +0 -1
- package/dist/input/inputmgr.js.map +0 -1
- package/dist/material/mixins/ggxlut.js.map +0 -1
- package/dist/posteffect/water.js +0 -508
- package/dist/posteffect/water.js.map +0 -1
- package/dist/render/oit.js +0 -16
- package/dist/render/oit.js.map +0 -1
- package/dist/render/scatteringlut.js +0 -634
- package/dist/render/scatteringlut.js.map +0 -1
- package/dist/render/watermesh.js +0 -193
- package/dist/render/watermesh.js.map +0 -1
- package/dist/render/wavegenerator.js +0 -8
- package/dist/render/wavegenerator.js.map +0 -1
- package/dist/scene/xform.js +0 -247
- package/dist/scene/xform.js.map +0 -1
- package/dist/utility/shprojection.js +0 -442
- package/dist/utility/shprojection.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compositor.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"compositor.js","sources":["../../src/posteffect/compositor.ts"],"sourcesContent":["import { linearToGamma } from '../shaders/misc';\r\nimport type { DrawContext } from '../render';\r\nimport type {\r\n AbstractDevice,\r\n BindGroup,\r\n FrameBuffer,\r\n GPUProgram,\r\n RenderStateSet,\r\n Texture2D,\r\n TextureFormat,\r\n VertexLayout\r\n} from '@zephyr3d/device';\r\nimport type { AbstractPostEffect } from './posteffect';\r\nimport { PostEffectLayer } from './posteffect';\r\nimport { MaterialVaryingFlags } from '../values';\r\nimport { fetchSampler } from '../utility/misc';\r\nimport { DRef } from '@zephyr3d/base';\r\n\r\n/**\r\n * Posteffect rendering context\r\n * @public\r\n */\r\nexport interface CompositorContext {\r\n pingpongFramebuffers: FrameBuffer[];\r\n finalFramebuffer: FrameBuffer;\r\n writeIndex: number;\r\n}\r\n/**\r\n * Post processing compositor\r\n * @public\r\n */\r\nexport class Compositor {\r\n /** @internal */\r\n protected _postEffects: DRef<AbstractPostEffect>[][];\r\n /** @internal */\r\n private _finalFramebuffer: FrameBuffer;\r\n /** @internal */\r\n private _prevInputTexture: Texture2D;\r\n /** @internal */\r\n private _prevFrameBuffer: FrameBuffer;\r\n /** @internal */\r\n private _textureFormat: TextureFormat;\r\n /** @internal */\r\n private static _blitProgram: GPUProgram = null;\r\n /** @internal */\r\n private static _blitBindgroup: BindGroup = null;\r\n /** @internal */\r\n private static _blitRenderStates: RenderStateSet = null;\r\n /** @internal */\r\n private static _blitVertexLayout: VertexLayout = null;\r\n /**\r\n * Creates an instance of Compositor\r\n */\r\n constructor() {\r\n this._postEffects = [];\r\n this._postEffects[PostEffectLayer.opaque] = [];\r\n this._postEffects[PostEffectLayer.transparent] = [];\r\n this._postEffects[PostEffectLayer.end] = [];\r\n this._finalFramebuffer = null;\r\n this._prevInputTexture = null;\r\n this._prevFrameBuffer = null;\r\n this._textureFormat = 'rgba16f';\r\n }\r\n /** @internal */\r\n requireLinearDepth(ctx: DrawContext): boolean {\r\n for (const list of this._postEffects) {\r\n for (const postEffect of list) {\r\n if (postEffect.get().requireLinearDepthTexture(ctx)) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n /**\r\n * Adds a posteffect\r\n *\r\n * @param postEffect - The post effect to add\r\n * @param opaque - true if the post effect should be applied after the opaque pass and before the transparent pass, otherwise the post effect should be applied after the transparent pass\r\n */\r\n appendPostEffect(postEffect: AbstractPostEffect): void {\r\n if (postEffect) {\r\n for (const list of this._postEffects) {\r\n if (list.findIndex((val) => val.get() === postEffect) >= 0) {\r\n console.error(`Posteffect cannot be added to same compositor multiple times`);\r\n return;\r\n }\r\n }\r\n this._postEffects[postEffect.layer].push(new DRef(postEffect));\r\n }\r\n }\r\n /**\r\n * Removes a posteffect that was previously added\r\n *\r\n * @param postEffect - The posteffect to be remove.\r\n */\r\n removePostEffect(postEffect: AbstractPostEffect): void {\r\n for (const list of this._postEffects) {\r\n const index = list.findIndex((val) => val.get() === postEffect);\r\n if (index >= 0) {\r\n list[index].dispose();\r\n list.splice(index, 1);\r\n return;\r\n }\r\n }\r\n }\r\n /**\r\n * Removes all post effects\r\n */\r\n clear(): void {\r\n for (const list of this._postEffects) {\r\n for (const p of list) {\r\n p.dispose();\r\n }\r\n list.splice(0, list.length);\r\n }\r\n }\r\n /** @internal */\r\n begin(ctx: DrawContext) {\r\n const device = ctx.device;\r\n this._textureFormat =\r\n ctx.camera.HDR && device.getDeviceCaps().textureCaps.supportHalfFloatColorBuffer\r\n ? 'rgba16f'\r\n : 'rgba8unorm';\r\n this._finalFramebuffer = device.getFramebuffer();\r\n const ssr = !!(ctx.materialFlags & MaterialVaryingFlags.SSR_STORE_ROUGHNESS);\r\n if (this._postEffects.every((list) => list.length === 0)) {\r\n return;\r\n }\r\n const depth = this._finalFramebuffer?.getDepthAttachment() as Texture2D;\r\n const w = depth ? depth.width : device.getDrawingBufferWidth();\r\n const h = depth ? depth.height : device.getDrawingBufferHeight();\r\n //const fmt2: TextureFormat = ssr ? (device.type === 'webgl' ? format : 'rgba8unorm') : format;\r\n const tmpFramebuffer = device.pool.fetchTemporalFramebuffer(\r\n true,\r\n w,\r\n h,\r\n ssr ? [this._textureFormat, ctx.SSRRoughnessTexture, ctx.SSRNormalTexture] : this._textureFormat,\r\n depth ?? ctx.depthFormat\r\n );\r\n device.setFramebuffer(tmpFramebuffer);\r\n }\r\n /** @internal */\r\n drawPostEffects(ctx: DrawContext, layer: PostEffectLayer, sceneDepthTexture: Texture2D) {\r\n const postEffects = this._postEffects[layer];\r\n if (postEffects.length > 0) {\r\n const device = ctx.device;\r\n const inputFramebuffer = device.getFramebuffer();\r\n const inputTexture = inputFramebuffer.getColorAttachments()[0] as Texture2D;\r\n let tmpTexture: Texture2D = null;\r\n for (let i = 0; i < postEffects.length; i++) {\r\n const postEffect = postEffects[i].get();\r\n if (!postEffect.enabled) {\r\n continue;\r\n }\r\n if (this._prevFrameBuffer) {\r\n device.pool.releaseFrameBuffer(this._prevFrameBuffer);\r\n this._prevFrameBuffer = null;\r\n }\r\n const isLast = this.isLastPostEffect(layer, i);\r\n const finalEffect = isLast && (!postEffect.requireDepthAttachment(ctx) || !!this._finalFramebuffer);\r\n if (finalEffect) {\r\n device.setFramebuffer(this._finalFramebuffer);\r\n } else {\r\n this._prevFrameBuffer = device.pool.fetchTemporalFramebuffer(\r\n false,\r\n inputFramebuffer.getWidth(),\r\n inputFramebuffer.getHeight(),\r\n this._textureFormat,\r\n inputFramebuffer.getDepthAttachment() ?? null\r\n );\r\n device.setFramebuffer(this._prevFrameBuffer);\r\n }\r\n const inputColorTexture = tmpTexture ?? inputTexture;\r\n postEffect.apply(ctx, inputColorTexture, sceneDepthTexture, !device.getFramebuffer());\r\n if (this._prevInputTexture) {\r\n device.pool.releaseTexture(this._prevInputTexture);\r\n this._prevInputTexture = null;\r\n }\r\n if (this._prevFrameBuffer) {\r\n tmpTexture = this._prevFrameBuffer.getColorAttachments()[0] as Texture2D;\r\n device.pool.retainTexture(tmpTexture);\r\n this._prevInputTexture = tmpTexture;\r\n }\r\n }\r\n }\r\n }\r\n /** @internal */\r\n end(ctx: DrawContext) {\r\n const device = ctx.device;\r\n if (device.getFramebuffer() !== this._finalFramebuffer) {\r\n const srcTex = device.getFramebuffer().getColorAttachments()[0] as Texture2D;\r\n device.setFramebuffer(this._finalFramebuffer);\r\n device.setViewport(null);\r\n device.setScissor(null);\r\n Compositor._blit(device, srcTex, !this._finalFramebuffer);\r\n }\r\n if (this._prevInputTexture) {\r\n device.pool.releaseTexture(this._prevInputTexture);\r\n this._prevInputTexture = null;\r\n }\r\n if (this._prevFrameBuffer) {\r\n device.pool.releaseFrameBuffer(this._prevFrameBuffer);\r\n this._prevFrameBuffer = null;\r\n }\r\n }\r\n /** @internal */\r\n private isLastPostEffect(layer: PostEffectLayer, index: number) {\r\n for (let i = layer; i < this._postEffects.length; i++) {\r\n const start = i === layer ? index + 1 : 0;\r\n for (let j = start; j < this._postEffects[i].length; j++) {\r\n if (this._postEffects[i][j].get().enabled) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n /** @internal */\r\n static _blit(device: AbstractDevice, srcTex: Texture2D, srgbOutput: boolean) {\r\n if (!this._blitProgram) {\r\n this._blitProgram = device.buildRenderProgram({\r\n vertex(pb) {\r\n this.$inputs.pos = pb.vec2().attrib('position');\r\n this.$outputs.uv = pb.vec2();\r\n this.flip = pb.int().uniform(0);\r\n pb.main(function () {\r\n this.$builtins.position = pb.vec4(this.$inputs.pos, 0, 1);\r\n this.$outputs.uv = pb.add(pb.mul(this.$inputs.pos.xy, 0.5), pb.vec2(0.5));\r\n this.$if(pb.notEqual(this.flip, 0), function () {\r\n this.$builtins.position.y = pb.neg(this.$builtins.position.y);\r\n });\r\n });\r\n },\r\n fragment(pb) {\r\n this.srcTex = pb.tex2D().sampleType('unfilterable-float').uniform(0);\r\n this.srgbOutput = pb.int().uniform(0);\r\n this.$outputs.outColor = pb.vec4();\r\n pb.main(function () {\r\n this.$outputs.outColor = pb.textureSample(this.srcTex, this.$inputs.uv);\r\n this.$if(pb.notEqual(this.srgbOutput, 0), function () {\r\n this.$outputs.outColor = pb.vec4(linearToGamma(this, this.$outputs.outColor.rgb), 1);\r\n });\r\n });\r\n }\r\n });\r\n this._blitProgram.name = '@Compositor_blit';\r\n this._blitBindgroup = device.createBindGroup(this._blitProgram.bindGroupLayouts[0]);\r\n this._blitVertexLayout = device.createVertexLayout({\r\n vertexBuffers: [\r\n {\r\n buffer: device.createVertexBuffer(\r\n 'position_f32x2',\r\n new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])\r\n )\r\n }\r\n ]\r\n });\r\n this._blitRenderStates = device.createRenderStateSet();\r\n this._blitRenderStates.useRasterizerState().setCullMode('none');\r\n this._blitRenderStates.useDepthState().enableTest(false).enableWrite(false);\r\n }\r\n this._blitBindgroup.setTexture('srcTex', srcTex, fetchSampler('clamp_nearest_nomip'));\r\n this._blitBindgroup.setValue('srgbOutput', srgbOutput ? 1 : 0);\r\n this._blitBindgroup.setValue('flip', device.type === 'webgpu' && !!device.getFramebuffer() ? 1 : 0);\r\n device.setRenderStates(this._blitRenderStates);\r\n device.setProgram(this._blitProgram);\r\n device.setBindGroup(0, this._blitBindgroup);\r\n device.setVertexLayout(this._blitVertexLayout);\r\n device.draw('triangle-strip', 0, 4);\r\n }\r\n}\r\n"],"names":["Compositor","_blitProgram","_blitBindgroup","_blitRenderStates","_blitVertexLayout","_postEffects","PostEffectLayer","opaque","transparent","end","_finalFramebuffer","_prevInputTexture","_prevFrameBuffer","_textureFormat","requireLinearDepth","ctx","list","postEffect","get","requireLinearDepthTexture","appendPostEffect","findIndex","val","console","error","layer","push","DRef","removePostEffect","index","dispose","splice","clear","p","length","begin","device","camera","HDR","getDeviceCaps","textureCaps","supportHalfFloatColorBuffer","getFramebuffer","ssr","materialFlags","MaterialVaryingFlags","SSR_STORE_ROUGHNESS","every","depth","getDepthAttachment","w","width","getDrawingBufferWidth","h","height","getDrawingBufferHeight","tmpFramebuffer","pool","fetchTemporalFramebuffer","SSRRoughnessTexture","SSRNormalTexture","depthFormat","setFramebuffer","drawPostEffects","sceneDepthTexture","postEffects","inputFramebuffer","inputTexture","getColorAttachments","tmpTexture","i","enabled","releaseFrameBuffer","isLast","isLastPostEffect","finalEffect","requireDepthAttachment","getWidth","getHeight","inputColorTexture","apply","releaseTexture","retainTexture","srcTex","setViewport","setScissor","_blit","start","j","srgbOutput","buildRenderProgram","vertex","pb","$inputs","pos","vec2","attrib","$outputs","uv","flip","int","uniform","main","$builtins","position","vec4","add","mul","xy","$if","notEqual","y","neg","fragment","tex2D","sampleType","outColor","textureSample","linearToGamma","rgb","name","createBindGroup","bindGroupLayouts","createVertexLayout","vertexBuffers","buffer","createVertexBuffer","Float32Array","createRenderStateSet","useRasterizerState","setCullMode","useDepthState","enableTest","enableWrite","setTexture","fetchSampler","setValue","type","setRenderStates","setProgram","setBindGroup","setVertexLayout","draw"],"mappings":";;;;;;AA2BA;;;AAGC,IACM,MAAMA,UAAAA,CAAAA;qBAEX,YAAqD;qBAErD,iBAAuC;qBAEvC,iBAAqC;qBAErC,gBAAsC;qBAEtC,cAAsC;qBAEtC,OAAeC,YAAAA,GAA2B,IAAK;qBAE/C,OAAeC,cAAAA,GAA4B,IAAK;qBAEhD,OAAeC,iBAAAA,GAAoC,IAAK;qBAExD,OAAeC,iBAAAA,GAAkC,IAAK;AACtD;;AAEC,MACD,WAAc,EAAA;QACZ,IAAI,CAACC,YAAY,GAAG,EAAE;AACtB,QAAA,IAAI,CAACA,YAAY,CAACC,gBAAgBC,MAAM,CAAC,GAAG,EAAE;AAC9C,QAAA,IAAI,CAACF,YAAY,CAACC,gBAAgBE,WAAW,CAAC,GAAG,EAAE;AACnD,QAAA,IAAI,CAACH,YAAY,CAACC,gBAAgBG,GAAG,CAAC,GAAG,EAAE;QAC3C,IAAI,CAACC,iBAAiB,GAAG,IAAA;QACzB,IAAI,CAACC,iBAAiB,GAAG,IAAA;QACzB,IAAI,CAACC,gBAAgB,GAAG,I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A;QAC7CgC,MAAO0G,CAAAA,IAAI,CAAC,gBAAA,EAAkB,CAAG,EAAA,CAAA,CAAA;AACnC;AACF;;;;"}
|
package/dist/posteffect/fxaa.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Vector2 } from '@zephyr3d/base';
|
|
2
|
-
import { AbstractPostEffect } from './posteffect.js';
|
|
2
|
+
import { AbstractPostEffect, PostEffectLayer } from './posteffect.js';
|
|
3
3
|
import { linearToGamma } from '../shaders/misc.js';
|
|
4
4
|
import { fetchSampler } from '../utility/misc.js';
|
|
5
5
|
|
|
@@ -7,23 +7,16 @@ import { fetchSampler } from '../utility/misc.js';
|
|
|
7
7
|
* FXAA post effect
|
|
8
8
|
* @public
|
|
9
9
|
*/ class FXAA extends AbstractPostEffect {
|
|
10
|
-
static className = 'FXAA';
|
|
11
10
|
static _program = null;
|
|
12
|
-
_bindgroup;
|
|
11
|
+
static _bindgroup = null;
|
|
13
12
|
_invTexSize;
|
|
14
13
|
/**
|
|
15
14
|
* Creates an instance of grayscale post effect
|
|
16
15
|
*/ constructor(){
|
|
17
16
|
super();
|
|
18
|
-
this.
|
|
19
|
-
this._bindgroup = null;
|
|
17
|
+
this._layer = PostEffectLayer.transparent;
|
|
20
18
|
this._invTexSize = new Vector2();
|
|
21
19
|
}
|
|
22
|
-
/** {@inheritDoc AbstractPostEffect.dispose} */ dispose() {
|
|
23
|
-
super.dispose();
|
|
24
|
-
this._bindgroup?.dispose();
|
|
25
|
-
this._bindgroup = null;
|
|
26
|
-
}
|
|
27
20
|
/** {@inheritDoc AbstractPostEffect.requireLinearDepthTexture} */ requireLinearDepthTexture() {
|
|
28
21
|
return false;
|
|
29
22
|
}
|
|
@@ -34,12 +27,12 @@ import { fetchSampler } from '../utility/misc.js';
|
|
|
34
27
|
const device = ctx.device;
|
|
35
28
|
this._prepare(device);
|
|
36
29
|
this._invTexSize.setXY(1 / inputColorTexture.width, 1 / inputColorTexture.height);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
FXAA._bindgroup.setTexture('srcTex', inputColorTexture, fetchSampler('clamp_linear_nomip'));
|
|
31
|
+
FXAA._bindgroup.setValue('flip', this.needFlip(device) ? 1 : 0);
|
|
32
|
+
FXAA._bindgroup.setValue('srgbOut', srgbOutput ? 1 : 0);
|
|
33
|
+
FXAA._bindgroup.setValue('invTexSize', this._invTexSize);
|
|
41
34
|
device.setProgram(FXAA._program);
|
|
42
|
-
device.setBindGroup(0,
|
|
35
|
+
device.setBindGroup(0, FXAA._bindgroup);
|
|
43
36
|
this.drawFullscreenQuad();
|
|
44
37
|
}
|
|
45
38
|
/** @internal */ _prepare(device) {
|
|
@@ -271,9 +264,8 @@ import { fetchSampler } from '../utility/misc.js';
|
|
|
271
264
|
});
|
|
272
265
|
}
|
|
273
266
|
});
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
this._bindgroup = device.createBindGroup(FXAA._program.bindGroupLayouts[0]);
|
|
267
|
+
FXAA._program.name = '@FXAA_program';
|
|
268
|
+
FXAA._bindgroup = device.createBindGroup(FXAA._program.bindGroupLayouts[0]);
|
|
277
269
|
}
|
|
278
270
|
}
|
|
279
271
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fxaa.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"fxaa.js","sources":["../../src/posteffect/fxaa.ts"],"sourcesContent":["import { Vector2 } from '@zephyr3d/base';\r\nimport { AbstractPostEffect, PostEffectLayer } from './posteffect';\r\nimport { linearToGamma } from '../shaders/misc';\r\nimport type { AbstractDevice, BindGroup, GPUProgram, Texture2D } from '@zephyr3d/device';\r\nimport type { DrawContext } from '../render';\r\nimport { fetchSampler } from '../utility/misc';\r\n\r\n/**\r\n * FXAA post effect\r\n * @public\r\n */\r\nexport class FXAA extends AbstractPostEffect {\r\n private static _program: GPUProgram = null;\r\n private static _bindgroup: BindGroup = null;\r\n private readonly _invTexSize: Vector2;\r\n /**\r\n * Creates an instance of grayscale post effect\r\n */\r\n constructor() {\r\n super();\r\n this._layer = PostEffectLayer.transparent;\r\n this._invTexSize = new Vector2();\r\n }\r\n /** {@inheritDoc AbstractPostEffect.requireLinearDepthTexture} */\r\n requireLinearDepthTexture(): boolean {\r\n return false;\r\n }\r\n /** {@inheritDoc AbstractPostEffect.requireDepthAttachment} */\r\n requireDepthAttachment(): boolean {\r\n return false;\r\n }\r\n /** {@inheritDoc AbstractPostEffect.apply} */\r\n apply(ctx: DrawContext, inputColorTexture: Texture2D, sceneDepthTexture: Texture2D, srgbOutput: boolean) {\r\n const device = ctx.device;\r\n this._prepare(device);\r\n this._invTexSize.setXY(1 / inputColorTexture.width, 1 / inputColorTexture.height);\r\n FXAA._bindgroup.setTexture('srcTex', inputColorTexture, fetchSampler('clamp_linear_nomip'));\r\n FXAA._bindgroup.setValue('flip', this.needFlip(device) ? 1 : 0);\r\n FXAA._bindgroup.setValue('srgbOut', srgbOutput ? 1 : 0);\r\n FXAA._bindgroup.setValue('invTexSize', this._invTexSize);\r\n device.setProgram(FXAA._program);\r\n device.setBindGroup(0, FXAA._bindgroup);\r\n this.drawFullscreenQuad();\r\n }\r\n /** @internal */\r\n private _prepare(device: AbstractDevice) {\r\n if (!FXAA._program) {\r\n FXAA._program = device.buildRenderProgram({\r\n vertex(pb) {\r\n this.flip = pb.int().uniform(0);\r\n this.$inputs.pos = pb.vec2().attrib('position');\r\n this.$outputs.uv = pb.vec2();\r\n pb.main(function () {\r\n this.$builtins.position = pb.vec4(this.$inputs.pos, 0, 1);\r\n this.$outputs.uv = pb.add(pb.mul(this.$inputs.pos.xy, 0.5), pb.vec2(0.5));\r\n this.$if(pb.notEqual(this.flip, 0), function () {\r\n this.$builtins.position.y = pb.neg(this.$builtins.position.y);\r\n });\r\n });\r\n },\r\n fragment(pb) {\r\n this.srcTex = pb.tex2D().uniform(0);\r\n this.srgbOut = pb.int().uniform(0);\r\n this.invTexSize = pb.vec2().uniform(0);\r\n this.$outputs.outColor = pb.vec4();\r\n pb.func('getLuma', [pb.vec3('vSample')], function () {\r\n this.$return(pb.dot(this.vSample, pb.vec3(0.299, 0.587, 0.114)));\r\n });\r\n pb.func('FXAA', [pb.vec2('uv')], function () {\r\n this.$l.posM = this.uv;\r\n this.$l.rgbyM = pb.textureSampleLevel(this.srcTex, this.uv, 0);\r\n this.$l.lumaM = this.getLuma(this.rgbyM.rgb);\r\n this.$l.lumaN = this.getLuma(\r\n pb.textureSampleLevel(this.srcTex, pb.add(this.uv, pb.mul(pb.vec2(0, -1), this.invTexSize)), 0)\r\n .rgb\r\n );\r\n this.$l.lumaW = this.getLuma(\r\n pb.textureSampleLevel(this.srcTex, pb.add(this.uv, pb.mul(pb.vec2(-1, 0), this.invTexSize)), 0)\r\n .rgb\r\n );\r\n this.$l.lumaE = this.getLuma(\r\n pb.textureSampleLevel(this.srcTex, pb.add(this.uv, pb.mul(pb.vec2(1, 0), this.invTexSize)), 0)\r\n .rgb\r\n );\r\n this.$l.lumaS = this.getLuma(\r\n pb.textureSampleLevel(this.srcTex, pb.add(this.uv, pb.mul(pb.vec2(0, 1), this.invTexSize)), 0)\r\n .rgb\r\n );\r\n this.$l.rangeMin = pb.min(\r\n this.lumaM,\r\n pb.min(pb.min(this.lumaN, this.lumaW), pb.min(this.lumaS, this.lumaE))\r\n );\r\n this.$l.rangeMax = pb.max(\r\n this.lumaM,\r\n pb.max(pb.max(this.lumaN, this.lumaW), pb.max(this.lumaS, this.lumaE))\r\n );\r\n this.$l.range = pb.sub(this.rangeMax, this.rangeMin);\r\n this.$if(pb.lessThan(this.range, pb.max(1 / 16, pb.div(this.rangeMax, 8))), function () {\r\n this.$return(this.rgbyM);\r\n });\r\n this.$l.lumaNW = this.getLuma(\r\n pb.textureSampleLevel(this.srcTex, pb.add(this.uv, pb.mul(pb.vec2(-1, -1), this.invTexSize)), 0)\r\n .rgb\r\n );\r\n this.$l.lumaNE = this.getLuma(\r\n pb.textureSampleLevel(this.srcTex, pb.add(this.uv, pb.mul(pb.vec2(1, -1), this.invTexSize)), 0)\r\n .rgb\r\n );\r\n this.$l.lumaSW = this.getLuma(\r\n pb.textureSampleLevel(this.srcTex, pb.add(this.uv, pb.mul(pb.vec2(-1, 1), this.invTexSize)), 0)\r\n .rgb\r\n );\r\n this.$l.lumaSE = this.getLuma(\r\n pb.textureSampleLevel(this.srcTex, pb.add(this.uv, pb.mul(pb.vec2(1, 1), this.invTexSize)), 0)\r\n .rgb\r\n );\r\n this.$l.lumaNS = pb.add(this.lumaN, this.lumaS);\r\n this.$l.lumaWE = pb.add(this.lumaW, this.lumaE);\r\n this.$l.subpixRcpRange = pb.div(1, this.range);\r\n this.$l.subpixNSWE = pb.add(this.lumaNS, this.lumaWE);\r\n this.$l.edgeHorz1 = pb.add(pb.mul(-2, this.lumaM), this.lumaNS);\r\n this.$l.edgeVert1 = pb.add(pb.mul(-2, this.lumaM), this.lumaWE);\r\n this.$l.lumaNESE = pb.add(this.lumaNE, this.lumaSE);\r\n this.$l.lumaNWNE = pb.add(this.lumaNW, this.lumaNE);\r\n this.$l.edgeHorz2 = pb.add(pb.mul(-2, this.lumaE), this.lumaNESE);\r\n this.$l.edgeVert2 = pb.add(pb.mul(-2, this.lumaN), this.lumaNWNE);\r\n this.$l.lumaNWSW = pb.add(this.lumaNW, this.lumaSW);\r\n this.$l.lumaSWSE = pb.add(this.lumaSW, this.lumaSE);\r\n this.$l.edgeHorz4 = pb.add(pb.mul(pb.abs(this.edgeHorz1), 2), pb.abs(this.edgeHorz2));\r\n this.$l.edgeVert4 = pb.add(pb.mul(pb.abs(this.edgeVert1), 2), pb.abs(this.edgeVert2));\r\n this.$l.edgeHorz3 = pb.add(pb.mul(-2, this.lumaW), this.lumaNWSW);\r\n this.$l.edgeVert3 = pb.add(pb.mul(-2, this.lumaS), this.lumaSWSE);\r\n this.$l.edgeHorz = pb.add(pb.abs(this.edgeHorz3), this.edgeHorz4);\r\n this.$l.edgeVert = pb.add(pb.abs(this.edgeVert3), this.edgeVert4);\r\n this.$l.subpixNWSWNESE = pb.add(this.lumaNWSW, this.lumaNESE);\r\n this.$l.lengthSign = this.invTexSize.x;\r\n this.$l.horzSpan = pb.greaterThanEqual(this.edgeHorz, this.edgeVert);\r\n this.$l.subpixA = pb.add(pb.mul(this.subpixNSWE, 2), this.subpixNWSWNESE);\r\n this.$if(pb.not(this.horzSpan), function () {\r\n this.lumaN = this.lumaW;\r\n this.lumaS = this.lumaE;\r\n }).$else(function () {\r\n this.lengthSign = this.invTexSize.y;\r\n });\r\n this.$l.subpixB = pb.sub(pb.div(this.subpixA, 12), this.lumaM);\r\n this.$l.gradientN = pb.sub(this.lumaN, this.lumaM);\r\n this.$l.gradientS = pb.sub(this.lumaS, this.lumaM);\r\n this.$l.lumaNN = pb.add(this.lumaN, this.lumaM);\r\n this.$l.lumaSS = pb.add(this.lumaS, this.lumaM);\r\n this.$l.pairN = pb.greaterThanEqual(pb.abs(this.gradientN), pb.abs(this.gradientS));\r\n this.$l.gradient = pb.max(pb.abs(this.gradientN), pb.abs(this.gradientS));\r\n this.$if(this.pairN, function () {\r\n this.lengthSign = pb.neg(this.lengthSign);\r\n });\r\n this.$l.subpixC = pb.clamp(pb.mul(pb.abs(this.subpixB), this.subpixRcpRange), 0, 1);\r\n\r\n this.$l.posB = this.posM;\r\n this.$l.offNP = pb.vec2();\r\n this.$if(pb.not(this.horzSpan), function () {\r\n this.offNP.x = 0;\r\n this.offNP.y = this.invTexSize.y;\r\n this.posB.x = pb.add(this.posB.x, pb.mul(this.lengthSign, 0.5));\r\n }).$else(function () {\r\n this.offNP.x = this.invTexSize.x;\r\n this.offNP.y = 0;\r\n this.posB.y = pb.add(this.posB.y, pb.mul(this.lengthSign, 0.5));\r\n });\r\n this.$l.posN = pb.sub(this.posB, this.offNP);\r\n this.$l.posP = pb.add(this.posB, this.offNP);\r\n this.$l.subpixD = pb.add(pb.mul(-2, this.subpixC), 3);\r\n this.$l.lumaEndN = this.getLuma(pb.textureSampleLevel(this.srcTex, this.posN, 0).rgb);\r\n this.$l.subpixE = pb.mul(this.subpixC, this.subpixC);\r\n this.$l.lumaEndP = this.getLuma(pb.textureSampleLevel(this.srcTex, this.posP, 0).rgb);\r\n this.$if(pb.not(this.pairN), function () {\r\n this.lumaNN = this.lumaSS;\r\n });\r\n this.$l.gradientScaled = pb.div(this.gradient, 4);\r\n this.$l.lumaMM = pb.sub(this.lumaM, pb.mul(this.lumaNN, 0.5));\r\n this.$l.subpixF = pb.mul(this.subpixD, this.subpixE);\r\n this.$l.lumaMLTZero = pb.lessThan(this.lumaMM, 0);\r\n\r\n this.lumaEndN = pb.sub(this.lumaEndN, pb.mul(this.lumaNN, 0.5));\r\n this.lumaEndP = pb.sub(this.lumaEndP, pb.mul(this.lumaNN, 0.5));\r\n this.$l.doneN = pb.greaterThanEqual(pb.abs(this.lumaEndN), this.gradientScaled);\r\n this.$l.doneP = pb.greaterThanEqual(pb.abs(this.lumaEndP), this.gradientScaled);\r\n this.$if(pb.not(this.doneN), function () {\r\n this.posN = pb.sub(this.posN, pb.mul(this.offNP, 1.5));\r\n });\r\n this.$l.doneNP = pb.or(pb.not(this.doneN), pb.not(this.doneP));\r\n this.$if(pb.not(this.doneP), function () {\r\n this.posP = pb.add(this.posP, pb.mul(this.offNP, 1.5));\r\n });\r\n this.$if(this.doneNP, function () {\r\n this.$if(pb.not(this.doneN), function () {\r\n this.lumaEndN = this.getLuma(pb.textureSampleLevel(this.srcTex, this.posN.xy, 0).rgb);\r\n this.lumaEndN = pb.sub(this.lumaEndN, pb.mul(this.lumaNN, 0.5));\r\n });\r\n this.$if(pb.not(this.doneP), function () {\r\n this.lumaEndP = this.getLuma(pb.textureSampleLevel(this.srcTex, this.posP.xy, 0).rgb);\r\n this.lumaEndP = pb.sub(this.lumaEndP, pb.mul(this.lumaNN, 0.5));\r\n });\r\n this.doneN = pb.greaterThanEqual(pb.abs(this.lumaEndN), this.gradientScaled);\r\n this.doneP = pb.greaterThanEqual(pb.abs(this.lumaEndP), this.gradientScaled);\r\n this.$if(pb.not(this.doneN), function () {\r\n this.posN = pb.sub(this.posN, pb.mul(this.offNP, 2.0));\r\n });\r\n this.doneNP = pb.or(pb.not(this.doneN), pb.not(this.doneP));\r\n this.$if(pb.not(this.doneP), function () {\r\n this.posP = pb.add(this.posP, pb.mul(this.offNP, 2.0));\r\n });\r\n this.$if(this.doneNP, function () {\r\n this.$if(pb.not(this.doneN), function () {\r\n this.lumaEndN = this.getLuma(pb.textureSampleLevel(this.srcTex, this.posN.xy, 0).rgb);\r\n this.lumaEndN = pb.sub(this.lumaEndN, pb.mul(this.lumaNN, 0.5));\r\n });\r\n this.$if(pb.not(this.doneP), function () {\r\n this.lumaEndP = this.getLuma(pb.textureSampleLevel(this.srcTex, this.posP.xy, 0).rgb);\r\n this.lumaEndP = pb.sub(this.lumaEndP, pb.mul(this.lumaNN, 0.5));\r\n });\r\n this.doneN = pb.greaterThanEqual(pb.abs(this.lumaEndN), this.gradientScaled);\r\n this.doneP = pb.greaterThanEqual(pb.abs(this.lumaEndP), this.gradientScaled);\r\n this.$if(pb.not(this.doneN), function () {\r\n this.posN = pb.sub(this.posN, pb.mul(this.offNP, 2.0));\r\n });\r\n this.doneNP = pb.or(pb.not(this.doneN), pb.not(this.doneP));\r\n this.$if(pb.not(this.doneP), function () {\r\n this.posP = pb.add(this.posP, pb.mul(this.offNP, 2.0));\r\n });\r\n this.$if(this.doneNP, function () {\r\n this.$if(pb.not(this.doneN), function () {\r\n this.lumaEndN = this.getLuma(pb.textureSampleLevel(this.srcTex, this.posN.xy, 0).rgb);\r\n this.lumaEndN = pb.sub(this.lumaEndN, pb.mul(this.lumaNN, 0.5));\r\n });\r\n this.$if(pb.not(this.doneP), function () {\r\n this.lumaEndP = this.getLuma(pb.textureSampleLevel(this.srcTex, this.posP.xy, 0).rgb);\r\n this.lumaEndP = pb.sub(this.lumaEndP, pb.mul(this.lumaNN, 0.5));\r\n });\r\n this.doneN = pb.greaterThanEqual(pb.abs(this.lumaEndN), this.gradientScaled);\r\n this.doneP = pb.greaterThanEqual(pb.abs(this.lumaEndP), this.gradientScaled);\r\n this.$if(pb.not(this.doneN), function () {\r\n this.posN = pb.sub(this.posN, pb.mul(this.offNP, 4.0));\r\n });\r\n this.doneNP = pb.or(pb.not(this.doneN), pb.not(this.doneP));\r\n this.$if(pb.not(this.doneP), function () {\r\n this.posP = pb.add(this.posP, pb.mul(this.offNP, 4.0));\r\n });\r\n this.$if(this.doneNP, function () {\r\n this.$if(pb.not(this.doneN), function () {\r\n this.lumaEndN = this.getLuma(pb.textureSampleLevel(this.srcTex, this.posN.xy, 0).rgb);\r\n this.lumaEndN = pb.sub(this.lumaEndN, pb.mul(this.lumaNN, 0.5));\r\n });\r\n this.$if(pb.not(this.doneP), function () {\r\n this.lumaEndP = this.getLuma(pb.textureSampleLevel(this.srcTex, this.posP.xy, 0).rgb);\r\n this.lumaEndP = pb.sub(this.lumaEndP, pb.mul(this.lumaNN, 0.5));\r\n });\r\n this.doneN = pb.greaterThanEqual(pb.abs(this.lumaEndN), this.gradientScaled);\r\n this.doneP = pb.greaterThanEqual(pb.abs(this.lumaEndP), this.gradientScaled);\r\n this.$if(pb.not(this.doneN), function () {\r\n this.posN = pb.sub(this.posN, pb.mul(this.offNP, 2.0));\r\n });\r\n this.$if(pb.not(this.doneP), function () {\r\n this.posP = pb.add(this.posP, pb.mul(this.offNP, 2.0));\r\n });\r\n });\r\n });\r\n });\r\n });\r\n this.$l.dstN = pb.sub(this.posM.x, this.posN.x);\r\n this.$l.dstP = pb.sub(this.posP.x, this.posM.x);\r\n this.$if(pb.not(this.horzSpan), function () {\r\n this.dstN = pb.sub(this.posM.y, this.posN.y);\r\n this.dstP = pb.sub(this.posP.y, this.posM.y);\r\n });\r\n\r\n this.$l.goodSpanN = pb.notEqual(pb.lessThan(this.lumaEndN, 0), this.lumaMLTZero);\r\n this.$l.spanLength = pb.add(this.dstP, this.dstN);\r\n this.$l.goodSpanP = pb.notEqual(pb.lessThan(this.lumaEndP, 0), this.lumaMLTZero);\r\n this.$l.spanLengthRcp = pb.div(1, this.spanLength);\r\n\r\n this.$l.directionN = pb.lessThan(this.dstN, this.dstP);\r\n this.$l.dst = pb.min(this.dstN, this.dstP);\r\n this.$l.goodSpan = this.$choice(this.directionN, this.goodSpanN, this.goodSpanP);\r\n this.$l.subpixG = pb.mul(this.subpixF, this.subpixF);\r\n this.$l.pixelOffset = pb.add(pb.mul(this.dst, pb.neg(this.spanLengthRcp)), 0.5);\r\n this.$l.subpixH = pb.mul(this.subpixG, 0.75);\r\n\r\n this.$l.pixelOffsetGood = this.$choice(this.goodSpan, this.pixelOffset, 0);\r\n this.$l.pixelOffsetSubpix = pb.max(this.pixelOffsetGood, this.subpixH);\r\n this.$if(pb.not(this.horzSpan), function () {\r\n this.posM.x = pb.add(this.posM.x, pb.mul(this.pixelOffsetSubpix, this.lengthSign));\r\n }).$else(function () {\r\n this.posM.y = pb.add(this.posM.y, pb.mul(this.pixelOffsetSubpix, this.lengthSign));\r\n });\r\n this.$return(pb.textureSampleLevel(this.srcTex, this.posM, 0).xyzw);\r\n });\r\n pb.main(function () {\r\n this.$l.color = this.FXAA(this.$inputs.uv);\r\n this.$if(pb.equal(this.srgbOut, 0), function () {\r\n this.$outputs.outColor = this.color;\r\n }).$else(function () {\r\n this.$outputs.outColor = pb.vec4(linearToGamma(this, this.color.rgb), this.color.a);\r\n });\r\n });\r\n }\r\n });\r\n FXAA._program.name = '@FXAA_program';\r\n FXAA._bindgroup = device.createBindGroup(FXAA._program.bindGroupLayouts[0]);\r\n }\r\n }\r\n}\r\n"],"names":["FXAA","AbstractPostEffect","_program","_bindgroup","_invTexSize","_layer","PostEffectLayer","transparent","Vector2","requireLinearDepthTexture","requireDepthAttachment","apply","ctx","inputColorTexture","sceneDepthTexture","srgbOutput","device","_prepare","setXY","width","height","setTexture","fetchSampler","setValue","needFlip","setProgram","setBindGroup","drawFullscreenQuad","buildRenderProgram","vertex","pb","flip","int","uniform","$inputs","pos","vec2","attrib","$outputs","uv","main","$builtins","position","vec4","add","mul","xy","$if","notEqual","y","neg","fragment","srcTex","tex2D","srgbOut","invTexSize","outColor","func","vec3","$return","dot","vSample","$l","posM","rgbyM","textureSampleLevel","lumaM","getLuma","rgb","lumaN","lumaW","lumaE","lumaS","rangeMin","min","rangeMax","max","range","sub","lessThan","div","lumaNW","lumaNE","lumaSW","lumaSE","lumaNS","lumaWE","subpixRcpRange","subpixNSWE","edgeHorz1","edgeVert1","lumaNESE","lumaNWNE","edgeHorz2","edgeVert2","lumaNWSW","lumaSWSE","edgeHorz4","abs","edgeVert4","edgeHorz3","edgeVert3","edgeHorz","edgeVert","subpixNWSWNESE","lengthSign","x","horzSpan","greaterThanEqual","subpixA","not","$else","subpixB","gradientN","gradientS","lumaNN","lumaSS","pairN","gradient","subpixC","clamp","posB","offNP","posN","posP","subpixD","lumaEndN","subpixE","lumaEndP","gradientScaled","lumaMM","subpixF","lumaMLTZero","doneN","doneP","doneNP","or","dstN","dstP","goodSpanN","spanLength","goodSpanP","spanLengthRcp","directionN","dst","goodSpan","$choice","subpixG","pixelOffset","subpixH","pixelOffsetGood","pixelOffsetSubpix","xyzw","color","equal","linearToGamma","a","name","createBindGroup","bindGroupLayouts"],"mappings":";;;;;AAOA;;;IAIO,MAAMA,IAAaC,SAAAA,kBAAAA,CAAAA;AACxB,IAAA,OAAeC,WAAuB,IAAK;AAC3C,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U,GAAGa,MAAAA,CAAO8I,eAAe,CAAC9J,KAAKE,QAAQ,CAAC6J,gBAAgB,CAAC,CAAE,CAAA,CAAA;AAC5E;AACF;AACF;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractPostEffect } from './posteffect.js';
|
|
1
|
+
import { AbstractPostEffect, PostEffectLayer } from './posteffect.js';
|
|
2
2
|
import { linearToGamma } from '../shaders/misc.js';
|
|
3
3
|
import { fetchSampler } from '../utility/misc.js';
|
|
4
4
|
|
|
@@ -6,20 +6,13 @@ import { fetchSampler } from '../utility/misc.js';
|
|
|
6
6
|
* Grayscale post effect
|
|
7
7
|
* @public
|
|
8
8
|
*/ class Grayscale extends AbstractPostEffect {
|
|
9
|
-
static className = 'Grayscale';
|
|
10
9
|
static _program = null;
|
|
11
|
-
_bindgroup;
|
|
10
|
+
static _bindgroup = null;
|
|
12
11
|
/**
|
|
13
12
|
* Creates an instance of grayscale post effect
|
|
14
13
|
*/ constructor(){
|
|
15
14
|
super();
|
|
16
|
-
this.
|
|
17
|
-
this._bindgroup = null;
|
|
18
|
-
}
|
|
19
|
-
/** {@inheritDoc AbstractPostEffect.dispose} */ dispose() {
|
|
20
|
-
super.dispose();
|
|
21
|
-
this._bindgroup?.dispose();
|
|
22
|
-
this._bindgroup = null;
|
|
15
|
+
this._layer = PostEffectLayer.transparent;
|
|
23
16
|
}
|
|
24
17
|
/** {@inheritDoc AbstractPostEffect.requireLinearDepthTexture} */ requireLinearDepthTexture() {
|
|
25
18
|
return false;
|
|
@@ -30,11 +23,11 @@ import { fetchSampler } from '../utility/misc.js';
|
|
|
30
23
|
/** {@inheritDoc AbstractPostEffect.apply} */ apply(ctx, inputColorTexture, sceneDepthTexture, srgbOutput) {
|
|
31
24
|
const device = ctx.device;
|
|
32
25
|
this._prepare(device);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
Grayscale._bindgroup.setTexture('srcTex', inputColorTexture, fetchSampler('clamp_nearest_nomip'));
|
|
27
|
+
Grayscale._bindgroup.setValue('flip', this.needFlip(device) ? 1 : 0);
|
|
28
|
+
Grayscale._bindgroup.setValue('srgbOut', srgbOutput ? 1 : 0);
|
|
36
29
|
device.setProgram(Grayscale._program);
|
|
37
|
-
device.setBindGroup(0,
|
|
30
|
+
device.setBindGroup(0, Grayscale._bindgroup);
|
|
38
31
|
this.drawFullscreenQuad();
|
|
39
32
|
}
|
|
40
33
|
/** @internal */ _prepare(device) {
|
|
@@ -67,9 +60,8 @@ import { fetchSampler } from '../utility/misc.js';
|
|
|
67
60
|
});
|
|
68
61
|
}
|
|
69
62
|
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
this._bindgroup = device.createBindGroup(Grayscale._program.bindGroupLayouts[0]);
|
|
63
|
+
Grayscale._program.name = '@Grayscale';
|
|
64
|
+
Grayscale._bindgroup = device.createBindGroup(Grayscale._program.bindGroupLayouts[0]);
|
|
73
65
|
}
|
|
74
66
|
}
|
|
75
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grayscale.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"grayscale.js","sources":["../../src/posteffect/grayscale.ts"],"sourcesContent":["import { AbstractPostEffect, PostEffectLayer } from './posteffect';\r\nimport { linearToGamma } from '../shaders/misc';\r\nimport type { AbstractDevice, BindGroup, GPUProgram, Texture2D } from '@zephyr3d/device';\r\nimport type { DrawContext } from '../render';\r\nimport { fetchSampler } from '../utility/misc';\r\n\r\n/**\r\n * Grayscale post effect\r\n * @public\r\n */\r\nexport class Grayscale extends AbstractPostEffect {\r\n private static _program: GPUProgram = null;\r\n private static _bindgroup: BindGroup = null;\r\n /**\r\n * Creates an instance of grayscale post effect\r\n */\r\n constructor() {\r\n super();\r\n this._layer = PostEffectLayer.transparent;\r\n }\r\n /** {@inheritDoc AbstractPostEffect.requireLinearDepthTexture} */\r\n requireLinearDepthTexture(): boolean {\r\n return false;\r\n }\r\n /** {@inheritDoc AbstractPostEffect.requireDepthAttachment} */\r\n requireDepthAttachment(): boolean {\r\n return false;\r\n }\r\n /** {@inheritDoc AbstractPostEffect.apply} */\r\n apply(ctx: DrawContext, inputColorTexture: Texture2D, sceneDepthTexture: Texture2D, srgbOutput: boolean) {\r\n const device = ctx.device;\r\n this._prepare(device);\r\n Grayscale._bindgroup.setTexture('srcTex', inputColorTexture, fetchSampler('clamp_nearest_nomip'));\r\n Grayscale._bindgroup.setValue('flip', this.needFlip(device) ? 1 : 0);\r\n Grayscale._bindgroup.setValue('srgbOut', srgbOutput ? 1 : 0);\r\n device.setProgram(Grayscale._program);\r\n device.setBindGroup(0, Grayscale._bindgroup);\r\n this.drawFullscreenQuad();\r\n }\r\n /** @internal */\r\n private _prepare(device: AbstractDevice) {\r\n if (!Grayscale._program) {\r\n Grayscale._program = device.buildRenderProgram({\r\n vertex(pb) {\r\n this.flip = pb.int().uniform(0);\r\n this.$inputs.pos = pb.vec2().attrib('position');\r\n this.$outputs.uv = pb.vec2();\r\n pb.main(function () {\r\n this.$builtins.position = pb.vec4(this.$inputs.pos, 0, 1);\r\n this.$outputs.uv = pb.add(pb.mul(this.$inputs.pos.xy, 0.5), pb.vec2(0.5));\r\n this.$if(pb.notEqual(this.flip, 0), function () {\r\n this.$builtins.position.y = pb.neg(this.$builtins.position.y);\r\n });\r\n });\r\n },\r\n fragment(pb) {\r\n this.srcTex = pb.tex2D().sampleType('unfilterable-float').uniform(0);\r\n this.srgbOut = pb.int().uniform(0);\r\n this.$outputs.outColor = pb.vec4();\r\n pb.main(function () {\r\n this.$l.color = pb.textureSample(this.srcTex, this.$inputs.uv);\r\n this.$l.grayscaleColor = pb.vec3(pb.dot(this.$l.color.rgb, pb.vec3(0.299, 0.587, 0.114)));\r\n this.$if(pb.equal(this.srgbOut, 0), function () {\r\n this.$outputs.outColor = pb.vec4(this.grayscaleColor, this.color.a);\r\n }).$else(function () {\r\n this.$outputs.outColor = pb.vec4(linearToGamma(this, this.grayscaleColor), this.color.a);\r\n });\r\n });\r\n }\r\n });\r\n Grayscale._program.name = '@Grayscale';\r\n Grayscale._bindgroup = device.createBindGroup(Grayscale._program.bindGroupLayouts[0]);\r\n }\r\n }\r\n}\r\n"],"names":["Grayscale","AbstractPostEffect","_program","_bindgroup","_layer","PostEffectLayer","transparent","requireLinearDepthTexture","requireDepthAttachment","apply","ctx","inputColorTexture","sceneDepthTexture","srgbOutput","device","_prepare","setTexture","fetchSampler","setValue","needFlip","setProgram","setBindGroup","drawFullscreenQuad","buildRenderProgram","vertex","pb","flip","int","uniform","$inputs","pos","vec2","attrib","$outputs","uv","main","$builtins","position","vec4","add","mul","xy","$if","notEqual","y","neg","fragment","srcTex","tex2D","sampleType","srgbOut","outColor","$l","color","textureSample","grayscaleColor","vec3","dot","rgb","equal","a","$else","linearToGamma","name","createBindGroup","bindGroupLayouts"],"mappings":";;;;AAMA;;;IAIO,MAAMA,SAAkBC,SAAAA,kBAAAA,CAAAA;AAC7B,IAAA,OAAeC,WAAuB,IAAK;AAC3C,IAAA,OAAeC,aAAwB,IAAK;AAC5C;;AAEC,MACD,WAAc,EAAA;QACZ,KAAK,EAAA;AACL,QAAA,IAAI,CAACC,MAAM,GAAGC,eAAAA,CAAgBC,WAAW;AAC3C;AACA,sEACAC,yBAAqC,GAAA;QACnC,OAAO,KAAA;AACT;AACA,mEACAC,sBAAkC,GAAA;QAChC,OAAO,KAAA;AACT;kDAEAC,MAAMC,GAAgB,EAAEC,iBAA4B,EAAEC,iBAA4B,EAAEC,UAAmB,EAAE;QACvG,MAAMC,MAAAA,GAASJ,IAAII,MAAM;QACzB,IAAI,CAACC,QAAQ,CAACD,MAAAA,CAAAA;AACdd,QAAAA,SAAAA,CAAUG,UAAU,CAACa,UAAU,CAAC,QAAA,EAAUL,mBAAmBM,YAAa,CAAA,qBAAA,CAAA,CAAA;QAC1EjB,SAAUG,CAAAA,UAAU,CAACe,QAAQ,CAAC,MAAA,EAAQ,IAAI,CAACC,QA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ACiB,cAAc,EAAE,IAAI,CAACF,KAAK,CAACO,CAAC,CAAA;AACpE,yBAAA,CAAA,CAAGC,KAAK,CAAC,WAAA;AACP,4BAAA,IAAI,CAAC5B,QAAQ,CAACkB,QAAQ,GAAG1B,EAAAA,CAAGa,IAAI,CAACwB,aAAAA,CAAc,IAAI,EAAE,IAAI,CAACP,cAAc,CAAA,EAAG,IAAI,CAACF,KAAK,CAACO,CAAC,CAAA;AACzF,yBAAA,CAAA;AACF,qBAAA,CAAA;AACF;AACF,aAAA,CAAA;YACA5D,SAAUE,CAAAA,QAAQ,CAAC6D,IAAI,GAAG,YAAA;YAC1B/D,SAAUG,CAAAA,UAAU,GAAGW,MAAAA,CAAOkD,eAAe,CAAChE,UAAUE,QAAQ,CAAC+D,gBAAgB,CAAC,CAAE,CAAA,CAAA;AACtF;AACF;AACF;;;;"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { AbstractPostEffect, PostEffectLayer } from './posteffect.js';
|
|
2
|
+
import { linearToGamma } from '../shaders/misc.js';
|
|
3
|
+
import { fetchSampler } from '../utility/misc.js';
|
|
4
|
+
import { Vector2 } from '@zephyr3d/base';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The motion blur post effect
|
|
8
|
+
* @public
|
|
9
|
+
*/ class MotionBlur extends AbstractPostEffect {
|
|
10
|
+
static _programMotionBlur = null;
|
|
11
|
+
static _bindgroupMotionBlur = null;
|
|
12
|
+
/** @internal */ _intensity;
|
|
13
|
+
/** @internal */ _aspect;
|
|
14
|
+
/**
|
|
15
|
+
* Creates an instance of tonemap post effect
|
|
16
|
+
*/ constructor(){
|
|
17
|
+
super();
|
|
18
|
+
this._intensity = 1;
|
|
19
|
+
this._aspect = new Vector2();
|
|
20
|
+
this._layer = PostEffectLayer.transparent;
|
|
21
|
+
}
|
|
22
|
+
/** Motion blur strength */ get strength() {
|
|
23
|
+
return this._intensity;
|
|
24
|
+
}
|
|
25
|
+
set strength(val) {
|
|
26
|
+
this._intensity = val;
|
|
27
|
+
}
|
|
28
|
+
/** {@inheritDoc AbstractPostEffect.requireLinearDepthTexture} */ requireLinearDepthTexture() {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
/** {@inheritDoc AbstractPostEffect.requireDepthAttachment} */ requireDepthAttachment() {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
/** {@inheritDoc AbstractPostEffect.apply} */ apply(ctx, inputColorTexture, sceneDepthTexture, srgbOutput) {
|
|
35
|
+
const device = ctx.device;
|
|
36
|
+
this._prepare(device);
|
|
37
|
+
this._aspect.setXY(inputColorTexture.width / inputColorTexture.height, 1);
|
|
38
|
+
MotionBlur._bindgroupMotionBlur.setTexture('inputTexture', inputColorTexture, fetchSampler('clamp_nearest_nomip'));
|
|
39
|
+
MotionBlur._bindgroupMotionBlur.setTexture('motionVectorTexture', ctx.motionVectorTexture, fetchSampler('clamp_nearest_nomip'));
|
|
40
|
+
MotionBlur._bindgroupMotionBlur.setValue('flip', this.needFlip(device) ? 1 : 0);
|
|
41
|
+
MotionBlur._bindgroupMotionBlur.setValue('srgbOut', srgbOutput ? 1 : 0);
|
|
42
|
+
MotionBlur._bindgroupMotionBlur.setValue('frameDeltaTime', device.frameInfo.elapsedFrame);
|
|
43
|
+
MotionBlur._bindgroupMotionBlur.setValue('intensity', this._intensity);
|
|
44
|
+
MotionBlur._bindgroupMotionBlur.setValue('aspect', this._aspect);
|
|
45
|
+
device.setProgram(MotionBlur._programMotionBlur);
|
|
46
|
+
device.setBindGroup(0, MotionBlur._bindgroupMotionBlur);
|
|
47
|
+
this.drawFullscreenQuad();
|
|
48
|
+
}
|
|
49
|
+
/** @internal */ _prepare(device) {
|
|
50
|
+
if (!MotionBlur._programMotionBlur) {
|
|
51
|
+
MotionBlur._programMotionBlur = device.buildRenderProgram({
|
|
52
|
+
vertex (pb) {
|
|
53
|
+
this.flip = pb.int().uniform(0);
|
|
54
|
+
this.$inputs.pos = pb.vec2().attrib('position');
|
|
55
|
+
this.$outputs.uv = pb.vec2();
|
|
56
|
+
pb.main(function() {
|
|
57
|
+
this.$builtins.position = pb.vec4(this.$inputs.pos, 0, 1);
|
|
58
|
+
this.$outputs.uv = pb.add(pb.mul(this.$inputs.pos.xy, 0.5), pb.vec2(0.5));
|
|
59
|
+
this.$if(pb.notEqual(this.flip, 0), function() {
|
|
60
|
+
this.$builtins.position.y = pb.neg(this.$builtins.position.y);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
fragment (pb) {
|
|
65
|
+
this.srgbOut = pb.int().uniform(0);
|
|
66
|
+
this.frameDeltaTime = pb.float().uniform(0);
|
|
67
|
+
this.inputTexture = pb.tex2D().uniform(0);
|
|
68
|
+
this.motionVectorTexture = pb.tex2D().uniform(0);
|
|
69
|
+
this.intensity = pb.float().uniform(0);
|
|
70
|
+
this.aspect = pb.vec2().uniform(0);
|
|
71
|
+
this.$outputs.outColor = pb.vec4();
|
|
72
|
+
pb.main(function() {
|
|
73
|
+
this.$l.color = pb.vec3();
|
|
74
|
+
this.$l.velocity = pb.textureSampleLevel(this.motionVectorTexture, this.$inputs.uv, 0).xy;
|
|
75
|
+
this.velocity = pb.div(pb.mul(this.velocity, 0.5), this.aspect);
|
|
76
|
+
this.$l.sourceSample = pb.textureSampleLevel(this.inputTexture, this.$inputs.uv, 0);
|
|
77
|
+
this.$l.color = this.sourceSample.rgb;
|
|
78
|
+
this.$if(pb.greaterThan(pb.dot(this.velocity, this.velocity), 1e-7), function() {
|
|
79
|
+
this.velocity = pb.mul(this.velocity, this.intensity, this.frameDeltaTime);
|
|
80
|
+
this.$l.uv0 = pb.clamp(pb.sub(this.$inputs.uv, this.velocity), pb.vec2(0), pb.vec2(1));
|
|
81
|
+
this.$l.uv1 = pb.clamp(pb.add(this.$inputs.uv, this.velocity), pb.vec2(0), pb.vec2(1));
|
|
82
|
+
const NUM_SAMPLES = 17;
|
|
83
|
+
this.$for(pb.float('i'), 0, NUM_SAMPLES, function() {
|
|
84
|
+
this.$l.t = pb.div(this.i, NUM_SAMPLES - 1);
|
|
85
|
+
this.color = pb.add(this.color, pb.textureSampleLevel(this.inputTexture, pb.mix(this.uv0, this.uv1, this.t), 0).rgb);
|
|
86
|
+
});
|
|
87
|
+
this.color = pb.mul(this.color, 1 / NUM_SAMPLES);
|
|
88
|
+
});
|
|
89
|
+
//this.color = pb.vec3(this.velocity, 0);
|
|
90
|
+
this.$if(pb.notEqual(this.srgbOut, 0), function() {
|
|
91
|
+
this.color = linearToGamma(this, this.color);
|
|
92
|
+
});
|
|
93
|
+
this.$outputs.outColor = pb.vec4(this.color, this.sourceSample.a);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
MotionBlur._programMotionBlur.name = '@MotionBlur';
|
|
98
|
+
MotionBlur._bindgroupMotionBlur = device.createBindGroup(MotionBlur._programMotionBlur.bindGroupLayouts[0]);
|
|
99
|
+
console.log(MotionBlur._programMotionBlur.getShaderSource('fragment'));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { MotionBlur };
|
|
105
|
+
//# sourceMappingURL=motionblur.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"motionblur.js","sources":["../../src/posteffect/motionblur.ts"],"sourcesContent":["import { AbstractPostEffect, PostEffectLayer } from './posteffect';\r\nimport { linearToGamma } from '../shaders/misc';\r\nimport type { AbstractDevice, BindGroup, GPUProgram, Texture2D } from '@zephyr3d/device';\r\nimport type { DrawContext } from '../render';\r\nimport { fetchSampler } from '../utility/misc';\r\nimport { Vector2 } from '@zephyr3d/base';\r\n\r\n/**\r\n * The motion blur post effect\r\n * @public\r\n */\r\nexport class MotionBlur extends AbstractPostEffect {\r\n private static _programMotionBlur: GPUProgram = null;\r\n private static _bindgroupMotionBlur: BindGroup = null;\r\n /** @internal */\r\n private _intensity: number;\r\n /** @internal */\r\n private _aspect: Vector2;\r\n /**\r\n * Creates an instance of tonemap post effect\r\n */\r\n constructor() {\r\n super();\r\n this._intensity = 1;\r\n this._aspect = new Vector2();\r\n this._layer = PostEffectLayer.transparent;\r\n }\r\n /** Motion blur strength */\r\n get strength() {\r\n return this._intensity;\r\n }\r\n set strength(val: number) {\r\n this._intensity = val;\r\n }\r\n /** {@inheritDoc AbstractPostEffect.requireLinearDepthTexture} */\r\n requireLinearDepthTexture(): boolean {\r\n return false;\r\n }\r\n /** {@inheritDoc AbstractPostEffect.requireDepthAttachment} */\r\n requireDepthAttachment(): boolean {\r\n return false;\r\n }\r\n /** {@inheritDoc AbstractPostEffect.apply} */\r\n apply(ctx: DrawContext, inputColorTexture: Texture2D, sceneDepthTexture: Texture2D, srgbOutput: boolean) {\r\n const device = ctx.device;\r\n this._prepare(device);\r\n this._aspect.setXY(inputColorTexture.width / inputColorTexture.height, 1);\r\n MotionBlur._bindgroupMotionBlur.setTexture(\r\n 'inputTexture',\r\n inputColorTexture,\r\n fetchSampler('clamp_nearest_nomip')\r\n );\r\n MotionBlur._bindgroupMotionBlur.setTexture(\r\n 'motionVectorTexture',\r\n ctx.motionVectorTexture,\r\n fetchSampler('clamp_nearest_nomip')\r\n );\r\n MotionBlur._bindgroupMotionBlur.setValue('flip', this.needFlip(device) ? 1 : 0);\r\n MotionBlur._bindgroupMotionBlur.setValue('srgbOut', srgbOutput ? 1 : 0);\r\n MotionBlur._bindgroupMotionBlur.setValue('frameDeltaTime', device.frameInfo.elapsedFrame);\r\n MotionBlur._bindgroupMotionBlur.setValue('intensity', this._intensity);\r\n MotionBlur._bindgroupMotionBlur.setValue('aspect', this._aspect);\r\n device.setProgram(MotionBlur._programMotionBlur);\r\n device.setBindGroup(0, MotionBlur._bindgroupMotionBlur);\r\n this.drawFullscreenQuad();\r\n }\r\n /** @internal */\r\n private _prepare(device: AbstractDevice) {\r\n if (!MotionBlur._programMotionBlur) {\r\n MotionBlur._programMotionBlur = device.buildRenderProgram({\r\n vertex(pb) {\r\n this.flip = pb.int().uniform(0);\r\n this.$inputs.pos = pb.vec2().attrib('position');\r\n this.$outputs.uv = pb.vec2();\r\n pb.main(function () {\r\n this.$builtins.position = pb.vec4(this.$inputs.pos, 0, 1);\r\n this.$outputs.uv = pb.add(pb.mul(this.$inputs.pos.xy, 0.5), pb.vec2(0.5));\r\n this.$if(pb.notEqual(this.flip, 0), function () {\r\n this.$builtins.position.y = pb.neg(this.$builtins.position.y);\r\n });\r\n });\r\n },\r\n fragment(pb) {\r\n this.srgbOut = pb.int().uniform(0);\r\n this.frameDeltaTime = pb.float().uniform(0);\r\n this.inputTexture = pb.tex2D().uniform(0);\r\n this.motionVectorTexture = pb.tex2D().uniform(0);\r\n this.intensity = pb.float().uniform(0);\r\n this.aspect = pb.vec2().uniform(0);\r\n this.$outputs.outColor = pb.vec4();\r\n pb.main(function () {\r\n this.$l.color = pb.vec3();\r\n this.$l.velocity = pb.textureSampleLevel(this.motionVectorTexture, this.$inputs.uv, 0).xy;\r\n this.velocity = pb.div(pb.mul(this.velocity, 0.5), this.aspect);\r\n this.$l.sourceSample = pb.textureSampleLevel(this.inputTexture, this.$inputs.uv, 0);\r\n this.$l.color = this.sourceSample.rgb;\r\n this.$if(pb.greaterThan(pb.dot(this.velocity, this.velocity), 1e-7), function () {\r\n this.velocity = pb.mul(this.velocity, this.intensity, this.frameDeltaTime);\r\n this.$l.uv0 = pb.clamp(pb.sub(this.$inputs.uv, this.velocity), pb.vec2(0), pb.vec2(1));\r\n this.$l.uv1 = pb.clamp(pb.add(this.$inputs.uv, this.velocity), pb.vec2(0), pb.vec2(1));\r\n const NUM_SAMPLES = 17;\r\n this.$for(pb.float('i'), 0, NUM_SAMPLES, function () {\r\n this.$l.t = pb.div(this.i, NUM_SAMPLES - 1);\r\n this.color = pb.add(\r\n this.color,\r\n pb.textureSampleLevel(this.inputTexture, pb.mix(this.uv0, this.uv1, this.t), 0).rgb\r\n );\r\n });\r\n this.color = pb.mul(this.color, 1 / NUM_SAMPLES);\r\n });\r\n //this.color = pb.vec3(this.velocity, 0);\r\n this.$if(pb.notEqual(this.srgbOut, 0), function () {\r\n this.color = linearToGamma(this, this.color);\r\n });\r\n this.$outputs.outColor = pb.vec4(this.color, this.sourceSample.a);\r\n });\r\n }\r\n });\r\n MotionBlur._programMotionBlur.name = '@MotionBlur';\r\n MotionBlur._bindgroupMotionBlur = device.createBindGroup(\r\n MotionBlur._programMotionBlur.bindGroupLayouts[0]\r\n );\r\n console.log(MotionBlur._programMotionBlur.getShaderSource('fragment'));\r\n }\r\n }\r\n}\r\n"],"names":["MotionBlur","AbstractPostEffect","_programMotionBlur","_bindgroupMotionBlur","_intensity","_aspect","Vector2","_layer","PostEffectLayer","transparent","strength","val","requireLinearDepthTexture","requireDepthAttachment","apply","ctx","inputColorTexture","sceneDepthTexture","srgbOutput","device","_prepare","setXY","width","height","setTexture","fetchSampler","motionVectorTexture","setValue","needFlip","frameInfo","elapsedFrame","setProgram","setBindGroup","drawFullscreenQuad","buildRenderProgram","vertex","pb","flip","int","uniform","$inputs","pos","vec2","attrib","$outputs","uv","main","$builtins","position","vec4","add","mul","xy","$if","notEqual","y","neg","fragment","srgbOut","frameDeltaTime","float","inputTexture","tex2D","intensity","aspect","outColor","$l","color","vec3","velocity","textureSampleLevel","div","sourceSample","rgb","greaterThan","dot","uv0","clamp","sub","uv1","NUM_SAMPLES","$for","t","i","mix","linearToGamma","a","name","createBindGroup","bindGroupLayouts","console","log","getShaderSource"],"mappings":";;;;;AAOA;;;IAIO,MAAMA,UAAmBC,SAAAA,kBAAAA,CAAAA;AAC9B,IAAA,OAAeC,qBAAiC,IAAK;AACrD,IAAA,OAAeC,uBAAkC,IAAK;qBAEtD,UAA2B;qBAE3B,OAAyB;AACzB;;AAEC,MACD,WAAc,EAAA;QACZ,KAAK,EAAA;QACL,IAAI,CAACC,UAAU,GAAG,CAAA;QAClB,IAAI,CAACC,OAAO,GAAG,IAAIC,OAAAA,EAAAA;AACnB,QAAA,IAAI,CAACC,MAAM,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YAAAA,OAAAA,CAAQC,GAAG,CAAC3F,UAAAA,CAAWE,kBAAkB,CAAC0F,eAAe,CAAC,UAAA,CAAA,CAAA;AAC5D;AACF;AACF;;;;"}
|
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import { drawFullscreenQuad } from '../render/fullscreenquad.js';
|
|
2
|
+
import { copyTexture, fetchSampler } from '../utility/misc.js';
|
|
3
|
+
import { Disposable } from '@zephyr3d/base';
|
|
2
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Rendering layer of post processing effects
|
|
7
|
+
* @public
|
|
8
|
+
*
|
|
9
|
+
*/ var PostEffectLayer = /*#__PURE__*/ function(PostEffectLayer) {
|
|
10
|
+
PostEffectLayer[PostEffectLayer["opaque"] = 0] = "opaque";
|
|
11
|
+
PostEffectLayer[PostEffectLayer["transparent"] = 1] = "transparent";
|
|
12
|
+
PostEffectLayer[PostEffectLayer["end"] = 2] = "end";
|
|
13
|
+
return PostEffectLayer;
|
|
14
|
+
}({});
|
|
3
15
|
/**
|
|
4
16
|
* Base class for any type of post effect
|
|
5
17
|
* @public
|
|
6
|
-
*/ class AbstractPostEffect {
|
|
7
|
-
static
|
|
8
|
-
_outputTexture;
|
|
9
|
-
_quadVertexLayout;
|
|
10
|
-
_quadRenderStateSet;
|
|
18
|
+
*/ class AbstractPostEffect extends Disposable {
|
|
19
|
+
static _defaultRenderStates = {};
|
|
11
20
|
_enabled;
|
|
12
|
-
|
|
21
|
+
_layer;
|
|
13
22
|
/**
|
|
14
23
|
* Creates an instance of a post effect
|
|
15
24
|
* @param name - Name of the post effect
|
|
16
25
|
*/ constructor(){
|
|
17
|
-
|
|
18
|
-
this._quadVertexLayout = null;
|
|
19
|
-
this._quadRenderStateSet = null;
|
|
26
|
+
super();
|
|
20
27
|
this._enabled = true;
|
|
21
|
-
this.
|
|
22
|
-
}
|
|
23
|
-
/** Gets class name of this instance */ getClassName() {
|
|
24
|
-
return this.constructor.className;
|
|
28
|
+
this._layer = 2;
|
|
25
29
|
}
|
|
26
30
|
/** Whether this post effect is enabled */ get enabled() {
|
|
27
31
|
return this._enabled;
|
|
@@ -29,8 +33,8 @@ import { drawFullscreenQuad } from '../render/fullscreenquad.js';
|
|
|
29
33
|
set enabled(val) {
|
|
30
34
|
this._enabled = !!val;
|
|
31
35
|
}
|
|
32
|
-
/** Whether this post effect will be rendered at opaque phase */ get
|
|
33
|
-
return this.
|
|
36
|
+
/** Whether this post effect will be rendered at opaque phase */ get layer() {
|
|
37
|
+
return this._layer;
|
|
34
38
|
}
|
|
35
39
|
/**
|
|
36
40
|
* Check if the post effect should be rendered upside down.
|
|
@@ -40,31 +44,43 @@ import { drawFullscreenQuad } from '../render/fullscreenquad.js';
|
|
|
40
44
|
return device.type === 'webgpu' && !!device.getFramebuffer();
|
|
41
45
|
}
|
|
42
46
|
/**
|
|
43
|
-
*
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
* Checks whether this post effect requires the linear depth texture
|
|
48
|
+
* @returns true if the linear depth texture is required.
|
|
49
|
+
*/ requireLinearDepthTexture(_ctx) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Checks whether this post effect requires the scene depth buffer
|
|
54
|
+
* @returns true if the scene depth buffer is required.
|
|
55
|
+
*/ requireDepthAttachment(_ctx) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Apply the post effect
|
|
60
|
+
* @param camera - Camera used the render the scene
|
|
61
|
+
* @param inputColorTexture - The previous scene color texture
|
|
62
|
+
* @param sceneDepthTexture - The linear scene depth texture
|
|
63
|
+
* @param srgbOutput - Whether the result should be gamma corrected
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* The frame buffer of the post effect is already set when apply() is called.
|
|
67
|
+
*/ apply(ctx, inputColorTexture, sceneDepthTexture, srgbOutput) {
|
|
68
|
+
this.passThrough(ctx, inputColorTexture, srgbOutput);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @param ctx - Draw context
|
|
73
|
+
* @param inputColorTexture - Input color texture
|
|
74
|
+
* @param srgbOutput - Whether the result should be gamma corrected
|
|
75
|
+
*/ passThrough(ctx, inputColorTexture, srgbOutput, renderStates) {
|
|
76
|
+
copyTexture(inputColorTexture, ctx.device.getFramebuffer(), fetchSampler('clamp_nearest_nomip'), renderStates, 0, srgbOutput);
|
|
48
77
|
}
|
|
49
78
|
/**
|
|
50
79
|
* Draws a fullscreen quad
|
|
51
80
|
* @param renderStateSet - Render states that will be used when drawing the fullscreen quad.
|
|
52
81
|
*/ drawFullscreenQuad(renderStateSet) {
|
|
53
82
|
drawFullscreenQuad(renderStateSet);
|
|
54
|
-
|
|
55
|
-
const device = Application.instance.device;
|
|
56
|
-
if (!this._quadVertexLayout) {
|
|
57
|
-
this._quadVertexLayout = this.createVertexLayout(device);
|
|
58
|
-
}
|
|
59
|
-
if (!this._quadRenderStateSet) {
|
|
60
|
-
this._quadRenderStateSet = this.createRenderStates(device);
|
|
61
|
-
}
|
|
62
|
-
const lastRenderState = device.getRenderStates();
|
|
63
|
-
device.setVertexLayout(this._quadVertexLayout);
|
|
64
|
-
device.setRenderStates(renderStateSet ?? this._quadRenderStateSet);
|
|
65
|
-
device.draw('triangle-strip', 0, 4);
|
|
66
|
-
device.setRenderStates(lastRenderState);
|
|
67
|
-
*/ }
|
|
83
|
+
}
|
|
68
84
|
/** @internal */ createVertexLayout(device) {
|
|
69
85
|
return device.createVertexLayout({
|
|
70
86
|
vertexBuffers: [
|
|
@@ -83,13 +99,28 @@ import { drawFullscreenQuad } from '../render/fullscreenquad.js';
|
|
|
83
99
|
]
|
|
84
100
|
});
|
|
85
101
|
}
|
|
102
|
+
onDispose() {
|
|
103
|
+
super.onDispose();
|
|
104
|
+
this.destroy();
|
|
105
|
+
}
|
|
86
106
|
/** @internal */ createRenderStates(device) {
|
|
87
107
|
const renderStates = device.createRenderStateSet();
|
|
88
108
|
renderStates.useRasterizerState().setCullMode('none');
|
|
89
109
|
renderStates.useDepthState().enableTest(false).enableWrite(false);
|
|
90
110
|
return renderStates;
|
|
91
111
|
}
|
|
112
|
+
/** @internal */ destroy() {}
|
|
113
|
+
/** @internal */ static getDefaultRenderState(ctx, compareFunc) {
|
|
114
|
+
let renderState = this._defaultRenderStates[compareFunc];
|
|
115
|
+
if (!renderState) {
|
|
116
|
+
renderState = ctx.device.createRenderStateSet();
|
|
117
|
+
renderState.useRasterizerState().setCullMode('none');
|
|
118
|
+
renderState.useDepthState().enableTest(compareFunc !== 'always').enableWrite(false).setCompareFunc(compareFunc);
|
|
119
|
+
this._defaultRenderStates[compareFunc] = renderState;
|
|
120
|
+
}
|
|
121
|
+
return renderState;
|
|
122
|
+
}
|
|
92
123
|
}
|
|
93
124
|
|
|
94
|
-
export { AbstractPostEffect };
|
|
125
|
+
export { AbstractPostEffect, PostEffectLayer };
|
|
95
126
|
//# sourceMappingURL=posteffect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posteffect.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"posteffect.js","sources":["../../src/posteffect/posteffect.ts"],"sourcesContent":["import type { AbstractDevice, CompareFunc, RenderStateSet, Texture2D, VertexLayout } from '@zephyr3d/device';\r\nimport type { DrawContext } from '../render';\r\nimport { drawFullscreenQuad } from '../render/fullscreenquad';\r\nimport { copyTexture, fetchSampler } from '../utility/misc';\r\nimport { Disposable } from '@zephyr3d/base';\r\n\r\n/**\r\n * Rendering layer of post processing effects\r\n * @public\r\n *\r\n */\r\nexport enum PostEffectLayer {\r\n opaque = 0,\r\n transparent = 1,\r\n end = 2\r\n}\r\n\r\n/**\r\n * Base class for any type of post effect\r\n * @public\r\n */\r\nexport class AbstractPostEffect extends Disposable {\r\n private static _defaultRenderStates: { CompareFunc?: RenderStateSet } = {};\r\n protected _enabled: boolean;\r\n protected _layer: PostEffectLayer;\r\n /**\r\n * Creates an instance of a post effect\r\n * @param name - Name of the post effect\r\n */\r\n constructor() {\r\n super();\r\n this._enabled = true;\r\n this._layer = PostEffectLayer.end;\r\n }\r\n /** Whether this post effect is enabled */\r\n get enabled(): boolean {\r\n return this._enabled;\r\n }\r\n set enabled(val: boolean) {\r\n this._enabled = !!val;\r\n }\r\n /** Whether this post effect will be rendered at opaque phase */\r\n get layer(): PostEffectLayer {\r\n return this._layer;\r\n }\r\n /**\r\n * Check if the post effect should be rendered upside down.\r\n * @param device - The device object\r\n * @returns true if the post effect should be rendered upside down\r\n */\r\n needFlip(device: AbstractDevice): boolean {\r\n return device.type === 'webgpu' && !!device.getFramebuffer();\r\n }\r\n /**\r\n * Checks whether this post effect requires the linear depth texture\r\n * @returns true if the linear depth texture is required.\r\n */\r\n requireLinearDepthTexture(_ctx: DrawContext): boolean {\r\n return false;\r\n }\r\n /**\r\n * Checks whether this post effect requires the scene depth buffer\r\n * @returns true if the scene depth buffer is required.\r\n */\r\n requireDepthAttachment(_ctx: DrawContext): boolean {\r\n return false;\r\n }\r\n /**\r\n * Apply the post effect\r\n * @param camera - Camera used the render the scene\r\n * @param inputColorTexture - The previous scene color texture\r\n * @param sceneDepthTexture - The linear scene depth texture\r\n * @param srgbOutput - Whether the result should be gamma corrected\r\n *\r\n * @remarks\r\n * The frame buffer of the post effect is already set when apply() is called.\r\n */\r\n apply(\r\n ctx: DrawContext,\r\n inputColorTexture: Texture2D,\r\n sceneDepthTexture: Texture2D,\r\n srgbOutput: boolean\r\n ): void {\r\n this.passThrough(ctx, inputColorTexture, srgbOutput);\r\n }\r\n /**\r\n *\r\n * @param ctx - Draw context\r\n * @param inputColorTexture - Input color texture\r\n * @param srgbOutput - Whether the result should be gamma corrected\r\n */\r\n protected passThrough(\r\n ctx: DrawContext,\r\n inputColorTexture: Texture2D,\r\n srgbOutput: boolean,\r\n renderStates?: RenderStateSet\r\n ) {\r\n copyTexture(\r\n inputColorTexture,\r\n ctx.device.getFramebuffer(),\r\n fetchSampler('clamp_nearest_nomip'),\r\n renderStates,\r\n 0,\r\n srgbOutput\r\n );\r\n }\r\n /**\r\n * Draws a fullscreen quad\r\n * @param renderStateSet - Render states that will be used when drawing the fullscreen quad.\r\n */\r\n protected drawFullscreenQuad(renderStateSet?: RenderStateSet) {\r\n drawFullscreenQuad(renderStateSet);\r\n }\r\n /** @internal */\r\n protected createVertexLayout(device: AbstractDevice): VertexLayout {\r\n return device.createVertexLayout({\r\n vertexBuffers: [\r\n {\r\n buffer: device.createVertexBuffer('position_f32x2', new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]))\r\n }\r\n ]\r\n });\r\n }\r\n protected onDispose() {\r\n super.onDispose();\r\n this.destroy();\r\n }\r\n /** @internal */\r\n protected createRenderStates(device: AbstractDevice): RenderStateSet {\r\n const renderStates = device.createRenderStateSet();\r\n renderStates.useRasterizerState().setCullMode('none');\r\n renderStates.useDepthState().enableTest(false).enableWrite(false);\r\n return renderStates;\r\n }\r\n /** @internal */\r\n protected destroy() {}\r\n /** @internal */\r\n static getDefaultRenderState(ctx: DrawContext, compareFunc: CompareFunc) {\r\n let renderState = this._defaultRenderStates[compareFunc];\r\n if (!renderState) {\r\n renderState = ctx.device.createRenderStateSet();\r\n renderState.useRasterizerState().setCullMode('none');\r\n renderState\r\n .useDepthState()\r\n .enableTest(compareFunc !== 'always')\r\n .enableWrite(false)\r\n .setCompareFunc(compareFunc);\r\n this._defaultRenderStates[compareFunc] = renderState;\r\n }\r\n return renderState;\r\n }\r\n}\r\n"],"names":["PostEffectLayer","AbstractPostEffect","Disposable","_defaultRenderStates","_enabled","_layer","enabled","val","layer","needFlip","device","type","getFramebuffer","requireLinearDepthTexture","_ctx","requireDepthAttachment","apply","ctx","inputColorTexture","sceneDepthTexture","srgbOutput","passThrough","renderStates","copyTexture","fetchSampler","drawFullscreenQuad","renderStateSet","createVertexLayout","vertexBuffers","buffer","createVertexBuffer","Float32Array","onDispose","destroy","createRenderStates","createRenderStateSet","useRasterizerState","setCullMode","useDepthState","enableTest","enableWrite","getDefaultRenderState","compareFunc","renderState","setCompareFunc"],"mappings":";;;;AAMA;;;;IAKO,IAAKA,eAAAA,iBAAAA,SAAAA,eAAAA,EAAAA;;;;AAAAA,IAAAA,OAAAA,eAAAA;AAIX,CAAA,CAAA,EAAA;AAED;;;IAIO,MAAMC,kBAA2BC,SAAAA,UAAAA,CAAAA;IACtC,OAAeC,oBAAAA,GAAyD,EAAG;IACjEC,QAAkB;IAClBC,MAAwB;AAClC;;;AAGC,MACD,WAAc,EAAA;QACZ,KAAK,EAAA;QACL,IAAI,CAACD,QAAQ,GAAG,IAAA;AAChB,QAAA,IAAI,CAACC,MAAM,GAAA,CAAA;AACb;+CAEA,IAAIC,OAAmB,GAAA;QACrB,OAAO,IAAI,CAACF,QAAQ;AACtB;IACA,IAAIE,OAAAA,CAAQC,GAAY,EAAE;AACxB,QAAA,IAAI,CAACH,QAAQ,GAAG,CAAC,CAACG,GAAAA;AACpB;qEAEA,IAAIC,KAAyB,GAAA;QAC3B,OAAO,IAAI,CAACH,MAAM;AACpB;AACA;;;;MAKAI,QAAAA,CAASC,MAAsB,EAAW;AACxC,QAAA,OAAOA,OAAOC,IAAI,KAAK,YAAY,CAAC,CAACD,OAAOE,cAAc,EAAA;AAC5D;AACA;;;MAIAC,yBAAAA,CAA0BC,IAAiB,EAAW;QACpD,OAAO,KAAA;AACT;AACA;;;MAIAC,sBAAAA,CAAuBD,IAAiB,EAAW;QACjD,OAAO,KAAA;AACT;AACA;;;;;;;;;MAUAE,KAAAA,CACEC,GAAgB,EAChBC,iBAA4B,EAC5BC,iBAA4B,EAC5BC,UAAmB,EACb;AACN,QAAA,IAAI,CAACC,WAAW,CAACJ,GAAAA,EAAKC,iBAAmBE,EAAAA,UAAAA,CAAAA;AAC3C;AACA;;;;;MAMUC,YACRJ,GAAgB,EAChBC,iBAA4B,EAC5BE,UAAmB,EACnBE,YAA6B,EAC7B;QACAC,WACEL,CAAAA,i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