@zephyr3d/scene 0.6.1 → 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/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
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
import { RENDER_PASS_TYPE_LIGHT, LIGHT_TYPE_DIRECTIONAL, LIGHT_TYPE_POINT, LIGHT_TYPE_SPOT } from '../../values.js';
|
|
2
|
+
import { applyMaterialMixins } from '../meshmaterial.js';
|
|
3
|
+
import { mixinTextureProps } from './texture.js';
|
|
4
|
+
import { mixinAlbedoColor } from './albedocolor.js';
|
|
5
|
+
import { ShaderHelper } from '../shader/helper.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Light mixin
|
|
9
|
+
* @param BaseCls - class to mix in
|
|
10
|
+
* @returns Mixed class
|
|
11
|
+
* @public
|
|
12
|
+
*/ function mixinLight(BaseCls) {
|
|
13
|
+
if (BaseCls.lightMixed) {
|
|
14
|
+
return BaseCls;
|
|
15
|
+
}
|
|
16
|
+
const S = applyMaterialMixins(BaseCls, mixinAlbedoColor, mixinTextureProps('normal'));
|
|
17
|
+
let FEATURE_DOUBLE_SIDED_LIGHTING = 0;
|
|
18
|
+
let FEATURE_OBJECT_SPACE_NORMALMAP = 0;
|
|
19
|
+
const cls = class extends S {
|
|
20
|
+
static lightMixed = true;
|
|
21
|
+
_normalScale;
|
|
22
|
+
constructor(){
|
|
23
|
+
super();
|
|
24
|
+
this._normalScale = 1;
|
|
25
|
+
this.useFeature(FEATURE_DOUBLE_SIDED_LIGHTING, true);
|
|
26
|
+
}
|
|
27
|
+
copyFrom(other) {
|
|
28
|
+
super.copyFrom(other);
|
|
29
|
+
this.normalScale = other.normalScale;
|
|
30
|
+
this.normalMapMode = other.normalMapMode;
|
|
31
|
+
this.doubleSidedLighting = other.doubleSidedLighting;
|
|
32
|
+
}
|
|
33
|
+
get normalScale() {
|
|
34
|
+
return this._normalScale;
|
|
35
|
+
}
|
|
36
|
+
set normalScale(val) {
|
|
37
|
+
if (val !== this._normalScale) {
|
|
38
|
+
this._normalScale = val;
|
|
39
|
+
this.uniformChanged();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
get normalMapMode() {
|
|
43
|
+
return this.featureUsed(FEATURE_OBJECT_SPACE_NORMALMAP);
|
|
44
|
+
}
|
|
45
|
+
set normalMapMode(val) {
|
|
46
|
+
this.useFeature(FEATURE_OBJECT_SPACE_NORMALMAP, val);
|
|
47
|
+
}
|
|
48
|
+
/** true if double sided lighting is used */ get doubleSidedLighting() {
|
|
49
|
+
return this.featureUsed(FEATURE_DOUBLE_SIDED_LIGHTING);
|
|
50
|
+
}
|
|
51
|
+
set doubleSidedLighting(val) {
|
|
52
|
+
this.useFeature(FEATURE_DOUBLE_SIDED_LIGHTING, !!val);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Calculates the normalized vector from world coordinates to the viewpoint.
|
|
56
|
+
*
|
|
57
|
+
* @param scope - Shader scope
|
|
58
|
+
*
|
|
59
|
+
* @returns The view vector
|
|
60
|
+
*/ calculateViewVector(scope, worldPos) {
|
|
61
|
+
const pb = scope.$builder;
|
|
62
|
+
return pb.normalize(pb.sub(ShaderHelper.getCameraPosition(scope), worldPos.xyz));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Calculate the reflection vector of the view vector with respect to the normal.
|
|
66
|
+
*
|
|
67
|
+
* @param scope - Shader scope
|
|
68
|
+
* @param normal - Surface normal
|
|
69
|
+
* @param viewVec - The view vector
|
|
70
|
+
* @returns The reflection vector
|
|
71
|
+
*/ calculateReflectionVector(scope, normal, viewVec) {
|
|
72
|
+
const pb = scope.$builder;
|
|
73
|
+
return pb.reflect(pb.neg(viewVec), normal);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Calculate the normal vector for current fragment
|
|
77
|
+
* @param scope - The shader scope
|
|
78
|
+
* @returns Normal vector for current fragment
|
|
79
|
+
*/ calculateNormal(scope, worldPos, worldNormal, worldTangent, worldBinormal) {
|
|
80
|
+
const pb = scope.$builder;
|
|
81
|
+
const that = this;
|
|
82
|
+
const args = [
|
|
83
|
+
worldPos
|
|
84
|
+
];
|
|
85
|
+
const params = [
|
|
86
|
+
pb.vec3('worldPos')
|
|
87
|
+
];
|
|
88
|
+
let funcName = 'Z_calculateNormal';
|
|
89
|
+
if (worldNormal) {
|
|
90
|
+
params.push(pb.vec3('worldNormal'));
|
|
91
|
+
args.push(worldNormal);
|
|
92
|
+
funcName += '_N';
|
|
93
|
+
if (worldTangent && worldBinormal) {
|
|
94
|
+
params.push(pb.vec3('worldTangent'), pb.vec3('worldBinormal'));
|
|
95
|
+
args.push(worldTangent, worldBinormal);
|
|
96
|
+
funcName += '_T';
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
pb.func(funcName, params, function() {
|
|
100
|
+
this.$l.uv = that.normalTexture ? that.getNormalTexCoord(this) ?? pb.vec2(0) : that.albedoTexture ? that.getAlbedoTexCoord(this) ?? pb.vec2(0) : pb.vec2(0);
|
|
101
|
+
this.$l.TBN = that.calculateTBN(this, this.worldPos, this.worldNormal, this.worldTangent, this.worldBinormal);
|
|
102
|
+
if (that.drawContext.renderPass.type === RENDER_PASS_TYPE_LIGHT && that.normalTexture) {
|
|
103
|
+
if (that.normalMapMode === 'object-space') {
|
|
104
|
+
const pixel = pb.sub(pb.mul(pb.textureSample(that.getNormalTextureUniform(this), this.uv).rgb, 2), pb.vec3(1));
|
|
105
|
+
const normalTex = pb.mul(pixel, pb.vec3(pb.vec3(this.zNormalScale).xx, 1));
|
|
106
|
+
this.$return(pb.normalize(normalTex));
|
|
107
|
+
} else {
|
|
108
|
+
const pixel = pb.sub(pb.mul(pb.textureSample(that.getNormalTextureUniform(this), this.uv).rgb, 2), pb.vec3(1));
|
|
109
|
+
const normalTex = pb.mul(pixel, pb.vec3(pb.vec3(this.zNormalScale).xx, 1));
|
|
110
|
+
this.$return(pb.normalize(pb.mul(this.TBN, normalTex)));
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
this.$return(this.TBN[2]);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return pb.getGlobalScope()[funcName](...args);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Normal scale uniform
|
|
120
|
+
* @return Normal scale uniform
|
|
121
|
+
*/ getUniformNormalScale(scope) {
|
|
122
|
+
return scope.zNormalScale;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Calculate the normal vector for current fragment
|
|
126
|
+
*
|
|
127
|
+
* @param scope - The shader scope
|
|
128
|
+
* @returns Structure that contains normal vector and TBN matrix
|
|
129
|
+
*/ calculateNormalAndTBN(scope, worldPos, worldNormal, worldTangent, worldBinormal) {
|
|
130
|
+
const pb = scope.$builder;
|
|
131
|
+
const NormalStruct = pb.defineStruct([
|
|
132
|
+
pb.mat3('TBN'),
|
|
133
|
+
pb.vec3('normal')
|
|
134
|
+
]);
|
|
135
|
+
const that = this;
|
|
136
|
+
const args = [
|
|
137
|
+
worldPos.xyz
|
|
138
|
+
];
|
|
139
|
+
const params = [
|
|
140
|
+
pb.vec3('worldPos')
|
|
141
|
+
];
|
|
142
|
+
let funcName = 'Z_calculateNormalAndTBN';
|
|
143
|
+
if (worldNormal) {
|
|
144
|
+
params.push(pb.vec3('worldNormal'));
|
|
145
|
+
args.push(worldNormal);
|
|
146
|
+
funcName += '_N';
|
|
147
|
+
if (worldTangent && worldBinormal) {
|
|
148
|
+
params.push(pb.vec3('worldTangent'), pb.vec3('worldBinormal'));
|
|
149
|
+
args.push(worldTangent, worldBinormal);
|
|
150
|
+
funcName += '_T';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
pb.func(funcName, params, function() {
|
|
154
|
+
this.$l.uv = that.normalTexture ? that.getNormalTexCoord(this) ?? pb.vec2(0) : that.albedoTexture ? that.getAlbedoTexCoord(this) ?? pb.vec2(0) : pb.vec2(0);
|
|
155
|
+
this.$l.TBN = that.calculateTBN(this, this.worldPos, this.worldNormal, this.worldTangent, this.worldBinormal);
|
|
156
|
+
if (that.drawContext.renderPass.type === RENDER_PASS_TYPE_LIGHT && that.normalTexture) {
|
|
157
|
+
if (that.normalMapMode === 'object-space') {
|
|
158
|
+
const pixel = pb.sub(pb.mul(pb.textureSample(that.getNormalTextureUniform(this), this.uv).rgb, 2), pb.vec3(1));
|
|
159
|
+
const normalTex = pb.mul(pixel, pb.vec3(pb.vec3(this.zNormalScale).xx, 1));
|
|
160
|
+
this.$return(NormalStruct(this.TBN, pb.normalize(normalTex)));
|
|
161
|
+
} else {
|
|
162
|
+
const pixel = pb.sub(pb.mul(pb.textureSample(that.getNormalTextureUniform(this), this.uv).rgb, 2), pb.vec3(1));
|
|
163
|
+
const normalTex = pb.mul(pixel, pb.vec3(pb.vec3(this.zNormalScale).xx, 1));
|
|
164
|
+
this.$return(NormalStruct(this.TBN, pb.normalize(pb.mul(this.TBN, normalTex))));
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
this.$return(NormalStruct(this.TBN, this.TBN[2]));
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
return pb.getGlobalScope()[funcName](...args);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Calculate the TBN matrix
|
|
174
|
+
*
|
|
175
|
+
* @param scope - The shader scope
|
|
176
|
+
* @returns TBN matrix
|
|
177
|
+
*/ calculateTBN(scope, worldPos, worldNormal, worldTangent, worldBinormal) {
|
|
178
|
+
const pb = scope.$builder;
|
|
179
|
+
const that = this;
|
|
180
|
+
const args = [
|
|
181
|
+
worldPos.xyz
|
|
182
|
+
];
|
|
183
|
+
const params = [
|
|
184
|
+
pb.vec3('worldPos')
|
|
185
|
+
];
|
|
186
|
+
let funcName = 'Z_calculateTBN';
|
|
187
|
+
if (worldNormal) {
|
|
188
|
+
params.push(pb.vec3('worldNormal'));
|
|
189
|
+
args.push(worldNormal);
|
|
190
|
+
funcName += '_N';
|
|
191
|
+
if (worldTangent && worldBinormal) {
|
|
192
|
+
params.push(pb.vec3('worldTangent'), pb.vec3('worldBinormal'));
|
|
193
|
+
args.push(worldTangent, worldBinormal);
|
|
194
|
+
funcName += '_T';
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
pb.func(funcName, params, function() {
|
|
198
|
+
const posW = this.worldPos;
|
|
199
|
+
this.$l.uv = that.normalTexture ? that.getNormalTexCoord(this) ?? pb.vec2(0) : that.albedoTexture ? that.getAlbedoTexCoord(this) ?? pb.vec2(0) : pb.vec2(0);
|
|
200
|
+
this.$l.TBN = pb.mat3();
|
|
201
|
+
if (!worldNormal) {
|
|
202
|
+
this.$l.uv_dx = pb.dpdx(pb.vec3(this.uv, 0));
|
|
203
|
+
this.$l.uv_dy = pb.dpdy(pb.vec3(this.uv, 0));
|
|
204
|
+
this.$if(pb.lessThanEqual(pb.add(pb.length(this.uv_dx), pb.length(this.uv_dy)), 0.000001), function() {
|
|
205
|
+
this.uv_dx = pb.vec3(1, 0, 0);
|
|
206
|
+
this.uv_dy = pb.vec3(0, 1, 0);
|
|
207
|
+
});
|
|
208
|
+
this.$l.t_ = pb.div(pb.sub(pb.mul(pb.dpdx(posW), this.uv_dy.y), pb.mul(pb.dpdy(posW), this.uv_dx.y)), pb.sub(pb.mul(this.uv_dx.x, this.uv_dy.y), pb.mul(this.uv_dx.y, this.uv_dy.x)));
|
|
209
|
+
this.$l.ng = pb.normalize(pb.cross(pb.dpdx(posW), pb.dpdy(posW)));
|
|
210
|
+
this.$l.t = pb.normalize(pb.sub(this.t_, pb.mul(this.ng, pb.dot(this.ng, this.t_))));
|
|
211
|
+
this.$l.b = pb.cross(this.ng, this.t);
|
|
212
|
+
if (that.doubleSidedLighting) {
|
|
213
|
+
this.$if(pb.not(this.$builtins.frontFacing), function() {
|
|
214
|
+
this.t = pb.mul(this.t, -1);
|
|
215
|
+
this.b = pb.mul(this.b, -1);
|
|
216
|
+
this.ng = pb.mul(this.ng, -1);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
this.TBN = pb.mat3(this.t, this.b, this.ng);
|
|
220
|
+
} else if (!worldTangent) {
|
|
221
|
+
this.$l.uv_dx = pb.dpdx(pb.vec3(this.uv, 0));
|
|
222
|
+
this.$l.uv_dy = pb.dpdy(pb.vec3(this.uv, 0));
|
|
223
|
+
this.$if(pb.lessThanEqual(pb.add(pb.length(this.uv_dx), pb.length(this.uv_dy)), 0.000001), function() {
|
|
224
|
+
this.uv_dx = pb.vec3(1, 0, 0);
|
|
225
|
+
this.uv_dy = pb.vec3(0, 1, 0);
|
|
226
|
+
});
|
|
227
|
+
this.$l.t_ = pb.div(pb.sub(pb.mul(pb.dpdx(posW), this.uv_dy.y), pb.mul(pb.dpdy(posW), this.uv_dx.y)), pb.sub(pb.mul(this.uv_dx.x, this.uv_dy.y), pb.mul(this.uv_dx.y, this.uv_dy.x)));
|
|
228
|
+
this.$l.ng = pb.normalize(this.worldNormal);
|
|
229
|
+
this.$l.t = pb.normalize(pb.sub(this.t_, pb.mul(this.ng, pb.dot(this.ng, this.t_))));
|
|
230
|
+
this.$l.b = pb.cross(this.ng, this.t);
|
|
231
|
+
if (that.doubleSidedLighting) {
|
|
232
|
+
this.$if(pb.not(this.$builtins.frontFacing), function() {
|
|
233
|
+
this.t = pb.mul(this.t, -1);
|
|
234
|
+
this.b = pb.mul(this.b, -1);
|
|
235
|
+
this.ng = pb.mul(this.ng, -1);
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
this.TBN = pb.mat3(this.t, this.b, this.ng);
|
|
239
|
+
} else {
|
|
240
|
+
this.$l.ng = pb.normalize(this.worldNormal);
|
|
241
|
+
this.$l.t = pb.normalize(this.worldTangent);
|
|
242
|
+
this.$l.b = pb.normalize(this.worldBinormal);
|
|
243
|
+
if (that.doubleSidedLighting) {
|
|
244
|
+
this.$if(pb.not(this.$builtins.frontFacing), function() {
|
|
245
|
+
this.t = pb.mul(this.t, -1);
|
|
246
|
+
this.b = pb.mul(this.b, -1);
|
|
247
|
+
this.ng = pb.mul(this.ng, -1);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
this.TBN = pb.mat3(this.t, this.b, this.ng);
|
|
251
|
+
}
|
|
252
|
+
this.$return(this.TBN);
|
|
253
|
+
});
|
|
254
|
+
return pb.getGlobalScope()[funcName](...args);
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* {@inheritDoc MeshMaterial.applyUniformsValues}
|
|
258
|
+
* @override
|
|
259
|
+
*/ applyUniformValues(bindGroup, ctx, pass) {
|
|
260
|
+
super.applyUniformValues(bindGroup, ctx, pass);
|
|
261
|
+
if (ctx.renderPass.type === RENDER_PASS_TYPE_LIGHT) {
|
|
262
|
+
if (this.normalTexture) {
|
|
263
|
+
bindGroup.setValue('zNormalScale', this._normalScale);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Check if the environment lighting should be calculated.
|
|
269
|
+
*
|
|
270
|
+
* @returns true Environment lighting should be calculated, otherwise false
|
|
271
|
+
*/ needCalculateEnvLight() {
|
|
272
|
+
return this.drawContext.renderPass.type === RENDER_PASS_TYPE_LIGHT && this.drawContext.drawEnvLight;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Get irradiance of current environment light
|
|
276
|
+
*
|
|
277
|
+
* @param scope - Shader scope
|
|
278
|
+
* @param normal - Fragment normal vector
|
|
279
|
+
*
|
|
280
|
+
* @returns Irradiance of current environment light of type vec3
|
|
281
|
+
*/ getEnvLightIrradiance(scope, normal) {
|
|
282
|
+
if (!this.needCalculateEnvLight()) {
|
|
283
|
+
console.warn('getEnvLightIrradiance(): No need to calculate environment lighting');
|
|
284
|
+
return scope.$builder.vec3(0);
|
|
285
|
+
}
|
|
286
|
+
return this.drawContext.env.light.envLight.hasIrradiance() ? scope.$builder.mul(this.drawContext.env.light.envLight.getIrradiance(scope, normal).rgb, ShaderHelper.getEnvLightStrength(scope)) : scope.$builder.vec3(0);
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Get Radiance of current environment light
|
|
290
|
+
*
|
|
291
|
+
* @param scope - Shader scope
|
|
292
|
+
* @param reflectVec - The reflection vector
|
|
293
|
+
* @param roughness - Roughness value of current fragment
|
|
294
|
+
*
|
|
295
|
+
* @returns Radiance of current environment light of type vec3
|
|
296
|
+
*/ getEnvLightRadiance(scope, reflectVec, roughness) {
|
|
297
|
+
if (!this.needCalculateEnvLight()) {
|
|
298
|
+
console.warn('getEnvLightRadiance(): No need to calculate environment lighting');
|
|
299
|
+
return scope.$builder.vec3(0);
|
|
300
|
+
}
|
|
301
|
+
return this.drawContext.env.light.envLight.hasRadiance() ? scope.$builder.mul(this.drawContext.env.light.envLight.getRadiance(scope, reflectVec, roughness).rgb, ShaderHelper.getEnvLightStrength(scope)) : scope.$builder.vec3(0);
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Checks if shadow should be computed
|
|
305
|
+
*
|
|
306
|
+
* @returns true if shadow should be computed, other wise false
|
|
307
|
+
*/ needCalculateShadow() {
|
|
308
|
+
return this.drawContext.renderPass.type === RENDER_PASS_TYPE_LIGHT && !!this.drawContext.currentShadowLight;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Calculates shadow of current fragment
|
|
312
|
+
*
|
|
313
|
+
* @param scope - Shader scope
|
|
314
|
+
* @param NoL - NdotL vector
|
|
315
|
+
* @returns Shadow of current fragment, 1 means no shadow and 0 means full shadowed.
|
|
316
|
+
*/ calculateShadow(scope, worldPos, NoL) {
|
|
317
|
+
const pb = scope.$builder;
|
|
318
|
+
if (!this.needCalculateShadow()) {
|
|
319
|
+
console.warn('calculateShadow(): No need to calculate shadow');
|
|
320
|
+
return pb.float(1);
|
|
321
|
+
}
|
|
322
|
+
return ShaderHelper.calculateShadow(scope, worldPos, NoL, this.drawContext);
|
|
323
|
+
}
|
|
324
|
+
getClusterIndex(scope, fragCoord) {
|
|
325
|
+
const pb = scope.$builder;
|
|
326
|
+
const funcName = 'lm_getClusterIndex';
|
|
327
|
+
pb.func(funcName, [
|
|
328
|
+
pb.vec3('fragCoord')
|
|
329
|
+
], function() {
|
|
330
|
+
const clusterParams = ShaderHelper.getClusterParams(this);
|
|
331
|
+
const countParams = ShaderHelper.getCountParams(this);
|
|
332
|
+
this.$l.zTile = pb.int(pb.max(pb.add(pb.mul(pb.log2(ShaderHelper.nonLinearDepthToLinear(this, this.fragCoord.z)), clusterParams.z), clusterParams.w), 0));
|
|
333
|
+
this.$l.f = pb.vec2(this.fragCoord.x, pb.sub(clusterParams.y, pb.add(this.fragCoord.y, 1)));
|
|
334
|
+
this.$l.xyTile = pb.ivec2(pb.div(this.f, pb.div(clusterParams.xy, pb.vec2(countParams.xy))));
|
|
335
|
+
this.$return(pb.ivec3(this.xyTile, this.zTile));
|
|
336
|
+
});
|
|
337
|
+
return pb.getGlobalScope()[funcName](fragCoord);
|
|
338
|
+
}
|
|
339
|
+
calculatePointLightAttenuation(scope, worldPos, posRange) {
|
|
340
|
+
const pb = scope.$builder;
|
|
341
|
+
const funcName = 'Z_calculatePointLightAttenuation';
|
|
342
|
+
pb.func(funcName, [
|
|
343
|
+
pb.vec3('worldPos'),
|
|
344
|
+
pb.vec4('posRange')
|
|
345
|
+
], function() {
|
|
346
|
+
this.$l.dist = pb.distance(this.posRange.xyz, this.worldPos);
|
|
347
|
+
this.$l.falloff = pb.max(0, pb.sub(1, pb.div(this.dist, this.posRange.w)));
|
|
348
|
+
this.$return(pb.mul(this.falloff, this.falloff));
|
|
349
|
+
});
|
|
350
|
+
return pb.getGlobalScope()[funcName](worldPos, posRange);
|
|
351
|
+
}
|
|
352
|
+
calculateSpotLightAttenuation(scope, worldPos, posRange, dirCutoff) {
|
|
353
|
+
const pb = scope.$builder;
|
|
354
|
+
const funcName = 'Z_calculateSpotLightAttenuation';
|
|
355
|
+
pb.func(funcName, [
|
|
356
|
+
pb.vec3('worldPos'),
|
|
357
|
+
pb.vec4('posRange'),
|
|
358
|
+
pb.vec4('dirCutoff')
|
|
359
|
+
], function() {
|
|
360
|
+
this.$l.dist = pb.distance(this.posRange.xyz, this.worldPos);
|
|
361
|
+
this.$l.falloff = pb.max(0, pb.sub(1, pb.div(this.dist, this.posRange.w)));
|
|
362
|
+
this.$l.spotFactor = pb.dot(pb.normalize(pb.sub(this.worldPos, this.posRange.xyz)), this.dirCutoff.xyz);
|
|
363
|
+
this.spotFactor = pb.smoothStep(this.dirCutoff.w, pb.mix(this.dirCutoff.w, 1, 0.5), this.spotFactor);
|
|
364
|
+
this.$return(pb.mul(this.spotFactor, this.falloff, this.falloff));
|
|
365
|
+
});
|
|
366
|
+
return pb.getGlobalScope()[funcName](worldPos, posRange, dirCutoff);
|
|
367
|
+
}
|
|
368
|
+
calculateLightAttenuation(scope, type, worldPos, posRange, dirCutoff) {
|
|
369
|
+
const pb = scope.$builder;
|
|
370
|
+
return scope.$choice(pb.equal(type, LIGHT_TYPE_DIRECTIONAL), pb.float(1), scope.$choice(pb.equal(type, LIGHT_TYPE_POINT), this.calculatePointLightAttenuation(scope, worldPos.xyz, posRange), this.calculateSpotLightAttenuation(scope, worldPos.xyz, posRange, dirCutoff)));
|
|
371
|
+
}
|
|
372
|
+
calculateLightDirection(scope, type, worldPos, posRange, dirCutoff) {
|
|
373
|
+
const pb = scope.$builder;
|
|
374
|
+
return scope.$choice(pb.equal(type, LIGHT_TYPE_DIRECTIONAL), pb.neg(dirCutoff.xyz), pb.normalize(pb.sub(posRange.xyz, worldPos.xyz)));
|
|
375
|
+
}
|
|
376
|
+
forEachLight(scope, callback) {
|
|
377
|
+
const pb = scope.$builder;
|
|
378
|
+
const that = this;
|
|
379
|
+
if (that.drawContext.renderPass.type !== RENDER_PASS_TYPE_LIGHT) {
|
|
380
|
+
console.warn('LitMaterial.forEachLight(): must be called in forward render pass');
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
if (that.drawContext.currentShadowLight) {
|
|
384
|
+
const posRange = scope.light.positionAndRange;
|
|
385
|
+
const dirCutoff = scope.light.directionAndCutoff;
|
|
386
|
+
const colorIntensity = scope.light.diffuseAndIntensity;
|
|
387
|
+
scope.$scope(function() {
|
|
388
|
+
const lightType = scope.$choice(pb.lessThan(posRange.w, 0), pb.int(LIGHT_TYPE_DIRECTIONAL), scope.$choice(pb.lessThan(dirCutoff.w, 0), pb.int(LIGHT_TYPE_POINT), pb.int(LIGHT_TYPE_SPOT)));
|
|
389
|
+
callback.call(this, lightType, posRange, dirCutoff, colorIntensity, true);
|
|
390
|
+
});
|
|
391
|
+
} else {
|
|
392
|
+
scope.$scope(function() {
|
|
393
|
+
const countParams = ShaderHelper.getCountParams(this);
|
|
394
|
+
this.$l.cluster = that.getClusterIndex(this, this.$builtins.fragCoord.xyz);
|
|
395
|
+
this.$l.clusterIndex = pb.add(this.cluster.x, pb.mul(this.cluster.y, countParams.x), pb.mul(this.cluster.z, countParams.x, countParams.y));
|
|
396
|
+
this.$l.texSize = scope.light.lightIndexTexSize;
|
|
397
|
+
if (pb.getDevice().type === 'webgl') {
|
|
398
|
+
this.$l.texCoordX = pb.div(pb.add(pb.mod(pb.float(this.clusterIndex), pb.float(this.texSize.x)), 0.5), pb.float(this.texSize.x));
|
|
399
|
+
this.$l.texCoordY = pb.div(pb.add(pb.float(pb.div(this.clusterIndex, this.texSize.x)), 0.5), pb.float(this.texSize.y));
|
|
400
|
+
this.$l.samp = pb.textureSample(ShaderHelper.getClusteredLightIndexTexture(this), pb.vec2(this.texCoordX, this.texCoordY));
|
|
401
|
+
} else {
|
|
402
|
+
this.$l.texCoordX = pb.mod(this.clusterIndex, this.texSize.x);
|
|
403
|
+
this.$l.texCoordY = pb.div(this.clusterIndex, this.texSize.x);
|
|
404
|
+
this.$l.samp = pb.textureLoad(ShaderHelper.getClusteredLightIndexTexture(this), pb.ivec2(this.texCoordX, this.texCoordY), 0);
|
|
405
|
+
}
|
|
406
|
+
if (pb.getDevice().type === 'webgl') {
|
|
407
|
+
this.$for(pb.int('i'), 0, 4, function() {
|
|
408
|
+
this.$l.k = this.samp.at(this.i);
|
|
409
|
+
this.$l.lights = pb.int[2]();
|
|
410
|
+
this.$l.lights[0] = pb.int(pb.mod(this.k, 256));
|
|
411
|
+
this.$l.lights[1] = pb.int(pb.div(this.k, 256));
|
|
412
|
+
this.$for(pb.int('k'), 0, 2, function() {
|
|
413
|
+
this.$l.li = this.lights.at(this.k);
|
|
414
|
+
this.$if(pb.greaterThan(this.li, 0), function() {
|
|
415
|
+
this.$for(pb.int('j'), 1, 256, function() {
|
|
416
|
+
this.$if(pb.equal(this.j, this.li), function() {
|
|
417
|
+
this.$l.positionRange = ShaderHelper.getLightPositionAndRange(this, this.j);
|
|
418
|
+
this.$l.directionCutoff = ShaderHelper.getLightDirectionAndCutoff(this, this.j);
|
|
419
|
+
this.$l.diffuseIntensity = ShaderHelper.getLightColorAndIntensity(this, this.j);
|
|
420
|
+
this.$l.lightType = this.$choice(pb.lessThan(this.positionRange.w, 0), pb.int(LIGHT_TYPE_DIRECTIONAL), this.$choice(pb.lessThan(this.directionCutoff.w, 0), pb.int(LIGHT_TYPE_POINT), pb.int(LIGHT_TYPE_SPOT)));
|
|
421
|
+
this.$scope(function() {
|
|
422
|
+
callback.call(this, this.lightType, this.positionRange, this.directionCutoff, this.diffuseIntensity, false);
|
|
423
|
+
});
|
|
424
|
+
this.$break();
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
});
|
|
430
|
+
} else {
|
|
431
|
+
this.$for(pb.uint('i'), 0, 4, function() {
|
|
432
|
+
this.$for(pb.uint('k'), 0, 4, function() {
|
|
433
|
+
this.$l.c = pb.compAnd(pb.sar(this.samp.at(this.i), pb.mul(this.k, 8)), 0xff);
|
|
434
|
+
this.$if(pb.greaterThan(this.c, 0), function() {
|
|
435
|
+
this.$l.positionRange = ShaderHelper.getLightPositionAndRange(this, this.c);
|
|
436
|
+
this.$l.directionCutoff = ShaderHelper.getLightDirectionAndCutoff(this, this.c);
|
|
437
|
+
this.$l.diffuseIntensity = ShaderHelper.getLightColorAndIntensity(this, this.c);
|
|
438
|
+
this.$l.lightType = this.$choice(pb.lessThan(this.positionRange.w, 0), pb.int(LIGHT_TYPE_DIRECTIONAL), this.$choice(pb.lessThan(this.directionCutoff.w, 0), pb.int(LIGHT_TYPE_POINT), pb.int(LIGHT_TYPE_SPOT)));
|
|
439
|
+
this.$scope(function() {
|
|
440
|
+
callback.call(this, this.lightType, this.positionRange, this.directionCutoff, this.diffuseIntensity, false);
|
|
441
|
+
});
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Fragment shader implementation
|
|
451
|
+
*
|
|
452
|
+
* @param scope - Shader scope
|
|
453
|
+
* @returns Calucated fragment color
|
|
454
|
+
*/ fragmentShader(scope) {
|
|
455
|
+
super.fragmentShader(scope);
|
|
456
|
+
const pb = scope.$builder;
|
|
457
|
+
if (this.drawContext.renderPass.type === RENDER_PASS_TYPE_LIGHT) {
|
|
458
|
+
if (this.normalTexture) {
|
|
459
|
+
scope.zNormalScale = pb.float().uniform(2);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* {@inheritDoc Material.supportLighting}
|
|
465
|
+
* @override
|
|
466
|
+
*/ supportLighting() {
|
|
467
|
+
return true;
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
FEATURE_DOUBLE_SIDED_LIGHTING = cls.defineFeature();
|
|
471
|
+
FEATURE_OBJECT_SPACE_NORMALMAP = cls.defineFeature();
|
|
472
|
+
return cls;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
export { mixinLight };
|
|
476
|
+
//# sourceMappingURL=lit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lit.js","sources":["../../../../src/material/mixins/lit.ts"],"sourcesContent":["import type { BindGroup, PBFunctionScope, PBInsideFunctionScope, PBShaderExp } from '@zephyr3d/device';\r\nimport {\r\n LIGHT_TYPE_DIRECTIONAL,\r\n LIGHT_TYPE_POINT,\r\n LIGHT_TYPE_SPOT,\r\n RENDER_PASS_TYPE_LIGHT\r\n} from '../../values';\r\nimport type { DrawContext } from '../../render';\r\nimport type { MeshMaterial } from '../meshmaterial';\r\nimport { applyMaterialMixins } from '../meshmaterial';\r\nimport type { TextureMixinInstanceTypes } from './texture';\r\nimport { mixinTextureProps } from './texture';\r\nimport type { IMixinAlbedoColor } from './albedocolor';\r\nimport { mixinAlbedoColor } from './albedocolor';\r\nimport { ShaderHelper } from '../shader/helper';\r\n\r\n/**\r\n * Interface for light mixin\r\n * @public\r\n */\r\nexport type IMixinLight = {\r\n normalScale: number;\r\n normalMapMode: 'tangent-space' | 'object-space';\r\n doubleSidedLighting: boolean;\r\n needCalculateEnvLight(): boolean;\r\n getUniformNormalScale(scope: PBInsideFunctionScope): PBShaderExp;\r\n getEnvLightIrradiance(scope: PBInsideFunctionScope, normal: PBShaderExp): PBShaderExp;\r\n getEnvLightRadiance(\r\n scope: PBInsideFunctionScope,\r\n reflectVec: PBShaderExp,\r\n roughness: PBShaderExp\r\n ): PBShaderExp;\r\n calculateViewVector(scope: PBInsideFunctionScope, worldPos: PBShaderExp): PBShaderExp;\r\n calculateReflectionVector(\r\n scope: PBInsideFunctionScope,\r\n normal: PBShaderExp,\r\n viewVec: PBShaderExp\r\n ): PBShaderExp;\r\n calculateTBN(\r\n scope: PBInsideFunctionScope,\r\n worldPos: PBShaderExp,\r\n worldNormal?: PBShaderExp,\r\n worldTangent?: PBShaderExp,\r\n worldBinormal?: PBShaderExp\r\n ): PBShaderExp;\r\n calculateNormal(\r\n scope: PBInsideFunctionScope,\r\n worldPos: PBShaderExp,\r\n worldNormal?: PBShaderExp,\r\n worldTangent?: PBShaderExp,\r\n worldBinormal?: PBShaderExp\r\n ): PBShaderExp;\r\n calculateNormalAndTBN(\r\n scope: PBInsideFunctionScope,\r\n worldPos: PBShaderExp,\r\n worldNormal?: PBShaderExp,\r\n worldTangent?: PBShaderExp,\r\n worldBinormal?: PBShaderExp\r\n ): PBShaderExp;\r\n calculateLightAttenuation(\r\n scope: PBInsideFunctionScope,\r\n type: PBShaderExp,\r\n worldPos: PBShaderExp,\r\n posRange: PBShaderExp,\r\n dirCutoff: PBShaderExp\r\n ): PBShaderExp;\r\n calculateLightDirection(\r\n scope: PBInsideFunctionScope,\r\n type: PBShaderExp,\r\n worldPos: PBShaderExp,\r\n posRange: PBShaderExp,\r\n dirCutoff: PBShaderExp\r\n ): PBShaderExp;\r\n calculateShadow(scope: PBInsideFunctionScope, worldPos: PBShaderExp, NoL: PBShaderExp): PBShaderExp;\r\n forEachLight(\r\n scope: PBInsideFunctionScope,\r\n callback: (\r\n this: PBInsideFunctionScope,\r\n type: PBShaderExp,\r\n posRange: PBShaderExp,\r\n dirCutoff: PBShaderExp,\r\n colorIntensity: PBShaderExp,\r\n shadow: boolean\r\n ) => void\r\n ): void;\r\n} & TextureMixinInstanceTypes<['normal']> &\r\n IMixinAlbedoColor;\r\n\r\n/**\r\n * Light mixin\r\n * @param BaseCls - class to mix in\r\n * @returns Mixed class\r\n * @public\r\n */\r\nexport function mixinLight<T extends typeof MeshMaterial>(BaseCls: T) {\r\n if ((BaseCls as any).lightMixed) {\r\n return BaseCls as T & { new (...args: any[]): IMixinLight };\r\n }\r\n const S = applyMaterialMixins(BaseCls, mixinAlbedoColor, mixinTextureProps('normal'));\r\n let FEATURE_DOUBLE_SIDED_LIGHTING = 0;\r\n let FEATURE_OBJECT_SPACE_NORMALMAP = 0;\r\n const cls = class extends S {\r\n static readonly lightMixed = true;\r\n private _normalScale: number;\r\n constructor() {\r\n super();\r\n this._normalScale = 1;\r\n this.useFeature(FEATURE_DOUBLE_SIDED_LIGHTING, true);\r\n }\r\n copyFrom(other: this): void {\r\n super.copyFrom(other);\r\n this.normalScale = other.normalScale;\r\n this.normalMapMode = other.normalMapMode;\r\n this.doubleSidedLighting = other.doubleSidedLighting;\r\n }\r\n get normalScale(): number {\r\n return this._normalScale;\r\n }\r\n set normalScale(val: number) {\r\n if (val !== this._normalScale) {\r\n this._normalScale = val;\r\n this.uniformChanged();\r\n }\r\n }\r\n get normalMapMode(): 'tangent-space' | 'object-space' {\r\n return this.featureUsed(FEATURE_OBJECT_SPACE_NORMALMAP);\r\n }\r\n set normalMapMode(val: 'tangent-space' | 'object-space') {\r\n this.useFeature(FEATURE_OBJECT_SPACE_NORMALMAP, val);\r\n }\r\n /** true if double sided lighting is used */\r\n get doubleSidedLighting(): boolean {\r\n return this.featureUsed(FEATURE_DOUBLE_SIDED_LIGHTING);\r\n }\r\n set doubleSidedLighting(val: boolean) {\r\n this.useFeature(FEATURE_DOUBLE_SIDED_LIGHTING, !!val);\r\n }\r\n /**\r\n * Calculates the normalized vector from world coordinates to the viewpoint.\r\n *\r\n * @param scope - Shader scope\r\n *\r\n * @returns The view vector\r\n */\r\n calculateViewVector(scope: PBInsideFunctionScope, worldPos: PBShaderExp): PBShaderExp {\r\n const pb = scope.$builder;\r\n return pb.normalize(pb.sub(ShaderHelper.getCameraPosition(scope), worldPos.xyz));\r\n }\r\n /**\r\n * Calculate the reflection vector of the view vector with respect to the normal.\r\n *\r\n * @param scope - Shader scope\r\n * @param normal - Surface normal\r\n * @param viewVec - The view vector\r\n * @returns The reflection vector\r\n */\r\n calculateReflectionVector(\r\n scope: PBInsideFunctionScope,\r\n normal: PBShaderExp,\r\n viewVec: PBShaderExp\r\n ): PBShaderExp {\r\n const pb = scope.$builder;\r\n return pb.reflect(pb.neg(viewVec), normal);\r\n }\r\n /**\r\n * Calculate the normal vector for current fragment\r\n * @param scope - The shader scope\r\n * @returns Normal vector for current fragment\r\n */\r\n calculateNormal(\r\n scope: PBInsideFunctionScope,\r\n worldPos: PBShaderExp,\r\n worldNormal?: PBShaderExp,\r\n worldTangent?: PBShaderExp,\r\n worldBinormal?: PBShaderExp\r\n ): PBShaderExp {\r\n const pb = scope.$builder;\r\n const that = this;\r\n const args: PBShaderExp[] = [worldPos];\r\n const params: PBShaderExp[] = [pb.vec3('worldPos')];\r\n let funcName = 'Z_calculateNormal';\r\n if (worldNormal) {\r\n params.push(pb.vec3('worldNormal'));\r\n args.push(worldNormal);\r\n funcName += '_N';\r\n if (worldTangent && worldBinormal) {\r\n params.push(pb.vec3('worldTangent'), pb.vec3('worldBinormal'));\r\n args.push(worldTangent, worldBinormal);\r\n funcName += '_T';\r\n }\r\n }\r\n pb.func(funcName, params, function () {\r\n this.$l.uv = that.normalTexture\r\n ? that.getNormalTexCoord(this) ?? pb.vec2(0)\r\n : that.albedoTexture\r\n ? that.getAlbedoTexCoord(this) ?? pb.vec2(0)\r\n : pb.vec2(0);\r\n this.$l.TBN = that.calculateTBN(\r\n this,\r\n this.worldPos,\r\n this.worldNormal,\r\n this.worldTangent,\r\n this.worldBinormal\r\n );\r\n if (that.drawContext.renderPass.type === RENDER_PASS_TYPE_LIGHT && that.normalTexture) {\r\n if (that.normalMapMode === 'object-space') {\r\n const pixel = pb.sub(\r\n pb.mul(pb.textureSample(that.getNormalTextureUniform(this), this.uv).rgb, 2),\r\n pb.vec3(1)\r\n );\r\n const normalTex = pb.mul(pixel, pb.vec3(pb.vec3(this.zNormalScale).xx, 1));\r\n this.$return(pb.normalize(normalTex));\r\n } else {\r\n const pixel = pb.sub(\r\n pb.mul(pb.textureSample(that.getNormalTextureUniform(this), this.uv).rgb, 2),\r\n pb.vec3(1)\r\n );\r\n const normalTex = pb.mul(pixel, pb.vec3(pb.vec3(this.zNormalScale).xx, 1));\r\n this.$return(pb.normalize(pb.mul(this.TBN, normalTex)));\r\n }\r\n } else {\r\n this.$return(this.TBN[2]);\r\n }\r\n });\r\n return pb.getGlobalScope()[funcName](...args);\r\n }\r\n /**\r\n * Normal scale uniform\r\n * @return Normal scale uniform\r\n */\r\n getUniformNormalScale(scope: PBInsideFunctionScope): PBShaderExp {\r\n return scope.zNormalScale;\r\n }\r\n /**\r\n * Calculate the normal vector for current fragment\r\n *\r\n * @param scope - The shader scope\r\n * @returns Structure that contains normal vector and TBN matrix\r\n */\r\n calculateNormalAndTBN(\r\n scope: PBInsideFunctionScope,\r\n worldPos: PBShaderExp,\r\n worldNormal?: PBShaderExp,\r\n worldTangent?: PBShaderExp,\r\n worldBinormal?: PBShaderExp\r\n ): PBShaderExp {\r\n const pb = scope.$builder;\r\n const NormalStruct = pb.defineStruct([pb.mat3('TBN'), pb.vec3('normal')]);\r\n const that = this;\r\n const args: PBShaderExp[] = [worldPos.xyz];\r\n const params: PBShaderExp[] = [pb.vec3('worldPos')];\r\n let funcName = 'Z_calculateNormalAndTBN';\r\n if (worldNormal) {\r\n params.push(pb.vec3('worldNormal'));\r\n args.push(worldNormal);\r\n funcName += '_N';\r\n if (worldTangent && worldBinormal) {\r\n params.push(pb.vec3('worldTangent'), pb.vec3('worldBinormal'));\r\n args.push(worldTangent, worldBinormal);\r\n funcName += '_T';\r\n }\r\n }\r\n pb.func(funcName, params, function () {\r\n this.$l.uv = that.normalTexture\r\n ? that.getNormalTexCoord(this) ?? pb.vec2(0)\r\n : that.albedoTexture\r\n ? that.getAlbedoTexCoord(this) ?? pb.vec2(0)\r\n : pb.vec2(0);\r\n this.$l.TBN = that.calculateTBN(\r\n this,\r\n this.worldPos,\r\n this.worldNormal,\r\n this.worldTangent,\r\n this.worldBinormal\r\n );\r\n if (that.drawContext.renderPass.type === RENDER_PASS_TYPE_LIGHT && that.normalTexture) {\r\n if (that.normalMapMode === 'object-space') {\r\n const pixel = pb.sub(\r\n pb.mul(pb.textureSample(that.getNormalTextureUniform(this), this.uv).rgb, 2),\r\n pb.vec3(1)\r\n );\r\n const normalTex = pb.mul(pixel, pb.vec3(pb.vec3(this.zNormalScale).xx, 1));\r\n this.$return(NormalStruct(this.TBN, pb.normalize(normalTex)));\r\n } else {\r\n const pixel = pb.sub(\r\n pb.mul(pb.textureSample(that.getNormalTextureUniform(this), this.uv).rgb, 2),\r\n pb.vec3(1)\r\n );\r\n const normalTex = pb.mul(pixel, pb.vec3(pb.vec3(this.zNormalScale).xx, 1));\r\n this.$return(NormalStruct(this.TBN, pb.normalize(pb.mul(this.TBN, normalTex))));\r\n }\r\n } else {\r\n this.$return(NormalStruct(this.TBN, this.TBN[2]));\r\n }\r\n });\r\n return pb.getGlobalScope()[funcName](...args);\r\n }\r\n /**\r\n * Calculate the TBN matrix\r\n *\r\n * @param scope - The shader scope\r\n * @returns TBN matrix\r\n */\r\n calculateTBN(\r\n scope: PBInsideFunctionScope,\r\n worldPos: PBShaderExp,\r\n worldNormal?: PBShaderExp,\r\n worldTangent?: PBShaderExp,\r\n worldBinormal?: PBShaderExp\r\n ): PBShaderExp {\r\n const pb = scope.$builder;\r\n const that = this;\r\n const args: PBShaderExp[] = [worldPos.xyz];\r\n const params: PBShaderExp[] = [pb.vec3('worldPos')];\r\n let funcName = 'Z_calculateTBN';\r\n if (worldNormal) {\r\n params.push(pb.vec3('worldNormal'));\r\n args.push(worldNormal);\r\n funcName += '_N';\r\n if (worldTangent && worldBinormal) {\r\n params.push(pb.vec3('worldTangent'), pb.vec3('worldBinormal'));\r\n args.push(worldTangent, worldBinormal);\r\n funcName += '_T';\r\n }\r\n }\r\n pb.func(funcName, params, function () {\r\n const posW = this.worldPos;\r\n this.$l.uv = that.normalTexture\r\n ? that.getNormalTexCoord(this) ?? pb.vec2(0)\r\n : that.albedoTexture\r\n ? that.getAlbedoTexCoord(this) ?? pb.vec2(0)\r\n : pb.vec2(0);\r\n this.$l.TBN = pb.mat3();\r\n if (!worldNormal) {\r\n this.$l.uv_dx = pb.dpdx(pb.vec3(this.uv, 0));\r\n this.$l.uv_dy = pb.dpdy(pb.vec3(this.uv, 0));\r\n this.$if(\r\n pb.lessThanEqual(pb.add(pb.length(this.uv_dx), pb.length(this.uv_dy)), 0.000001),\r\n function () {\r\n this.uv_dx = pb.vec3(1, 0, 0);\r\n this.uv_dy = pb.vec3(0, 1, 0);\r\n }\r\n );\r\n this.$l.t_ = pb.div(\r\n pb.sub(pb.mul(pb.dpdx(posW), this.uv_dy.y), pb.mul(pb.dpdy(posW), this.uv_dx.y)),\r\n pb.sub(pb.mul(this.uv_dx.x, this.uv_dy.y), pb.mul(this.uv_dx.y, this.uv_dy.x))\r\n );\r\n this.$l.ng = pb.normalize(pb.cross(pb.dpdx(posW), pb.dpdy(posW)));\r\n this.$l.t = pb.normalize(pb.sub(this.t_, pb.mul(this.ng, pb.dot(this.ng, this.t_))));\r\n this.$l.b = pb.cross(this.ng, this.t);\r\n if (that.doubleSidedLighting) {\r\n this.$if(pb.not(this.$builtins.frontFacing), function () {\r\n this.t = pb.mul(this.t, -1);\r\n this.b = pb.mul(this.b, -1);\r\n this.ng = pb.mul(this.ng, -1);\r\n });\r\n }\r\n this.TBN = pb.mat3(this.t, this.b, this.ng);\r\n } else if (!worldTangent) {\r\n this.$l.uv_dx = pb.dpdx(pb.vec3(this.uv, 0));\r\n this.$l.uv_dy = pb.dpdy(pb.vec3(this.uv, 0));\r\n this.$if(\r\n pb.lessThanEqual(pb.add(pb.length(this.uv_dx), pb.length(this.uv_dy)), 0.000001),\r\n function () {\r\n this.uv_dx = pb.vec3(1, 0, 0);\r\n this.uv_dy = pb.vec3(0, 1, 0);\r\n }\r\n );\r\n this.$l.t_ = pb.div(\r\n pb.sub(pb.mul(pb.dpdx(posW), this.uv_dy.y), pb.mul(pb.dpdy(posW), this.uv_dx.y)),\r\n pb.sub(pb.mul(this.uv_dx.x, this.uv_dy.y), pb.mul(this.uv_dx.y, this.uv_dy.x))\r\n );\r\n this.$l.ng = pb.normalize(this.worldNormal);\r\n this.$l.t = pb.normalize(pb.sub(this.t_, pb.mul(this.ng, pb.dot(this.ng, this.t_))));\r\n this.$l.b = pb.cross(this.ng, this.t);\r\n if (that.doubleSidedLighting) {\r\n this.$if(pb.not(this.$builtins.frontFacing), function () {\r\n this.t = pb.mul(this.t, -1);\r\n this.b = pb.mul(this.b, -1);\r\n this.ng = pb.mul(this.ng, -1);\r\n });\r\n }\r\n this.TBN = pb.mat3(this.t, this.b, this.ng);\r\n } else {\r\n this.$l.ng = pb.normalize(this.worldNormal);\r\n this.$l.t = pb.normalize(this.worldTangent);\r\n this.$l.b = pb.normalize(this.worldBinormal);\r\n if (that.doubleSidedLighting) {\r\n this.$if(pb.not(this.$builtins.frontFacing), function () {\r\n this.t = pb.mul(this.t, -1);\r\n this.b = pb.mul(this.b, -1);\r\n this.ng = pb.mul(this.ng, -1);\r\n });\r\n }\r\n this.TBN = pb.mat3(this.t, this.b, this.ng);\r\n }\r\n this.$return(this.TBN);\r\n });\r\n return pb.getGlobalScope()[funcName](...args);\r\n }\r\n /**\r\n * {@inheritDoc MeshMaterial.applyUniformsValues}\r\n * @override\r\n */\r\n applyUniformValues(bindGroup: BindGroup, ctx: DrawContext, pass: number): void {\r\n super.applyUniformValues(bindGroup, ctx, pass);\r\n if (ctx.renderPass.type === RENDER_PASS_TYPE_LIGHT) {\r\n if (this.normalTexture) {\r\n bindGroup.setValue('zNormalScale', this._normalScale);\r\n }\r\n }\r\n }\r\n /**\r\n * Check if the environment lighting should be calculated.\r\n *\r\n * @returns true Environment lighting should be calculated, otherwise false\r\n */\r\n needCalculateEnvLight(): boolean {\r\n return this.drawContext.renderPass.type === RENDER_PASS_TYPE_LIGHT && this.drawContext.drawEnvLight;\r\n }\r\n /**\r\n * Get irradiance of current environment light\r\n *\r\n * @param scope - Shader scope\r\n * @param normal - Fragment normal vector\r\n *\r\n * @returns Irradiance of current environment light of type vec3\r\n */\r\n getEnvLightIrradiance(scope: PBInsideFunctionScope, normal: PBShaderExp): PBShaderExp {\r\n if (!this.needCalculateEnvLight()) {\r\n console.warn('getEnvLightIrradiance(): No need to calculate environment lighting');\r\n return scope.$builder.vec3(0);\r\n }\r\n return this.drawContext.env.light.envLight.hasIrradiance()\r\n ? scope.$builder.mul(\r\n this.drawContext.env.light.envLight.getIrradiance(scope, normal).rgb,\r\n ShaderHelper.getEnvLightStrength(scope)\r\n )\r\n : scope.$builder.vec3(0);\r\n }\r\n /**\r\n * Get Radiance of current environment light\r\n *\r\n * @param scope - Shader scope\r\n * @param reflectVec - The reflection vector\r\n * @param roughness - Roughness value of current fragment\r\n *\r\n * @returns Radiance of current environment light of type vec3\r\n */\r\n getEnvLightRadiance(\r\n scope: PBInsideFunctionScope,\r\n reflectVec: PBShaderExp,\r\n roughness: PBShaderExp\r\n ): PBShaderExp {\r\n if (!this.needCalculateEnvLight()) {\r\n console.warn('getEnvLightRadiance(): No need to calculate environment lighting');\r\n return scope.$builder.vec3(0);\r\n }\r\n return this.drawContext.env.light.envLight.hasRadiance()\r\n ? scope.$builder.mul(\r\n this.drawContext.env.light.envLight.getRadiance(scope, reflectVec, roughness).rgb,\r\n ShaderHelper.getEnvLightStrength(scope)\r\n )\r\n : scope.$builder.vec3(0);\r\n }\r\n /**\r\n * Checks if shadow should be computed\r\n *\r\n * @returns true if shadow should be computed, other wise false\r\n */\r\n protected needCalculateShadow(): boolean {\r\n return (\r\n this.drawContext.renderPass.type === RENDER_PASS_TYPE_LIGHT && !!this.drawContext.currentShadowLight\r\n );\r\n }\r\n /**\r\n * Calculates shadow of current fragment\r\n *\r\n * @param scope - Shader scope\r\n * @param NoL - NdotL vector\r\n * @returns Shadow of current fragment, 1 means no shadow and 0 means full shadowed.\r\n */\r\n calculateShadow(scope: PBInsideFunctionScope, worldPos: PBShaderExp, NoL: PBShaderExp): PBShaderExp {\r\n const pb = scope.$builder;\r\n if (!this.needCalculateShadow()) {\r\n console.warn('calculateShadow(): No need to calculate shadow');\r\n return pb.float(1);\r\n }\r\n return ShaderHelper.calculateShadow(scope, worldPos, NoL, this.drawContext);\r\n }\r\n private getClusterIndex(scope: PBInsideFunctionScope, fragCoord: PBShaderExp) {\r\n const pb = scope.$builder;\r\n const funcName = 'lm_getClusterIndex';\r\n pb.func(funcName, [pb.vec3('fragCoord')], function () {\r\n const clusterParams = ShaderHelper.getClusterParams(this);\r\n const countParams = ShaderHelper.getCountParams(this);\r\n this.$l.zTile = pb.int(\r\n pb.max(\r\n pb.add(\r\n pb.mul(pb.log2(ShaderHelper.nonLinearDepthToLinear(this, this.fragCoord.z)), clusterParams.z),\r\n clusterParams.w\r\n ),\r\n 0\r\n )\r\n );\r\n this.$l.f = pb.vec2(this.fragCoord.x, pb.sub(clusterParams.y, pb.add(this.fragCoord.y, 1)));\r\n this.$l.xyTile = pb.ivec2(pb.div(this.f, pb.div(clusterParams.xy, pb.vec2(countParams.xy))));\r\n this.$return(pb.ivec3(this.xyTile, this.zTile));\r\n });\r\n return pb.getGlobalScope()[funcName](fragCoord);\r\n }\r\n protected calculatePointLightAttenuation(\r\n scope: PBInsideFunctionScope,\r\n worldPos: PBShaderExp,\r\n posRange: PBShaderExp\r\n ) {\r\n const pb = scope.$builder;\r\n const funcName = 'Z_calculatePointLightAttenuation';\r\n pb.func(funcName, [pb.vec3('worldPos'), pb.vec4('posRange')], function () {\r\n this.$l.dist = pb.distance(this.posRange.xyz, this.worldPos);\r\n this.$l.falloff = pb.max(0, pb.sub(1, pb.div(this.dist, this.posRange.w)));\r\n this.$return(pb.mul(this.falloff, this.falloff));\r\n });\r\n return pb.getGlobalScope()[funcName](worldPos, posRange);\r\n }\r\n protected calculateSpotLightAttenuation(\r\n scope: PBInsideFunctionScope,\r\n worldPos: PBShaderExp,\r\n posRange: PBShaderExp,\r\n dirCutoff: PBShaderExp\r\n ) {\r\n const pb = scope.$builder;\r\n const funcName = 'Z_calculateSpotLightAttenuation';\r\n pb.func(funcName, [pb.vec3('worldPos'), pb.vec4('posRange'), pb.vec4('dirCutoff')], function () {\r\n this.$l.dist = pb.distance(this.posRange.xyz, this.worldPos);\r\n this.$l.falloff = pb.max(0, pb.sub(1, pb.div(this.dist, this.posRange.w)));\r\n this.$l.spotFactor = pb.dot(\r\n pb.normalize(pb.sub(this.worldPos, this.posRange.xyz)),\r\n this.dirCutoff.xyz\r\n );\r\n this.spotFactor = pb.smoothStep(this.dirCutoff.w, pb.mix(this.dirCutoff.w, 1, 0.5), this.spotFactor);\r\n this.$return(pb.mul(this.spotFactor, this.falloff, this.falloff));\r\n });\r\n return pb.getGlobalScope()[funcName](worldPos, posRange, dirCutoff);\r\n }\r\n calculateLightAttenuation(\r\n scope: PBInsideFunctionScope,\r\n type: PBShaderExp,\r\n worldPos: PBShaderExp,\r\n posRange: PBShaderExp,\r\n dirCutoff: PBShaderExp\r\n ): PBShaderExp {\r\n const pb = scope.$builder;\r\n return scope.$choice(\r\n pb.equal(type, LIGHT_TYPE_DIRECTIONAL),\r\n pb.float(1),\r\n scope.$choice(\r\n pb.equal(type, LIGHT_TYPE_POINT),\r\n this.calculatePointLightAttenuation(scope, worldPos.xyz, posRange),\r\n this.calculateSpotLightAttenuation(scope, worldPos.xyz, posRange, dirCutoff)\r\n )\r\n );\r\n }\r\n calculateLightDirection(\r\n scope: PBInsideFunctionScope,\r\n type: PBShaderExp,\r\n worldPos: PBShaderExp,\r\n posRange: PBShaderExp,\r\n dirCutoff: PBShaderExp\r\n ): PBShaderExp {\r\n const pb = scope.$builder;\r\n return scope.$choice(\r\n pb.equal(type, LIGHT_TYPE_DIRECTIONAL),\r\n pb.neg(dirCutoff.xyz),\r\n pb.normalize(pb.sub(posRange.xyz, worldPos.xyz))\r\n );\r\n }\r\n forEachLight(\r\n scope: PBInsideFunctionScope,\r\n callback: (\r\n this: PBInsideFunctionScope,\r\n type: PBShaderExp,\r\n posRange: PBShaderExp,\r\n dirCutoff: PBShaderExp,\r\n colorIntensity: PBShaderExp,\r\n shadow: boolean\r\n ) => void\r\n ) {\r\n const pb = scope.$builder;\r\n const that = this;\r\n if (that.drawContext.renderPass.type !== RENDER_PASS_TYPE_LIGHT) {\r\n console.warn('LitMaterial.forEachLight(): must be called in forward render pass');\r\n return;\r\n }\r\n if (that.drawContext.currentShadowLight) {\r\n const posRange = scope.light.positionAndRange;\r\n const dirCutoff = scope.light.directionAndCutoff;\r\n const colorIntensity = scope.light.diffuseAndIntensity;\r\n scope.$scope(function () {\r\n const lightType = scope.$choice(\r\n pb.lessThan(posRange.w, 0),\r\n pb.int(LIGHT_TYPE_DIRECTIONAL),\r\n scope.$choice(pb.lessThan(dirCutoff.w, 0), pb.int(LIGHT_TYPE_POINT), pb.int(LIGHT_TYPE_SPOT))\r\n );\r\n callback.call(this, lightType, posRange, dirCutoff, colorIntensity, true);\r\n });\r\n } else {\r\n scope.$scope(function () {\r\n const countParams = ShaderHelper.getCountParams(this);\r\n this.$l.cluster = that.getClusterIndex(this, this.$builtins.fragCoord.xyz);\r\n this.$l.clusterIndex = pb.add(\r\n this.cluster.x,\r\n pb.mul(this.cluster.y, countParams.x),\r\n pb.mul(this.cluster.z, countParams.x, countParams.y)\r\n );\r\n this.$l.texSize = scope.light.lightIndexTexSize;\r\n if (pb.getDevice().type === 'webgl') {\r\n this.$l.texCoordX = pb.div(\r\n pb.add(pb.mod(pb.float(this.clusterIndex), pb.float(this.texSize.x)), 0.5),\r\n pb.float(this.texSize.x)\r\n );\r\n this.$l.texCoordY = pb.div(\r\n pb.add(pb.float(pb.div(this.clusterIndex, this.texSize.x)), 0.5),\r\n pb.float(this.texSize.y)\r\n );\r\n this.$l.samp = pb.textureSample(\r\n ShaderHelper.getClusteredLightIndexTexture(this),\r\n pb.vec2(this.texCoordX, this.texCoordY)\r\n );\r\n } else {\r\n this.$l.texCoordX = pb.mod(this.clusterIndex, this.texSize.x);\r\n this.$l.texCoordY = pb.div(this.clusterIndex, this.texSize.x);\r\n this.$l.samp = pb.textureLoad(\r\n ShaderHelper.getClusteredLightIndexTexture(this),\r\n pb.ivec2(this.texCoordX, this.texCoordY),\r\n 0\r\n );\r\n }\r\n if (pb.getDevice().type === 'webgl') {\r\n this.$for(pb.int('i'), 0, 4, function () {\r\n this.$l.k = this.samp.at(this.i);\r\n this.$l.lights = pb.int[2]();\r\n this.$l.lights[0] = pb.int(pb.mod(this.k, 256));\r\n this.$l.lights[1] = pb.int(pb.div(this.k, 256));\r\n this.$for(pb.int('k'), 0, 2, function () {\r\n this.$l.li = this.lights.at(this.k);\r\n this.$if(pb.greaterThan(this.li, 0), function () {\r\n this.$for(pb.int('j'), 1, 256, function () {\r\n this.$if(pb.equal(this.j, this.li), function () {\r\n this.$l.positionRange = ShaderHelper.getLightPositionAndRange(this, this.j);\r\n this.$l.directionCutoff = ShaderHelper.getLightDirectionAndCutoff(this, this.j);\r\n this.$l.diffuseIntensity = ShaderHelper.getLightColorAndIntensity(this, this.j);\r\n this.$l.lightType = this.$choice(\r\n pb.lessThan(this.positionRange.w, 0),\r\n pb.int(LIGHT_TYPE_DIRECTIONAL),\r\n this.$choice(\r\n pb.lessThan(this.directionCutoff.w, 0),\r\n pb.int(LIGHT_TYPE_POINT),\r\n pb.int(LIGHT_TYPE_SPOT)\r\n )\r\n );\r\n this.$scope(function () {\r\n callback.call(\r\n this,\r\n this.lightType,\r\n this.positionRange,\r\n this.directionCutoff,\r\n this.diffuseIntensity,\r\n false\r\n );\r\n });\r\n this.$break();\r\n });\r\n });\r\n });\r\n });\r\n });\r\n } else {\r\n this.$for(pb.uint('i'), 0, 4, function () {\r\n this.$for(pb.uint('k'), 0, 4, function () {\r\n this.$l.c = pb.compAnd(pb.sar(this.samp.at(this.i), pb.mul(this.k, 8)), 0xff);\r\n this.$if(pb.greaterThan(this.c, 0), function () {\r\n this.$l.positionRange = ShaderHelper.getLightPositionAndRange(this, this.c);\r\n this.$l.directionCutoff = ShaderHelper.getLightDirectionAndCutoff(this, this.c);\r\n this.$l.diffuseIntensity = ShaderHelper.getLightColorAndIntensity(this, this.c);\r\n this.$l.lightType = this.$choice(\r\n pb.lessThan(this.positionRange.w, 0),\r\n pb.int(LIGHT_TYPE_DIRECTIONAL),\r\n this.$choice(\r\n pb.lessThan(this.directionCutoff.w, 0),\r\n pb.int(LIGHT_TYPE_POINT),\r\n pb.int(LIGHT_TYPE_SPOT)\r\n )\r\n );\r\n this.$scope(function () {\r\n callback.call(\r\n this,\r\n this.lightType,\r\n this.positionRange,\r\n this.directionCutoff,\r\n this.diffuseIntensity,\r\n false\r\n );\r\n });\r\n });\r\n });\r\n });\r\n }\r\n });\r\n }\r\n }\r\n /**\r\n * Fragment shader implementation\r\n *\r\n * @param scope - Shader scope\r\n * @returns Calucated fragment color\r\n */\r\n fragmentShader(scope: PBFunctionScope) {\r\n super.fragmentShader(scope);\r\n const pb = scope.$builder;\r\n if (this.drawContext.renderPass.type === RENDER_PASS_TYPE_LIGHT) {\r\n if (this.normalTexture) {\r\n scope.zNormalScale = pb.float().uniform(2);\r\n }\r\n }\r\n }\r\n /**\r\n * {@inheritDoc Material.supportLighting}\r\n * @override\r\n */\r\n supportLighting(): boolean {\r\n return true;\r\n }\r\n } as unknown as T & { new (...args: any[]): IMixinLight };\r\n FEATURE_DOUBLE_SIDED_LIGHTING = cls.defineFeature();\r\n FEATURE_OBJECT_SPACE_NORMALMAP = cls.defineFeature();\r\n return cls;\r\n}\r\n"],"names":["mixinLight","BaseCls","lightMixed","S","applyMaterialMixins","mixinAlbedoColor","mixinTextureProps","FEATURE_DOUBLE_SIDED_LIGHTING","FEATURE_OBJECT_SPACE_NORMALMAP","cls","_normalScale","useFeature","copyFrom","other","normalScale","normalMapMode","doubleSidedLighting","val","uniformChanged","featureUsed","calculateViewVector","scope","worldPos","pb","$builder","normalize","sub","ShaderHelper","getCameraPosition","xyz","calculateReflectionVector","normal","viewVec","reflect","neg","calculateNormal","worldNormal","worldTangent","worldBinormal","that","args","params","vec3","funcName","push","func","$l","uv","normalTexture","getNormalTexCoord","vec2","albedoTexture","getAlbedoTexCoord","TBN","calculateTBN","drawContext","renderPass","type","RENDER_PASS_TYPE_LIGHT","pixel","mul","textureSample","getNormalTextureUniform","rgb","normalTex","zNormalScale","xx","$return","getGlobalScope","getUniformNormalScale","calculateNormalAndTBN","NormalStruct","defineStruct","mat3","posW","uv_dx","dpdx","uv_dy","dpdy","$if","lessThanEqual","add","length","t_","div","y","x","ng","cross","t","dot","b","not","$builtins","frontFacing","applyUniformValues","bindGroup","ctx","pass","setValue","needCalculateEnvLight","drawEnvLight","getEnvLightIrradiance","console","warn","env","light","envLight","hasIrradiance","getIrradiance","getEnvLightStrength","getEnvLightRadiance","reflectVec","roughness","hasRadiance","getRadiance","currentShadowLight","calculateShadow","NoL","needCalculateShadow","float","getClusterIndex","fragCoord","clusterParams","getClusterParams","countParams","getCountParams","zTile","int","max","log2","nonLinearDepthToLinear","z","w","f","xyTile","ivec2","xy","ivec3","calculatePointLightAttenuation","posRange","vec4","dist","distance","falloff","calculateSpotLightAttenuation","dirCutoff","spotFactor","smoothStep","mix","calculateLightAttenuation","$choice","equal","LIGHT_TYPE_DIRECTIONAL","LIGHT_TYPE_POINT","calculateLightDirection","forEachLight","callback","positionAndRange","directionAndCutoff","colorIntensity","diffuseAndIntensity","$scope","lightType","lessThan","LIGHT_TYPE_SPOT","call","cluster","clusterIndex","texSize","lightIndexTexSize","getDevice","texCoordX","mod","texCoordY","samp","getClusteredLightIndexTexture","textureLoad","$for","k","at","i","lights","li","greaterThan","j","positionRange","getLightPositionAndRange","directionCutoff","getLightDirectionAndCutoff","diffuseIntensity","getLightColorAndIntensity","$break","uint","c","compAnd","sar","fragmentShader","uniform","supportLighting","defineFeature"],"mappings":";;;;;;AAwFA;;;;;IAMO,SAASA,UAAAA,CAA0CC,OAAU,EAAA;IAClE,IAAKA,OAAgBC,CAAAA,UAAU,EAAE;QAC/B,OAAOD,OAAAA;AACT;AACA,IAAA,MAAME,CAAIC,GAAAA,mBAAAA,CAAoBH,OAASI,EAAAA,gBAAAA,EAAkBC,iBAAkB,CAAA,QAAA,CAAA,CAAA;AAC3E,IAAA,IAAIC,6BAAgC,GAAA,CAAA;AACpC,IAAA,IAAIC,8BAAiC,GAAA,CAAA;AACrC,IAAA,MAAMC,MAAM,cAAcN,CAAAA,CAAAA;AACxB,QAAA,OAAgBD,aAAa,IAAK;QAC1BQ,YAAqB;QAC7B,WAAc,EAAA;YACZ,KAAK,EAAA;YACL,IAAI,CAACA,YAAY,GAAG,CAAA;YACpB,IAAI,CAACC,UAAU,CAACJ,6BAA+B,EAAA,IAAA,CAAA;AACjD;AACAK,QAAAA,QAAAA,CAASC,KAAW,EAAQ;AAC1B,YAAA,KAAK,CAACD,QAASC,CAAAA,KAAAA,CAAAA;AACf,YAAA,IAAI,CAACC,WAAW,GAAGD,KAAAA,CAAMC,WAAW;AACpC,YAAA,IAAI,CAACC,aAAa,GAAGF,KAAAA,CAAME,aAAa;AACxC,YAAA,IAAI,CAACC,mBAAmB,GAAGH,KAAAA,CAAMG,mBAAmB;AACtD;AACA,QAAA,IAAIF,WAAsB,GAAA;YACxB,OAAO,IAAI,CAACJ,YAAY;AAC1B;QACA,IAAII,WAAAA,CAAYG,GAAW,EAAE;AAC3B,YAAA,IAAIA,GAAQ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