@zephyr3d/scene 0.9.5 → 0.9.7
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/joint_dynamics/controller.js +92 -32
- package/dist/animation/joint_dynamics/controller.js.map +1 -1
- package/dist/animation/joint_dynamics/convex_collider.js +320 -0
- package/dist/animation/joint_dynamics/convex_collider.js.map +1 -0
- package/dist/animation/joint_dynamics/joint_dynamics_system.js +57 -19
- package/dist/animation/joint_dynamics/joint_dynamics_system.js.map +1 -1
- package/dist/animation/joint_dynamics/solver.js +71 -27
- package/dist/animation/joint_dynamics/solver.js.map +1 -1
- package/dist/animation/joint_dynamics_modifier.js +21 -20
- package/dist/animation/joint_dynamics_modifier.js.map +1 -1
- package/dist/animation/skeleton.js +7 -10
- package/dist/animation/skeleton.js.map +1 -1
- package/dist/app/engine.js +134 -140
- package/dist/app/engine.js.map +1 -1
- package/dist/app/scriptregistry.js +47 -16
- package/dist/app/scriptregistry.js.map +1 -1
- package/dist/asset/assetmanager.js +3 -1
- package/dist/asset/assetmanager.js.map +1 -1
- package/dist/asset/model.js +346 -7
- package/dist/asset/model.js.map +1 -1
- package/dist/avatar/wardrobe.js +20 -16
- package/dist/avatar/wardrobe.js.map +1 -1
- package/dist/camera/camera.js +416 -210
- package/dist/camera/camera.js.map +1 -1
- package/dist/index.d.ts +1350 -621
- package/dist/index.js +6 -11
- package/dist/index.js.map +1 -1
- package/dist/material/blinn.js +1 -1
- package/dist/material/blinn.js.map +1 -1
- package/dist/material/lambert.js +1 -1
- package/dist/material/lambert.js.map +1 -1
- package/dist/material/material.js +23 -1
- package/dist/material/material.js.map +1 -1
- package/dist/material/meshmaterial.js +178 -23
- package/dist/material/meshmaterial.js.map +1 -1
- package/dist/material/mixins/albedocolor.js +4 -4
- package/dist/material/mixins/albedocolor.js.map +1 -1
- package/dist/material/mixins/lightmodel/blinnphong.js +2 -1
- package/dist/material/mixins/lightmodel/blinnphong.js.map +1 -1
- package/dist/material/mixins/lightmodel/lambert.js +2 -1
- package/dist/material/mixins/lightmodel/lambert.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js +63 -16
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js +105 -32
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js +16 -6
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -1
- package/dist/material/mixins/lit.js +1 -1
- package/dist/material/mixins/lit.js.map +1 -1
- package/dist/material/mixins/pbr/common.js +276 -65
- package/dist/material/mixins/pbr/common.js.map +1 -1
- package/dist/material/mixins/texture.js +3 -3
- package/dist/material/mixins/texture.js.map +1 -1
- package/dist/material/mixins/vertexcolor.js +2 -2
- package/dist/material/mixins/vertexcolor.js.map +1 -1
- package/dist/material/msdf_text.js +3 -3
- package/dist/material/msdf_text.js.map +1 -1
- package/dist/material/mtoon.js +574 -0
- package/dist/material/mtoon.js.map +1 -0
- package/dist/material/pbrblueprint.js +499 -336
- package/dist/material/pbrblueprint.js.map +1 -1
- package/dist/material/pbrmr.js +118 -100
- package/dist/material/pbrmr.js.map +1 -1
- package/dist/material/pbrsg.js +1 -1
- package/dist/material/pbrsg.js.map +1 -1
- package/dist/material/shader/helper.js +324 -294
- package/dist/material/shader/helper.js.map +1 -1
- package/dist/material/subsurfaceprofile.js +812 -0
- package/dist/material/subsurfaceprofile.js.map +1 -0
- package/dist/material/unlit.js +1 -1
- package/dist/material/unlit.js.map +1 -1
- package/dist/posteffect/compositor.js +46 -11
- package/dist/posteffect/compositor.js.map +1 -1
- package/dist/posteffect/ssr.js +422 -96
- package/dist/posteffect/ssr.js.map +1 -1
- package/dist/posteffect/sss.js +1053 -0
- package/dist/posteffect/sss.js.map +1 -0
- package/dist/posteffect/taa.js +61 -60
- package/dist/posteffect/taa.js.map +1 -1
- package/dist/render/abuffer_oit.js +63 -12
- package/dist/render/abuffer_oit.js.map +1 -1
- package/dist/render/cluster_light.js +6 -5
- package/dist/render/cluster_light.js.map +1 -1
- package/dist/render/drawable.js +1 -5
- package/dist/render/drawable.js.map +1 -1
- package/dist/render/drawable_mixin.js +2 -1
- package/dist/render/drawable_mixin.js.map +1 -1
- package/dist/render/fbm_wavegenerator.js +2 -1
- package/dist/render/fbm_wavegenerator.js.map +1 -1
- package/dist/render/gerstner_wavegenerator.js +2 -1
- package/dist/render/gerstner_wavegenerator.js.map +1 -1
- package/dist/render/globalbindgroup_allocator.js +2 -1
- package/dist/render/globalbindgroup_allocator.js.map +1 -1
- package/dist/render/lightpass.js +110 -23
- package/dist/render/lightpass.js.map +1 -1
- package/dist/render/render_queue.js +51 -8
- package/dist/render/render_queue.js.map +1 -1
- package/dist/render/renderer.js +80 -66
- package/dist/render/renderer.js.map +1 -1
- package/dist/render/rendergraph/device_pool_allocator.js +8 -0
- package/dist/render/rendergraph/device_pool_allocator.js.map +1 -1
- package/dist/render/rendergraph/forward_plus_builder.js +481 -95
- package/dist/render/rendergraph/forward_plus_builder.js.map +1 -1
- package/dist/render/rendergraph/history_resource_manager.js +55 -0
- package/dist/render/rendergraph/history_resource_manager.js.map +1 -1
- package/dist/render/rendergraph/history_resources.js +3 -1
- package/dist/render/rendergraph/history_resources.js.map +1 -1
- package/dist/render/rendergraph/types.js.map +1 -1
- package/dist/render/renderpass.js +10 -4
- package/dist/render/renderpass.js.map +1 -1
- package/dist/render/sky.js +31 -1
- package/dist/render/sky.js.map +1 -1
- package/dist/render/weightedblended_oit.js +23 -5
- package/dist/render/weightedblended_oit.js.map +1 -1
- package/dist/scene/basesprite.js +4 -2
- package/dist/scene/basesprite.js.map +1 -1
- package/dist/scene/batchgroup.js +3 -1
- package/dist/scene/batchgroup.js.map +1 -1
- package/dist/scene/environment.js +11 -1
- package/dist/scene/environment.js.map +1 -1
- package/dist/scene/light.js +21 -3
- package/dist/scene/light.js.map +1 -1
- package/dist/scene/mesh.js +29 -14
- package/dist/scene/mesh.js.map +1 -1
- package/dist/scene/meshdrawable.js +6 -0
- package/dist/scene/meshdrawable.js.map +1 -1
- package/dist/scene/msdftext.js +5 -2
- package/dist/scene/msdftext.js.map +1 -1
- package/dist/scene/msdftextsprite.js +5 -3
- package/dist/scene/msdftextsprite.js.map +1 -1
- package/dist/scene/particlesys.js +3 -1
- package/dist/scene/particlesys.js.map +1 -1
- package/dist/scene/scene.js +6 -5
- package/dist/scene/scene.js.map +1 -1
- package/dist/scene/terrain-cm/grass.js +4 -2
- package/dist/scene/terrain-cm/grass.js.map +1 -1
- package/dist/scene/terrain-cm/grassmaterial.js +2 -1
- package/dist/scene/terrain-cm/grassmaterial.js.map +1 -1
- package/dist/scene/terrain-cm/terrain-cm.js +4 -2
- package/dist/scene/terrain-cm/terrain-cm.js.map +1 -1
- package/dist/scene/water.js +4 -2
- package/dist/scene/water.js.map +1 -1
- package/dist/shaders/shadow.js +26 -393
- package/dist/shaders/shadow.js.map +1 -1
- package/dist/shadow/esm.js +112 -12
- package/dist/shadow/esm.js.map +1 -1
- package/dist/shadow/pcf_opt.js +2 -2
- package/dist/shadow/pcf_opt.js.map +1 -1
- package/dist/shadow/pcf_pd.js +19 -10
- package/dist/shadow/pcf_pd.js.map +1 -1
- package/dist/shadow/shader.js +58 -7
- package/dist/shadow/shader.js.map +1 -1
- package/dist/shadow/shadow_impl.js +6 -0
- package/dist/shadow/shadow_impl.js.map +1 -1
- package/dist/shadow/shadow_region.js +229 -0
- package/dist/shadow/shadow_region.js.map +1 -0
- package/dist/shadow/shadowmapper.js +67 -59
- package/dist/shadow/shadowmapper.js.map +1 -1
- package/dist/shadow/vsm.js +45 -19
- package/dist/shadow/vsm.js.map +1 -1
- package/dist/text/font/cff_font.js +890 -0
- package/dist/text/font/cff_font.js.map +1 -0
- package/dist/text/font/font_asset.js +17 -3
- package/dist/text/font/font_asset.js.map +1 -1
- package/dist/utility/blueprint/common/constants.js +8 -8
- package/dist/utility/blueprint/common/constants.js.map +1 -1
- package/dist/utility/blueprint/material/pbr.js +31 -4
- package/dist/utility/blueprint/material/pbr.js.map +1 -1
- package/dist/utility/blueprint/material/texture.js +1 -17
- package/dist/utility/blueprint/material/texture.js.map +1 -1
- package/dist/utility/serialization/manager.js +327 -359
- package/dist/utility/serialization/manager.js.map +1 -1
- package/dist/utility/serialization/scene/animation.js +5 -2
- package/dist/utility/serialization/scene/animation.js.map +1 -1
- package/dist/utility/serialization/scene/batch.js +4 -1
- package/dist/utility/serialization/scene/batch.js.map +1 -1
- package/dist/utility/serialization/scene/camera.js +249 -54
- package/dist/utility/serialization/scene/camera.js.map +1 -1
- package/dist/utility/serialization/scene/common.js +37 -1
- package/dist/utility/serialization/scene/common.js.map +1 -1
- package/dist/utility/serialization/scene/light.js +42 -3
- package/dist/utility/serialization/scene/light.js.map +1 -1
- package/dist/utility/serialization/scene/material.js +1112 -646
- package/dist/utility/serialization/scene/material.js.map +1 -1
- package/dist/utility/serialization/scene/mesh.js +7 -4
- package/dist/utility/serialization/scene/mesh.js.map +1 -1
- package/dist/utility/serialization/scene/node.js +31 -12
- package/dist/utility/serialization/scene/node.js.map +1 -1
- package/dist/utility/serialization/scene/particle.js +4 -1
- package/dist/utility/serialization/scene/particle.js.map +1 -1
- package/dist/utility/serialization/scene/primitive.js +3 -1
- package/dist/utility/serialization/scene/primitive.js.map +1 -1
- package/dist/utility/serialization/scene/scene.js +18 -0
- package/dist/utility/serialization/scene/scene.js.map +1 -1
- package/dist/utility/serialization/scene/sprite.js +6 -3
- package/dist/utility/serialization/scene/sprite.js.map +1 -1
- package/dist/utility/serialization/scene/terrain.js +5 -2
- package/dist/utility/serialization/scene/terrain.js.map +1 -1
- package/dist/utility/serialization/scene/text.js +3 -1
- package/dist/utility/serialization/scene/text.js.map +1 -1
- package/dist/utility/serialization/scene/water.js +4 -1
- package/dist/utility/serialization/scene/water.js.map +1 -1
- package/dist/utility/textures/ltcdata.js +6 -0
- package/dist/utility/textures/ltcdata.js.map +1 -0
- package/dist/utility/textures/ltclut.js +61 -0
- package/dist/utility/textures/ltclut.js.map +1 -0
- package/dist/values.js +9 -1
- package/dist/values.js.map +1 -1
- package/package.json +3 -3
- package/dist/animation/ik/ik_chain_builder.js +0 -68
- package/dist/animation/ik/ik_chain_builder.js.map +0 -1
- package/dist/animation/ik/ik_pole_constraint.js +0 -123
- package/dist/animation/ik/ik_pole_constraint.js.map +0 -1
- package/dist/animation/ik/ik_track.js +0 -96
- package/dist/animation/ik/ik_track.js.map +0 -1
- package/dist/animation/ik_postprocessor.js +0 -71
- package/dist/animation/ik_postprocessor.js.map +0 -1
- package/dist/animation/joint_dynamics/math.js +0 -16
- package/dist/animation/joint_dynamics/math.js.map +0 -1
- package/dist/animation/manual_transform_processor.js +0 -156
- package/dist/animation/manual_transform_processor.js.map +0 -1
- package/dist/animation/skeleton_postprocessor.js +0 -50
- package/dist/animation/skeleton_postprocessor.js.map +0 -1
- package/dist/animation/spring2/collision.js +0 -469
- package/dist/animation/spring2/collision.js.map +0 -1
- package/dist/animation/spring2/constraints.js +0 -329
- package/dist/animation/spring2/constraints.js.map +0 -1
- package/dist/animation/spring2/controller.js +0 -434
- package/dist/animation/spring2/controller.js.map +0 -1
- package/dist/animation/spring2/math.js +0 -16
- package/dist/animation/spring2/math.js.map +0 -1
- package/dist/animation/spring2/solver.js +0 -624
- package/dist/animation/spring2/solver.js.map +0 -1
- package/dist/animation/spring2/spring_system.js +0 -118
- package/dist/animation/spring2/spring_system.js.map +0 -1
- package/dist/animation/spring2/types.js +0 -19
- package/dist/animation/spring2/types.js.map +0 -1
- package/dist/animation/spring_postprocessor.js +0 -54
- package/dist/animation/spring_postprocessor.js.map +0 -1
- package/dist/asset/loaders/gltf/gltf_loader.js +0 -1276
- package/dist/asset/loaders/gltf/gltf_loader.js.map +0 -1
- package/dist/asset/loaders/gltf/helpers.js +0 -331
- package/dist/asset/loaders/gltf/helpers.js.map +0 -1
- package/dist/material/sprite3d.js +0 -301
- package/dist/material/sprite3d.js.map +0 -1
- package/dist/material/sprite3d_std.js +0 -116
- package/dist/material/sprite3d_std.js.map +0 -1
- package/dist/material/sprite3dblueprint.js +0 -235
- package/dist/material/sprite3dblueprint.js.map +0 -1
- package/dist/material/sprite_sdf.js +0 -106
- package/dist/material/sprite_sdf.js.map +0 -1
- package/dist/material/terrainmaterial.js +0 -368
- package/dist/material/terrainmaterial.js.map +0 -1
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js +0 -38
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js.map +0 -1
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js +0 -10
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js.map +0 -1
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js +0 -127
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js.map +0 -1
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js +0 -263
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js.map +0 -1
- package/dist/render/deferredlightpass.js +0 -510
- package/dist/render/deferredlightpass.js.map +0 -1
- package/dist/render/deferredshadowlightpass.js +0 -428
- package/dist/render/deferredshadowlightpass.js.map +0 -1
- package/dist/render/gbufferpass.js +0 -50
- package/dist/render/gbufferpass.js.map +0 -1
- package/dist/scene/sdftextsprite.js +0 -322
- package/dist/scene/sdftextsprite.js.map +0 -1
- package/dist/scene/sprite3d.js +0 -18
- package/dist/scene/sprite3d.js.map +0 -1
- package/dist/scene/terrain/grass.js +0 -280
- package/dist/scene/terrain/grass.js.map +0 -1
- package/dist/scene/terrain/heightfield.js +0 -475
- package/dist/scene/terrain/heightfield.js.map +0 -1
- package/dist/scene/terrain/patch.js +0 -532
- package/dist/scene/terrain/patch.js.map +0 -1
- package/dist/scene/terrain/quadtree.js +0 -461
- package/dist/scene/terrain/quadtree.js.map +0 -1
- package/dist/scene/terrain/terrain.js +0 -231
- package/dist/scene/terrain/terrain.js.map +0 -1
- package/dist/src/animation/animation.js +0 -127
- package/dist/src/animation/animation.js.map +0 -1
- package/dist/src/animation/animationset.js +0 -255
- package/dist/src/animation/animationset.js.map +0 -1
- package/dist/src/animation/animationtrack.js +0 -34
- package/dist/src/animation/animationtrack.js.map +0 -1
- package/dist/src/animation/eulerrotationtrack.js +0 -52
- package/dist/src/animation/eulerrotationtrack.js.map +0 -1
- package/dist/src/animation/morphtarget.js +0 -93
- package/dist/src/animation/morphtarget.js.map +0 -1
- package/dist/src/animation/morphtrack.js +0 -70
- package/dist/src/animation/morphtrack.js.map +0 -1
- package/dist/src/animation/proptrack.js +0 -161
- package/dist/src/animation/proptrack.js.map +0 -1
- package/dist/src/animation/rotationtrack.js +0 -51
- package/dist/src/animation/rotationtrack.js.map +0 -1
- package/dist/src/animation/scaletrack.js +0 -50
- package/dist/src/animation/scaletrack.js.map +0 -1
- package/dist/src/animation/skeleton.js +0 -204
- package/dist/src/animation/skeleton.js.map +0 -1
- package/dist/src/animation/translationtrack.js +0 -50
- package/dist/src/animation/translationtrack.js.map +0 -1
- package/dist/src/app/app.js +0 -129
- package/dist/src/app/app.js.map +0 -1
- package/dist/src/app/inputmgr.js +0 -267
- package/dist/src/app/inputmgr.js.map +0 -1
- package/dist/src/asset/assetmanager.js +0 -404
- package/dist/src/asset/assetmanager.js.map +0 -1
- package/dist/src/asset/builtin.js +0 -337
- package/dist/src/asset/builtin.js.map +0 -1
- package/dist/src/asset/loaders/dds/dds.js +0 -470
- package/dist/src/asset/loaders/dds/dds.js.map +0 -1
- package/dist/src/asset/loaders/dds/dds_loader.js +0 -28
- package/dist/src/asset/loaders/dds/dds_loader.js.map +0 -1
- package/dist/src/asset/loaders/gltf/gltf_loader.js +0 -1265
- package/dist/src/asset/loaders/gltf/gltf_loader.js.map +0 -1
- package/dist/src/asset/loaders/gltf/helpers.js +0 -327
- package/dist/src/asset/loaders/gltf/helpers.js.map +0 -1
- package/dist/src/asset/loaders/hdr/hdr.js +0 -180
- package/dist/src/asset/loaders/hdr/hdr.js.map +0 -1
- package/dist/src/asset/loaders/image/tga_Loader.js +0 -116
- package/dist/src/asset/loaders/image/tga_Loader.js.map +0 -1
- package/dist/src/asset/loaders/image/webimage_loader.js +0 -63
- package/dist/src/asset/loaders/image/webimage_loader.js.map +0 -1
- package/dist/src/asset/loaders/loader.js +0 -45
- package/dist/src/asset/loaders/loader.js.map +0 -1
- package/dist/src/asset/model.js +0 -414
- package/dist/src/asset/model.js.map +0 -1
- package/dist/src/blitter/bilateralblur.js +0 -221
- package/dist/src/blitter/bilateralblur.js.map +0 -1
- package/dist/src/blitter/blitter.js +0 -390
- package/dist/src/blitter/blitter.js.map +0 -1
- package/dist/src/blitter/box.js +0 -118
- package/dist/src/blitter/box.js.map +0 -1
- package/dist/src/blitter/copy.js +0 -22
- package/dist/src/blitter/copy.js.map +0 -1
- package/dist/src/blitter/gaussianblur.js +0 -228
- package/dist/src/blitter/gaussianblur.js.map +0 -1
- package/dist/src/camera/base.js +0 -92
- package/dist/src/camera/base.js.map +0 -1
- package/dist/src/camera/camera.js +0 -1005
- package/dist/src/camera/camera.js.map +0 -1
- package/dist/src/camera/fps.js +0 -238
- package/dist/src/camera/fps.js.map +0 -1
- package/dist/src/camera/orbit.js +0 -245
- package/dist/src/camera/orbit.js.map +0 -1
- package/dist/src/camera/orthocamera.js +0 -167
- package/dist/src/camera/orthocamera.js.map +0 -1
- package/dist/src/camera/perspectivecamera.js +0 -141
- package/dist/src/camera/perspectivecamera.js.map +0 -1
- package/dist/src/index.js +0 -120
- package/dist/src/index.js.map +0 -1
- package/dist/src/material/blinn.js +0 -81
- package/dist/src/material/blinn.js.map +0 -1
- package/dist/src/material/grassmaterial.js +0 -113
- package/dist/src/material/grassmaterial.js.map +0 -1
- package/dist/src/material/lambert.js +0 -92
- package/dist/src/material/lambert.js.map +0 -1
- package/dist/src/material/material.js +0 -301
- package/dist/src/material/material.js.map +0 -1
- package/dist/src/material/meshmaterial.js +0 -704
- package/dist/src/material/meshmaterial.js.map +0 -1
- package/dist/src/material/mixins/albedocolor.js +0 -76
- package/dist/src/material/mixins/albedocolor.js.map +0 -1
- package/dist/src/material/mixins/foliage.js +0 -47
- package/dist/src/material/mixins/foliage.js.map +0 -1
- package/dist/src/material/mixins/lightmodel/blinnphong.js +0 -112
- package/dist/src/material/mixins/lightmodel/blinnphong.js.map +0 -1
- package/dist/src/material/mixins/lightmodel/lambert.js +0 -58
- package/dist/src/material/mixins/lightmodel/lambert.js.map +0 -1
- package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js +0 -178
- package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js.map +0 -1
- package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js +0 -139
- package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js.map +0 -1
- package/dist/src/material/mixins/lit.js +0 -476
- package/dist/src/material/mixins/lit.js.map +0 -1
- package/dist/src/material/mixins/pbr/common.js +0 -918
- package/dist/src/material/mixins/pbr/common.js.map +0 -1
- package/dist/src/material/mixins/texture.js +0 -172
- package/dist/src/material/mixins/texture.js.map +0 -1
- package/dist/src/material/mixins/vertexcolor.js +0 -56
- package/dist/src/material/mixins/vertexcolor.js.map +0 -1
- package/dist/src/material/particle.js +0 -178
- package/dist/src/material/particle.js.map +0 -1
- package/dist/src/material/pbrmr.js +0 -97
- package/dist/src/material/pbrmr.js.map +0 -1
- package/dist/src/material/pbrsg.js +0 -97
- package/dist/src/material/pbrsg.js.map +0 -1
- package/dist/src/material/shader/helper.js +0 -1209
- package/dist/src/material/shader/helper.js.map +0 -1
- package/dist/src/material/terrain-cm.js +0 -606
- package/dist/src/material/terrain-cm.js.map +0 -1
- package/dist/src/material/terrainmaterial.js +0 -375
- package/dist/src/material/terrainmaterial.js.map +0 -1
- package/dist/src/material/unlit.js +0 -41
- package/dist/src/material/unlit.js.map +0 -1
- package/dist/src/material/water.js +0 -417
- package/dist/src/material/water.js.map +0 -1
- package/dist/src/posteffect/bloom.js +0 -361
- package/dist/src/posteffect/bloom.js.map +0 -1
- package/dist/src/posteffect/compositor.js +0 -226
- package/dist/src/posteffect/compositor.js.map +0 -1
- package/dist/src/posteffect/fxaa.js +0 -273
- package/dist/src/posteffect/fxaa.js.map +0 -1
- package/dist/src/posteffect/grayscale.js +0 -69
- package/dist/src/posteffect/grayscale.js.map +0 -1
- package/dist/src/posteffect/motionblur.js +0 -96
- package/dist/src/posteffect/motionblur.js.map +0 -1
- package/dist/src/posteffect/posteffect.js +0 -126
- package/dist/src/posteffect/posteffect.js.map +0 -1
- package/dist/src/posteffect/sao.js +0 -324
- package/dist/src/posteffect/sao.js.map +0 -1
- package/dist/src/posteffect/ssr.js +0 -489
- package/dist/src/posteffect/ssr.js.map +0 -1
- package/dist/src/posteffect/taa.js +0 -172
- package/dist/src/posteffect/taa.js.map +0 -1
- package/dist/src/posteffect/tonemap.js +0 -94
- package/dist/src/posteffect/tonemap.js.map +0 -1
- package/dist/src/render/abuffer_oit.js +0 -361
- package/dist/src/render/abuffer_oit.js.map +0 -1
- package/dist/src/render/clipmap.js +0 -851
- package/dist/src/render/clipmap.js.map +0 -1
- package/dist/src/render/cluster_light.js +0 -333
- package/dist/src/render/cluster_light.js.map +0 -1
- package/dist/src/render/cull_visitor.js +0 -187
- package/dist/src/render/cull_visitor.js.map +0 -1
- package/dist/src/render/depthpass.js +0 -68
- package/dist/src/render/depthpass.js.map +0 -1
- package/dist/src/render/drawable_mixin.js +0 -227
- package/dist/src/render/drawable_mixin.js.map +0 -1
- package/dist/src/render/envlight.js +0 -463
- package/dist/src/render/envlight.js.map +0 -1
- package/dist/src/render/fbm_wavegenerator.js +0 -251
- package/dist/src/render/fbm_wavegenerator.js.map +0 -1
- package/dist/src/render/fft_wavegenerator.js +0 -1006
- package/dist/src/render/fft_wavegenerator.js.map +0 -1
- package/dist/src/render/fullscreenquad.js +0 -38
- package/dist/src/render/fullscreenquad.js.map +0 -1
- package/dist/src/render/gerstner_wavegenerator.js +0 -314
- package/dist/src/render/gerstner_wavegenerator.js.map +0 -1
- package/dist/src/render/globalbindgroup_allocator.js +0 -60
- package/dist/src/render/globalbindgroup_allocator.js.map +0 -1
- package/dist/src/render/hzb.js +0 -273
- package/dist/src/render/hzb.js.map +0 -1
- package/dist/src/render/lightpass.js +0 -172
- package/dist/src/render/lightpass.js.map +0 -1
- package/dist/src/render/objectcolorpass.js +0 -51
- package/dist/src/render/objectcolorpass.js.map +0 -1
- package/dist/src/render/primitive.js +0 -364
- package/dist/src/render/primitive.js.map +0 -1
- package/dist/src/render/render_queue.js +0 -467
- package/dist/src/render/render_queue.js.map +0 -1
- package/dist/src/render/renderbundle_wrapper.js +0 -152
- package/dist/src/render/renderbundle_wrapper.js.map +0 -1
- package/dist/src/render/renderer.js +0 -455
- package/dist/src/render/renderer.js.map +0 -1
- package/dist/src/render/renderpass.js +0 -200
- package/dist/src/render/renderpass.js.map +0 -1
- package/dist/src/render/shadowmap_pass.js +0 -56
- package/dist/src/render/shadowmap_pass.js.map +0 -1
- package/dist/src/render/sky.js +0 -1103
- package/dist/src/render/sky.js.map +0 -1
- package/dist/src/render/weightedblended_oit.js +0 -168
- package/dist/src/render/weightedblended_oit.js.map +0 -1
- package/dist/src/scene/batchgroup.js +0 -162
- package/dist/src/scene/batchgroup.js.map +0 -1
- package/dist/src/scene/environment.js +0 -209
- package/dist/src/scene/environment.js.map +0 -1
- package/dist/src/scene/graph_node.js +0 -72
- package/dist/src/scene/graph_node.js.map +0 -1
- package/dist/src/scene/light.js +0 -416
- package/dist/src/scene/light.js.map +0 -1
- package/dist/src/scene/mesh.js +0 -341
- package/dist/src/scene/mesh.js.map +0 -1
- package/dist/src/scene/octree.js +0 -649
- package/dist/src/scene/octree.js.map +0 -1
- package/dist/src/scene/particlesys.js +0 -738
- package/dist/src/scene/particlesys.js.map +0 -1
- package/dist/src/scene/raycast_visitor.js +0 -103
- package/dist/src/scene/raycast_visitor.js.map +0 -1
- package/dist/src/scene/scene.js +0 -284
- package/dist/src/scene/scene.js.map +0 -1
- package/dist/src/scene/scene_node.js +0 -732
- package/dist/src/scene/scene_node.js.map +0 -1
- package/dist/src/scene/terrain/grass.js +0 -278
- package/dist/src/scene/terrain/grass.js.map +0 -1
- package/dist/src/scene/terrain/heightfield.js +0 -475
- package/dist/src/scene/terrain/heightfield.js.map +0 -1
- package/dist/src/scene/terrain/patch.js +0 -530
- package/dist/src/scene/terrain/patch.js.map +0 -1
- package/dist/src/scene/terrain/quadtree.js +0 -461
- package/dist/src/scene/terrain/quadtree.js.map +0 -1
- package/dist/src/scene/terrain/terrain.js +0 -246
- package/dist/src/scene/terrain/terrain.js.map +0 -1
- package/dist/src/scene/terrain-cm/grass.js +0 -594
- package/dist/src/scene/terrain-cm/grass.js.map +0 -1
- package/dist/src/scene/terrain-cm/grassmaterial.js +0 -159
- package/dist/src/scene/terrain-cm/grassmaterial.js.map +0 -1
- package/dist/src/scene/terrain-cm/terrain-cm.js +0 -538
- package/dist/src/scene/terrain-cm/terrain-cm.js.map +0 -1
- package/dist/src/scene/water.js +0 -374
- package/dist/src/scene/water.js.map +0 -1
- package/dist/src/shaders/atmosphere.js +0 -957
- package/dist/src/shaders/atmosphere.js.map +0 -1
- package/dist/src/shaders/fog.js +0 -112
- package/dist/src/shaders/fog.js.map +0 -1
- package/dist/src/shaders/misc.js +0 -266
- package/dist/src/shaders/misc.js.map +0 -1
- package/dist/src/shaders/noise.js +0 -222
- package/dist/src/shaders/noise.js.map +0 -1
- package/dist/src/shaders/pbr.js +0 -51
- package/dist/src/shaders/pbr.js.map +0 -1
- package/dist/src/shaders/shadow.js +0 -636
- package/dist/src/shaders/shadow.js.map +0 -1
- package/dist/src/shaders/ssr.js +0 -490
- package/dist/src/shaders/ssr.js.map +0 -1
- package/dist/src/shaders/temporal.js +0 -215
- package/dist/src/shaders/temporal.js.map +0 -1
- package/dist/src/shaders/water.js +0 -756
- package/dist/src/shaders/water.js.map +0 -1
- package/dist/src/shadow/esm.js +0 -237
- package/dist/src/shadow/esm.js.map +0 -1
- package/dist/src/shadow/pcf_opt.js +0 -181
- package/dist/src/shadow/pcf_opt.js.map +0 -1
- package/dist/src/shadow/pcf_pd.js +0 -189
- package/dist/src/shadow/pcf_pd.js.map +0 -1
- package/dist/src/shadow/shader.js +0 -37
- package/dist/src/shadow/shader.js.map +0 -1
- package/dist/src/shadow/shadow_impl.js +0 -15
- package/dist/src/shadow/shadow_impl.js.map +0 -1
- package/dist/src/shadow/shadowmapper.js +0 -790
- package/dist/src/shadow/shadowmapper.js.map +0 -1
- package/dist/src/shadow/ssm.js +0 -159
- package/dist/src/shadow/ssm.js.map +0 -1
- package/dist/src/shadow/vsm.js +0 -297
- package/dist/src/shadow/vsm.js.map +0 -1
- package/dist/src/shapes/box.js +0 -386
- package/dist/src/shapes/box.js.map +0 -1
- package/dist/src/shapes/cylinder.js +0 -125
- package/dist/src/shapes/cylinder.js.map +0 -1
- package/dist/src/shapes/plane.js +0 -88
- package/dist/src/shapes/plane.js.map +0 -1
- package/dist/src/shapes/shape.js +0 -87
- package/dist/src/shapes/shape.js.map +0 -1
- package/dist/src/shapes/sphere.js +0 -114
- package/dist/src/shapes/sphere.js.map +0 -1
- package/dist/src/shapes/tetrahedron.js +0 -188
- package/dist/src/shapes/tetrahedron.js.map +0 -1
- package/dist/src/shapes/torus.js +0 -111
- package/dist/src/shapes/torus.js.map +0 -1
- package/dist/src/utility/aabbtree.js +0 -400
- package/dist/src/utility/aabbtree.js.map +0 -1
- package/dist/src/utility/bounding_volume.js +0 -29
- package/dist/src/utility/bounding_volume.js.map +0 -1
- package/dist/src/utility/debug.js +0 -28
- package/dist/src/utility/debug.js.map +0 -1
- package/dist/src/utility/draco/decoder.js +0 -116
- package/dist/src/utility/draco/decoder.js.map +0 -1
- package/dist/src/utility/misc.js +0 -105
- package/dist/src/utility/misc.js.map +0 -1
- package/dist/src/utility/panorama.js +0 -163
- package/dist/src/utility/panorama.js.map +0 -1
- package/dist/src/utility/pmrem.js +0 -354
- package/dist/src/utility/pmrem.js.map +0 -1
- package/dist/src/utility/rendermipmap.js +0 -115
- package/dist/src/utility/rendermipmap.js.map +0 -1
- package/dist/src/utility/serialization/json.js +0 -402
- package/dist/src/utility/serialization/json.js.map +0 -1
- package/dist/src/utility/serialization/manager.js +0 -623
- package/dist/src/utility/serialization/manager.js.map +0 -1
- package/dist/src/utility/serialization/scene/animation.js +0 -248
- package/dist/src/utility/serialization/scene/animation.js.map +0 -1
- package/dist/src/utility/serialization/scene/batch.js +0 -59
- package/dist/src/utility/serialization/scene/batch.js.map +0 -1
- package/dist/src/utility/serialization/scene/camera.js +0 -790
- package/dist/src/utility/serialization/scene/camera.js.map +0 -1
- package/dist/src/utility/serialization/scene/common.js +0 -222
- package/dist/src/utility/serialization/scene/common.js.map +0 -1
- package/dist/src/utility/serialization/scene/light.js +0 -575
- package/dist/src/utility/serialization/scene/light.js.map +0 -1
- package/dist/src/utility/serialization/scene/material.js +0 -1111
- package/dist/src/utility/serialization/scene/material.js.map +0 -1
- package/dist/src/utility/serialization/scene/mesh.js +0 -148
- package/dist/src/utility/serialization/scene/mesh.js.map +0 -1
- package/dist/src/utility/serialization/scene/misc.js +0 -39
- package/dist/src/utility/serialization/scene/misc.js.map +0 -1
- package/dist/src/utility/serialization/scene/node.js +0 -451
- package/dist/src/utility/serialization/scene/node.js.map +0 -1
- package/dist/src/utility/serialization/scene/particle.js +0 -425
- package/dist/src/utility/serialization/scene/particle.js.map +0 -1
- package/dist/src/utility/serialization/scene/primitive.js +0 -692
- package/dist/src/utility/serialization/scene/primitive.js.map +0 -1
- package/dist/src/utility/serialization/scene/scene.js +0 -704
- package/dist/src/utility/serialization/scene/scene.js.map +0 -1
- package/dist/src/utility/serialization/scene/terrain.js +0 -488
- package/dist/src/utility/serialization/scene/terrain.js.map +0 -1
- package/dist/src/utility/serialization/scene/water.js +0 -465
- package/dist/src/utility/serialization/scene/water.js.map +0 -1
- package/dist/src/utility/shprojector.js +0 -297
- package/dist/src/utility/shprojector.js.map +0 -1
- package/dist/src/utility/textures/ggxlut.js +0 -213
- package/dist/src/utility/textures/ggxlut.js.map +0 -1
- package/dist/src/utility/textures/gradientnoise.js +0 -62
- package/dist/src/utility/textures/gradientnoise.js.map +0 -1
- package/dist/src/utility/textures/randomnoise.js +0 -41
- package/dist/src/utility/textures/randomnoise.js.map +0 -1
- package/dist/src/values.js +0 -162
- package/dist/src/values.js.map +0 -1
- package/dist/utility/blueprint/material/common.js +0 -7
- package/dist/utility/blueprint/material/common.js.map +0 -1
- package/dist/utility/serialization/blueprint/constants.js +0 -255
- package/dist/utility/serialization/blueprint/constants.js.map +0 -1
- package/dist/utility/serialization/blueprint/material/constants.js +0 -203
- package/dist/utility/serialization/blueprint/material/constants.js.map +0 -1
- package/dist/utility/serialization/blueprint/material/texture.js +0 -165
- package/dist/utility/serialization/blueprint/material/texture.js.map +0 -1
- package/dist/utility/serialization/scene/cloth_script.js +0 -834
- package/dist/utility/serialization/scene/cloth_script.js.map +0 -1
- package/dist/utility/serialization/scene/spring_script.js +0 -596
- package/dist/utility/serialization/scene/spring_script.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Vector3, Vector4, Vector2 } from '@zephyr3d/base';
|
|
2
|
-
import { RENDER_PASS_TYPE_DEPTH, RENDER_PASS_TYPE_SHADOWMAP, RENDER_PASS_TYPE_OBJECT_COLOR, RENDER_PASS_TYPE_LIGHT, MaterialVaryingFlags, MORPH_WEIGHTS_VECTOR_COUNT, MORPH_TARGET_POSITION, MORPH_TARGET_NORMAL, MORPH_TARGET_TANGENT, MORPH_ATTRIBUTE_VECTOR_COUNT } from '../../values.js';
|
|
2
|
+
import { RENDER_PASS_TYPE_DEPTH, RENDER_PASS_TYPE_SHADOWMAP, RENDER_PASS_TYPE_OBJECT_COLOR, RENDER_PASS_TYPE_LIGHT, MaterialVaryingFlags, MAX_CLUSTERED_LIGHTS, MORPH_WEIGHTS_VECTOR_COUNT, MORPH_TARGET_POSITION, MORPH_TARGET_NORMAL, MORPH_TARGET_TANGENT, MORPH_ATTRIBUTE_VECTOR_COUNT } from '../../values.js';
|
|
3
3
|
import { ProgramBuilder } from '@zephyr3d/device';
|
|
4
4
|
import { decodeNormalizedFloatFromRGBA, linearToGamma } from '../../shaders/misc.js';
|
|
5
5
|
import { fetchSampler } from '../../utility/misc.js';
|
|
@@ -31,9 +31,9 @@ const UNIFORM_NAME_BONE_TEXTURE_SIZE = 'Z_UniformBoneTexSize';
|
|
|
31
31
|
const UNIFORM_NAME_BONE_INV_BIND_MATRIX = 'Z_UniformBoneInvBindMatrix';
|
|
32
32
|
const UNIFORM_NAME_MORPH_DATA = 'Z_UniformMorphData';
|
|
33
33
|
const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
34
|
-
/**
|
|
35
|
-
* Helper shader functions for the builtin material system
|
|
36
|
-
* @public
|
|
34
|
+
/**
|
|
35
|
+
* Helper shader functions for the builtin material system
|
|
36
|
+
* @public
|
|
37
37
|
*/ class ShaderHelper {
|
|
38
38
|
static BILLBOARD_SPHERICAL = 1;
|
|
39
39
|
static BILLBOARD_SYLINDRAL = 2;
|
|
@@ -45,7 +45,6 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
45
45
|
/** @internal */ static _drawableBindGroupLayouts = {};
|
|
46
46
|
/** @internal */ static _lightUniformShadow = {
|
|
47
47
|
sunDir: new Vector3(),
|
|
48
|
-
envLightStrength: 1,
|
|
49
48
|
shadowCascades: 1,
|
|
50
49
|
positionAndRange: new Vector4(),
|
|
51
50
|
directionAndCutoff: new Vector4(),
|
|
@@ -55,7 +54,10 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
55
54
|
depthBiasValues: new Vector4(),
|
|
56
55
|
shadowCameraParams: new Vector4(),
|
|
57
56
|
depthBiasScales: new Vector4(),
|
|
58
|
-
shadowMatrices: new Float32Array(16 * 4)
|
|
57
|
+
shadowMatrices: new Float32Array(16 * 4),
|
|
58
|
+
shadowStrength: 1,
|
|
59
|
+
envLightStrength: 1,
|
|
60
|
+
envLightSpecularStrength: 1
|
|
59
61
|
};
|
|
60
62
|
/** @internal */ static _fogUniforms = {
|
|
61
63
|
withAerialPerspective: 0,
|
|
@@ -122,25 +124,25 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
122
124
|
}
|
|
123
125
|
return bindGroupLayout;
|
|
124
126
|
}
|
|
125
|
-
/**
|
|
126
|
-
* Prepares the fragment shader which is going to be used in our material system
|
|
127
|
-
*
|
|
128
|
-
* @remarks
|
|
129
|
-
* This function will setup all nessesary uniforms acoording to the drawing context
|
|
130
|
-
*
|
|
131
|
-
* @param pb - The program builder
|
|
132
|
-
* @param ctx - The drawing context
|
|
127
|
+
/**
|
|
128
|
+
* Prepares the fragment shader which is going to be used in our material system
|
|
129
|
+
*
|
|
130
|
+
* @remarks
|
|
131
|
+
* This function will setup all nessesary uniforms acoording to the drawing context
|
|
132
|
+
*
|
|
133
|
+
* @param pb - The program builder
|
|
134
|
+
* @param ctx - The drawing context
|
|
133
135
|
*/ static prepareFragmentShader(pb, ctx) {
|
|
134
136
|
this.setupGlobalUniforms(pb, ctx);
|
|
135
137
|
}
|
|
136
|
-
/**
|
|
137
|
-
* Prepares the vertex shader which is going to be used in our material system
|
|
138
|
-
*
|
|
139
|
-
* @remarks
|
|
140
|
-
* This function will setup all nessesary uniforms according to the drawing context
|
|
141
|
-
*
|
|
142
|
-
* @param pb - The program builder
|
|
143
|
-
* @param ctx - The drawing context
|
|
138
|
+
/**
|
|
139
|
+
* Prepares the vertex shader which is going to be used in our material system
|
|
140
|
+
*
|
|
141
|
+
* @remarks
|
|
142
|
+
* This function will setup all nessesary uniforms according to the drawing context
|
|
143
|
+
*
|
|
144
|
+
* @param pb - The program builder
|
|
145
|
+
* @param ctx - The drawing context
|
|
144
146
|
*/ static prepareVertexShader(pb, ctx) {
|
|
145
147
|
this.setupGlobalUniforms(pb, ctx);
|
|
146
148
|
this.prepareVertexShaderCommon(pb, ctx);
|
|
@@ -164,6 +166,7 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
164
166
|
pb.vec2('renderSize'),
|
|
165
167
|
pb.vec2('jitterValue'),
|
|
166
168
|
pb.float('roughnessFactor'),
|
|
169
|
+
pb.float('shadowDebugCascades'),
|
|
167
170
|
pb.float('frameDeltaTime'),
|
|
168
171
|
pb.float('elapsedTime'),
|
|
169
172
|
pb.int('framestamp')
|
|
@@ -207,10 +210,13 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
207
210
|
pb.vec4('shadowCameraParams'),
|
|
208
211
|
pb.vec4('depthBiasScales'),
|
|
209
212
|
pb.vec4[16]('shadowMatrices'),
|
|
210
|
-
pb.float('
|
|
213
|
+
pb.float('shadowStrength'),
|
|
214
|
+
pb.float('envLightStrength'),
|
|
215
|
+
pb.float('envLightSpecularStrength')
|
|
211
216
|
]) : pb.defineStruct([
|
|
212
217
|
pb.vec3('sunDir'),
|
|
213
218
|
pb.float('envLightStrength'),
|
|
219
|
+
pb.float('envLightSpecularStrength'),
|
|
214
220
|
pb.vec4('clusterParams'),
|
|
215
221
|
pb.ivec4('countParams'),
|
|
216
222
|
pb.ivec2('lightIndexTexSize')
|
|
@@ -218,7 +224,7 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
218
224
|
scope.camera = cameraStruct().uniform(0);
|
|
219
225
|
scope.light = lightStruct().uniform(0);
|
|
220
226
|
if (useClusteredLighting) {
|
|
221
|
-
scope[UNIFORM_NAME_LIGHT_BUFFER] = pb.vec4[(
|
|
227
|
+
scope[UNIFORM_NAME_LIGHT_BUFFER] = pb.vec4[(MAX_CLUSTERED_LIGHTS + 1) * 4]().uniformBuffer(0);
|
|
222
228
|
scope[UNIFORM_NAME_LIGHT_INDEX_TEXTURE] = (pb.getDevice().type === 'webgl' ? pb.tex2D() : pb.utex2D()).uniform(0);
|
|
223
229
|
}
|
|
224
230
|
scope[UNIFORM_NAME_BAKED_SKY_MAP] = pb.texCube().uniform(0);
|
|
@@ -248,30 +254,30 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
248
254
|
}
|
|
249
255
|
}
|
|
250
256
|
}
|
|
251
|
-
/**
|
|
252
|
-
* This function checks if the shader needs to process skeletal animation.
|
|
253
|
-
*
|
|
254
|
-
* @param scope - Current shader scope
|
|
255
|
-
*
|
|
256
|
-
* @returns true if the shader needs to process skeletal animation, otherwise false.
|
|
257
|
+
/**
|
|
258
|
+
* This function checks if the shader needs to process skeletal animation.
|
|
259
|
+
*
|
|
260
|
+
* @param scope - Current shader scope
|
|
261
|
+
*
|
|
262
|
+
* @returns true if the shader needs to process skeletal animation, otherwise false.
|
|
257
263
|
*/ static hasSkinning(scope) {
|
|
258
264
|
return !!scope[UNIFORM_NAME_BONE_MATRICES];
|
|
259
265
|
}
|
|
260
|
-
/**
|
|
261
|
-
* This function checks if the shader needs to process morph target animation.
|
|
262
|
-
*
|
|
263
|
-
* @param scope - Current shader scope
|
|
264
|
-
*
|
|
265
|
-
* @returns true if the shader needs to process morph target animation, otherwise false.
|
|
266
|
+
/**
|
|
267
|
+
* This function checks if the shader needs to process morph target animation.
|
|
268
|
+
*
|
|
269
|
+
* @param scope - Current shader scope
|
|
270
|
+
*
|
|
271
|
+
* @returns true if the shader needs to process morph target animation, otherwise false.
|
|
266
272
|
*/ static hasMorphing(scope) {
|
|
267
273
|
return !!scope[UNIFORM_NAME_MORPH_DATA];
|
|
268
274
|
}
|
|
269
|
-
/**
|
|
270
|
-
* Calculate skinning matrix for current vertex
|
|
271
|
-
*
|
|
272
|
-
* @param scope - Current shader scope
|
|
273
|
-
*
|
|
274
|
-
* @returns Skinning matrix for current vertex, or null if there is not skeletal animation
|
|
275
|
+
/**
|
|
276
|
+
* Calculate skinning matrix for current vertex
|
|
277
|
+
*
|
|
278
|
+
* @param scope - Current shader scope
|
|
279
|
+
*
|
|
280
|
+
* @returns Skinning matrix for current vertex, or null if there is not skeletal animation
|
|
275
281
|
*/ static calculateSkinMatrix(scope) {
|
|
276
282
|
if (!this.hasSkinning(scope)) {
|
|
277
283
|
return null;
|
|
@@ -426,12 +432,12 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
426
432
|
scope.$l[that.SKIN_PREV_MATRIX_NAME] = scope[funcNameGetSkinningMatrix](scope[that.SKIN_BONE_OFFSET].y);
|
|
427
433
|
}
|
|
428
434
|
}
|
|
429
|
-
/**
|
|
430
|
-
* Calculates the vertex position of type vec3 in object space
|
|
431
|
-
*
|
|
432
|
-
* @param scope - Current shader scope
|
|
433
|
-
* @param skinMatrix - The skinning matrix if there is skeletal animation, otherwise null
|
|
434
|
-
* @returns The calculated vertex position in object space, or null if pos is null
|
|
435
|
+
/**
|
|
436
|
+
* Calculates the vertex position of type vec3 in object space
|
|
437
|
+
*
|
|
438
|
+
* @param scope - Current shader scope
|
|
439
|
+
* @param skinMatrix - The skinning matrix if there is skeletal animation, otherwise null
|
|
440
|
+
* @returns The calculated vertex position in object space, or null if pos is null
|
|
435
441
|
*/ static resolveVertexPosition(scope) {
|
|
436
442
|
const pb = scope.$builder;
|
|
437
443
|
if (pb.shaderKind !== 'vertex') {
|
|
@@ -473,12 +479,12 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
473
479
|
});
|
|
474
480
|
return scope[that.SKIN_MATRIX_NAME] && scope[that.SKIN_PREV_MATRIX_NAME] ? scope.Z_resolveVertexPosition(scope[that.SKIN_MATRIX_NAME], scope[that.SKIN_PREV_MATRIX_NAME]) : scope[that.SKIN_MATRIX_NAME] ? scope.Z_resolveVertexPosition(scope[that.SKIN_MATRIX_NAME]) : scope.Z_resolveVertexPosition();
|
|
475
481
|
}
|
|
476
|
-
/**
|
|
477
|
-
* Resolve motion vector
|
|
478
|
-
*
|
|
479
|
-
* @param scope - Current shader scope
|
|
480
|
-
* @param worldPos - Current object position in world space
|
|
481
|
-
* @param prevWorldPos - Previous object position in world space
|
|
482
|
+
/**
|
|
483
|
+
* Resolve motion vector
|
|
484
|
+
*
|
|
485
|
+
* @param scope - Current shader scope
|
|
486
|
+
* @param worldPos - Current object position in world space
|
|
487
|
+
* @param prevWorldPos - Previous object position in world space
|
|
482
488
|
*/ static resolveMotionVector(scope, worldPos, prevWorldPos) {
|
|
483
489
|
const that = this;
|
|
484
490
|
const pb = scope.$builder;
|
|
@@ -489,13 +495,13 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
489
495
|
scope.$outputs.zMotionVectorPosPrev = pb.mul(prevUnjitteredVPMatrix, pb.vec4(prevWorldPos.xyz, 1));
|
|
490
496
|
}
|
|
491
497
|
}
|
|
492
|
-
/**
|
|
493
|
-
* Calculates the normal vector of type vec3 in object space
|
|
494
|
-
*
|
|
495
|
-
* @param scope - Current shader scope
|
|
496
|
-
* @param normal - Vertex normal input, must be type of vec3, null if no vertex normal input
|
|
497
|
-
* @param skinMatrix - The skinning matrix if there is skeletal animation, otherwise null
|
|
498
|
-
* @returns The calculated normal vector in object space, or null if normal is null
|
|
498
|
+
/**
|
|
499
|
+
* Calculates the normal vector of type vec3 in object space
|
|
500
|
+
*
|
|
501
|
+
* @param scope - Current shader scope
|
|
502
|
+
* @param normal - Vertex normal input, must be type of vec3, null if no vertex normal input
|
|
503
|
+
* @param skinMatrix - The skinning matrix if there is skeletal animation, otherwise null
|
|
504
|
+
* @returns The calculated normal vector in object space, or null if normal is null
|
|
499
505
|
*/ static resolveVertexNormal(scope, normal) {
|
|
500
506
|
const pb = scope.$builder;
|
|
501
507
|
if (pb.shaderKind !== 'vertex') {
|
|
@@ -520,13 +526,13 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
520
526
|
return normal;
|
|
521
527
|
}
|
|
522
528
|
}
|
|
523
|
-
/**
|
|
524
|
-
* Calculates the tangent vector of type vec3 in object space
|
|
525
|
-
*
|
|
526
|
-
* @param scope - Current shader scope
|
|
527
|
-
* @param tangent - Vertex tangent input, must be type of vec4, null if no vertex tangent input
|
|
528
|
-
* @param skinMatrix - The skinning matrix if there is skeletal animation, otherwise null
|
|
529
|
-
* @returns The calculated tangent vector of type vec4 in object space, or null if tangent is null
|
|
529
|
+
/**
|
|
530
|
+
* Calculates the tangent vector of type vec3 in object space
|
|
531
|
+
*
|
|
532
|
+
* @param scope - Current shader scope
|
|
533
|
+
* @param tangent - Vertex tangent input, must be type of vec4, null if no vertex tangent input
|
|
534
|
+
* @param skinMatrix - The skinning matrix if there is skeletal animation, otherwise null
|
|
535
|
+
* @returns The calculated tangent vector of type vec4 in object space, or null if tangent is null
|
|
530
536
|
*/ static resolveVertexTangent(scope, tangent) {
|
|
531
537
|
const pb = scope.$builder;
|
|
532
538
|
if (pb.shaderKind !== 'vertex') {
|
|
@@ -551,18 +557,18 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
551
557
|
return tangent;
|
|
552
558
|
}
|
|
553
559
|
}
|
|
554
|
-
/**
|
|
555
|
-
* Gets the uniform variable of type mat4 which holds the world matrix of current object to be drawn
|
|
556
|
-
* @param scope - Current shader scope
|
|
557
|
-
* @returns The world matrix of current object to be drawn
|
|
560
|
+
/**
|
|
561
|
+
* Gets the uniform variable of type mat4 which holds the world matrix of current object to be drawn
|
|
562
|
+
* @param scope - Current shader scope
|
|
563
|
+
* @returns The world matrix of current object to be drawn
|
|
558
564
|
*/ static getWorldMatrix(scope) {
|
|
559
565
|
const pb = scope.$builder;
|
|
560
566
|
return scope[UNIFORM_NAME_WORLD_MATRIX] ?? pb.mat4(this.getInstancedUniform(scope, 0), this.getInstancedUniform(scope, 1), this.getInstancedUniform(scope, 2), this.getInstancedUniform(scope, 3));
|
|
561
567
|
}
|
|
562
|
-
/**
|
|
563
|
-
* Gets the uniform variable of type mat4 which holds the world matrix at previous frame of current object to be drawn
|
|
564
|
-
* @param scope - Current shader scope
|
|
565
|
-
* @returns The world matrix at previous frame of current object to be drawn
|
|
568
|
+
/**
|
|
569
|
+
* Gets the uniform variable of type mat4 which holds the world matrix at previous frame of current object to be drawn
|
|
570
|
+
* @param scope - Current shader scope
|
|
571
|
+
* @returns The world matrix at previous frame of current object to be drawn
|
|
566
572
|
*/ static getPrevWorldMatrix(scope) {
|
|
567
573
|
const pb = scope.$builder;
|
|
568
574
|
const that = this;
|
|
@@ -593,28 +599,28 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
593
599
|
return scope.Z_getPrevWorldMatrix(framestamp);
|
|
594
600
|
}
|
|
595
601
|
}
|
|
596
|
-
/**
|
|
597
|
-
* Gets the instance uniform value of type vec4 by uniform index
|
|
598
|
-
* @param scope - Current shader scope
|
|
599
|
-
* @returns instance uniform value
|
|
602
|
+
/**
|
|
603
|
+
* Gets the instance uniform value of type vec4 by uniform index
|
|
604
|
+
* @param scope - Current shader scope
|
|
605
|
+
* @returns instance uniform value
|
|
600
606
|
*/ static getInstancedUniform(scope, uniformIndex) {
|
|
601
607
|
const pb = scope.$builder;
|
|
602
608
|
return scope[UNIFORM_NAME_INSTANCE_DATA].at(pb.add(pb.mul(scope[UNIFORM_NAME_INSTANCE_DATA_STRIDE], pb.uint(scope.$builtins.instanceIndex)), scope[UNIFORM_NAME_INSTANCE_DATA_OFFSET], pb.uint(uniformIndex)));
|
|
603
609
|
}
|
|
604
|
-
/**
|
|
605
|
-
* Gets the uniform variable of type mat4 which holds the normal matrix of current object to be drawn
|
|
606
|
-
*
|
|
607
|
-
* @param scope - Current shader scope
|
|
608
|
-
* @returns The normal matrix of current object to be drawn
|
|
610
|
+
/**
|
|
611
|
+
* Gets the uniform variable of type mat4 which holds the normal matrix of current object to be drawn
|
|
612
|
+
*
|
|
613
|
+
* @param scope - Current shader scope
|
|
614
|
+
* @returns The normal matrix of current object to be drawn
|
|
609
615
|
*/ static getNormalMatrix(scope) {
|
|
610
616
|
return this.getWorldMatrix(scope);
|
|
611
617
|
}
|
|
612
|
-
/**
|
|
613
|
-
* Vertex shader drawable stuff
|
|
614
|
-
*
|
|
615
|
-
* @param scope - Current shader scope
|
|
616
|
-
* @param skinning - true if skinning is used, otherwise false.
|
|
617
|
-
* @param instanced - true if instancing is used, otherwise false.
|
|
618
|
+
/**
|
|
619
|
+
* Vertex shader drawable stuff
|
|
620
|
+
*
|
|
621
|
+
* @param scope - Current shader scope
|
|
622
|
+
* @param skinning - true if skinning is used, otherwise false.
|
|
623
|
+
* @param instanced - true if instancing is used, otherwise false.
|
|
618
624
|
*/ static vertexShaderDrawableStuff(scope, skinning, morphing, instanced) {
|
|
619
625
|
const pb = scope.$builder;
|
|
620
626
|
if (instanced) {
|
|
@@ -657,6 +663,7 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
657
663
|
worldMatrix: camera.worldMatrix,
|
|
658
664
|
params: new Vector4(camera.getNearPlane(), camera.getFarPlane(), ctx.flip ? -1 : 1, linear ? 0 : 1),
|
|
659
665
|
roughnessFactor: camera.SSR ? camera.ssrRoughnessFactor : 1,
|
|
666
|
+
shadowDebugCascades: camera.shadowDebugCascades ? 1 : 0,
|
|
660
667
|
frameDeltaTime: ctx.device.frameInfo.elapsedFrame * 0.001,
|
|
661
668
|
elapsedTime: ctx.device.frameInfo.elapsedOverall * 0.001,
|
|
662
669
|
framestamp: ctx.device.frameInfo.frameCounter
|
|
@@ -708,6 +715,7 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
708
715
|
clusterParams: clusterParams,
|
|
709
716
|
countParams: countParams,
|
|
710
717
|
envLightStrength: ctx.env.light.strength ?? 0,
|
|
718
|
+
envLightSpecularStrength: ctx.env.light.specularStrength ?? 1,
|
|
711
719
|
lightIndexTexSize: new Int32Array([
|
|
712
720
|
lightIndexTexture.width,
|
|
713
721
|
lightIndexTexture.height
|
|
@@ -723,7 +731,6 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
723
731
|
/** @internal */ static setLightUniformsShadow(bindGroup, ctx, light) {
|
|
724
732
|
const shadowMapParams = ctx.shadowMapInfo.get(light);
|
|
725
733
|
this._lightUniformShadow.sunDir = ctx.sunLight ? ctx.sunLight.directionAndCutoff.xyz().scaleBy(-1) : this.defaultSunDir;
|
|
726
|
-
this._lightUniformShadow.envLightStrength = ctx.env?.light.strength ?? 0;
|
|
727
734
|
this._lightUniformShadow.shadowCascades = shadowMapParams.numShadowCascades;
|
|
728
735
|
this._lightUniformShadow.positionAndRange.set(light.positionAndRange);
|
|
729
736
|
this._lightUniformShadow.directionAndCutoff.set(light.directionAndCutoff);
|
|
@@ -734,6 +741,9 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
734
741
|
this._lightUniformShadow.shadowCameraParams.set(shadowMapParams.cameraParams);
|
|
735
742
|
this._lightUniformShadow.depthBiasScales.set(shadowMapParams.depthBiasScales);
|
|
736
743
|
this._lightUniformShadow.shadowMatrices.set(shadowMapParams.shadowMatrices);
|
|
744
|
+
this._lightUniformShadow.shadowStrength = light.shadow.shadowStrength;
|
|
745
|
+
this._lightUniformShadow.envLightStrength = ctx.env?.light.strength ?? 0;
|
|
746
|
+
this._lightUniformShadow.envLightSpecularStrength = ctx.env?.light.specularStrength ?? 1;
|
|
737
747
|
bindGroup.setValue('light', this._lightUniformShadow);
|
|
738
748
|
bindGroup.setTexture(UNIFORM_NAME_SHADOW_MAP, shadowMapParams.shadowMap, shadowMapParams.shadowMapSampler);
|
|
739
749
|
bindGroup.setTexture(UNIFORM_NAME_BAKED_SKY_MAP, ctx.scene.env.sky.getBakedSkyTexture(ctx));
|
|
@@ -741,133 +751,144 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
741
751
|
ctx.env.light.envLight.updateBindGroup(bindGroup);
|
|
742
752
|
}
|
|
743
753
|
}
|
|
744
|
-
/**
|
|
745
|
-
* Gets the uniform variable of type float which holds the strength of the environment light
|
|
746
|
-
*
|
|
747
|
-
* @remarks
|
|
748
|
-
* This function can only be used in the fragment shader
|
|
749
|
-
*
|
|
750
|
-
* @param scope - Current shader scope
|
|
751
|
-
* @returns The uniform variable of which presents the strength of the environment light
|
|
754
|
+
/**
|
|
755
|
+
* Gets the uniform variable of type float which holds the strength of the environment light
|
|
756
|
+
*
|
|
757
|
+
* @remarks
|
|
758
|
+
* This function can only be used in the fragment shader
|
|
759
|
+
*
|
|
760
|
+
* @param scope - Current shader scope
|
|
761
|
+
* @returns The uniform variable of which presents the strength of the environment light
|
|
752
762
|
*/ static getEnvLightStrength(scope) {
|
|
753
763
|
return scope.light.envLightStrength;
|
|
754
764
|
}
|
|
755
|
-
/**
|
|
756
|
-
* Gets
|
|
757
|
-
*
|
|
758
|
-
* @
|
|
765
|
+
/**
|
|
766
|
+
* Gets the uniform variable of type float which holds the specular strength of the environment light
|
|
767
|
+
*
|
|
768
|
+
* @remarks
|
|
769
|
+
* This function can only be used in the fragment shader
|
|
770
|
+
*
|
|
771
|
+
* @param scope - Current shader scope
|
|
772
|
+
* @returns The uniform variable which presents the specular strength of the environment light
|
|
773
|
+
*/ static getEnvLightSpecularStrength(scope) {
|
|
774
|
+
return scope.light.envLightSpecularStrength ?? scope.$builder.float(1);
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Gets current scene color texture
|
|
778
|
+
* @param scope - Current shader scope
|
|
779
|
+
* @returns current scene color texture
|
|
759
780
|
*/ static getSceneColorTexture(scope) {
|
|
760
781
|
return scope[UNIFORM_NAME_SCENE_COLOR_MAP];
|
|
761
782
|
}
|
|
762
|
-
/**
|
|
763
|
-
* Gets the size of current scene color texture
|
|
764
|
-
* @param scope - Current shader scope
|
|
765
|
-
* @returns The size of current scene color texture
|
|
783
|
+
/**
|
|
784
|
+
* Gets the size of current scene color texture
|
|
785
|
+
* @param scope - Current shader scope
|
|
786
|
+
* @returns The size of current scene color texture
|
|
766
787
|
*/ static getSceneColorTextureSize(scope) {
|
|
767
788
|
return scope[UNIFORM_NAME_SCENE_COLOR_MAP_SIZE];
|
|
768
789
|
}
|
|
769
|
-
/**
|
|
770
|
-
* Gets current linear depth texture
|
|
771
|
-
* @param scope - Current shader scope
|
|
772
|
-
* @returns current linear depth texture
|
|
790
|
+
/**
|
|
791
|
+
* Gets current linear depth texture
|
|
792
|
+
* @param scope - Current shader scope
|
|
793
|
+
* @returns current linear depth texture
|
|
773
794
|
*/ static getLinearDepthTexture(scope) {
|
|
774
795
|
return scope[UNIFORM_NAME_LINEAR_DEPTH_MAP];
|
|
775
796
|
}
|
|
776
|
-
/**
|
|
777
|
-
* Gets the size of current linear depth texture
|
|
778
|
-
* @param scope - Current shader scope
|
|
779
|
-
* @returns The size of current linear depth texture
|
|
797
|
+
/**
|
|
798
|
+
* Gets the size of current linear depth texture
|
|
799
|
+
* @param scope - Current shader scope
|
|
800
|
+
* @returns The size of current linear depth texture
|
|
780
801
|
*/ static getLinearDepthTextureSize(scope) {
|
|
781
802
|
return scope[UNIFORM_NAME_LINEAR_DEPTH_MAP_SIZE];
|
|
782
803
|
}
|
|
783
|
-
/**
|
|
784
|
-
* Gets current HiZ depth texture
|
|
785
|
-
* @param scope - Current shader scope
|
|
786
|
-
* @returns current HiZ depth texture
|
|
804
|
+
/**
|
|
805
|
+
* Gets current HiZ depth texture
|
|
806
|
+
* @param scope - Current shader scope
|
|
807
|
+
* @returns current HiZ depth texture
|
|
787
808
|
*/ static getHiZDepthTexture(scope) {
|
|
788
809
|
return scope[UNIFORM_NAME_HIZ_DEPTH_MAP];
|
|
789
810
|
}
|
|
790
|
-
/**
|
|
791
|
-
* Gets the size of current HiZ depth texture
|
|
792
|
-
* @param scope - Current shader scope
|
|
793
|
-
* @returns The size of current HiZ depth texture
|
|
811
|
+
/**
|
|
812
|
+
* Gets the size of current HiZ depth texture
|
|
813
|
+
* @param scope - Current shader scope
|
|
814
|
+
* @returns The size of current HiZ depth texture
|
|
794
815
|
*/ static getHiZDepthTextureSize(scope) {
|
|
795
816
|
return scope[UNIFORM_NAME_HIZ_DEPTH_MAP_INFO].xy;
|
|
796
817
|
}
|
|
797
|
-
/**
|
|
798
|
-
* Gets the mipmap levels count of current HiZ depth texture
|
|
799
|
-
* @param scope - Current shader scope
|
|
800
|
-
* @returns The mipmap levels count of current HiZ depth texture
|
|
818
|
+
/**
|
|
819
|
+
* Gets the mipmap levels count of current HiZ depth texture
|
|
820
|
+
* @param scope - Current shader scope
|
|
821
|
+
* @returns The mipmap levels count of current HiZ depth texture
|
|
801
822
|
*/ static getHiZDepthTextureMipLevelCount(scope) {
|
|
802
823
|
return scope[UNIFORM_NAME_HIZ_DEPTH_MAP_INFO].z;
|
|
803
824
|
}
|
|
804
|
-
/**
|
|
805
|
-
* Gets current baked skybox texture
|
|
806
|
-
* @param scope - Current shader scope
|
|
807
|
-
* @returns current baked skybox texture
|
|
825
|
+
/**
|
|
826
|
+
* Gets current baked skybox texture
|
|
827
|
+
* @param scope - Current shader scope
|
|
828
|
+
* @returns current baked skybox texture
|
|
808
829
|
*/ static getBakedSkyTexture(scope) {
|
|
809
830
|
return scope[UNIFORM_NAME_BAKED_SKY_MAP];
|
|
810
831
|
}
|
|
811
|
-
/**
|
|
812
|
-
* Gets the elapsed time in seconds
|
|
813
|
-
* @param scope - Current shader scope
|
|
814
|
-
* @returns The elapsed time in seconds
|
|
832
|
+
/**
|
|
833
|
+
* Gets the elapsed time in seconds
|
|
834
|
+
* @param scope - Current shader scope
|
|
835
|
+
* @returns The elapsed time in seconds
|
|
815
836
|
*/ static getElapsedTime(scope) {
|
|
816
837
|
return scope.camera.elapsedTime;
|
|
817
838
|
}
|
|
818
|
-
/**
|
|
819
|
-
* Gets the elapsed time since last frame in seconds
|
|
820
|
-
* @param scope - Current shader scope
|
|
821
|
-
* @returns The elapsed time since last frame in seconds
|
|
839
|
+
/**
|
|
840
|
+
* Gets the elapsed time since last frame in seconds
|
|
841
|
+
* @param scope - Current shader scope
|
|
842
|
+
* @returns The elapsed time since last frame in seconds
|
|
822
843
|
*/ static getElapsedTimeFrame(scope) {
|
|
823
844
|
return scope.camera.frameDeltaTime;
|
|
824
845
|
}
|
|
825
|
-
/**
|
|
826
|
-
* Gets the uniform variable of type vec3 which holds the camera position
|
|
827
|
-
* @param scope - Current shader scope
|
|
828
|
-
* @returns The camera position
|
|
846
|
+
/**
|
|
847
|
+
* Gets the uniform variable of type vec3 which holds the camera position
|
|
848
|
+
* @param scope - Current shader scope
|
|
849
|
+
* @returns The camera position
|
|
829
850
|
*/ static getCameraPosition(scope) {
|
|
830
851
|
return scope.camera.position.xyz;
|
|
831
852
|
}
|
|
832
|
-
/**
|
|
833
|
-
* Gets the uniform variable of type float which holds the roughness factor
|
|
834
|
-
* @param scope - Current shader scope
|
|
835
|
-
* @returns The roughness factor
|
|
853
|
+
/**
|
|
854
|
+
* Gets the uniform variable of type float which holds the roughness factor
|
|
855
|
+
* @param scope - Current shader scope
|
|
856
|
+
* @returns The roughness factor
|
|
836
857
|
*/ static getCameraRoughnessFactor(scope) {
|
|
837
858
|
return scope.camera.roughnessFactor;
|
|
838
859
|
}
|
|
839
|
-
/**
|
|
840
|
-
* Gets framebuffer size for rendering
|
|
841
|
-
* @param scope - Current shader scope
|
|
842
|
-
* @returns The roughness factor
|
|
860
|
+
/**
|
|
861
|
+
* Gets framebuffer size for rendering
|
|
862
|
+
* @param scope - Current shader scope
|
|
863
|
+
* @returns The roughness factor
|
|
843
864
|
*/ static getRenderSize(scope) {
|
|
844
865
|
return scope.camera.renderSize;
|
|
845
866
|
}
|
|
846
|
-
/**
|
|
847
|
-
* Gets the uniform variable of type uint which holds the framestamp
|
|
848
|
-
* @param scope - Current shader scope
|
|
849
|
-
* @returns The framestamp
|
|
867
|
+
/**
|
|
868
|
+
* Gets the uniform variable of type uint which holds the framestamp
|
|
869
|
+
* @param scope - Current shader scope
|
|
870
|
+
* @returns The framestamp
|
|
850
871
|
*/ static getFramestamp(scope) {
|
|
851
872
|
return scope.camera.framestamp;
|
|
852
873
|
}
|
|
853
|
-
/**
|
|
854
|
-
* Gets the clip plane flag
|
|
855
|
-
* @param scope - Current shader scope
|
|
856
|
-
* @returns A float value of 1 indices the clip plane presents, otherwise 0
|
|
874
|
+
/**
|
|
875
|
+
* Gets the clip plane flag
|
|
876
|
+
* @param scope - Current shader scope
|
|
877
|
+
* @returns A float value of 1 indices the clip plane presents, otherwise 0
|
|
857
878
|
*/ static getCameraClipPlaneFlag(scope) {
|
|
858
879
|
return scope.camera.position.w;
|
|
859
880
|
}
|
|
860
|
-
/**
|
|
861
|
-
* Gets the clip plane
|
|
862
|
-
* @param scope - Current shader scope
|
|
863
|
-
* @returns A vec4 presents the clip plane
|
|
881
|
+
/**
|
|
882
|
+
* Gets the clip plane
|
|
883
|
+
* @param scope - Current shader scope
|
|
884
|
+
* @returns A vec4 presents the clip plane
|
|
864
885
|
*/ static getCameraClipPlane(scope) {
|
|
865
886
|
return scope.camera.clipPlane;
|
|
866
887
|
}
|
|
867
|
-
/**
|
|
868
|
-
* Gets the uniform variable of type vec4 which holds the camera parameters
|
|
869
|
-
* @param scope - Current shader scope
|
|
870
|
-
* @returns The camera parameters
|
|
888
|
+
/**
|
|
889
|
+
* Gets the uniform variable of type vec4 which holds the camera parameters
|
|
890
|
+
* @param scope - Current shader scope
|
|
891
|
+
* @returns The camera parameters
|
|
871
892
|
*/ static getCameraParams(scope) {
|
|
872
893
|
return scope.camera.params;
|
|
873
894
|
}
|
|
@@ -880,87 +901,87 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
880
901
|
/** @internal */ static getClusteredLightIndexTexture(scope) {
|
|
881
902
|
return scope[UNIFORM_NAME_LIGHT_INDEX_TEXTURE];
|
|
882
903
|
}
|
|
883
|
-
/**
|
|
884
|
-
* Gets the uniform variable that contains atmosphere parameters
|
|
885
|
-
* @param scope - Current shader scope
|
|
886
|
-
* @returns The atmosphere parameters
|
|
904
|
+
/**
|
|
905
|
+
* Gets the uniform variable that contains atmosphere parameters
|
|
906
|
+
* @param scope - Current shader scope
|
|
907
|
+
* @returns The atmosphere parameters
|
|
887
908
|
*/ static getAtmosphereParams(scope) {
|
|
888
909
|
return scope.fog.atmosphereParams;
|
|
889
910
|
}
|
|
890
|
-
/**
|
|
891
|
-
* Gets the aerial perspective LUT
|
|
892
|
-
* @param scope - Current shader scope
|
|
893
|
-
* @returns The aerial perspective LUT texture
|
|
911
|
+
/**
|
|
912
|
+
* Gets the aerial perspective LUT
|
|
913
|
+
* @param scope - Current shader scope
|
|
914
|
+
* @returns The aerial perspective LUT texture
|
|
894
915
|
*/ static getAerialPerspectiveLUT(scope) {
|
|
895
916
|
return scope[UNIFORM_NAME_AERIALPERSPECTIVE_LUT];
|
|
896
917
|
}
|
|
897
|
-
/**
|
|
898
|
-
* Gets the uniform variable of type mat4 which holds the view projection matrix of current camera
|
|
899
|
-
* @param scope - Current shader scope
|
|
900
|
-
* @returns The view projection matrix of current camera
|
|
918
|
+
/**
|
|
919
|
+
* Gets the uniform variable of type mat4 which holds the view projection matrix of current camera
|
|
920
|
+
* @param scope - Current shader scope
|
|
921
|
+
* @returns The view projection matrix of current camera
|
|
901
922
|
*/ static getViewProjectionMatrix(scope) {
|
|
902
923
|
return scope.camera.viewProjectionMatrix;
|
|
903
924
|
}
|
|
904
|
-
/**
|
|
905
|
-
* Gets the uniform variable of type mat4 which holds the inversed view projection matrix of current camera
|
|
906
|
-
* @param scope - Current shader scope
|
|
907
|
-
* @returns The inversed view projection matrix of current camera
|
|
925
|
+
/**
|
|
926
|
+
* Gets the uniform variable of type mat4 which holds the inversed view projection matrix of current camera
|
|
927
|
+
* @param scope - Current shader scope
|
|
928
|
+
* @returns The inversed view projection matrix of current camera
|
|
908
929
|
*/ static getInvViewProjectionMatrix(scope) {
|
|
909
930
|
return scope.camera.invViewProjectionMatrix;
|
|
910
931
|
}
|
|
911
|
-
/**
|
|
912
|
-
* Gets the uniform variable of type mat4 which holds the projection matrix of current camera
|
|
913
|
-
* @param scope - Current shader scope
|
|
914
|
-
* @returns The projection matrix of current camera
|
|
932
|
+
/**
|
|
933
|
+
* Gets the uniform variable of type mat4 which holds the projection matrix of current camera
|
|
934
|
+
* @param scope - Current shader scope
|
|
935
|
+
* @returns The projection matrix of current camera
|
|
915
936
|
*/ static getProjectionMatrix(scope) {
|
|
916
937
|
return scope.camera.projectionMatrix;
|
|
917
938
|
}
|
|
918
|
-
/**
|
|
919
|
-
* Gets the uniform variable of type mat4 which holds the inversed projection matrix of current camera
|
|
920
|
-
* @param scope - Current shader scope
|
|
921
|
-
* @returns The inversed projection matrix of current camera
|
|
939
|
+
/**
|
|
940
|
+
* Gets the uniform variable of type mat4 which holds the inversed projection matrix of current camera
|
|
941
|
+
* @param scope - Current shader scope
|
|
942
|
+
* @returns The inversed projection matrix of current camera
|
|
922
943
|
*/ static getInvProjectionMatrix(scope) {
|
|
923
944
|
return scope.camera.invProjectionMatrix;
|
|
924
945
|
}
|
|
925
|
-
/**
|
|
926
|
-
* Gets the uniform variable of type mat4 which holds the unjittered view projection matrix of current camera
|
|
927
|
-
* @param scope - Current shader scope
|
|
928
|
-
* @returns The unjittered view projection matrix of current camera
|
|
946
|
+
/**
|
|
947
|
+
* Gets the uniform variable of type mat4 which holds the unjittered view projection matrix of current camera
|
|
948
|
+
* @param scope - Current shader scope
|
|
949
|
+
* @returns The unjittered view projection matrix of current camera
|
|
929
950
|
*/ static getUnjitteredViewProjectionMatrix(scope) {
|
|
930
951
|
return scope.camera.unjitteredVPMatrix;
|
|
931
952
|
}
|
|
932
|
-
/**
|
|
933
|
-
* Gets the uniform variable of type vec2 which holds the jitter value of the projection matrix of current camera
|
|
934
|
-
* @param scope - Current shader scope
|
|
935
|
-
* @returns The jitter value of projection matrix of current camera
|
|
953
|
+
/**
|
|
954
|
+
* Gets the uniform variable of type vec2 which holds the jitter value of the projection matrix of current camera
|
|
955
|
+
* @param scope - Current shader scope
|
|
956
|
+
* @returns The jitter value of projection matrix of current camera
|
|
936
957
|
*/ static getProjectionMatrixJitterValue(scope) {
|
|
937
958
|
return scope.camera.jitterValue;
|
|
938
959
|
}
|
|
939
|
-
/**
|
|
940
|
-
* Gets the uniform variable of type mat4 which holds the jittered inversed view-projection matrix
|
|
941
|
-
* @param scope - Current shader scope
|
|
942
|
-
* @returns The jittered inversed view-projection matrix
|
|
960
|
+
/**
|
|
961
|
+
* Gets the uniform variable of type mat4 which holds the jittered inversed view-projection matrix
|
|
962
|
+
* @param scope - Current shader scope
|
|
963
|
+
* @returns The jittered inversed view-projection matrix
|
|
943
964
|
*/ static getJitteredInvVPMatrix(scope) {
|
|
944
965
|
return scope.camera.jitteredInvVPMatrix;
|
|
945
966
|
}
|
|
946
|
-
/**
|
|
947
|
-
* Gets the uniform variable of type mat4 which holds the unjittered view projection at previous frame matrix of current camera
|
|
948
|
-
* @param scope - Current shader scope
|
|
949
|
-
* @returns The unjittered view projection matrix at previous frame of current camera
|
|
967
|
+
/**
|
|
968
|
+
* Gets the uniform variable of type mat4 which holds the unjittered view projection at previous frame matrix of current camera
|
|
969
|
+
* @param scope - Current shader scope
|
|
970
|
+
* @returns The unjittered view projection matrix at previous frame of current camera
|
|
950
971
|
*/ static getPrevUnjitteredViewProjectionMatrix(scope) {
|
|
951
972
|
return scope.camera.prevUnjitteredVPMatrix;
|
|
952
973
|
}
|
|
953
|
-
/**
|
|
954
|
-
* Gets the uniform variable of type mat4 which holds the view matrix of current camera (world space to camera space)
|
|
955
|
-
* @param scope - Current shader scope
|
|
956
|
-
* @returns The view matrix of current camera
|
|
974
|
+
/**
|
|
975
|
+
* Gets the uniform variable of type mat4 which holds the view matrix of current camera (world space to camera space)
|
|
976
|
+
* @param scope - Current shader scope
|
|
977
|
+
* @returns The view matrix of current camera
|
|
957
978
|
*/ static getViewMatrix(scope) {
|
|
958
979
|
return scope.camera.viewMatrix;
|
|
959
980
|
}
|
|
960
|
-
/**
|
|
961
|
-
* Gets the uniform variable of type mat4 which holds the inv-view matrix of current camera (camera space to world space)
|
|
962
|
-
* @param scope - Current shader scope
|
|
963
|
-
* @returns The inv-view matrix of current camera
|
|
981
|
+
/**
|
|
982
|
+
* Gets the uniform variable of type mat4 which holds the inv-view matrix of current camera (camera space to world space)
|
|
983
|
+
* @param scope - Current shader scope
|
|
984
|
+
* @returns The inv-view matrix of current camera
|
|
964
985
|
*/ static getInvViewMatrix(scope) {
|
|
965
986
|
return scope.camera.worldMatrix;
|
|
966
987
|
}
|
|
@@ -1011,20 +1032,20 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
1011
1032
|
/** @internal */ static getLightExtra(scope, lightIndex) {
|
|
1012
1033
|
return scope[UNIFORM_NAME_LIGHT_BUFFER].at(scope.$builder.add(scope.$builder.mul(lightIndex, 4), 3));
|
|
1013
1034
|
}
|
|
1014
|
-
/**
|
|
1015
|
-
* Sets the clip space position in vertex shader
|
|
1016
|
-
*
|
|
1017
|
-
* @remarks
|
|
1018
|
-
* Use this function instead of using
|
|
1019
|
-
* <pre>
|
|
1020
|
-
* // Do not use this
|
|
1021
|
-
* this.$builtins.position = some_value;
|
|
1022
|
-
* // Use this
|
|
1023
|
-
* ShaderFramework.setClipSpacePosition(some_value);
|
|
1024
|
-
* </pre>,
|
|
1025
|
-
*
|
|
1026
|
-
* @param scope - Current shader scope
|
|
1027
|
-
* @param pos - The clip space position to be set
|
|
1035
|
+
/**
|
|
1036
|
+
* Sets the clip space position in vertex shader
|
|
1037
|
+
*
|
|
1038
|
+
* @remarks
|
|
1039
|
+
* Use this function instead of using
|
|
1040
|
+
* <pre>
|
|
1041
|
+
* // Do not use this
|
|
1042
|
+
* this.$builtins.position = some_value;
|
|
1043
|
+
* // Use this
|
|
1044
|
+
* ShaderFramework.setClipSpacePosition(some_value);
|
|
1045
|
+
* </pre>,
|
|
1046
|
+
*
|
|
1047
|
+
* @param scope - Current shader scope
|
|
1048
|
+
* @param pos - The clip space position to be set
|
|
1028
1049
|
*/ static setClipSpacePosition(scope, pos) {
|
|
1029
1050
|
const pb = scope.$builder;
|
|
1030
1051
|
const cameraParams = this.getCameraParams(scope);
|
|
@@ -1034,20 +1055,20 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
1034
1055
|
scope.$builtins.position = pos;
|
|
1035
1056
|
}
|
|
1036
1057
|
}
|
|
1037
|
-
/**
|
|
1038
|
-
* Get shadow map uniform value
|
|
1039
|
-
*
|
|
1040
|
-
* @param scope - Shader scope
|
|
1041
|
-
* @returns The shadow map texture uniform
|
|
1058
|
+
/**
|
|
1059
|
+
* Get shadow map uniform value
|
|
1060
|
+
*
|
|
1061
|
+
* @param scope - Shader scope
|
|
1062
|
+
* @returns The shadow map texture uniform
|
|
1042
1063
|
*/ static getShadowMap(scope) {
|
|
1043
1064
|
return scope[UNIFORM_NAME_SHADOW_MAP];
|
|
1044
1065
|
}
|
|
1045
|
-
/**
|
|
1046
|
-
* Calculates shadow of current fragment
|
|
1047
|
-
*
|
|
1048
|
-
* @param scope - Shader scope
|
|
1049
|
-
* @param NoL - NdotL vector
|
|
1050
|
-
* @returns Shadow of current fragment, 1 means no shadow and 0 means full shadowed.
|
|
1066
|
+
/**
|
|
1067
|
+
* Calculates shadow of current fragment
|
|
1068
|
+
*
|
|
1069
|
+
* @param scope - Shader scope
|
|
1070
|
+
* @param NoL - NdotL vector
|
|
1071
|
+
* @returns Shadow of current fragment, 1 means no shadow and 0 means full shadowed.
|
|
1051
1072
|
*/ static calculateShadow(scope, worldPos, NoL, ctx) {
|
|
1052
1073
|
const pb = scope.$builder;
|
|
1053
1074
|
const that = this;
|
|
@@ -1078,15 +1099,24 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
1078
1099
|
}
|
|
1079
1100
|
const shadowMapParams = ctx.shadowMapInfo.get(ctx.currentShadowLight);
|
|
1080
1101
|
this.$l.shadow = shadowMapParams.impl.computeShadowCSM(shadowMapParams, this, this.shadowVertex, this.NoL, this.split);
|
|
1102
|
+
this.shadow = pb.clamp(this.shadow, 0, 1);
|
|
1081
1103
|
this.$l.shadowDistance = that.getShadowCameraParams(scope).w;
|
|
1082
1104
|
this.shadow = pb.mix(this.shadow, 1, pb.smoothStep(pb.mul(this.shadowDistance, 0.8), this.shadowDistance, pb.distance(that.getCameraPosition(this), this.worldPos)));
|
|
1105
|
+
this.shadow = pb.mix(1, this.shadow, this.light.shadowStrength);
|
|
1106
|
+
this.shadow = pb.clamp(this.shadow, 0, 1);
|
|
1107
|
+
this.$if(pb.greaterThan(this.camera.shadowDebugCascades, 0.5), function() {
|
|
1108
|
+
this.shadow = pb.add(pb.mul(pb.float(this.split), 0.2), 0.2);
|
|
1109
|
+
});
|
|
1083
1110
|
this.$return(this.shadow);
|
|
1084
1111
|
} else {
|
|
1085
1112
|
this.$l.shadowVertex = that.calculateShadowSpaceVertex(this, pb.vec4(this.worldPos, 1));
|
|
1086
1113
|
const shadowMapParams = ctx.shadowMapInfo.get(ctx.currentShadowLight);
|
|
1087
1114
|
this.$l.shadow = shadowMapParams.impl.computeShadow(shadowMapParams, this, this.shadowVertex, this.NoL);
|
|
1115
|
+
this.shadow = pb.clamp(this.shadow, 0, 1);
|
|
1088
1116
|
this.$l.shadowDistance = that.getShadowCameraParams(scope).w;
|
|
1089
1117
|
this.shadow = pb.mix(this.shadow, 1, pb.smoothStep(pb.mul(this.shadowDistance, 0.8), this.shadowDistance, pb.distance(that.getCameraPosition(this), this.worldPos)));
|
|
1118
|
+
this.shadow = pb.mix(1, this.shadow, this.light.shadowStrength);
|
|
1119
|
+
this.shadow = pb.clamp(this.shadow, 0, 1);
|
|
1090
1120
|
this.$return(this.shadow);
|
|
1091
1121
|
}
|
|
1092
1122
|
});
|
|
@@ -1101,59 +1131,62 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
1101
1131
|
pb.vec3('worldPos'),
|
|
1102
1132
|
pb.vec4('color').inout()
|
|
1103
1133
|
], function() {
|
|
1134
|
+
this.$if(pb.notEqual(this.fog.additive, 0), function() {
|
|
1135
|
+
this.$return();
|
|
1136
|
+
});
|
|
1104
1137
|
this.$l.uv = pb.div(pb.vec2(this.$builtins.fragCoord.xy), that.getRenderSize(this));
|
|
1105
1138
|
this.$l.fogging = calculateFog(this, this.fog.withAerialPerspective, this.fog.fogType, this.fog.atmosphereParams, this.fog.heightFogParams, this.uv, false, that.getCameraPosition(this).xyz, this.worldPos, this.fog.additive, this[UNIFORM_NAME_AERIALPERSPECTIVE_LUT], this[UNIFORM_NAME_SKYDISTANTLIGHT_LUT]);
|
|
1106
|
-
this.
|
|
1139
|
+
this.$l.foggingAlpha = pb.sub(1, pb.mul(pb.sub(1, this.fogging.a), this.color.a));
|
|
1140
|
+
this.$l.foggingRGB = pb.mul(this.fogging.rgb, this.color.a);
|
|
1141
|
+
this.color = pb.vec4(pb.add(pb.mul(this.color.rgb, this.foggingAlpha), this.foggingRGB), this.color.a);
|
|
1107
1142
|
//this.color = pb.vec4(pb.vec3(pb.mix(this.u0, this.u1, this.factor)), this.color.a);
|
|
1108
1143
|
});
|
|
1109
1144
|
scope[funcName](worldPos, color);
|
|
1110
1145
|
}
|
|
1111
1146
|
}
|
|
1112
|
-
/**
|
|
1113
|
-
* Calculates the non-linear depth from linear depth
|
|
1114
|
-
*
|
|
1115
|
-
* @param scope - Current shader scope
|
|
1116
|
-
* @param depth - The linear depth
|
|
1117
|
-
* @param nearFar - A vector that contains the near clip plane in x component and the far clip plane in y component
|
|
1118
|
-
* @returns The calculated non-linear depth
|
|
1147
|
+
/**
|
|
1148
|
+
* Calculates the non-linear depth from linear depth
|
|
1149
|
+
*
|
|
1150
|
+
* @param scope - Current shader scope
|
|
1151
|
+
* @param depth - The linear depth
|
|
1152
|
+
* @param nearFar - A vector that contains the near clip plane in x component and the far clip plane in y component
|
|
1153
|
+
* @returns The calculated non-linear depth
|
|
1119
1154
|
*/ static linearDepthToNonLinear(scope, depth, nearFar) {
|
|
1120
1155
|
const pb = scope.$builder;
|
|
1121
1156
|
nearFar = nearFar ?? this.getCameraParams(scope);
|
|
1122
|
-
return pb.
|
|
1123
|
-
}
|
|
1124
|
-
/**
|
|
1125
|
-
* Calculates the linear depth from non-linear depth
|
|
1126
|
-
*
|
|
1127
|
-
* @param scope - Current shader scope
|
|
1128
|
-
* @param depth - The non-linear depth
|
|
1129
|
-
* @param nearFar - A vector that contains the near clip plane in x component and the far clip plane in y component
|
|
1130
|
-
* @returns The calculated linear depth
|
|
1157
|
+
return pb.div(pb.sub(nearFar.y, pb.div(pb.mul(nearFar.x, nearFar.y), depth)), pb.sub(nearFar.y, nearFar.x));
|
|
1158
|
+
}
|
|
1159
|
+
/**
|
|
1160
|
+
* Calculates the linear depth from non-linear depth
|
|
1161
|
+
*
|
|
1162
|
+
* @param scope - Current shader scope
|
|
1163
|
+
* @param depth - The non-linear depth
|
|
1164
|
+
* @param nearFar - A vector that contains the near clip plane in x component and the far clip plane in y component
|
|
1165
|
+
* @returns The calculated linear depth
|
|
1131
1166
|
*/ static nonLinearDepthToLinear(scope, depth, nearFar) {
|
|
1132
1167
|
const pb = scope.$builder;
|
|
1133
1168
|
nearFar = nearFar ?? this.getCameraParams(scope);
|
|
1134
|
-
return pb.div(pb.mul(nearFar.x, nearFar.y
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
*
|
|
1139
|
-
*
|
|
1140
|
-
* @param
|
|
1141
|
-
* @param
|
|
1142
|
-
* @
|
|
1143
|
-
* @returns The calculated normalized linear depth
|
|
1169
|
+
return pb.div(pb.mul(nearFar.x, nearFar.y), pb.mix(nearFar.y, nearFar.x, depth));
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* Calculates the normalized linear depth from non-linear depth
|
|
1173
|
+
*
|
|
1174
|
+
* @param scope - Current shader scope
|
|
1175
|
+
* @param depth - The non-linear depth
|
|
1176
|
+
* @param nearFar - A vector that contains the near clip plane in x component and the far clip plane in y component
|
|
1177
|
+
* @returns The calculated normalized linear depth
|
|
1144
1178
|
*/ static nonLinearDepthToLinearNormalized(scope, depth, nearFar) {
|
|
1145
1179
|
const pb = scope.$builder;
|
|
1146
1180
|
nearFar = nearFar ?? this.getCameraParams(scope);
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
*
|
|
1152
|
-
* @param
|
|
1153
|
-
* @param
|
|
1154
|
-
* @param
|
|
1155
|
-
* @
|
|
1156
|
-
* @returns Linear depth value
|
|
1181
|
+
return pb.div(nearFar.x, pb.mix(nearFar.y, nearFar.x, depth));
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* Sample linear depth from linear depth texture
|
|
1185
|
+
* @param scope - Current shader scope
|
|
1186
|
+
* @param tex - The linear depth texture
|
|
1187
|
+
* @param uv - The uv coordinates
|
|
1188
|
+
* @param level - The mipmap level to sample
|
|
1189
|
+
* @returns Linear depth value
|
|
1157
1190
|
*/ static sampleLinearDepth(scope, tex, uv, level) {
|
|
1158
1191
|
const pb = scope.$builder;
|
|
1159
1192
|
const depth = pb.textureSampleLevel(tex, uv, level);
|
|
@@ -1175,23 +1208,23 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
1175
1208
|
});
|
|
1176
1209
|
return scope.zSamplePositionFromDepth(uv, cameraNearFar, mat);
|
|
1177
1210
|
}
|
|
1178
|
-
/**
|
|
1179
|
-
* Sample linear depth from linear depth texture with backface
|
|
1180
|
-
* @param scope - Current shader scope
|
|
1181
|
-
* @param tex - The linear depth texture
|
|
1182
|
-
* @param uv - The uv coordinates
|
|
1183
|
-
* @param level - The mipmap level to sample
|
|
1184
|
-
* @returns Linear depth value
|
|
1211
|
+
/**
|
|
1212
|
+
* Sample linear depth from linear depth texture with backface
|
|
1213
|
+
* @param scope - Current shader scope
|
|
1214
|
+
* @param tex - The linear depth texture
|
|
1215
|
+
* @param uv - The uv coordinates
|
|
1216
|
+
* @param level - The mipmap level to sample
|
|
1217
|
+
* @returns Linear depth value
|
|
1185
1218
|
*/ static sampleLinearDepthWithBackface(scope, tex, uv, level) {
|
|
1186
1219
|
const pb = scope.$builder;
|
|
1187
1220
|
return pb.textureSampleLevel(tex, uv, level).rg;
|
|
1188
1221
|
}
|
|
1189
|
-
/**
|
|
1190
|
-
* Transform color to sRGB color space if nessesary
|
|
1191
|
-
*
|
|
1192
|
-
* @param scope - Current shader scope
|
|
1193
|
-
* @param outputColor - The color to be transformed
|
|
1194
|
-
* @returns The transformed color
|
|
1222
|
+
/**
|
|
1223
|
+
* Transform color to sRGB color space if nessesary
|
|
1224
|
+
*
|
|
1225
|
+
* @param scope - Current shader scope
|
|
1226
|
+
* @param outputColor - The color to be transformed
|
|
1227
|
+
* @returns The transformed color
|
|
1195
1228
|
*/ static encodeColorOutput(scope, outputColor) {
|
|
1196
1229
|
const pb = scope.$builder;
|
|
1197
1230
|
const that = this;
|
|
@@ -1208,9 +1241,6 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
1208
1241
|
});
|
|
1209
1242
|
return pb.getGlobalScope()[funcName](outputColor);
|
|
1210
1243
|
}
|
|
1211
|
-
static getMaxClusteredLightCount() {
|
|
1212
|
-
return getDevice().type === 'webgl' ? 127 : 255;
|
|
1213
|
-
}
|
|
1214
1244
|
}
|
|
1215
1245
|
|
|
1216
1246
|
export { ShaderHelper };
|