@zephyr3d/scene 0.9.5 → 0.9.6
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/index.d.ts +1 -0
- package/dist/material/msdf_text.js +3 -3
- package/dist/material/msdf_text.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/package.json +1 -1
- 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,510 +0,0 @@
|
|
|
1
|
-
import { drawFullscreenQuad } from './fullscreenquad.js';
|
|
2
|
-
import { fetchSampler } from '../utility/misc.js';
|
|
3
|
-
import { getGGXLUT } from '../utility/textures/ggxlut.js';
|
|
4
|
-
import { decodeNormalizedFloatFromRGBA } from '../shaders/misc.js';
|
|
5
|
-
import { fresnelSchlick, distributionGGX, visGGX } from '../shaders/pbr.js';
|
|
6
|
-
import { MAX_CLUSTERED_LIGHTS, LIGHT_TYPE_POINT, LIGHT_TYPE_SPOT, LIGHT_TYPE_RECT } from '../values.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Deferred lighting pass scaffold.
|
|
10
|
-
*
|
|
11
|
-
* Stage-1 implementation simply resolves GBuffer color to the lighting target.
|
|
12
|
-
* Follow-up will evaluate clustered lights using compact material attributes.
|
|
13
|
-
* @internal
|
|
14
|
-
*/ class DeferredLightPass {
|
|
15
|
-
static _programs = {};
|
|
16
|
-
static _bindGroups = {};
|
|
17
|
-
render(ctx, gbufferColor, gbufferRoughness, gbufferNormal, gbufferExtra) {
|
|
18
|
-
if (!ctx.clusteredLight?.lightBuffer || !ctx.clusteredLight.lightIndexTexture || !ctx.linearDepthTexture) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const device = ctx.device;
|
|
22
|
-
const hasEnvLight = !!ctx.env?.light?.envLight;
|
|
23
|
-
const hasEnvRadiance = !!ctx.env?.light?.envLight?.hasRadiance();
|
|
24
|
-
const hasEnvIrradiance = !!ctx.env?.light?.envLight?.hasIrradiance();
|
|
25
|
-
const envHash = ctx.env?.light?.envLight ? ctx.env.light.getHash() : 'none';
|
|
26
|
-
const hash = `${device.type}:${envHash}:clustered:env:${hasEnvLight ? 1 : 0}:rad:${hasEnvRadiance ? 1 : 0}:irr:${hasEnvIrradiance ? 1 : 0}`;
|
|
27
|
-
let program = DeferredLightPass._programs[hash];
|
|
28
|
-
if (!program) {
|
|
29
|
-
const isWebGL = device.type === 'webgl';
|
|
30
|
-
const builtProgram = device.buildRenderProgram({
|
|
31
|
-
label: 'DeferredLightPass',
|
|
32
|
-
vertex (pb) {
|
|
33
|
-
this.$inputs.pos = pb.vec2().attrib('position');
|
|
34
|
-
this.$outputs.uv = pb.vec2();
|
|
35
|
-
pb.main(function() {
|
|
36
|
-
this.$builtins.position = pb.vec4(this.$inputs.pos, 1, 1);
|
|
37
|
-
this.$outputs.uv = pb.add(pb.mul(this.$inputs.pos.xy, 0.5), pb.vec2(0.5));
|
|
38
|
-
if (device.type === 'webgpu') {
|
|
39
|
-
this.$builtins.position.y = pb.neg(this.$builtins.position.y);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
},
|
|
43
|
-
fragment (pb) {
|
|
44
|
-
this.gbufferColorTex = pb.tex2D().uniform(0);
|
|
45
|
-
this.gbufferRoughnessTex = pb.tex2D().uniform(0);
|
|
46
|
-
this.gbufferNormalTex = pb.tex2D().uniform(0);
|
|
47
|
-
this.gbufferExtraTex = pb.tex2D().uniform(0);
|
|
48
|
-
this.linearDepthTex = pb.tex2D().uniform(0);
|
|
49
|
-
this.zGGXLut = pb.tex2D().uniform(0);
|
|
50
|
-
this.lightIndexTex = (isWebGL ? pb.tex2D() : pb.utex2D()).uniform(0);
|
|
51
|
-
this.zLightBuffer = pb.vec4[(MAX_CLUSTERED_LIGHTS + 1) * 4]().uniformBuffer(0);
|
|
52
|
-
this.clusterParams = pb.vec4().uniform(0);
|
|
53
|
-
this.countParams = pb.ivec4().uniform(0);
|
|
54
|
-
this.lightIndexTexSize = pb.ivec2().uniform(0);
|
|
55
|
-
this.cameraPos = pb.vec3().uniform(0);
|
|
56
|
-
this.cameraRight = pb.vec3().uniform(0);
|
|
57
|
-
this.cameraUp = pb.vec3().uniform(0);
|
|
58
|
-
this.cameraForward = pb.vec3().uniform(0);
|
|
59
|
-
this.cameraProj = pb.vec2().uniform(0); // x: tanHalfFovy, y: aspect
|
|
60
|
-
this.cameraNearFar = pb.vec2().uniform(0);
|
|
61
|
-
this.sunDir = pb.vec3().uniform(0);
|
|
62
|
-
this.sunColorIntensity = pb.vec4().uniform(0);
|
|
63
|
-
this.showGBuffer = pb.int().uniform(0);
|
|
64
|
-
this.gbufferViewMode = pb.int().uniform(0);
|
|
65
|
-
this.showCluster = pb.int().uniform(0);
|
|
66
|
-
this.showShadowTerm = pb.int().uniform(0);
|
|
67
|
-
this.showSpecTerm = pb.int().uniform(0);
|
|
68
|
-
if (hasEnvLight) {
|
|
69
|
-
this.envLightStrength = pb.float().uniform(0);
|
|
70
|
-
ctx.env.light.envLight.initShaderBindings(pb);
|
|
71
|
-
}
|
|
72
|
-
this.$outputs.color = pb.vec4();
|
|
73
|
-
pb.func('zGetClusterIndex', [
|
|
74
|
-
pb.float('linearDepth')
|
|
75
|
-
], function() {
|
|
76
|
-
this.$l.zTile = pb.int(pb.max(pb.add(pb.mul(pb.log2(pb.max(this.linearDepth, 1e-4)), this.clusterParams.z), this.clusterParams.w), 0));
|
|
77
|
-
this.zTile = pb.min(this.zTile, pb.sub(this.countParams.z, 1));
|
|
78
|
-
this.$l.f = pb.vec2(this.$builtins.fragCoord.x, pb.sub(this.clusterParams.y, pb.add(this.$builtins.fragCoord.y, 1)));
|
|
79
|
-
this.$l.xyTile = pb.ivec2(pb.div(this.f, pb.div(this.clusterParams.xy, pb.vec2(this.countParams.xy))));
|
|
80
|
-
this.xyTile = pb.clamp(this.xyTile, pb.ivec2(0), pb.sub(this.countParams.xy, 1));
|
|
81
|
-
this.$return(pb.add(this.xyTile.x, pb.mul(this.xyTile.y, this.countParams.x), pb.mul(this.zTile, this.countParams.x, this.countParams.y)));
|
|
82
|
-
});
|
|
83
|
-
pb.func('zGetLinearDepth', [], function() {
|
|
84
|
-
this.$l.depthSample = pb.textureSample(this.linearDepthTex, this.$inputs.uv);
|
|
85
|
-
if (isWebGL) {
|
|
86
|
-
this.$return(decodeNormalizedFloatFromRGBA(this, this.depthSample));
|
|
87
|
-
} else {
|
|
88
|
-
this.$return(this.depthSample.r);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
pb.func('zDecodeWebGLLightIndex', [
|
|
92
|
-
pb.float('packed'),
|
|
93
|
-
pb.int('slot')
|
|
94
|
-
], function() {
|
|
95
|
-
this.$if(pb.equal(this.slot, 0), function() {
|
|
96
|
-
this.$return(pb.int(pb.div(this.packed, 256)));
|
|
97
|
-
});
|
|
98
|
-
this.$return(pb.int(pb.mod(this.packed, 256)));
|
|
99
|
-
});
|
|
100
|
-
pb.func('zPointAtten', [
|
|
101
|
-
pb.float('dist'),
|
|
102
|
-
pb.float('range')
|
|
103
|
-
], function() {
|
|
104
|
-
this.$l.falloff = pb.max(0, pb.sub(1, pb.div(this.dist, pb.max(this.range, 1e-4))));
|
|
105
|
-
this.$return(pb.mul(this.falloff, this.falloff));
|
|
106
|
-
});
|
|
107
|
-
pb.func('zSpotAtten', [
|
|
108
|
-
pb.vec3('worldPos'),
|
|
109
|
-
pb.vec4('posRange'),
|
|
110
|
-
pb.vec4('dirCutoff'),
|
|
111
|
-
pb.float('dist')
|
|
112
|
-
], function() {
|
|
113
|
-
this.$l.base = this.zPointAtten(this.dist, this.posRange.w);
|
|
114
|
-
this.$l.spotFactor = pb.dot(pb.normalize(pb.sub(this.worldPos, this.posRange.xyz)), this.dirCutoff.xyz);
|
|
115
|
-
this.spotFactor = pb.smoothStep(this.dirCutoff.w, pb.mix(this.dirCutoff.w, 1, 0.5), this.spotFactor);
|
|
116
|
-
this.$return(pb.mul(this.base, this.spotFactor));
|
|
117
|
-
});
|
|
118
|
-
pb.func('zAccumulatePunctualLight', [
|
|
119
|
-
pb.vec3('baseColor'),
|
|
120
|
-
pb.float('metallic'),
|
|
121
|
-
pb.float('roughness'),
|
|
122
|
-
pb.float('specularStrength'),
|
|
123
|
-
pb.vec3('n'),
|
|
124
|
-
pb.vec3('viewDir'),
|
|
125
|
-
pb.float('NoV'),
|
|
126
|
-
pb.vec3('f0'),
|
|
127
|
-
pb.vec3('lightColor'),
|
|
128
|
-
pb.vec3('L'),
|
|
129
|
-
pb.float('atten'),
|
|
130
|
-
pb.float('diffScale'),
|
|
131
|
-
pb.float('specScale'),
|
|
132
|
-
pb.float('sourceRadiusFactor'),
|
|
133
|
-
pb.vec3('outDiffuse').inout(),
|
|
134
|
-
pb.vec3('outSpecular').inout()
|
|
135
|
-
], function() {
|
|
136
|
-
this.$l.pointNoL = pb.clamp(pb.dot(this.n, this.L), 0, 1);
|
|
137
|
-
this.$if(pb.greaterThan(this.pointNoL, 1e-5), function() {
|
|
138
|
-
this.$l.H = pb.normalize(pb.add(this.viewDir, this.L));
|
|
139
|
-
this.$l.NoH = pb.clamp(pb.dot(this.n, this.H), 0, 1);
|
|
140
|
-
this.$l.VoH = pb.clamp(pb.dot(this.viewDir, this.H), 0, 1);
|
|
141
|
-
this.$l.F = fresnelSchlick(this, this.VoH, this.f0, pb.vec3(1));
|
|
142
|
-
this.$l.specularRoughness = pb.clamp(pb.add(this.roughness, this.sourceRadiusFactor), 0, 1);
|
|
143
|
-
this.$l.alphaRoughness = pb.mul(this.specularRoughness, this.specularRoughness);
|
|
144
|
-
this.$l.D = distributionGGX(this, this.NoH, this.alphaRoughness);
|
|
145
|
-
this.$l.V = visGGX(this, this.NoV, this.pointNoL, this.alphaRoughness);
|
|
146
|
-
this.$l.punctualColor = pb.mul(this.lightColor, this.atten, this.pointNoL);
|
|
147
|
-
this.$l.diffuseBRDF = pb.mul(pb.sub(pb.vec3(1), this.F), pb.div(pb.mul(this.baseColor, pb.sub(1, this.metallic)), Math.PI));
|
|
148
|
-
this.outDiffuse = pb.add(this.outDiffuse, pb.mul(this.punctualColor, pb.max(this.diffuseBRDF, pb.vec3(0)), this.diffScale));
|
|
149
|
-
this.outSpecular = pb.add(this.outSpecular, pb.mul(this.punctualColor, this.D, this.V, this.F, this.specScale));
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
pb.func('zAccumulateRectLight', [
|
|
153
|
-
pb.vec3('worldPos'),
|
|
154
|
-
pb.vec3('baseColor'),
|
|
155
|
-
pb.float('metallic'),
|
|
156
|
-
pb.float('roughness'),
|
|
157
|
-
pb.float('specularStrength'),
|
|
158
|
-
pb.vec3('n'),
|
|
159
|
-
pb.vec3('viewDir'),
|
|
160
|
-
pb.float('NoV'),
|
|
161
|
-
pb.vec3('f0'),
|
|
162
|
-
pb.vec4('posRange'),
|
|
163
|
-
pb.vec4('axisX'),
|
|
164
|
-
pb.vec4('axisY'),
|
|
165
|
-
pb.vec4('colorIntensity'),
|
|
166
|
-
pb.vec3('outDiffuse').inout(),
|
|
167
|
-
pb.vec3('outSpecular').inout()
|
|
168
|
-
], function() {
|
|
169
|
-
this.$l.center = this.posRange.xyz;
|
|
170
|
-
this.$l.range = this.posRange.w;
|
|
171
|
-
this.$l.ax = this.axisX.xyz;
|
|
172
|
-
this.$l.ay = this.axisY.xyz;
|
|
173
|
-
this.$l.halfWidth = pb.length(this.ax);
|
|
174
|
-
this.$l.halfHeight = pb.length(this.ay);
|
|
175
|
-
this.$l.area = pb.mul(this.halfWidth, this.halfHeight, 4);
|
|
176
|
-
this.$l.lightNormal = pb.neg(pb.normalize(pb.cross(this.ax, this.ay)));
|
|
177
|
-
this.$if(pb.greaterThan(this.area, 0), function() {
|
|
178
|
-
this.$l.baseRectColor = pb.mul(this.colorIntensity.rgb, this.colorIntensity.a, this.area, 0.25);
|
|
179
|
-
this.$l.samplePos = pb.vec3();
|
|
180
|
-
this.$l.Lvec = pb.vec3();
|
|
181
|
-
this.$l.L = pb.vec3();
|
|
182
|
-
this.$l.dist = pb.float();
|
|
183
|
-
this.$l.invDist2 = pb.float();
|
|
184
|
-
this.$l.NoL = pb.float();
|
|
185
|
-
this.$l.NoL_light = pb.float();
|
|
186
|
-
this.$l.falloff = pb.float();
|
|
187
|
-
this.$l.lightSampleColor = pb.vec3();
|
|
188
|
-
const sample = (u, v)=>{
|
|
189
|
-
this.samplePos = pb.add(this.center, pb.add(pb.mul(this.ax, pb.sub(pb.mul(u, 2), 1)), pb.mul(this.ay, pb.sub(pb.mul(v, 2), 1))));
|
|
190
|
-
this.Lvec = pb.sub(this.samplePos, this.worldPos);
|
|
191
|
-
this.dist = pb.length(this.Lvec);
|
|
192
|
-
this.invDist2 = pb.div(1, pb.max(pb.mul(this.dist, this.dist), 0.0001));
|
|
193
|
-
this.L = pb.normalize(this.Lvec);
|
|
194
|
-
this.NoL = pb.clamp(pb.dot(this.n, this.L), 0, 1);
|
|
195
|
-
this.NoL_light = pb.clamp(pb.dot(this.lightNormal, pb.neg(this.L)), 0, 1);
|
|
196
|
-
this.$if(pb.greaterThan(pb.mul(this.NoL, this.NoL_light), 1e-5), function() {
|
|
197
|
-
this.falloff = pb.float(1);
|
|
198
|
-
this.$if(pb.greaterThan(this.range, 0), function() {
|
|
199
|
-
this.falloff = pb.max(0, pb.sub(1, pb.div(this.dist, this.range)));
|
|
200
|
-
this.falloff = pb.mul(this.falloff, this.falloff);
|
|
201
|
-
});
|
|
202
|
-
this.lightSampleColor = pb.mul(this.baseRectColor, this.invDist2, this.NoL_light);
|
|
203
|
-
this.zAccumulatePunctualLight(this.baseColor, this.metallic, this.roughness, this.specularStrength, this.n, this.viewDir, this.NoV, this.f0, this.lightSampleColor, this.L, this.falloff, 1, 1, 0, this.outDiffuse, this.outSpecular);
|
|
204
|
-
});
|
|
205
|
-
};
|
|
206
|
-
sample(0.25, 0.25);
|
|
207
|
-
sample(0.75, 0.25);
|
|
208
|
-
sample(0.25, 0.75);
|
|
209
|
-
sample(0.75, 0.75);
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
pb.main(function() {
|
|
213
|
-
this.$l.base = pb.textureSample(this.gbufferColorTex, this.$inputs.uv);
|
|
214
|
-
this.$l.rm = pb.textureSample(this.gbufferRoughnessTex, this.$inputs.uv);
|
|
215
|
-
this.$l.extra = pb.textureSample(this.gbufferExtraTex, this.$inputs.uv);
|
|
216
|
-
this.$l.litFlag = pb.float(pb.greaterThan(this.extra.a, 0.5));
|
|
217
|
-
this.$l.n = pb.normalize(pb.sub(pb.mul(pb.textureSample(this.gbufferNormalTex, this.$inputs.uv).xyz, 2), pb.vec3(1)));
|
|
218
|
-
this.$l.metallic = pb.clamp(this.rm.r, 0, 1);
|
|
219
|
-
this.$l.occlusion = pb.clamp(this.rm.g, 0, 1);
|
|
220
|
-
this.$l.specularStrength = pb.clamp(this.rm.b, 0, 1);
|
|
221
|
-
this.$l.roughness = pb.clamp(this.rm.a, 0.045, 1);
|
|
222
|
-
this.$l.ndc = pb.sub(pb.mul(this.$inputs.uv, 2), pb.vec2(1));
|
|
223
|
-
this.$l.xScale = pb.mul(this.cameraProj.x, this.cameraProj.y);
|
|
224
|
-
this.$l.yScale = this.cameraProj.x;
|
|
225
|
-
this.$l.camRayDir = pb.normalize(pb.add(this.cameraForward, pb.mul(this.cameraRight, pb.mul(this.ndc.x, this.xScale)), pb.mul(this.cameraUp, pb.mul(this.ndc.y, this.yScale))));
|
|
226
|
-
this.$l.linearDepthNormalized = this.zGetLinearDepth();
|
|
227
|
-
this.$l.linearDepth = pb.mul(pb.clamp(this.linearDepthNormalized, 0, 1), this.cameraNearFar.y);
|
|
228
|
-
this.$l.rayScale = pb.max(pb.dot(this.camRayDir, this.cameraForward), 1e-4);
|
|
229
|
-
this.$l.worldPos = pb.add(this.cameraPos, pb.mul(this.camRayDir, pb.div(this.linearDepth, this.rayScale)));
|
|
230
|
-
this.$l.viewDir = pb.neg(this.camRayDir);
|
|
231
|
-
this.$l.sunL = pb.normalize(this.sunDir);
|
|
232
|
-
this.$l.sunColor = pb.mul(this.sunColorIntensity.rgb, this.sunColorIntensity.a);
|
|
233
|
-
this.$l.NoL = pb.clamp(pb.dot(this.n, this.sunL), 0, 1);
|
|
234
|
-
this.$l.NoV = pb.clamp(pb.dot(this.n, this.viewDir), 0, 1);
|
|
235
|
-
this.$l.f0 = pb.mix(pb.mul(pb.vec3(0.04), this.specularStrength), this.base.rgb, this.metallic);
|
|
236
|
-
this.$l.fresnelNoV = pb.add(this.f0, pb.mul(pb.sub(pb.vec3(1), this.f0), pb.pow(pb.sub(1, this.NoV), 5)));
|
|
237
|
-
this.$l.kd = pb.mul(pb.sub(pb.vec3(1), this.fresnelNoV), pb.sub(1, this.metallic));
|
|
238
|
-
this.$l.sunDiffuse = pb.vec3(0);
|
|
239
|
-
this.$l.sunSpecular = pb.vec3(0);
|
|
240
|
-
this.$if(pb.greaterThan(this.NoL, 1e-5), function() {
|
|
241
|
-
this.$l.H = pb.normalize(pb.add(this.viewDir, this.sunL));
|
|
242
|
-
this.$l.NoH = pb.clamp(pb.dot(this.n, this.H), 0, 1);
|
|
243
|
-
this.$l.VoH = pb.clamp(pb.dot(this.viewDir, this.H), 0, 1);
|
|
244
|
-
this.$l.F = fresnelSchlick(this, this.VoH, this.f0, pb.vec3(1));
|
|
245
|
-
this.$l.alphaRoughness = pb.mul(this.roughness, this.roughness);
|
|
246
|
-
this.$l.D = distributionGGX(this, this.NoH, this.alphaRoughness);
|
|
247
|
-
this.$l.V = visGGX(this, this.NoV, this.NoL, this.alphaRoughness);
|
|
248
|
-
this.$l.sunPunctualColor = pb.mul(this.sunColor, this.NoL);
|
|
249
|
-
this.$l.diffuseBRDF = pb.mul(pb.sub(pb.vec3(1), this.F), pb.div(pb.mul(this.base.rgb, pb.sub(1, this.metallic)), Math.PI));
|
|
250
|
-
this.sunDiffuse = pb.mul(this.sunPunctualColor, pb.max(this.diffuseBRDF, pb.vec3(0)));
|
|
251
|
-
this.sunSpecular = pb.mul(this.sunPunctualColor, this.D, this.V, this.F);
|
|
252
|
-
});
|
|
253
|
-
this.$l.diffuse = this.sunDiffuse;
|
|
254
|
-
this.$l.specular = this.sunSpecular;
|
|
255
|
-
this.$l.clusterLightCount = pb.int(0);
|
|
256
|
-
this.$l.clusterIndex = this.zGetClusterIndex(this.linearDepth);
|
|
257
|
-
if (isWebGL) {
|
|
258
|
-
this.$l.texCoordX = pb.div(pb.add(pb.mod(pb.float(this.clusterIndex), pb.float(this.lightIndexTexSize.x)), 0.5), pb.float(this.lightIndexTexSize.x));
|
|
259
|
-
this.$l.texCoordY = pb.div(pb.add(pb.float(pb.div(this.clusterIndex, this.lightIndexTexSize.x)), 0.5), pb.float(this.lightIndexTexSize.y));
|
|
260
|
-
this.$l.samp = pb.textureSample(this.lightIndexTex, pb.vec2(this.texCoordX, this.texCoordY));
|
|
261
|
-
this.$for(pb.int('i'), 0, 4, function() {
|
|
262
|
-
this.$l.packed = this.samp.at(this.i);
|
|
263
|
-
this.$for(pb.int('k'), 0, 2, function() {
|
|
264
|
-
this.$l.lightIndex = this.zDecodeWebGLLightIndex(this.packed, this.k);
|
|
265
|
-
this.$if(pb.greaterThan(this.lightIndex, 0), function() {
|
|
266
|
-
this.clusterLightCount = pb.add(this.clusterLightCount, 1);
|
|
267
|
-
this.$l.positionRange = this.zLightBuffer.at(pb.mul(this.lightIndex, 4));
|
|
268
|
-
this.$l.directionCutoff = this.zLightBuffer.at(pb.add(pb.mul(this.lightIndex, 4), 1));
|
|
269
|
-
this.$l.diffuseIntensity = this.zLightBuffer.at(pb.add(pb.mul(this.lightIndex, 4), 2));
|
|
270
|
-
this.$l.extra = this.zLightBuffer.at(pb.add(pb.mul(this.lightIndex, 4), 3));
|
|
271
|
-
this.$l.lightType = pb.int(this.extra.w);
|
|
272
|
-
this.$if(pb.or(pb.equal(this.lightType, LIGHT_TYPE_POINT), pb.equal(this.lightType, LIGHT_TYPE_SPOT)), function() {
|
|
273
|
-
this.$l.toLight = pb.sub(this.positionRange.xyz, this.worldPos);
|
|
274
|
-
this.$l.dist = pb.length(this.toLight);
|
|
275
|
-
this.$l.L = pb.div(this.toLight, pb.max(this.dist, 1e-4));
|
|
276
|
-
this.$l.atten = this.zPointAtten(this.dist, this.positionRange.w);
|
|
277
|
-
this.$if(pb.equal(this.lightType, LIGHT_TYPE_SPOT), function() {
|
|
278
|
-
this.atten = this.zSpotAtten(this.worldPos, this.positionRange, this.directionCutoff, this.dist);
|
|
279
|
-
});
|
|
280
|
-
this.$if(pb.greaterThan(this.atten, 1e-5), function() {
|
|
281
|
-
this.$l.lightColor = pb.mul(this.diffuseIntensity.rgb, this.diffuseIntensity.a);
|
|
282
|
-
this.$l.diffScale = this.$choice(pb.equal(this.lightType, LIGHT_TYPE_POINT), this.extra.x, pb.float(1));
|
|
283
|
-
this.$l.specScale = this.$choice(pb.equal(this.lightType, LIGHT_TYPE_POINT), this.extra.y, pb.float(1));
|
|
284
|
-
this.$l.sourceRadiusFactor = this.$choice(pb.equal(this.lightType, LIGHT_TYPE_POINT), pb.div(this.extra.z, pb.max(this.dist, 1e-4)), pb.float(0));
|
|
285
|
-
this.zAccumulatePunctualLight(this.base.rgb, this.metallic, this.roughness, this.specularStrength, this.n, this.viewDir, this.NoV, this.f0, this.lightColor, this.L, this.atten, this.diffScale, this.specScale, this.sourceRadiusFactor, this.diffuse, this.specular);
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
this.$if(pb.equal(this.lightType, LIGHT_TYPE_RECT), function() {
|
|
289
|
-
this.zAccumulateRectLight(this.worldPos, this.base.rgb, this.metallic, this.roughness, this.specularStrength, this.n, this.viewDir, this.NoV, this.f0, this.positionRange, this.directionCutoff, this.extra, this.diffuseIntensity, this.diffuse, this.specular);
|
|
290
|
-
});
|
|
291
|
-
});
|
|
292
|
-
});
|
|
293
|
-
});
|
|
294
|
-
} else {
|
|
295
|
-
this.$l.texCoordX = pb.mod(this.clusterIndex, this.lightIndexTexSize.x);
|
|
296
|
-
this.$l.texCoordY = pb.div(this.clusterIndex, this.lightIndexTexSize.x);
|
|
297
|
-
this.$l.samp = pb.textureLoad(this.lightIndexTex, pb.ivec2(this.texCoordX, this.texCoordY), 0);
|
|
298
|
-
this.$for(pb.uint('i'), 0, 4, function() {
|
|
299
|
-
this.$for(pb.uint('k'), 0, 4, function() {
|
|
300
|
-
this.$l.lightIndex = pb.compAnd(pb.sar(this.samp.at(this.i), pb.mul(this.k, 8)), 0xff);
|
|
301
|
-
this.$if(pb.greaterThan(this.lightIndex, 0), function() {
|
|
302
|
-
this.clusterLightCount = pb.add(this.clusterLightCount, 1);
|
|
303
|
-
this.$l.positionRange = this.zLightBuffer.at(pb.mul(this.lightIndex, 4));
|
|
304
|
-
this.$l.directionCutoff = this.zLightBuffer.at(pb.add(pb.mul(this.lightIndex, 4), 1));
|
|
305
|
-
this.$l.diffuseIntensity = this.zLightBuffer.at(pb.add(pb.mul(this.lightIndex, 4), 2));
|
|
306
|
-
this.$l.extra = this.zLightBuffer.at(pb.add(pb.mul(this.lightIndex, 4), 3));
|
|
307
|
-
this.$l.lightType = pb.int(this.extra.w);
|
|
308
|
-
this.$if(pb.or(pb.equal(this.lightType, LIGHT_TYPE_POINT), pb.equal(this.lightType, LIGHT_TYPE_SPOT)), function() {
|
|
309
|
-
this.$l.toLight = pb.sub(this.positionRange.xyz, this.worldPos);
|
|
310
|
-
this.$l.dist = pb.length(this.toLight);
|
|
311
|
-
this.$l.L = pb.div(this.toLight, pb.max(this.dist, 1e-4));
|
|
312
|
-
this.$l.atten = this.zPointAtten(this.dist, this.positionRange.w);
|
|
313
|
-
this.$if(pb.equal(this.lightType, LIGHT_TYPE_SPOT), function() {
|
|
314
|
-
this.atten = this.zSpotAtten(this.worldPos, this.positionRange, this.directionCutoff, this.dist);
|
|
315
|
-
});
|
|
316
|
-
this.$if(pb.greaterThan(this.atten, 1e-5), function() {
|
|
317
|
-
this.$l.lightColor = pb.mul(this.diffuseIntensity.rgb, this.diffuseIntensity.a);
|
|
318
|
-
this.$l.diffScale = this.$choice(pb.equal(this.lightType, LIGHT_TYPE_POINT), this.extra.x, pb.float(1));
|
|
319
|
-
this.$l.specScale = this.$choice(pb.equal(this.lightType, LIGHT_TYPE_POINT), this.extra.y, pb.float(1));
|
|
320
|
-
this.$l.sourceRadiusFactor = this.$choice(pb.equal(this.lightType, LIGHT_TYPE_POINT), pb.div(this.extra.z, pb.max(this.dist, 1e-4)), pb.float(0));
|
|
321
|
-
this.zAccumulatePunctualLight(this.base.rgb, this.metallic, this.roughness, this.specularStrength, this.n, this.viewDir, this.NoV, this.f0, this.lightColor, this.L, this.atten, this.diffScale, this.specScale, this.sourceRadiusFactor, this.diffuse, this.specular);
|
|
322
|
-
});
|
|
323
|
-
});
|
|
324
|
-
this.$if(pb.equal(this.lightType, LIGHT_TYPE_RECT), function() {
|
|
325
|
-
this.zAccumulateRectLight(this.worldPos, this.base.rgb, this.metallic, this.roughness, this.specularStrength, this.n, this.viewDir, this.NoV, this.f0, this.positionRange, this.directionCutoff, this.extra, this.diffuseIntensity, this.diffuse, this.specular);
|
|
326
|
-
});
|
|
327
|
-
});
|
|
328
|
-
});
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
this.$l.finalColor = pb.add(pb.mul(pb.add(this.diffuse, this.specular), this.litFlag), this.extra.rgb);
|
|
332
|
-
if (hasEnvIrradiance || hasEnvRadiance) {
|
|
333
|
-
this.$l.ggxLutSample = pb.clamp(pb.textureSampleLevel(this.zGGXLut, pb.clamp(pb.vec2(this.NoV, this.roughness), pb.vec2(0), pb.vec2(1)), 0), pb.vec4(0), pb.vec4(1));
|
|
334
|
-
this.$l.f_ab = this.ggxLutSample.rg;
|
|
335
|
-
this.$l.FssEss = pb.add(pb.mul(this.fresnelNoV, this.f_ab.x), pb.vec3(this.f_ab.y));
|
|
336
|
-
this.$l.Ems = pb.sub(1, pb.add(this.f_ab.x, this.f_ab.y));
|
|
337
|
-
this.$l.F_avg = pb.add(this.f0, pb.div(pb.sub(pb.vec3(1), this.f0), 21));
|
|
338
|
-
this.$l.FmsEms = pb.div(pb.mul(this.FssEss, this.F_avg, this.Ems), pb.max(pb.sub(pb.vec3(1), pb.mul(this.F_avg, this.Ems)), pb.vec3(1e-4)));
|
|
339
|
-
}
|
|
340
|
-
if (hasEnvIrradiance) {
|
|
341
|
-
this.$l.envIrr = ctx.env.light.envLight.getIrradiance(this, this.n).rgb;
|
|
342
|
-
this.finalColor = pb.add(this.finalColor, pb.mul(pb.add(this.kd, this.FmsEms), this.base.rgb, this.envIrr, this.envLightStrength, this.occlusion, 1 / Math.PI));
|
|
343
|
-
}
|
|
344
|
-
if (hasEnvRadiance) {
|
|
345
|
-
this.$l.reflectVec = pb.reflect(pb.neg(this.viewDir), this.n);
|
|
346
|
-
this.$l.envRad = ctx.env.light.envLight.getRadiance(this, this.reflectVec, this.roughness).rgb;
|
|
347
|
-
this.finalColor = pb.add(this.finalColor, pb.mul(this.envRad, this.FssEss, this.envLightStrength, this.occlusion));
|
|
348
|
-
}
|
|
349
|
-
// Deferred direct shadowing is aligned in follow-up pass; keep a stable debug channel now.
|
|
350
|
-
this.$l.shadowTerm = pb.float(1);
|
|
351
|
-
this.$l.debugColor = pb.max(this.finalColor, pb.vec3(0));
|
|
352
|
-
this.$if(pb.notEqual(this.showGBuffer, 0), function() {
|
|
353
|
-
this.$if(pb.equal(this.gbufferViewMode, 1), function() {
|
|
354
|
-
this.debugColor = pb.vec3(pb.clamp(this.linearDepthNormalized, 0, 1));
|
|
355
|
-
}).$elseif(pb.equal(this.gbufferViewMode, 2), function() {
|
|
356
|
-
this.debugColor = pb.vec3(this.metallic);
|
|
357
|
-
}).$elseif(pb.equal(this.gbufferViewMode, 3), function() {
|
|
358
|
-
this.debugColor = pb.vec3(this.roughness);
|
|
359
|
-
}).$elseif(pb.equal(this.gbufferViewMode, 4), function() {
|
|
360
|
-
this.$l.rawN = pb.sub(pb.mul(pb.textureSample(this.gbufferNormalTex, this.$inputs.uv).xyz, 2), pb.vec3(1));
|
|
361
|
-
this.debugColor = pb.vec3(pb.clamp(pb.length(this.rawN), 0, 1));
|
|
362
|
-
}).$else(function() {
|
|
363
|
-
// composite
|
|
364
|
-
this.$if(pb.lessThan(this.$inputs.uv.x, 0.5), function() {
|
|
365
|
-
this.$if(pb.lessThan(this.$inputs.uv.y, 0.5), function() {
|
|
366
|
-
this.debugColor = this.base.rgb;
|
|
367
|
-
}).$else(function() {
|
|
368
|
-
this.debugColor = this.rm.rgb;
|
|
369
|
-
});
|
|
370
|
-
}).$else(function() {
|
|
371
|
-
this.$if(pb.lessThan(this.$inputs.uv.y, 0.5), function() {
|
|
372
|
-
this.debugColor = pb.add(pb.mul(this.n, 0.5), pb.vec3(0.5));
|
|
373
|
-
}).$else(function() {
|
|
374
|
-
this.debugColor = pb.vec3(this.roughness);
|
|
375
|
-
});
|
|
376
|
-
});
|
|
377
|
-
});
|
|
378
|
-
}).$elseif(pb.notEqual(this.showCluster, 0), function() {
|
|
379
|
-
this.$l.clusterT = pb.clamp(pb.div(pb.float(this.clusterLightCount), 16), 0, 1);
|
|
380
|
-
this.debugColor = pb.vec3(this.clusterT, pb.mul(this.clusterT, this.clusterT), pb.sub(1, this.clusterT));
|
|
381
|
-
}).$elseif(pb.notEqual(this.showShadowTerm, 0), function() {
|
|
382
|
-
this.debugColor = pb.vec3(this.shadowTerm);
|
|
383
|
-
}).$elseif(pb.notEqual(this.showSpecTerm, 0), function() {
|
|
384
|
-
this.debugColor = pb.max(this.specular, pb.vec3(0));
|
|
385
|
-
});
|
|
386
|
-
this.$outputs.color = pb.vec4(this.debugColor, this.base.a);
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
if (!builtProgram) {
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
393
|
-
program = builtProgram;
|
|
394
|
-
program.name = '@DeferredLightPass';
|
|
395
|
-
DeferredLightPass._programs[hash] = program;
|
|
396
|
-
}
|
|
397
|
-
let bindGroup = DeferredLightPass._bindGroups[hash];
|
|
398
|
-
if (!bindGroup) {
|
|
399
|
-
bindGroup = device.createBindGroup(program.bindGroupLayouts[0]);
|
|
400
|
-
DeferredLightPass._bindGroups[hash] = bindGroup;
|
|
401
|
-
}
|
|
402
|
-
bindGroup.setTexture('gbufferColorTex', gbufferColor, fetchSampler('clamp_nearest_nomip'));
|
|
403
|
-
bindGroup.setTexture('gbufferRoughnessTex', gbufferRoughness, fetchSampler('clamp_nearest_nomip'));
|
|
404
|
-
bindGroup.setTexture('gbufferNormalTex', gbufferNormal, fetchSampler('clamp_nearest_nomip'));
|
|
405
|
-
bindGroup.setTexture('gbufferExtraTex', gbufferExtra, fetchSampler('clamp_nearest_nomip'));
|
|
406
|
-
bindGroup.setTexture('linearDepthTex', ctx.linearDepthTexture, fetchSampler('clamp_nearest_nomip'));
|
|
407
|
-
bindGroup.setTexture('zGGXLut', getGGXLUT(1024), fetchSampler('clamp_nearest_nomip'));
|
|
408
|
-
bindGroup.setTexture('lightIndexTex', ctx.clusteredLight.lightIndexTexture);
|
|
409
|
-
bindGroup.setBuffer('zLightBuffer', ctx.clusteredLight.lightBuffer);
|
|
410
|
-
bindGroup.setValue('clusterParams', ctx.clusteredLight.clusterParam);
|
|
411
|
-
bindGroup.setValue('countParams', ctx.clusteredLight.countParam);
|
|
412
|
-
bindGroup.setValue('lightIndexTexSize', new Int32Array([
|
|
413
|
-
ctx.clusteredLight.lightIndexTexture.width,
|
|
414
|
-
ctx.clusteredLight.lightIndexTexture.height
|
|
415
|
-
]));
|
|
416
|
-
const sunDirSrc = ctx.sunLight ? ctx.sunLight.directionAndCutoff.xyz().scaleBy(-1) : {
|
|
417
|
-
x: 0,
|
|
418
|
-
y: 0,
|
|
419
|
-
z: 1
|
|
420
|
-
};
|
|
421
|
-
const sunShadowed = !!(ctx.sunLight && ctx.shadowMapInfo?.has(ctx.sunLight));
|
|
422
|
-
const sunColorIntensitySrc = ctx.sunLight ? sunShadowed ? {
|
|
423
|
-
x: 0,
|
|
424
|
-
y: 0,
|
|
425
|
-
z: 0,
|
|
426
|
-
w: 0
|
|
427
|
-
} : ctx.sunLight.diffuseAndIntensity : {
|
|
428
|
-
x: 1,
|
|
429
|
-
y: 1,
|
|
430
|
-
z: 1,
|
|
431
|
-
w: 0
|
|
432
|
-
};
|
|
433
|
-
const cameraRight = ctx.camera.worldMatrix.getRow(0).xyz().inplaceNormalize();
|
|
434
|
-
const cameraUp = ctx.camera.worldMatrix.getRow(1).xyz().inplaceNormalize();
|
|
435
|
-
const cameraForward = ctx.camera.worldMatrix.getRow(2).xyz().inplaceNormalize().scaleBy(-1);
|
|
436
|
-
const cameraPos = ctx.camera.getWorldPosition();
|
|
437
|
-
bindGroup.setValue('sunDir', new Float32Array([
|
|
438
|
-
sunDirSrc.x,
|
|
439
|
-
sunDirSrc.y,
|
|
440
|
-
sunDirSrc.z
|
|
441
|
-
]));
|
|
442
|
-
bindGroup.setValue('sunColorIntensity', new Float32Array([
|
|
443
|
-
sunColorIntensitySrc.x,
|
|
444
|
-
sunColorIntensitySrc.y,
|
|
445
|
-
sunColorIntensitySrc.z,
|
|
446
|
-
sunColorIntensitySrc.w
|
|
447
|
-
]));
|
|
448
|
-
bindGroup.setValue('cameraRight', new Float32Array([
|
|
449
|
-
cameraRight.x,
|
|
450
|
-
cameraRight.y,
|
|
451
|
-
cameraRight.z
|
|
452
|
-
]));
|
|
453
|
-
bindGroup.setValue('cameraUp', new Float32Array([
|
|
454
|
-
cameraUp.x,
|
|
455
|
-
cameraUp.y,
|
|
456
|
-
cameraUp.z
|
|
457
|
-
]));
|
|
458
|
-
bindGroup.setValue('cameraForward', new Float32Array([
|
|
459
|
-
cameraForward.x,
|
|
460
|
-
cameraForward.y,
|
|
461
|
-
cameraForward.z
|
|
462
|
-
]));
|
|
463
|
-
bindGroup.setValue('cameraPos', new Float32Array([
|
|
464
|
-
cameraPos.x,
|
|
465
|
-
cameraPos.y,
|
|
466
|
-
cameraPos.z
|
|
467
|
-
]));
|
|
468
|
-
bindGroup.setValue('cameraProj', new Float32Array([
|
|
469
|
-
ctx.camera.getTanHalfFovy(),
|
|
470
|
-
ctx.camera.getAspect()
|
|
471
|
-
]));
|
|
472
|
-
bindGroup.setValue('cameraNearFar', new Float32Array([
|
|
473
|
-
ctx.camera.getNearPlane(),
|
|
474
|
-
ctx.camera.getFarPlane()
|
|
475
|
-
]));
|
|
476
|
-
let gbufferViewMode = 0;
|
|
477
|
-
switch(ctx.camera.deferredGBufferView){
|
|
478
|
-
case 'depth':
|
|
479
|
-
gbufferViewMode = 1;
|
|
480
|
-
break;
|
|
481
|
-
case 'metallic':
|
|
482
|
-
gbufferViewMode = 2;
|
|
483
|
-
break;
|
|
484
|
-
case 'roughness':
|
|
485
|
-
gbufferViewMode = 3;
|
|
486
|
-
break;
|
|
487
|
-
case 'normal-length':
|
|
488
|
-
gbufferViewMode = 4;
|
|
489
|
-
break;
|
|
490
|
-
default:
|
|
491
|
-
gbufferViewMode = 0;
|
|
492
|
-
break;
|
|
493
|
-
}
|
|
494
|
-
bindGroup.setValue('showGBuffer', ctx.camera.deferredShowGBuffer ? 1 : 0);
|
|
495
|
-
bindGroup.setValue('gbufferViewMode', gbufferViewMode);
|
|
496
|
-
bindGroup.setValue('showCluster', ctx.camera.deferredShowCluster ? 1 : 0);
|
|
497
|
-
bindGroup.setValue('showShadowTerm', ctx.camera.deferredShowShadowTerm ? 1 : 0);
|
|
498
|
-
bindGroup.setValue('showSpecTerm', ctx.camera.deferredShowSpecTerm ? 1 : 0);
|
|
499
|
-
if (ctx.env?.light?.envLight) {
|
|
500
|
-
bindGroup.setValue('envLightStrength', ctx.env.light.strength ?? 0);
|
|
501
|
-
ctx.env.light.envLight.updateBindGroup(bindGroup);
|
|
502
|
-
}
|
|
503
|
-
device.setProgram(program);
|
|
504
|
-
device.setBindGroup(0, bindGroup);
|
|
505
|
-
drawFullscreenQuad();
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
export { DeferredLightPass };
|
|
510
|
-
//# sourceMappingURL=deferredlightpass.js.map
|