@zephyr3d/scene 0.8.0 → 0.8.1
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/animationset.js +198 -1
- package/dist/animation/animationset.js.map +1 -1
- package/dist/animation/ik/ccd_solver.js +3 -4
- package/dist/animation/ik/ccd_solver.js.map +1 -1
- package/dist/animation/ik/fabrik_solver.js +3 -4
- package/dist/animation/ik/fabrik_solver.js.map +1 -1
- package/dist/animation/ik/ik_pole_constraint.js +7 -2
- package/dist/animation/ik/ik_pole_constraint.js.map +1 -1
- package/dist/animation/ik/ik_utils.js +0 -79
- package/dist/animation/ik/ik_utils.js.map +1 -1
- package/dist/animation/ik/two_bone_ik_solver.js +3 -4
- package/dist/animation/ik/two_bone_ik_solver.js.map +1 -1
- package/dist/animation/spring/spring_bone.js +240 -0
- package/dist/animation/spring/spring_bone.js.map +1 -0
- package/dist/animation/spring/spring_bone_collider.js +198 -0
- package/dist/animation/spring/spring_bone_collider.js.map +1 -0
- package/dist/animation/spring/spring_bone_constraint.js +170 -0
- package/dist/animation/spring/spring_bone_constraint.js.map +1 -0
- package/dist/animation/spring/spring_bone_system.js +328 -0
- package/dist/animation/spring/spring_bone_system.js.map +1 -0
- package/dist/asset/model.js +2 -2
- package/dist/index.d.ts +15 -0
- package/dist/material/mixins/pbr/common.js +20 -17
- package/dist/material/mixins/pbr/common.js.map +1 -1
- package/dist/render/gpu_picking.js +100 -0
- package/dist/render/gpu_picking.js.map +1 -0
- package/dist/render/rendergraph/device_pool_allocator.js +41 -0
- package/dist/render/rendergraph/device_pool_allocator.js.map +1 -0
- package/dist/render/rendergraph/executor.js +146 -0
- package/dist/render/rendergraph/executor.js.map +1 -0
- package/dist/render/rendergraph/forward_plus_builder.js +414 -0
- package/dist/render/rendergraph/forward_plus_builder.js.map +1 -0
- package/dist/render/rendergraph/rendergraph.js +306 -0
- package/dist/render/rendergraph/rendergraph.js.map +1 -0
- package/dist/render/rendergraph/types.js +57 -0
- package/dist/render/rendergraph/types.js.map +1 -0
- package/dist/render/sky_motion_vector.js +85 -0
- package/dist/render/sky_motion_vector.js.map +1 -0
- package/dist/utility/serialization/scene/animation.js +3 -3
- package/dist/utility/serialization/scene/node.js +1 -1
- package/package.json +2 -2
- package/dist/animation/ik/ik_chain_builder.js +0 -68
- package/dist/animation/ik/ik_chain_builder.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/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
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import { Vector4 } from '@zephyr3d/base';
|
|
2
|
+
import { LightPass } from '../lightpass.js';
|
|
3
|
+
import { ShadowMapPass } from '../shadowmap_pass.js';
|
|
4
|
+
import { DepthPass } from '../depthpass.js';
|
|
5
|
+
import { ClusteredLight } from '../cluster_light.js';
|
|
6
|
+
import { buildHiZ } from '../hzb.js';
|
|
7
|
+
import '../primitive.js';
|
|
8
|
+
import '@zephyr3d/device';
|
|
9
|
+
import { CopyBlitter } from '../../blitter/copy.js';
|
|
10
|
+
import { fetchSampler } from '../../utility/misc.js';
|
|
11
|
+
import { MaterialVaryingFlags } from '../../values.js';
|
|
12
|
+
import { AbstractPostEffect, PostEffectLayer } from '../../posteffect/posteffect.js';
|
|
13
|
+
import { RenderGraph } from './rendergraph.js';
|
|
14
|
+
import { renderObjectColors } from '../gpu_picking.js';
|
|
15
|
+
import { BoxShape } from '../../shapes/box.js';
|
|
16
|
+
import '../../shapes/cylinder.js';
|
|
17
|
+
import '../../shapes/torus.js';
|
|
18
|
+
import '../../shapes/plane.js';
|
|
19
|
+
import '../../shapes/sphere.js';
|
|
20
|
+
import '../../shapes/tetrahedron.js';
|
|
21
|
+
|
|
22
|
+
// ─── Shared Pass Instances ──────────────────────────────────────────
|
|
23
|
+
const _scenePass = new LightPass();
|
|
24
|
+
const _depthPass = new DepthPass();
|
|
25
|
+
const _shadowMapPass = new ShadowMapPass();
|
|
26
|
+
const _clusters = [];
|
|
27
|
+
let _backDepthColorState = null;
|
|
28
|
+
let _frontDepthColorState = null;
|
|
29
|
+
function getClusteredLight() {
|
|
30
|
+
return _clusters.length > 0 ? _clusters.pop() : new ClusteredLight();
|
|
31
|
+
}
|
|
32
|
+
function freeClusteredLight(cl) {
|
|
33
|
+
_clusters.push(cl);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Derive pipeline options from the current scene/camera state.
|
|
37
|
+
* @internal
|
|
38
|
+
*/ function deriveForwardPlusOptions(scene, camera, deviceType, renderQueue) {
|
|
39
|
+
const ssr = camera.SSR && scene.env.light.envLight && scene.env.light.envLight.hasRadiance();
|
|
40
|
+
return {
|
|
41
|
+
depthPrepass: true,
|
|
42
|
+
motionVectors: deviceType !== 'webgl' && (camera.TAA || camera.motionBlur),
|
|
43
|
+
hiZ: camera.HiZ && deviceType !== 'webgl',
|
|
44
|
+
ssr: !!ssr,
|
|
45
|
+
ssrCalcThickness: !!ssr && camera.ssrCalcThickness,
|
|
46
|
+
gpuPicking: !!camera.getPickResultResolveFunc(),
|
|
47
|
+
needSceneColor: renderQueue.needSceneColor()
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
// ─── Forward+ Graph Builder ─────────────────────────────────────────
|
|
51
|
+
/**
|
|
52
|
+
* Constructs a render graph representing the forward+ pipeline.
|
|
53
|
+
*
|
|
54
|
+
* Each step in the existing `SceneRenderer._renderScene` becomes a graph pass.
|
|
55
|
+
* Execute callbacks delegate to the existing rendering code, sharing a mutable
|
|
56
|
+
* {@link FrameState}.
|
|
57
|
+
*
|
|
58
|
+
* @param graph - The render graph to populate.
|
|
59
|
+
* @param ctx - The draw context for this frame.
|
|
60
|
+
* @param renderQueue - The culled render queue.
|
|
61
|
+
* @param options - Pipeline feature toggles.
|
|
62
|
+
* @returns The backbuffer handle (graph output).
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
*/ function buildForwardPlusGraph(graph, ctx, renderQueue, options) {
|
|
66
|
+
const device = ctx.device;
|
|
67
|
+
const backbuffer = graph.importTexture('backbuffer');
|
|
68
|
+
// Shared mutable frame state
|
|
69
|
+
const frame = {
|
|
70
|
+
ctx,
|
|
71
|
+
renderQueue,
|
|
72
|
+
depthFramebuffer: null,
|
|
73
|
+
sunLightColor: null,
|
|
74
|
+
options
|
|
75
|
+
};
|
|
76
|
+
// ── 1. Sky Update ─────────────────────────────────────────────────
|
|
77
|
+
graph.addPass('SkyUpdate', (builder)=>{
|
|
78
|
+
builder.sideEffect();
|
|
79
|
+
builder.setExecute(()=>{
|
|
80
|
+
frame.sunLightColor = ctx.scene.env.sky.update(ctx);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
// ── 2. Clustered Light Setup ──────────────────────────────────────
|
|
84
|
+
graph.addPass('ClusterLights', (builder)=>{
|
|
85
|
+
builder.sideEffect();
|
|
86
|
+
builder.setExecute(()=>{
|
|
87
|
+
ctx.clusteredLight = getClusteredLight();
|
|
88
|
+
ctx.clusteredLight.calculateLightIndex(ctx.camera, renderQueue);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
// ── 3. GPU Picking (optional, sideEffect) ─────────────────────────
|
|
92
|
+
if (options.gpuPicking) {
|
|
93
|
+
graph.addPass('GPUPicking', (builder)=>{
|
|
94
|
+
builder.sideEffect();
|
|
95
|
+
builder.setExecute(()=>{
|
|
96
|
+
const pickResolveFunc = ctx.camera.getPickResultResolveFunc();
|
|
97
|
+
if (pickResolveFunc) {
|
|
98
|
+
renderObjectColors(ctx, pickResolveFunc, renderQueue);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
// ── 4. Shadow Maps ────────────────────────────────────────────────
|
|
104
|
+
let shadowMapsHandle;
|
|
105
|
+
if (renderQueue.shadowedLights.length > 0) {
|
|
106
|
+
graph.addPass('ShadowMaps', (builder)=>{
|
|
107
|
+
shadowMapsHandle = builder.createTexture({
|
|
108
|
+
format: 'r32f',
|
|
109
|
+
label: 'shadowMaps'
|
|
110
|
+
});
|
|
111
|
+
builder.setExecute(()=>{
|
|
112
|
+
renderShadowMaps(ctx, renderQueue.shadowedLights);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
// ── 5. Depth Prepass ──────────────────────────────────────────────
|
|
117
|
+
let depthHandle;
|
|
118
|
+
let motionVectorHandle;
|
|
119
|
+
graph.addPass('DepthPrepass', (builder)=>{
|
|
120
|
+
depthHandle = builder.createTexture({
|
|
121
|
+
format: ctx.SSRCalcThickness ? device.type === 'webgl' ? 'rgba16f' : 'rg32f' : device.type === 'webgl' ? 'rgba8unorm' : 'r32f',
|
|
122
|
+
label: 'linearDepth'
|
|
123
|
+
});
|
|
124
|
+
if (options.motionVectors) {
|
|
125
|
+
motionVectorHandle = builder.createTexture({
|
|
126
|
+
format: 'rgba16f',
|
|
127
|
+
label: 'motionVector'
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
builder.setExecute(()=>{
|
|
131
|
+
frame.depthFramebuffer = renderSceneDepth(frame, null);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
// ── 6. Hi-Z (optional) ───────────────────────────────────────────
|
|
135
|
+
let hiZHandle;
|
|
136
|
+
if (options.hiZ) {
|
|
137
|
+
graph.addPass('HiZ', (builder)=>{
|
|
138
|
+
builder.read(depthHandle);
|
|
139
|
+
hiZHandle = builder.createTexture({
|
|
140
|
+
format: 'r32f',
|
|
141
|
+
label: 'hiZ',
|
|
142
|
+
mipLevels: 10
|
|
143
|
+
});
|
|
144
|
+
builder.setExecute(()=>{
|
|
145
|
+
// HiZ is already built inside renderSceneDepth, but we declare it
|
|
146
|
+
// for graph dependency tracking. In the future this will be split out.
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
// ── 7. Main Light Pass ────────────────────────────────────────────
|
|
151
|
+
let sceneColorHandle;
|
|
152
|
+
graph.addPass('LightPass', (builder)=>{
|
|
153
|
+
builder.read(depthHandle);
|
|
154
|
+
if (shadowMapsHandle) {
|
|
155
|
+
builder.read(shadowMapsHandle);
|
|
156
|
+
}
|
|
157
|
+
if (hiZHandle) {
|
|
158
|
+
builder.read(hiZHandle);
|
|
159
|
+
}
|
|
160
|
+
sceneColorHandle = builder.createTexture({
|
|
161
|
+
format: ctx.colorFormat,
|
|
162
|
+
label: 'sceneColor'
|
|
163
|
+
});
|
|
164
|
+
builder.setExecute(()=>{
|
|
165
|
+
renderMainLightPass(frame);
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
// ── 8. Post Effects + Final Composite ─────────────────────────────
|
|
169
|
+
graph.addPass('Composite', (builder)=>{
|
|
170
|
+
builder.read(sceneColorHandle);
|
|
171
|
+
if (motionVectorHandle) {
|
|
172
|
+
builder.read(motionVectorHandle);
|
|
173
|
+
}
|
|
174
|
+
builder.write(backbuffer);
|
|
175
|
+
builder.setExecute(()=>{
|
|
176
|
+
renderComposite(frame);
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
return backbuffer;
|
|
180
|
+
}
|
|
181
|
+
// ─── Pass Implementation Helpers ────────────────────────────────────
|
|
182
|
+
// These wrap the existing SceneRenderer static methods, adapted to work
|
|
183
|
+
// with the FrameState pattern. They contain the same logic as the
|
|
184
|
+
// original methods but read/write through FrameState.
|
|
185
|
+
/** @internal */ function renderShadowMaps(ctx, lights) {
|
|
186
|
+
ctx.renderPass = _shadowMapPass;
|
|
187
|
+
ctx.device.pushDeviceStates();
|
|
188
|
+
for (const light of lights){
|
|
189
|
+
light.shadow.render(ctx, _shadowMapPass);
|
|
190
|
+
}
|
|
191
|
+
ctx.device.popDeviceStates();
|
|
192
|
+
}
|
|
193
|
+
/** @internal */ function renderSceneDepth(frame, existingDepthFb) {
|
|
194
|
+
const ctx = frame.ctx;
|
|
195
|
+
const renderQueue = frame.renderQueue;
|
|
196
|
+
const transmission = !!existingDepthFb;
|
|
197
|
+
let depthFramebuffer = existingDepthFb;
|
|
198
|
+
if (!depthFramebuffer) {
|
|
199
|
+
const format = ctx.device.type === 'webgl' ? ctx.SSRCalcThickness ? 'rgba16f' : 'rgba8unorm' : ctx.SSRCalcThickness ? 'rg32f' : 'r32f';
|
|
200
|
+
const mvFormat = 'rgba16f';
|
|
201
|
+
if (!ctx.finalFramebuffer) {
|
|
202
|
+
depthFramebuffer = ctx.device.pool.fetchTemporalFramebuffer(true, ctx.renderWidth, ctx.renderHeight, ctx.motionVectors ? [
|
|
203
|
+
format,
|
|
204
|
+
mvFormat
|
|
205
|
+
] : format, ctx.depthFormat, false);
|
|
206
|
+
} else {
|
|
207
|
+
const originDepth = ctx.finalFramebuffer?.getDepthAttachment();
|
|
208
|
+
depthFramebuffer = originDepth?.isTexture2D() ? ctx.device.pool.fetchTemporalFramebuffer(true, originDepth.width, originDepth.height, ctx.motionVectors ? [
|
|
209
|
+
format,
|
|
210
|
+
mvFormat
|
|
211
|
+
] : format, originDepth, false) : ctx.device.pool.fetchTemporalFramebuffer(true, ctx.renderWidth, ctx.renderHeight, ctx.motionVectors ? [
|
|
212
|
+
format,
|
|
213
|
+
mvFormat
|
|
214
|
+
] : format, ctx.depthFormat, false);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
ctx.device.pushDeviceStates();
|
|
218
|
+
ctx.device.setFramebuffer(depthFramebuffer);
|
|
219
|
+
_depthPass.encodeDepth = depthFramebuffer.getColorAttachments()[0].format === 'rgba8unorm';
|
|
220
|
+
_depthPass.clearColor = transmission ? null : _depthPass.encodeDepth ? new Vector4(0, 0, 0, 1) : new Vector4(1, 1, 1, 1);
|
|
221
|
+
_depthPass.clearDepth = transmission ? null : 1;
|
|
222
|
+
_depthPass.clearStencil = null;
|
|
223
|
+
_depthPass.transmission = transmission;
|
|
224
|
+
if (ctx.SSRCalcThickness && !transmission) {
|
|
225
|
+
if (!_backDepthColorState) {
|
|
226
|
+
_backDepthColorState = ctx.device.createColorState().setColorMask(false, true, false, false);
|
|
227
|
+
}
|
|
228
|
+
if (!_frontDepthColorState) {
|
|
229
|
+
_frontDepthColorState = ctx.device.createColorState().setColorMask(true, false, false, false);
|
|
230
|
+
}
|
|
231
|
+
ctx.forceColorState = _backDepthColorState;
|
|
232
|
+
ctx.forceCullMode = 'front';
|
|
233
|
+
_depthPass.renderBackface = true;
|
|
234
|
+
_depthPass.transmission = false;
|
|
235
|
+
_depthPass.render(ctx, null, null, renderQueue);
|
|
236
|
+
_depthPass.clearColor = null;
|
|
237
|
+
_depthPass.renderBackface = false;
|
|
238
|
+
ctx.forceColorState = _frontDepthColorState;
|
|
239
|
+
ctx.forceCullMode = null;
|
|
240
|
+
}
|
|
241
|
+
_depthPass.render(ctx, null, null, renderQueue);
|
|
242
|
+
ctx.forceColorState = null;
|
|
243
|
+
ctx.device.popDeviceStates();
|
|
244
|
+
if (!transmission) {
|
|
245
|
+
ctx.motionVectorTexture = ctx.motionVectors ? depthFramebuffer.getColorAttachments()[1] : null;
|
|
246
|
+
ctx.linearDepthTexture = depthFramebuffer.getColorAttachments()[0];
|
|
247
|
+
ctx.depthTexture = depthFramebuffer.getDepthAttachment();
|
|
248
|
+
if (ctx.motionVectorTexture) {
|
|
249
|
+
// Sky motion vectors rendering is handled inline
|
|
250
|
+
renderSkyMotionVectors(ctx);
|
|
251
|
+
}
|
|
252
|
+
if (ctx.HiZ) {
|
|
253
|
+
const w = ctx.linearDepthTexture.width;
|
|
254
|
+
const h = ctx.linearDepthTexture.height;
|
|
255
|
+
const HiZFrameBuffer = ctx.device.pool.fetchTemporalFramebuffer(true, w, h, ctx.linearDepthTexture.format, null, true);
|
|
256
|
+
buildHiZ(ctx.depthTexture, HiZFrameBuffer);
|
|
257
|
+
ctx.HiZTexture = HiZFrameBuffer.getColorAttachments()[0];
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return depthFramebuffer;
|
|
261
|
+
}
|
|
262
|
+
// ─── Sky Motion Vector State ────────────────────────────────────────
|
|
263
|
+
let _skyMVProgram = null;
|
|
264
|
+
let _skyMVBindGroup = null;
|
|
265
|
+
let _skyMVBox = null;
|
|
266
|
+
/** @internal */ function renderSkyMotionVectors(ctx) {
|
|
267
|
+
if (!ctx.motionVectorTexture) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
const device = ctx.device;
|
|
271
|
+
const fb = device.pool.fetchTemporalFramebuffer(false, 0, 0, ctx.motionVectorTexture, ctx.depthTexture);
|
|
272
|
+
if (!_skyMVProgram) {
|
|
273
|
+
_skyMVProgram = device.buildRenderProgram({
|
|
274
|
+
vertex (pb) {
|
|
275
|
+
this.$inputs.pos = pb.vec3().attrib('position');
|
|
276
|
+
this.VPMatrix = pb.mat4().uniform(0);
|
|
277
|
+
this.prevVPMatrix = pb.mat4().uniform(0);
|
|
278
|
+
this.cameraPos = pb.vec3().uniform(0);
|
|
279
|
+
this.prevCameraPos = pb.vec3().uniform(0);
|
|
280
|
+
pb.main(function() {
|
|
281
|
+
this.$l.worldPos = pb.add(this.$inputs.pos, this.cameraPos);
|
|
282
|
+
this.$l.prevWorldPos = pb.add(this.$inputs.pos, this.prevCameraPos);
|
|
283
|
+
this.$l.clipPos = pb.mul(this.VPMatrix, pb.vec4(this.worldPos, 1));
|
|
284
|
+
this.$l.prevClipPos = pb.mul(this.prevVPMatrix, pb.vec4(this.prevWorldPos, 1));
|
|
285
|
+
this.clipPos.z = this.clipPos.w;
|
|
286
|
+
this.$builtins.position = this.clipPos;
|
|
287
|
+
this.$outputs.currentPos = this.clipPos;
|
|
288
|
+
this.$outputs.prevPos = this.prevClipPos;
|
|
289
|
+
});
|
|
290
|
+
},
|
|
291
|
+
fragment (pb) {
|
|
292
|
+
this.$outputs.color = pb.vec4();
|
|
293
|
+
pb.main(function() {
|
|
294
|
+
this.$l.motionVector = pb.mul(pb.sub(pb.div(this.$inputs.currentPos.xy, this.$inputs.currentPos.w), pb.div(this.$inputs.prevPos.xy, this.$inputs.prevPos.w)), 0.5);
|
|
295
|
+
this.$outputs.color = pb.vec4(this.motionVector, 0, 1);
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
_skyMVProgram.name = '@TAA_SkyMotionVector';
|
|
300
|
+
}
|
|
301
|
+
if (!_skyMVBindGroup) {
|
|
302
|
+
_skyMVBindGroup = device.createBindGroup(_skyMVProgram.bindGroupLayouts[0]);
|
|
303
|
+
}
|
|
304
|
+
if (!_skyMVBox) {
|
|
305
|
+
_skyMVBox = new BoxShape({
|
|
306
|
+
size: 2,
|
|
307
|
+
needNormal: false,
|
|
308
|
+
needUV: false
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
_skyMVBindGroup.setValue('VPMatrix', ctx.camera.viewProjectionMatrix);
|
|
312
|
+
_skyMVBindGroup.setValue('prevVPMatrix', ctx.camera.prevVPMatrix);
|
|
313
|
+
_skyMVBindGroup.setValue('cameraPos', ctx.camera.getWorldPosition());
|
|
314
|
+
_skyMVBindGroup.setValue('prevCameraPos', ctx.camera.prevPosition);
|
|
315
|
+
device.pushDeviceStates();
|
|
316
|
+
device.setProgram(_skyMVProgram);
|
|
317
|
+
device.setBindGroup(0, _skyMVBindGroup);
|
|
318
|
+
device.setRenderStates(AbstractPostEffect.getDefaultRenderState(ctx, 'le'));
|
|
319
|
+
device.setFramebuffer(fb);
|
|
320
|
+
_skyMVBox.draw();
|
|
321
|
+
device.popDeviceStates();
|
|
322
|
+
device.pool.releaseFrameBuffer(fb);
|
|
323
|
+
}
|
|
324
|
+
/** @internal */ function renderMainLightPass(frame) {
|
|
325
|
+
const { ctx, renderQueue } = frame;
|
|
326
|
+
const device = ctx.device;
|
|
327
|
+
if (ctx.depthTexture === ctx.finalFramebuffer?.getDepthAttachment()) {
|
|
328
|
+
ctx.intermediateFramebuffer = ctx.finalFramebuffer;
|
|
329
|
+
} else {
|
|
330
|
+
ctx.intermediateFramebuffer = device.pool.fetchTemporalFramebuffer(false, ctx.depthTexture.width, ctx.depthTexture.height, ctx.colorFormat, ctx.depthTexture);
|
|
331
|
+
}
|
|
332
|
+
if (ctx.intermediateFramebuffer && ctx.intermediateFramebuffer !== ctx.finalFramebuffer) {
|
|
333
|
+
device.pushDeviceStates();
|
|
334
|
+
device.setFramebuffer(ctx.intermediateFramebuffer);
|
|
335
|
+
} else {
|
|
336
|
+
device.setViewport(null);
|
|
337
|
+
device.setScissor(null);
|
|
338
|
+
}
|
|
339
|
+
_scenePass.transmission = false;
|
|
340
|
+
_scenePass.clearDepth = ctx.depthTexture ? null : 1;
|
|
341
|
+
_scenePass.clearStencil = ctx.depthTexture ? null : 0;
|
|
342
|
+
if (ctx.SSR && !renderQueue.needSceneColor()) {
|
|
343
|
+
ctx.materialFlags |= MaterialVaryingFlags.SSR_STORE_ROUGHNESS;
|
|
344
|
+
}
|
|
345
|
+
ctx.compositor?.begin(ctx);
|
|
346
|
+
if (renderQueue.needSceneColor()) {
|
|
347
|
+
const compositor = ctx.compositor;
|
|
348
|
+
ctx.compositor = null;
|
|
349
|
+
const sceneColorFramebuffer = device.pool.fetchTemporalFramebuffer(true, ctx.depthTexture.width, ctx.depthTexture.height, ctx.materialFlags & MaterialVaryingFlags.SSR_STORE_ROUGHNESS ? [
|
|
350
|
+
ctx.colorFormat,
|
|
351
|
+
device.getFramebuffer().getColorAttachments()[1],
|
|
352
|
+
device.getFramebuffer().getColorAttachments()[2]
|
|
353
|
+
] : ctx.colorFormat, ctx.depthTexture, false);
|
|
354
|
+
device.pushDeviceStates();
|
|
355
|
+
device.setFramebuffer(sceneColorFramebuffer);
|
|
356
|
+
_scenePass.transmission = false;
|
|
357
|
+
_scenePass.render(ctx, null, null, renderQueue);
|
|
358
|
+
device.popDeviceStates();
|
|
359
|
+
ctx.sceneColorTexture = sceneColorFramebuffer.getColorAttachments()[0];
|
|
360
|
+
new CopyBlitter().blit(ctx.sceneColorTexture, device.getFramebuffer() ?? null, fetchSampler('clamp_nearest_nomip'));
|
|
361
|
+
_scenePass.transmission = true;
|
|
362
|
+
_scenePass.clearColor = null;
|
|
363
|
+
_scenePass.clearDepth = null;
|
|
364
|
+
_scenePass.clearStencil = null;
|
|
365
|
+
ctx.compositor = compositor;
|
|
366
|
+
}
|
|
367
|
+
_scenePass.render(ctx, null, null, renderQueue);
|
|
368
|
+
if (renderQueue.needSceneColor()) {
|
|
369
|
+
renderSceneDepth(frame, frame.depthFramebuffer);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
/** @internal */ function renderComposite(frame) {
|
|
373
|
+
const { ctx, renderQueue } = frame;
|
|
374
|
+
const device = ctx.device;
|
|
375
|
+
ctx.compositor?.drawPostEffects(ctx, PostEffectLayer.end, ctx.linearDepthTexture);
|
|
376
|
+
ctx.compositor?.end(ctx);
|
|
377
|
+
renderQueue.dispose();
|
|
378
|
+
ctx.materialFlags &= ~MaterialVaryingFlags.SSR_STORE_ROUGHNESS;
|
|
379
|
+
if (ctx.intermediateFramebuffer && ctx.intermediateFramebuffer !== ctx.finalFramebuffer) {
|
|
380
|
+
const blitter = new CopyBlitter();
|
|
381
|
+
blitter.srgbOut = !ctx.finalFramebuffer;
|
|
382
|
+
const srcTex = ctx.intermediateFramebuffer.getColorAttachments()[0];
|
|
383
|
+
blitter.blit(srcTex, ctx.finalFramebuffer ?? null, fetchSampler('clamp_nearest_nomip'));
|
|
384
|
+
device.popDeviceStates();
|
|
385
|
+
device.pool.releaseFrameBuffer(ctx.intermediateFramebuffer);
|
|
386
|
+
}
|
|
387
|
+
freeClusteredLight(ctx.clusteredLight);
|
|
388
|
+
if (frame.sunLightColor) {
|
|
389
|
+
ctx.sunLight.color = frame.sunLightColor;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
// ─── Convenience: Execute Full Pipeline ─────────────────────────────
|
|
393
|
+
/**
|
|
394
|
+
* Build, compile, and execute the forward+ pipeline as a render graph.
|
|
395
|
+
*
|
|
396
|
+
* This is the drop-in replacement for `SceneRenderer._renderScene`.
|
|
397
|
+
*
|
|
398
|
+
* @param ctx - The draw context for this frame.
|
|
399
|
+
* @public
|
|
400
|
+
*/ function executeForwardPlusGraph(ctx) {
|
|
401
|
+
const device = ctx.device;
|
|
402
|
+
const graph = new RenderGraph();
|
|
403
|
+
// Cull scene first (needed to derive options)
|
|
404
|
+
const renderQueue = _scenePass.cullScene(ctx, ctx.camera);
|
|
405
|
+
const options = deriveForwardPlusOptions(ctx.scene, ctx.camera, device.type, renderQueue);
|
|
406
|
+
const backbuffer = buildForwardPlusGraph(graph, ctx, renderQueue, options);
|
|
407
|
+
const compiled = graph.compile([
|
|
408
|
+
backbuffer
|
|
409
|
+
]);
|
|
410
|
+
graph.execute(compiled);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
export { buildForwardPlusGraph, deriveForwardPlusOptions, executeForwardPlusGraph };
|
|
414
|
+
//# sourceMappingURL=forward_plus_builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forward_plus_builder.js","sources":["../../../src/render/rendergraph/forward_plus_builder.ts"],"sourcesContent":["import type { Nullable } from '@zephyr3d/base';\nimport { Vector4 } from '@zephyr3d/base';\nimport type {\n BindGroup,\n ColorState,\n FrameBuffer,\n GPUProgram,\n Texture2D,\n TextureFormat\n} from '@zephyr3d/device';\nimport type { DrawContext } from '../drawable';\nimport type { RenderQueue } from '../render_queue';\nimport type { PunctualLight, Scene } from '../../scene';\nimport type { Camera } from '../../camera';\nimport { LightPass } from '../lightpass';\nimport { ShadowMapPass } from '../shadowmap_pass';\nimport { DepthPass } from '../depthpass';\nimport { ClusteredLight } from '../cluster_light';\nimport { buildHiZ } from '../hzb';\nimport { CopyBlitter } from '../../blitter';\nimport { fetchSampler } from '../../utility/misc';\nimport { MaterialVaryingFlags } from '../../values';\nimport { AbstractPostEffect, PostEffectLayer } from '../../posteffect/posteffect';\nimport { RenderGraph } from './rendergraph';\nimport type { RGHandle } from './types';\nimport { renderObjectColors } from '../gpu_picking';\nimport type { Primitive } from '../primitive';\nimport { BoxShape } from '../../shapes';\n\n// ─── Shared Pass Instances ──────────────────────────────────────────\n\nconst _scenePass = new LightPass();\nconst _depthPass = new DepthPass();\nconst _shadowMapPass = new ShadowMapPass();\nconst _clusters: ClusteredLight[] = [];\nlet _backDepthColorState: Nullable<ColorState> = null;\nlet _frontDepthColorState: Nullable<ColorState> = null;\n\nfunction getClusteredLight(): ClusteredLight {\n return _clusters.length > 0 ? _clusters.pop()! : new ClusteredLight();\n}\nfunction freeClusteredLight(cl: ClusteredLight): void {\n _clusters.push(cl);\n}\n\n// ─── Pipeline Options ───────────────────────────────────────────────\n\n/**\n * Options controlling which features are enabled in the forward+ pipeline.\n *\n * Derived from camera settings and device capabilities each frame.\n *\n * @public\n */\nexport interface ForwardPlusOptions {\n /** Enable depth prepass (always true for now). */\n depthPrepass: boolean;\n /** Enable motion vectors (requires TAA or motionBlur). */\n motionVectors: boolean;\n /** Enable Hi-Z pyramid (for SSR ray tracing). */\n hiZ: boolean;\n /** Enable screen-space reflections. */\n ssr: boolean;\n /** Whether to compute SSR thickness. */\n ssrCalcThickness: boolean;\n /** Whether GPU picking is requested this frame. */\n gpuPicking: boolean;\n /** Whether transmission/refraction materials are present. */\n needSceneColor: boolean;\n}\n\n/**\n * Derive pipeline options from the current scene/camera state.\n * @internal\n */\nexport function deriveForwardPlusOptions(\n scene: Scene,\n camera: Camera,\n deviceType: string,\n renderQueue: RenderQueue\n): ForwardPlusOptions {\n const ssr = camera.SSR && scene.env.light.envLight && scene.env.light.envLight.hasRadiance();\n return {\n depthPrepass: true,\n motionVectors: deviceType !== 'webgl' && (camera.TAA || camera.motionBlur),\n hiZ: camera.HiZ && deviceType !== 'webgl',\n ssr: !!ssr,\n ssrCalcThickness: !!ssr && camera.ssrCalcThickness,\n gpuPicking: !!camera.getPickResultResolveFunc(),\n needSceneColor: renderQueue.needSceneColor()\n };\n}\n\n// ─── Shared Frame State ─────────────────────────────────────────────\n\n/**\n * Mutable state shared between pass execute callbacks within a single frame.\n *\n * This replaces the monolithic DrawContext mutation pattern with an explicit\n * object that graph passes can read from and write to.\n *\n * @internal\n */\nexport interface FrameState {\n ctx: DrawContext;\n renderQueue: RenderQueue;\n depthFramebuffer: Nullable<FrameBuffer>;\n sunLightColor: Nullable<any>;\n options: ForwardPlusOptions;\n}\n\n// ─── Forward+ Graph Builder ─────────────────────────────────────────\n\n/**\n * Constructs a render graph representing the forward+ pipeline.\n *\n * Each step in the existing `SceneRenderer._renderScene` becomes a graph pass.\n * Execute callbacks delegate to the existing rendering code, sharing a mutable\n * {@link FrameState}.\n *\n * @param graph - The render graph to populate.\n * @param ctx - The draw context for this frame.\n * @param renderQueue - The culled render queue.\n * @param options - Pipeline feature toggles.\n * @returns The backbuffer handle (graph output).\n *\n * @public\n */\nexport function buildForwardPlusGraph(\n graph: RenderGraph,\n ctx: DrawContext,\n renderQueue: RenderQueue,\n options: ForwardPlusOptions\n): RGHandle {\n const device = ctx.device;\n const backbuffer = graph.importTexture('backbuffer');\n\n // Shared mutable frame state\n const frame: FrameState = {\n ctx,\n renderQueue,\n depthFramebuffer: null,\n sunLightColor: null,\n options\n };\n\n // ── 1. Sky Update ─────────────────────────────────────────────────\n graph.addPass('SkyUpdate', (builder) => {\n builder.sideEffect();\n builder.setExecute(() => {\n frame.sunLightColor = ctx.scene.env.sky.update(ctx);\n });\n });\n\n // ── 2. Clustered Light Setup ──────────────────────────────────────\n graph.addPass('ClusterLights', (builder) => {\n builder.sideEffect();\n builder.setExecute(() => {\n ctx.clusteredLight = getClusteredLight();\n ctx.clusteredLight.calculateLightIndex(ctx.camera, renderQueue);\n });\n });\n\n // ── 3. GPU Picking (optional, sideEffect) ─────────────────────────\n if (options.gpuPicking) {\n graph.addPass('GPUPicking', (builder) => {\n builder.sideEffect();\n builder.setExecute(() => {\n const pickResolveFunc = ctx.camera.getPickResultResolveFunc();\n if (pickResolveFunc) {\n renderObjectColors(ctx, pickResolveFunc, renderQueue);\n }\n });\n });\n }\n\n // ── 4. Shadow Maps ────────────────────────────────────────────────\n let shadowMapsHandle: RGHandle | undefined;\n if (renderQueue.shadowedLights.length > 0) {\n graph.addPass('ShadowMaps', (builder) => {\n shadowMapsHandle = builder.createTexture({ format: 'r32f', label: 'shadowMaps' });\n builder.setExecute(() => {\n renderShadowMaps(ctx, renderQueue.shadowedLights);\n });\n });\n }\n\n // ── 5. Depth Prepass ──────────────────────────────────────────────\n let depthHandle: RGHandle;\n let motionVectorHandle: RGHandle | undefined;\n\n graph.addPass('DepthPrepass', (builder) => {\n depthHandle = builder.createTexture({\n format: ctx.SSRCalcThickness\n ? device.type === 'webgl'\n ? 'rgba16f'\n : 'rg32f'\n : device.type === 'webgl'\n ? 'rgba8unorm'\n : 'r32f',\n label: 'linearDepth'\n });\n if (options.motionVectors) {\n motionVectorHandle = builder.createTexture({ format: 'rgba16f', label: 'motionVector' });\n }\n builder.setExecute(() => {\n frame.depthFramebuffer = renderSceneDepth(frame, null);\n });\n });\n\n // ── 6. Hi-Z (optional) ───────────────────────────────────────────\n let hiZHandle: RGHandle | undefined;\n if (options.hiZ) {\n graph.addPass('HiZ', (builder) => {\n builder.read(depthHandle!);\n hiZHandle = builder.createTexture({ format: 'r32f', label: 'hiZ', mipLevels: 10 });\n builder.setExecute(() => {\n // HiZ is already built inside renderSceneDepth, but we declare it\n // for graph dependency tracking. In the future this will be split out.\n });\n });\n }\n\n // ── 7. Main Light Pass ────────────────────────────────────────────\n let sceneColorHandle: RGHandle;\n graph.addPass('LightPass', (builder) => {\n builder.read(depthHandle!);\n if (shadowMapsHandle) {\n builder.read(shadowMapsHandle);\n }\n if (hiZHandle) {\n builder.read(hiZHandle);\n }\n sceneColorHandle = builder.createTexture({ format: ctx.colorFormat, label: 'sceneColor' });\n builder.setExecute(() => {\n renderMainLightPass(frame);\n });\n });\n\n // ── 8. Post Effects + Final Composite ─────────────────────────────\n graph.addPass('Composite', (builder) => {\n builder.read(sceneColorHandle!);\n if (motionVectorHandle) {\n builder.read(motionVectorHandle);\n }\n builder.write(backbuffer);\n builder.setExecute(() => {\n renderComposite(frame);\n });\n });\n\n return backbuffer;\n}\n\n// ─── Pass Implementation Helpers ────────────────────────────────────\n// These wrap the existing SceneRenderer static methods, adapted to work\n// with the FrameState pattern. They contain the same logic as the\n// original methods but read/write through FrameState.\n\n/** @internal */\nfunction renderShadowMaps(ctx: DrawContext, lights: PunctualLight[]): void {\n ctx.renderPass = _shadowMapPass;\n ctx.device.pushDeviceStates();\n for (const light of lights) {\n light.shadow.render(ctx, _shadowMapPass);\n }\n ctx.device.popDeviceStates();\n}\n\n/** @internal */\nfunction renderSceneDepth(frame: FrameState, existingDepthFb: Nullable<FrameBuffer>): FrameBuffer {\n const ctx = frame.ctx;\n const renderQueue = frame.renderQueue;\n const transmission = !!existingDepthFb;\n let depthFramebuffer = existingDepthFb;\n\n if (!depthFramebuffer) {\n const format: TextureFormat =\n ctx.device.type === 'webgl'\n ? ctx.SSRCalcThickness\n ? 'rgba16f'\n : 'rgba8unorm'\n : ctx.SSRCalcThickness\n ? 'rg32f'\n : 'r32f';\n const mvFormat: TextureFormat = 'rgba16f';\n if (!ctx.finalFramebuffer) {\n depthFramebuffer = ctx.device.pool.fetchTemporalFramebuffer(\n true,\n ctx.renderWidth,\n ctx.renderHeight,\n ctx.motionVectors ? [format, mvFormat] : format,\n ctx.depthFormat,\n false\n );\n } else {\n const originDepth = ctx.finalFramebuffer?.getDepthAttachment();\n depthFramebuffer = originDepth?.isTexture2D()\n ? ctx.device.pool.fetchTemporalFramebuffer(\n true,\n originDepth.width,\n originDepth.height,\n ctx.motionVectors ? [format, mvFormat] : format,\n originDepth,\n false\n )\n : ctx.device.pool.fetchTemporalFramebuffer(\n true,\n ctx.renderWidth,\n ctx.renderHeight,\n ctx.motionVectors ? [format, mvFormat] : format,\n ctx.depthFormat,\n false\n );\n }\n }\n\n ctx.device.pushDeviceStates();\n ctx.device.setFramebuffer(depthFramebuffer!);\n _depthPass.encodeDepth = depthFramebuffer!.getColorAttachments()[0].format === 'rgba8unorm';\n _depthPass.clearColor = transmission\n ? null\n : _depthPass.encodeDepth\n ? new Vector4(0, 0, 0, 1)\n : new Vector4(1, 1, 1, 1);\n _depthPass.clearDepth = transmission ? null : 1;\n _depthPass.clearStencil = null;\n _depthPass.transmission = transmission;\n\n if (ctx.SSRCalcThickness && !transmission) {\n if (!_backDepthColorState) {\n _backDepthColorState = ctx.device.createColorState().setColorMask(false, true, false, false);\n }\n if (!_frontDepthColorState) {\n _frontDepthColorState = ctx.device.createColorState().setColorMask(true, false, false, false);\n }\n ctx.forceColorState = _backDepthColorState;\n ctx.forceCullMode = 'front';\n _depthPass.renderBackface = true;\n _depthPass.transmission = false;\n _depthPass.render(ctx, null, null, renderQueue);\n _depthPass.clearColor = null;\n _depthPass.renderBackface = false;\n ctx.forceColorState = _frontDepthColorState;\n ctx.forceCullMode = null;\n }\n _depthPass.render(ctx, null, null, renderQueue);\n ctx.forceColorState = null;\n ctx.device.popDeviceStates();\n\n if (!transmission) {\n ctx.motionVectorTexture = ctx.motionVectors\n ? (depthFramebuffer!.getColorAttachments()[1] as Texture2D)\n : null;\n ctx.linearDepthTexture = depthFramebuffer!.getColorAttachments()[0] as Texture2D;\n ctx.depthTexture = depthFramebuffer!.getDepthAttachment() as Texture2D;\n if (ctx.motionVectorTexture) {\n // Sky motion vectors rendering is handled inline\n renderSkyMotionVectors(ctx);\n }\n if (ctx.HiZ) {\n const w = ctx.linearDepthTexture.width;\n const h = ctx.linearDepthTexture.height;\n const HiZFrameBuffer = ctx.device.pool.fetchTemporalFramebuffer(\n true,\n w,\n h,\n ctx.linearDepthTexture.format,\n null,\n true\n );\n buildHiZ(ctx.depthTexture, HiZFrameBuffer);\n ctx.HiZTexture = HiZFrameBuffer.getColorAttachments()[0] as Texture2D;\n }\n }\n return depthFramebuffer!;\n}\n\n// ─── Sky Motion Vector State ────────────────────────────────────────\n\nlet _skyMVProgram: Nullable<GPUProgram> = null;\nlet _skyMVBindGroup: Nullable<BindGroup> = null;\nlet _skyMVBox: Nullable<Primitive> = null;\n\n/** @internal */\nfunction renderSkyMotionVectors(ctx: DrawContext): void {\n if (!ctx.motionVectorTexture) {\n return;\n }\n\n const device = ctx.device;\n const fb = device.pool.fetchTemporalFramebuffer(false, 0, 0, ctx.motionVectorTexture, ctx.depthTexture);\n\n if (!_skyMVProgram) {\n _skyMVProgram = device.buildRenderProgram({\n vertex(pb) {\n this.$inputs.pos = pb.vec3().attrib('position');\n this.VPMatrix = pb.mat4().uniform(0);\n this.prevVPMatrix = pb.mat4().uniform(0);\n this.cameraPos = pb.vec3().uniform(0);\n this.prevCameraPos = pb.vec3().uniform(0);\n pb.main(function () {\n this.$l.worldPos = pb.add(this.$inputs.pos, this.cameraPos);\n this.$l.prevWorldPos = pb.add(this.$inputs.pos, this.prevCameraPos);\n this.$l.clipPos = pb.mul(this.VPMatrix, pb.vec4(this.worldPos, 1));\n this.$l.prevClipPos = pb.mul(this.prevVPMatrix, pb.vec4(this.prevWorldPos, 1));\n this.clipPos.z = this.clipPos.w;\n this.$builtins.position = this.clipPos;\n this.$outputs.currentPos = this.clipPos;\n this.$outputs.prevPos = this.prevClipPos;\n });\n },\n fragment(pb) {\n this.$outputs.color = pb.vec4();\n pb.main(function () {\n this.$l.motionVector = pb.mul(\n pb.sub(\n pb.div(this.$inputs.currentPos.xy, this.$inputs.currentPos.w),\n pb.div(this.$inputs.prevPos.xy, this.$inputs.prevPos.w)\n ),\n 0.5\n );\n this.$outputs.color = pb.vec4(this.motionVector, 0, 1);\n });\n }\n })!;\n _skyMVProgram.name = '@TAA_SkyMotionVector';\n }\n\n if (!_skyMVBindGroup) {\n _skyMVBindGroup = device.createBindGroup(_skyMVProgram.bindGroupLayouts[0]);\n }\n\n if (!_skyMVBox) {\n _skyMVBox = new BoxShape({ size: 2, needNormal: false, needUV: false });\n }\n\n _skyMVBindGroup.setValue('VPMatrix', ctx.camera.viewProjectionMatrix);\n _skyMVBindGroup.setValue('prevVPMatrix', ctx.camera.prevVPMatrix!);\n _skyMVBindGroup.setValue('cameraPos', ctx.camera.getWorldPosition());\n _skyMVBindGroup.setValue('prevCameraPos', ctx.camera.prevPosition!);\n\n device.pushDeviceStates();\n device.setProgram(_skyMVProgram);\n device.setBindGroup(0, _skyMVBindGroup);\n device.setRenderStates(AbstractPostEffect.getDefaultRenderState(ctx, 'le'));\n device.setFramebuffer(fb);\n _skyMVBox.draw();\n device.popDeviceStates();\n device.pool.releaseFrameBuffer(fb);\n}\n\n/** @internal */\nfunction renderMainLightPass(frame: FrameState): void {\n const { ctx, renderQueue } = frame;\n const device = ctx.device;\n\n if (ctx.depthTexture === ctx.finalFramebuffer?.getDepthAttachment()) {\n ctx.intermediateFramebuffer = ctx.finalFramebuffer;\n } else {\n ctx.intermediateFramebuffer = device.pool.fetchTemporalFramebuffer(\n false,\n ctx.depthTexture!.width,\n ctx.depthTexture!.height,\n ctx.colorFormat!,\n ctx.depthTexture\n );\n }\n if (ctx.intermediateFramebuffer && ctx.intermediateFramebuffer !== ctx.finalFramebuffer) {\n device.pushDeviceStates();\n device.setFramebuffer(ctx.intermediateFramebuffer);\n } else {\n device.setViewport(null);\n device.setScissor(null);\n }\n\n _scenePass.transmission = false;\n _scenePass.clearDepth = ctx.depthTexture ? null : 1;\n _scenePass.clearStencil = ctx.depthTexture ? null : 0;\n\n if (ctx.SSR && !renderQueue.needSceneColor()) {\n ctx.materialFlags |= MaterialVaryingFlags.SSR_STORE_ROUGHNESS;\n }\n\n ctx.compositor?.begin(ctx);\n\n if (renderQueue.needSceneColor()) {\n const compositor = ctx.compositor;\n ctx.compositor = null;\n const sceneColorFramebuffer = device.pool.fetchTemporalFramebuffer(\n true,\n ctx.depthTexture!.width,\n ctx.depthTexture!.height,\n ctx.materialFlags & MaterialVaryingFlags.SSR_STORE_ROUGHNESS\n ? [\n ctx.colorFormat!,\n device.getFramebuffer()!.getColorAttachments()[1]!,\n device.getFramebuffer()!.getColorAttachments()[2]!\n ]\n : ctx.colorFormat!,\n ctx.depthTexture,\n false\n );\n device.pushDeviceStates();\n device.setFramebuffer(sceneColorFramebuffer);\n _scenePass.transmission = false;\n _scenePass.render(ctx, null, null, renderQueue);\n device.popDeviceStates();\n ctx.sceneColorTexture = sceneColorFramebuffer.getColorAttachments()[0] as Texture2D;\n new CopyBlitter().blit(\n ctx.sceneColorTexture,\n device.getFramebuffer() ?? null,\n fetchSampler('clamp_nearest_nomip')\n );\n _scenePass.transmission = true;\n _scenePass.clearColor = null;\n _scenePass.clearDepth = null;\n _scenePass.clearStencil = null;\n ctx.compositor = compositor;\n }\n _scenePass.render(ctx, null, null, renderQueue);\n\n if (renderQueue.needSceneColor()) {\n renderSceneDepth(frame, frame.depthFramebuffer);\n }\n}\n\n/** @internal */\nfunction renderComposite(frame: FrameState): void {\n const { ctx, renderQueue } = frame;\n const device = ctx.device;\n\n ctx.compositor?.drawPostEffects(ctx, PostEffectLayer.end, ctx.linearDepthTexture!);\n ctx.compositor?.end(ctx);\n renderQueue.dispose();\n ctx.materialFlags &= ~MaterialVaryingFlags.SSR_STORE_ROUGHNESS;\n\n if (ctx.intermediateFramebuffer && ctx.intermediateFramebuffer !== ctx.finalFramebuffer) {\n const blitter = new CopyBlitter();\n blitter.srgbOut = !ctx.finalFramebuffer;\n const srcTex = ctx.intermediateFramebuffer.getColorAttachments()[0] as Texture2D;\n blitter.blit(srcTex, ctx.finalFramebuffer ?? null, fetchSampler('clamp_nearest_nomip'));\n device.popDeviceStates();\n device.pool.releaseFrameBuffer(ctx.intermediateFramebuffer);\n }\n\n freeClusteredLight(ctx.clusteredLight!);\n\n if (frame.sunLightColor) {\n ctx.sunLight!.color = frame.sunLightColor;\n }\n}\n\n// ─── Convenience: Execute Full Pipeline ─────────────────────────────\n\n/**\n * Build, compile, and execute the forward+ pipeline as a render graph.\n *\n * This is the drop-in replacement for `SceneRenderer._renderScene`.\n *\n * @param ctx - The draw context for this frame.\n * @public\n */\nexport function executeForwardPlusGraph(ctx: DrawContext): void {\n const device = ctx.device;\n const graph = new RenderGraph();\n\n // Cull scene first (needed to derive options)\n const renderQueue = _scenePass.cullScene(ctx, ctx.camera);\n\n const options = deriveForwardPlusOptions(ctx.scene, ctx.camera, device.type, renderQueue);\n const backbuffer = buildForwardPlusGraph(graph, ctx, renderQueue, options);\n\n const compiled = graph.compile([backbuffer]);\n graph.execute(compiled);\n}\n"],"names":["_scenePass","LightPass","_depthPass","DepthPass","_shadowMapPass","ShadowMapPass","_clusters","_backDepthColorState","_frontDepthColorState","getClusteredLight","length","pop","ClusteredLight","freeClusteredLight","cl","push","deriveForwardPlusOptions","scene","camera","deviceType","renderQueue","ssr","SSR","env","light","envLight","hasRadiance","depthPrepass","motionVectors","TAA","motionBlur","hiZ","HiZ","ssrCalcThickness","gpuPicking","getPickResultResolveFunc","needSceneColor","buildForwardPlusGraph","graph","ctx","options","device","backbuffer","importTexture","frame","depthFramebuffer","sunLightColor","addPass","builder","sideEffect","setExecute","sky","update","clusteredLight","calculateLightIndex","pickResolveFunc","renderObjectColors","shadowMapsHandle","shadowedLights","createTexture","format","label","renderShadowMaps","depthHandle","motionVectorHandle","SSRCalcThickness","type","renderSceneDepth","hiZHandle","read","mipLevels","sceneColorHandle","colorFormat","renderMainLightPass","write","renderComposite","lights","renderPass","pushDeviceStates","shadow","render","popDeviceStates","existingDepthFb","transmission","mvFormat","finalFramebuffer","pool","fetchTemporalFramebuffer","renderWidth","renderHeight","depthFormat","originDepth","getDepthAttachment","isTexture2D","width","height","setFramebuffer","encodeDepth","getColorAttachments","clearColor","Vector4","clearDepth","clearStencil","createColorState","setColorMask","forceColorState","forceCullMode","renderBackface","motionVectorTexture","linearDepthTexture","depthTexture","renderSkyMotionVectors","w","h","HiZFrameBuffer","buildHiZ","HiZTexture","_skyMVProgram","_skyMVBindGroup","_skyMVBox","fb","buildRenderProgram","vertex","pb","$inputs","pos","vec3","attrib","VPMatrix","mat4","uniform","prevVPMatrix","cameraPos","prevCameraPos","main","$l","worldPos","add","prevWorldPos","clipPos","mul","vec4","prevClipPos","z","$builtins","position","$outputs","currentPos","prevPos","fragment","color","motionVector","sub","div","xy","name","createBindGroup","bindGroupLayouts","BoxShape","size","needNormal","needUV","setValue","viewProjectionMatrix","getWorldPosition","prevPosition","setProgram","setBindGroup","setRenderStates","AbstractPostEffect","getDefaultRenderState","draw","releaseFrameBuffer","intermediateFramebuffer","setViewport","setScissor","materialFlags","MaterialVaryingFlags","SSR_STORE_ROUGHNESS","compositor","begin","sceneColorFramebuffer","getFramebuffer","sceneColorTexture","CopyBlitter","blit","fetchSampler","drawPostEffects","PostEffectLayer","end","dispose","blitter","srgbOut","srcTex","sunLight","executeFor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