@zephyr3d/scene 0.7.1 → 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/animation.js +0 -18
- package/dist/animation/animation.js.map +1 -1
- package/dist/animation/animationset.js +200 -3
- package/dist/animation/animationset.js.map +1 -1
- package/dist/animation/ik/ccd_solver.js +371 -0
- package/dist/animation/ik/ccd_solver.js.map +1 -0
- package/dist/animation/ik/fabrik_solver.js +398 -0
- package/dist/animation/ik/fabrik_solver.js.map +1 -0
- package/dist/animation/ik/ik_angle_constraint.js +181 -0
- package/dist/animation/ik/ik_angle_constraint.js.map +1 -0
- package/dist/animation/ik/ik_chain.js +163 -0
- package/dist/animation/ik/ik_chain.js.map +1 -0
- package/dist/animation/ik/ik_constraint.js +25 -0
- package/dist/animation/ik/ik_constraint.js.map +1 -0
- package/dist/animation/ik/ik_pole_constraint.js +128 -0
- package/dist/animation/ik/ik_pole_constraint.js.map +1 -0
- package/dist/animation/ik/ik_solver.js +48 -0
- package/dist/animation/ik/ik_solver.js.map +1 -0
- package/dist/animation/ik/ik_track.js +96 -0
- package/dist/animation/ik/ik_track.js.map +1 -0
- package/dist/animation/ik/ik_utils.js +191 -0
- package/dist/animation/ik/ik_utils.js.map +1 -0
- package/dist/animation/ik/two_bone_ik_solver.js +331 -0
- package/dist/animation/ik/two_bone_ik_solver.js.map +1 -0
- package/dist/animation/ik_modifier.js +61 -0
- package/dist/animation/ik_modifier.js.map +1 -0
- package/dist/animation/ik_postprocessor.js +71 -0
- package/dist/animation/ik_postprocessor.js.map +1 -0
- package/dist/animation/manual_transform_processor.js +156 -0
- package/dist/animation/manual_transform_processor.js.map +1 -0
- package/dist/animation/skeleton.js +55 -51
- package/dist/animation/skeleton.js.map +1 -1
- package/dist/animation/skeleton_modifier.js +38 -0
- package/dist/animation/skeleton_modifier.js.map +1 -0
- package/dist/animation/skeleton_postprocessor.js +50 -0
- package/dist/animation/skeleton_postprocessor.js.map +1 -0
- package/dist/animation/spring/multi_chain_spring_system.js +503 -0
- package/dist/animation/spring/multi_chain_spring_system.js.map +1 -0
- 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/animation/spring/spring_chain.js +103 -0
- package/dist/animation/spring/spring_chain.js.map +1 -0
- package/dist/animation/spring/spring_collider.js +247 -0
- package/dist/animation/spring/spring_collider.js.map +1 -0
- package/dist/animation/spring/spring_constraint.js +21 -0
- package/dist/animation/spring/spring_constraint.js.map +1 -0
- package/dist/animation/spring/spring_particle.js +20 -0
- package/dist/animation/spring/spring_particle.js.map +1 -0
- package/dist/animation/spring/spring_system.js +526 -0
- package/dist/animation/spring/spring_system.js.map +1 -0
- package/dist/animation/spring_modifier.js +45 -0
- package/dist/animation/spring_modifier.js.map +1 -0
- package/dist/animation/spring_postprocessor.js +54 -0
- package/dist/animation/spring_postprocessor.js.map +1 -0
- package/dist/app/screen.js +1 -1
- package/dist/app/screen.js.map +1 -1
- package/dist/asset/model.js +10 -6
- package/dist/asset/model.js.map +1 -1
- package/dist/camera/perspectivecamera.js +3 -3
- package/dist/camera/perspectivecamera.js.map +1 -1
- package/dist/index.d.ts +1400 -4
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/dist/material/mixins/lightmodel/blinnphong.js +66 -4
- package/dist/material/mixins/lightmodel/blinnphong.js.map +1 -1
- package/dist/material/mixins/pbr/common.js +20 -17
- package/dist/material/mixins/pbr/common.js.map +1 -1
- package/dist/material/shader/helper.js +5 -3
- package/dist/material/shader/helper.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/scene/mesh.js +15 -23
- package/dist/scene/mesh.js.map +1 -1
- package/dist/utility/serialization/scene/animation.js +24 -23
- package/dist/utility/serialization/scene/animation.js.map +1 -1
- package/dist/utility/serialization/scene/material.js +62 -0
- package/dist/utility/serialization/scene/material.js.map +1 -1
- package/dist/utility/serialization/scene/node.js +1 -1
- package/package.json +3 -3
- 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,100 @@
|
|
|
1
|
+
import { Matrix4x4, Vector3, Vector4 } from '@zephyr3d/base';
|
|
2
|
+
import { Camera } from '../camera/camera.js';
|
|
3
|
+
import { ObjectColorPass } from './objectcolorpass.js';
|
|
4
|
+
|
|
5
|
+
const _pickCamera = new Camera(null);
|
|
6
|
+
const _objectColorPass = new ObjectColorPass();
|
|
7
|
+
function decodeNormalizedFloat(rgba) {
|
|
8
|
+
const a = rgba[0] / 255;
|
|
9
|
+
const b = rgba[1] / 255;
|
|
10
|
+
const c = rgba[2] / 255;
|
|
11
|
+
const d = rgba[3] / 255;
|
|
12
|
+
return a / (256 * 256 * 256) + b / (256 * 256) + c / 256 + d;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Perform GPU-based object picking by rendering object IDs to a 1x1 framebuffer.
|
|
16
|
+
* @internal
|
|
17
|
+
*/ function renderObjectColors(ctx, pickResolveFunc, renderQueue) {
|
|
18
|
+
const camera = ctx.camera;
|
|
19
|
+
const isWebGL1 = ctx.device.type === 'webgl';
|
|
20
|
+
ctx.renderPass = _objectColorPass;
|
|
21
|
+
ctx.device.pushDeviceStates();
|
|
22
|
+
const fb = ctx.device.pool.fetchTemporalFramebuffer(false, 1, 1, isWebGL1 ? [
|
|
23
|
+
'rgba8unorm',
|
|
24
|
+
'rgba8unorm'
|
|
25
|
+
] : [
|
|
26
|
+
'rgba8unorm',
|
|
27
|
+
'rgba32f'
|
|
28
|
+
], ctx.depthFormat, false);
|
|
29
|
+
ctx.device.setViewport(camera.viewport);
|
|
30
|
+
const vp = ctx.device.getViewport();
|
|
31
|
+
const windowX = camera.getPickPosX() / vp.width;
|
|
32
|
+
const windowY = (vp.height - camera.getPickPosY() - 1) / vp.height;
|
|
33
|
+
const windowW = 1 / vp.width;
|
|
34
|
+
const windowH = 1 / vp.height;
|
|
35
|
+
const pickCamera = _pickCamera;
|
|
36
|
+
camera.worldMatrix.decompose(pickCamera.scale, pickCamera.rotation, pickCamera.position);
|
|
37
|
+
let left = camera.getProjectionMatrix().getLeftPlane();
|
|
38
|
+
let right = camera.getProjectionMatrix().getRightPlane();
|
|
39
|
+
let bottom = camera.getProjectionMatrix().getBottomPlane();
|
|
40
|
+
let top = camera.getProjectionMatrix().getTopPlane();
|
|
41
|
+
const near = camera.getProjectionMatrix().getNearPlane();
|
|
42
|
+
const far = camera.getProjectionMatrix().getFarPlane();
|
|
43
|
+
const width = right - left;
|
|
44
|
+
const height = top - bottom;
|
|
45
|
+
left += width * windowX;
|
|
46
|
+
bottom += height * windowY;
|
|
47
|
+
right = left + width * windowW;
|
|
48
|
+
top = bottom + height * windowH;
|
|
49
|
+
pickCamera.setProjectionMatrix(camera.isPerspective() ? Matrix4x4.frustum(left, right, bottom, top, near, far) : Matrix4x4.ortho(left, right, bottom, top, near, far));
|
|
50
|
+
const cameraPos = isWebGL1 ? new Vector3(pickCamera.position) : null;
|
|
51
|
+
const ray = isWebGL1 ? camera.constructRay(camera.getPickPosX(), camera.getPickPosY()) : null;
|
|
52
|
+
ctx.device.setFramebuffer(fb);
|
|
53
|
+
_objectColorPass.clearColor = Vector4.zero();
|
|
54
|
+
_objectColorPass.clearDepth = 1;
|
|
55
|
+
const rq = _objectColorPass.cullScene(ctx, pickCamera);
|
|
56
|
+
_objectColorPass.render(ctx, pickCamera, null, rq);
|
|
57
|
+
rq.dispose();
|
|
58
|
+
ctx.device.popDeviceStates();
|
|
59
|
+
const colorTex = fb.getColorAttachments()[0];
|
|
60
|
+
const distanceTex = fb.getColorAttachments()[1];
|
|
61
|
+
const colorPixels = new Uint8Array(4);
|
|
62
|
+
const distancePixels = isWebGL1 ? new Uint8Array(4) : new Float32Array(4);
|
|
63
|
+
const device = ctx.device;
|
|
64
|
+
let fence;
|
|
65
|
+
if (ctx.device.type === 'webgl') {
|
|
66
|
+
fence = Promise.all([
|
|
67
|
+
ctx.device.runNextFrameAsync(()=>colorTex.readPixels(0, 0, 1, 1, 0, 0, colorPixels)),
|
|
68
|
+
ctx.device.runNextFrameAsync(()=>distanceTex.readPixels(0, 0, 1, 1, 0, 0, distancePixels))
|
|
69
|
+
]);
|
|
70
|
+
} else {
|
|
71
|
+
fence = Promise.all([
|
|
72
|
+
colorTex.readPixels(0, 0, 1, 1, 0, 0, colorPixels),
|
|
73
|
+
distanceTex.readPixels(0, 0, 1, 1, 0, 0, distancePixels)
|
|
74
|
+
]);
|
|
75
|
+
}
|
|
76
|
+
fence.then(()=>{
|
|
77
|
+
const drawable = renderQueue.getDrawableByColor(colorPixels);
|
|
78
|
+
let d = isWebGL1 ? decodeNormalizedFloat(distancePixels) * far : distancePixels[0];
|
|
79
|
+
const intersectedPoint = new Vector3(distancePixels[0], distancePixels[1], distancePixels[2]);
|
|
80
|
+
if (isWebGL1) {
|
|
81
|
+
intersectedPoint.x = cameraPos.x + ray.direction.x * d;
|
|
82
|
+
intersectedPoint.y = cameraPos.y + ray.direction.y * d;
|
|
83
|
+
intersectedPoint.z = cameraPos.z + ray.direction.z * d;
|
|
84
|
+
d = Vector3.distance(intersectedPoint, cameraPos);
|
|
85
|
+
}
|
|
86
|
+
pickResolveFunc(drawable ? {
|
|
87
|
+
distance: d,
|
|
88
|
+
intersectedPoint,
|
|
89
|
+
drawable,
|
|
90
|
+
target: drawable.getPickTarget()
|
|
91
|
+
} : null);
|
|
92
|
+
device.pool.releaseFrameBuffer(fb);
|
|
93
|
+
}).catch((_err)=>{
|
|
94
|
+
camera.getPickResultResolveFunc()?.(null);
|
|
95
|
+
device.pool.releaseFrameBuffer(fb);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export { renderObjectColors };
|
|
100
|
+
//# sourceMappingURL=gpu_picking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gpu_picking.js","sources":["../../src/render/gpu_picking.ts"],"sourcesContent":["import type { Nullable } from '@zephyr3d/base';\r\nimport { Matrix4x4, Vector3, Vector4 } from '@zephyr3d/base';\r\nimport type { DrawContext } from './drawable';\r\nimport type { RenderQueue } from './render_queue';\r\nimport { type PickResult, Camera } from '../camera';\r\nimport { ObjectColorPass } from './objectcolorpass';\r\n\r\nconst _pickCamera = new Camera(null);\r\nconst _objectColorPass = new ObjectColorPass();\r\n\r\nfunction decodeNormalizedFloat(rgba: Uint8Array<ArrayBuffer>): number {\r\n const a = rgba[0] / 255;\r\n const b = rgba[1] / 255;\r\n const c = rgba[2] / 255;\r\n const d = rgba[3] / 255;\r\n return a / (256 * 256 * 256) + b / (256 * 256) + c / 256 + d;\r\n}\r\n\r\n/**\r\n * Perform GPU-based object picking by rendering object IDs to a 1x1 framebuffer.\r\n * @internal\r\n */\r\nexport function renderObjectColors(\r\n ctx: DrawContext,\r\n pickResolveFunc: (result: Nullable<PickResult>) => void,\r\n renderQueue: RenderQueue\r\n): void {\r\n const camera = ctx.camera;\r\n const isWebGL1 = ctx.device.type === 'webgl';\r\n ctx.renderPass = _objectColorPass;\r\n ctx.device.pushDeviceStates();\r\n const fb = ctx.device.pool.fetchTemporalFramebuffer(\r\n false,\r\n 1,\r\n 1,\r\n isWebGL1 ? ['rgba8unorm', 'rgba8unorm'] : ['rgba8unorm', 'rgba32f'],\r\n ctx.depthFormat,\r\n false\r\n );\r\n ctx.device.setViewport(camera.viewport);\r\n const vp = ctx.device.getViewport();\r\n const windowX = camera.getPickPosX() / vp.width;\r\n const windowY = (vp.height - camera.getPickPosY() - 1) / vp.height;\r\n const windowW = 1 / vp.width;\r\n const windowH = 1 / vp.height;\r\n const pickCamera = _pickCamera;\r\n camera.worldMatrix.decompose(pickCamera.scale, pickCamera.rotation, pickCamera.position);\r\n let left = camera.getProjectionMatrix().getLeftPlane();\r\n let right = camera.getProjectionMatrix().getRightPlane();\r\n let bottom = camera.getProjectionMatrix().getBottomPlane();\r\n let top = camera.getProjectionMatrix().getTopPlane();\r\n const near = camera.getProjectionMatrix().getNearPlane();\r\n const far = camera.getProjectionMatrix().getFarPlane();\r\n const width = right - left;\r\n const height = top - bottom;\r\n left += width * windowX;\r\n bottom += height * windowY;\r\n right = left + width * windowW;\r\n top = bottom + height * windowH;\r\n pickCamera.setProjectionMatrix(\r\n camera.isPerspective()\r\n ? Matrix4x4.frustum(left, right, bottom, top, near, far)\r\n : Matrix4x4.ortho(left, right, bottom, top, near, far)\r\n );\r\n const cameraPos = isWebGL1 ? new Vector3(pickCamera.position) : null;\r\n const ray = isWebGL1 ? camera.constructRay(camera.getPickPosX(), camera.getPickPosY()) : null;\r\n ctx.device.setFramebuffer(fb);\r\n _objectColorPass.clearColor = Vector4.zero();\r\n _objectColorPass.clearDepth = 1;\r\n const rq = _objectColorPass.cullScene(ctx, pickCamera);\r\n _objectColorPass.render(ctx, pickCamera, null, rq);\r\n rq.dispose();\r\n ctx.device.popDeviceStates();\r\n const colorTex = fb.getColorAttachments()[0];\r\n const distanceTex = fb.getColorAttachments()[1];\r\n const colorPixels = new Uint8Array(4);\r\n const distancePixels = isWebGL1 ? new Uint8Array(4) : new Float32Array(4);\r\n const device = ctx.device;\r\n let fence: Promise<void[]>;\r\n if (ctx.device.type === 'webgl') {\r\n fence = Promise.all([\r\n ctx.device.runNextFrameAsync(() => colorTex.readPixels(0, 0, 1, 1, 0, 0, colorPixels)),\r\n ctx.device.runNextFrameAsync(() => distanceTex.readPixels(0, 0, 1, 1, 0, 0, distancePixels))\r\n ]);\r\n } else {\r\n fence = Promise.all([\r\n colorTex.readPixels(0, 0, 1, 1, 0, 0, colorPixels),\r\n distanceTex.readPixels(0, 0, 1, 1, 0, 0, distancePixels)\r\n ]);\r\n }\r\n fence\r\n .then(() => {\r\n const drawable = renderQueue.getDrawableByColor(colorPixels);\r\n let d = isWebGL1\r\n ? decodeNormalizedFloat(distancePixels as Uint8Array<ArrayBuffer>) * far\r\n : distancePixels[0];\r\n const intersectedPoint = new Vector3(distancePixels[0], distancePixels[1], distancePixels[2]);\r\n if (isWebGL1) {\r\n intersectedPoint.x = cameraPos!.x + ray!.direction.x * d;\r\n intersectedPoint.y = cameraPos!.y + ray!.direction.y * d;\r\n intersectedPoint.z = cameraPos!.z + ray!.direction.z * d;\r\n d = Vector3.distance(intersectedPoint, cameraPos!);\r\n }\r\n pickResolveFunc(\r\n drawable\r\n ? {\r\n distance: d,\r\n intersectedPoint,\r\n drawable,\r\n target: drawable.getPickTarget()\r\n }\r\n : null\r\n );\r\n device.pool.releaseFrameBuffer(fb);\r\n })\r\n .catch((_err) => {\r\n camera.getPickResultResolveFunc()?.(null);\r\n device.pool.releaseFrameBuffer(fb);\r\n });\r\n}\r\n"],"names":["_pickCamera","Camera","_objectColorPass","ObjectColorPass","decodeNormalizedFloat","rgba","a","b","c","d","renderObjectColors","ctx","pickResolveFunc","renderQueue","camera","isWebGL1","device","type","renderPass","pushDeviceStates","fb","pool","fetchTemporalFramebuffer","depthFormat","setViewport","viewport","vp","getViewport","windowX","getPickPosX","width","windowY","height","getPickPosY","windowW","windowH","pickCamera","worldMatrix","decompose","scale","rotation","position","left","getProjectionMatrix","getLeftPlane","right","getRightPlane","bottom","getBottomPlane","top","getTopPlane","near","getNearPlane","far","getFarPlane","setProjectionMatrix","isPerspective","Matrix4x4","frustum","ortho","cameraPos","Vector3","ray","constructRay","setFramebuffer","clearColor","Vector4","zero","clearDepth","rq","cullScene","render","dispose","popDeviceStates","colorTex","getColorAttachments","distanceTex","colorPixels","Uint8Array","distancePixels","Float32Array","fence","Promise","all","runNextFrameAsync","readPixels","then","drawable","getDrawableByColor","intersectedPoint","x","direction","y","z","distance","target","getPickTarget","releaseFrameBuffer","catch","_err","getPickResultResolveFunc"],"mappings":";;;;AAOA,MAAMA,WAAAA,GAAc,IAAIC,MAAO,CAAA,IAAA,CAAA;AAC/B,MAAMC,mBAAmB,IAAIC,eAAAA,EAAAA;AAE7B,SAASC,sBAAsBC,IAA6B,EAAA;AAC1D,IAAA,MAAMC,CAAID,GAAAA,IAAI,CAAC,CAAA,CAAE,GAAG,GAAA;AACpB,IAAA,MAAME,CAAIF,GAAAA,IAAI,CAAC,CAAA,CAAE,GAAG,GAAA;AACpB,IAAA,MAAMG,CAAIH,GAAAA,IAAI,CAAC,CAAA,CAAE,GAAG,GAAA;AACpB,IAAA,MAAMI,CAAIJ,GAAAA,IAAI,CAAC,CAAA,CAAE,GAAG,GAAA;AACpB,IAAA,OAAOC,CAAK,IAAA,GAAM,GAAA,GAAA,GAAM,GAAE,CAAA,GAAKC,CAAK,IAAA,GAAM,GAAA,GAAE,CAAKC,GAAAA,CAAAA,GAAI,GAAMC,GAAAA,CAAAA;AAC7D;AAEA;;;AAGC,IACM,SAASC,kBAAAA,CACdC,GAAgB,EAChBC,eAAuD,EACvDC,WAAwB,EAAA;IAExB,MAAMC,MAAAA,GAASH,IAAIG,MAAM;AACzB,IAAA,MAAMC,QAAWJ,GAAAA,GAAAA,CAAIK,MAAM,CAACC,IAAI,KAAK,OAAA;AACrCN,IAAAA,GAAAA,CAAIO,UAAU,GAAGhB,gBAAAA;IACjBS,GAAIK,CAAAA,MAAM,CAACG,gBAAgB,EAAA;IAC3B,MAAMC,EAAAA,GAAKT,GAAIK,CAAAA,MAAM,CAACK,IAAI,CAACC,wBAAwB,CACjD,KAAA,EACA,CACA,EAAA,CAAA,EACAP,QAAW,GAAA;AAAC,QAAA,YAAA;AAAc,QAAA;KAAa,GAAG;AAAC,QAAA,YAAA;AAAc,QAAA;KAAU,EACnEJ,GAAAA,CAAIY,WAAW,EACf,KAAA,CAAA;A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ACpCpF,MAAOK,CAAAA,IAAI,CAAC4E,kBAAkB,CAAC7E,EAAAA,CAAAA;AACjC,KAAA,CAAA;AACJ;;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getDevice } from '../../app/api.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Bridges the render graph's {@link RGTextureAllocator} interface to the
|
|
5
|
+
* engine's device resource pool (`device.pool`).
|
|
6
|
+
*
|
|
7
|
+
* Transient textures are fetched from the pool on {@link allocate} and
|
|
8
|
+
* returned to the pool on {@link release}, enabling automatic reuse
|
|
9
|
+
* across frames without manual lifecycle management.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* ```ts
|
|
13
|
+
* const allocator = new DevicePoolAllocator();
|
|
14
|
+
* const executor = new RenderGraphExecutor(allocator, width, height);
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/ class DevicePoolAllocator {
|
|
19
|
+
/**
|
|
20
|
+
* Allocate a transient texture from the device pool.
|
|
21
|
+
*
|
|
22
|
+
* @param desc - Texture descriptor from the render graph pass.
|
|
23
|
+
* @param size - Resolved pixel dimensions.
|
|
24
|
+
* @returns A pooled Texture2D instance.
|
|
25
|
+
*/ allocate(desc, size) {
|
|
26
|
+
const device = getDevice();
|
|
27
|
+
const mipmapping = (desc.mipLevels ?? 1) > 1;
|
|
28
|
+
return device.pool.fetchTemporalTexture2D(false, desc.format, size.width, size.height, mipmapping);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Release a transient texture back to the device pool.
|
|
32
|
+
*
|
|
33
|
+
* @param texture - The texture to release.
|
|
34
|
+
*/ release(texture) {
|
|
35
|
+
const device = getDevice();
|
|
36
|
+
device.pool.releaseTexture(texture);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { DevicePoolAllocator };
|
|
41
|
+
//# sourceMappingURL=device_pool_allocator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device_pool_allocator.js","sources":["../../../src/render/rendergraph/device_pool_allocator.ts"],"sourcesContent":["import type { Texture2D } from '@zephyr3d/device';\r\nimport type { RGTextureAllocator, RGTextureDesc, RGResolvedSize } from './types';\r\nimport { getDevice } from '../../app/api';\r\n\r\n/**\r\n * Bridges the render graph's {@link RGTextureAllocator} interface to the\r\n * engine's device resource pool (`device.pool`).\r\n *\r\n * Transient textures are fetched from the pool on {@link allocate} and\r\n * returned to the pool on {@link release}, enabling automatic reuse\r\n * across frames without manual lifecycle management.\r\n *\r\n * Usage:\r\n * ```ts\r\n * const allocator = new DevicePoolAllocator();\r\n * const executor = new RenderGraphExecutor(allocator, width, height);\r\n * ```\r\n *\r\n * @public\r\n */\r\nexport class DevicePoolAllocator implements RGTextureAllocator<Texture2D> {\r\n /**\r\n * Allocate a transient texture from the device pool.\r\n *\r\n * @param desc - Texture descriptor from the render graph pass.\r\n * @param size - Resolved pixel dimensions.\r\n * @returns A pooled Texture2D instance.\r\n */\r\n allocate(desc: RGTextureDesc, size: RGResolvedSize): Texture2D {\r\n const device = getDevice();\r\n const mipmapping = (desc.mipLevels ?? 1) > 1;\r\n return device.pool.fetchTemporalTexture2D(false, desc.format, size.width, size.height, mipmapping);\r\n }\r\n\r\n /**\r\n * Release a transient texture back to the device pool.\r\n *\r\n * @param texture - The texture to release.\r\n */\r\n release(texture: Texture2D): void {\r\n const device = getDevice();\r\n device.pool.releaseTexture(texture);\r\n }\r\n}\r\n"],"names":["DevicePoolAllocator","allocate","desc","size","device","getDevice","mipmapping","mipLevels","pool","fetchTemporalTexture2D","format","width","height","release","texture","releaseTexture"],"mappings":";;AAIA;;;;;;;;;;;;;;;AAeC,IACM,MAAMA,mBAAAA,CAAAA;AACX;;;;;;AAMC,MACDC,QAASC,CAAAA,IAAmB,EAAEC,IAAoB,EAAa;AAC7D,QAAA,MAAMC,MAASC,GAAAA,SAAAA,EAAAA;AACf,QAAA,MAAMC,aAAa,CAACJ,KAAKK,SAAS,IAAI,CAAA,IAAK,CAAA;AAC3C,QAAA,OAAOH,MAAOI,CAAAA,IAAI,CAACC,sBAAsB,CAAC,KAAOP,EAAAA,IAAAA,CAAKQ,MAAM,EAAEP,IAAKQ,CAAAA,KAAK,EAAER,IAAAA,CAAKS,MAAM,EAAEN,UAAAA,CAAAA;AACzF;AAEA;;;;MAKAO,OAAAA,CAAQC,OAAkB,EAAQ;AAChC,QAAA,MAAMV,MAASC,GAAAA,SAAAA,EAAAA;QACfD,MAAOI,CAAAA,IAAI,CAACO,cAAc,CAACD,OAAAA,CAAAA;AAC7B;AACF;;;;"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executes a compiled render graph with automatic resource lifecycle management.
|
|
3
|
+
*
|
|
4
|
+
* The executor allocates transient textures before their first use and releases
|
|
5
|
+
* them after their last use, using the provided {@link RGTextureAllocator}.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```ts
|
|
9
|
+
* const executor = new RenderGraphExecutor(myAllocator, backbufferWidth, backbufferHeight);
|
|
10
|
+
* executor.setImportedTexture(backbufferHandle, actualBackbufferTexture);
|
|
11
|
+
* executor.execute(compiledGraph);
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @typeParam TTexture - The concrete texture type (e.g. `Texture2D`).
|
|
15
|
+
* @public
|
|
16
|
+
*/ class RenderGraphExecutor {
|
|
17
|
+
/** @internal */ _allocator;
|
|
18
|
+
/** @internal */ _backbufferWidth;
|
|
19
|
+
/** @internal */ _backbufferHeight;
|
|
20
|
+
/** @internal */ _importedTextures = new Map();
|
|
21
|
+
/** @internal */ _allocatedTextures = new Map();
|
|
22
|
+
constructor(allocator, backbufferWidth, backbufferHeight){
|
|
23
|
+
this._allocator = allocator;
|
|
24
|
+
this._backbufferWidth = backbufferWidth;
|
|
25
|
+
this._backbufferHeight = backbufferHeight;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Update the backbuffer dimensions used for 'backbuffer-relative' sizing.
|
|
29
|
+
*/ setBackbufferSize(width, height) {
|
|
30
|
+
this._backbufferWidth = width;
|
|
31
|
+
this._backbufferHeight = height;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Register an imported (external) texture so it can be resolved during execution.
|
|
35
|
+
*
|
|
36
|
+
* @param handle - The handle returned from {@link RenderGraph.importTexture}.
|
|
37
|
+
* @param texture - The actual GPU texture object.
|
|
38
|
+
*/ setImportedTexture(handle, texture) {
|
|
39
|
+
this._importedTextures.set(handle._id, texture);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Execute the compiled graph with full resource lifecycle management.
|
|
43
|
+
*
|
|
44
|
+
* For each pass in topological order:
|
|
45
|
+
* 1. Allocate any transient resources whose lifetime begins at this pass
|
|
46
|
+
* 2. Invoke the pass's execute callback with a context that resolves handles
|
|
47
|
+
* 3. Release any transient resources whose lifetime ends at this pass
|
|
48
|
+
*
|
|
49
|
+
* @param compiled - The compiled graph from {@link RenderGraph.compile}.
|
|
50
|
+
*/ execute(compiled) {
|
|
51
|
+
// Build per-pass allocation and release schedules
|
|
52
|
+
const allocateAt = new Map(); // passIndex -> resourceIds to allocate
|
|
53
|
+
const releaseAt = new Map(); // passIndex -> resourceIds to release
|
|
54
|
+
for (const [resId, lifetime] of compiled.lifetimes){
|
|
55
|
+
if (lifetime.resource.kind === 'transient') {
|
|
56
|
+
if (!allocateAt.has(lifetime.firstUse)) {
|
|
57
|
+
allocateAt.set(lifetime.firstUse, []);
|
|
58
|
+
}
|
|
59
|
+
allocateAt.get(lifetime.firstUse).push(resId);
|
|
60
|
+
if (!releaseAt.has(lifetime.lastUse)) {
|
|
61
|
+
releaseAt.set(lifetime.lastUse, []);
|
|
62
|
+
}
|
|
63
|
+
releaseAt.get(lifetime.lastUse).push(resId);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const ctx = this._createContext();
|
|
67
|
+
for(let i = 0; i < compiled.orderedPasses.length; i++){
|
|
68
|
+
const pass = compiled.orderedPasses[i];
|
|
69
|
+
// Allocate resources that start at this pass
|
|
70
|
+
const toAllocate = allocateAt.get(i);
|
|
71
|
+
if (toAllocate) {
|
|
72
|
+
for (const resId of toAllocate){
|
|
73
|
+
const lifetime = compiled.lifetimes.get(resId);
|
|
74
|
+
const desc = lifetime.resource.desc;
|
|
75
|
+
const size = this._resolveSize(desc);
|
|
76
|
+
const texture = this._allocator.allocate(desc, size);
|
|
77
|
+
this._allocatedTextures.set(resId, texture);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Execute the pass
|
|
81
|
+
if (pass.executeFn) {
|
|
82
|
+
pass.executeFn(ctx, pass.data);
|
|
83
|
+
}
|
|
84
|
+
// Release resources that end at this pass
|
|
85
|
+
const toRelease = releaseAt.get(i);
|
|
86
|
+
if (toRelease) {
|
|
87
|
+
for (const resId of toRelease){
|
|
88
|
+
const texture = this._allocatedTextures.get(resId);
|
|
89
|
+
if (texture !== undefined) {
|
|
90
|
+
this._allocator.release(texture);
|
|
91
|
+
this._allocatedTextures.delete(resId);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Clear imported texture registrations and any leftover allocated textures.
|
|
99
|
+
* Call this after execution or when resetting for a new frame.
|
|
100
|
+
*/ reset() {
|
|
101
|
+
// Release any textures that weren't released (shouldn't happen in normal flow)
|
|
102
|
+
for (const texture of this._allocatedTextures.values()){
|
|
103
|
+
this._allocator.release(texture);
|
|
104
|
+
}
|
|
105
|
+
this._allocatedTextures.clear();
|
|
106
|
+
this._importedTextures.clear();
|
|
107
|
+
}
|
|
108
|
+
// ─── Private ────────────────────────────────────────────────────────
|
|
109
|
+
/** @internal */ _resolveSize(desc) {
|
|
110
|
+
const mode = desc.sizeMode ?? 'backbuffer-relative';
|
|
111
|
+
if (mode === 'absolute') {
|
|
112
|
+
return {
|
|
113
|
+
width: desc.width ?? 1,
|
|
114
|
+
height: desc.height ?? 1
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
// backbuffer-relative: width/height are scale factors (default 1.0)
|
|
118
|
+
const scaleX = desc.width ?? 1.0;
|
|
119
|
+
const scaleY = desc.height ?? 1.0;
|
|
120
|
+
return {
|
|
121
|
+
width: Math.max(1, Math.floor(this._backbufferWidth * scaleX)),
|
|
122
|
+
height: Math.max(1, Math.floor(this._backbufferHeight * scaleY))
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/** @internal */ _createContext() {
|
|
126
|
+
const self = this;
|
|
127
|
+
return {
|
|
128
|
+
getTexture (handle) {
|
|
129
|
+
// Check imported first
|
|
130
|
+
const imported = self._importedTextures.get(handle._id);
|
|
131
|
+
if (imported !== undefined) {
|
|
132
|
+
return imported;
|
|
133
|
+
}
|
|
134
|
+
// Check allocated transient
|
|
135
|
+
const allocated = self._allocatedTextures.get(handle._id);
|
|
136
|
+
if (allocated !== undefined) {
|
|
137
|
+
return allocated;
|
|
138
|
+
}
|
|
139
|
+
throw new Error(`RenderGraphExecutor: cannot resolve resource "${handle.name}" (id=${handle._id}). ` + `It may not have been allocated yet or was already released.`);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export { RenderGraphExecutor };
|
|
146
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sources":["../../../src/render/rendergraph/executor.ts"],"sourcesContent":["import type {\r\n CompiledRenderGraph,\r\n RGTextureAllocator,\r\n RGTextureDesc,\r\n RGResolvedSize,\r\n RGExecuteContext,\r\n RGExecuteFn\r\n} from './types';\r\nimport type { RGHandle } from './types';\r\n\r\n/**\r\n * Executes a compiled render graph with automatic resource lifecycle management.\r\n *\r\n * The executor allocates transient textures before their first use and releases\r\n * them after their last use, using the provided {@link RGTextureAllocator}.\r\n *\r\n * Usage:\r\n * ```ts\r\n * const executor = new RenderGraphExecutor(myAllocator, backbufferWidth, backbufferHeight);\r\n * executor.setImportedTexture(backbufferHandle, actualBackbufferTexture);\r\n * executor.execute(compiledGraph);\r\n * ```\r\n *\r\n * @typeParam TTexture - The concrete texture type (e.g. `Texture2D`).\r\n * @public\r\n */\r\nexport class RenderGraphExecutor<TTexture = unknown> {\r\n /** @internal */\r\n private _allocator: RGTextureAllocator<TTexture>;\r\n /** @internal */\r\n private _backbufferWidth: number;\r\n /** @internal */\r\n private _backbufferHeight: number;\r\n /** @internal */\r\n private _importedTextures: Map<number, TTexture> = new Map();\r\n /** @internal */\r\n private _allocatedTextures: Map<number, TTexture> = new Map();\r\n\r\n constructor(allocator: RGTextureAllocator<TTexture>, backbufferWidth: number, backbufferHeight: number) {\r\n this._allocator = allocator;\r\n this._backbufferWidth = backbufferWidth;\r\n this._backbufferHeight = backbufferHeight;\r\n }\r\n\r\n /**\r\n * Update the backbuffer dimensions used for 'backbuffer-relative' sizing.\r\n */\r\n setBackbufferSize(width: number, height: number): void {\r\n this._backbufferWidth = width;\r\n this._backbufferHeight = height;\r\n }\r\n\r\n /**\r\n * Register an imported (external) texture so it can be resolved during execution.\r\n *\r\n * @param handle - The handle returned from {@link RenderGraph.importTexture}.\r\n * @param texture - The actual GPU texture object.\r\n */\r\n setImportedTexture(handle: RGHandle, texture: TTexture): void {\r\n this._importedTextures.set(handle._id, texture);\r\n }\r\n\r\n /**\r\n * Execute the compiled graph with full resource lifecycle management.\r\n *\r\n * For each pass in topological order:\r\n * 1. Allocate any transient resources whose lifetime begins at this pass\r\n * 2. Invoke the pass's execute callback with a context that resolves handles\r\n * 3. Release any transient resources whose lifetime ends at this pass\r\n *\r\n * @param compiled - The compiled graph from {@link RenderGraph.compile}.\r\n */\r\n execute(compiled: CompiledRenderGraph): void {\r\n // Build per-pass allocation and release schedules\r\n const allocateAt = new Map<number, number[]>(); // passIndex -> resourceIds to allocate\r\n const releaseAt = new Map<number, number[]>(); // passIndex -> resourceIds to release\r\n\r\n for (const [resId, lifetime] of compiled.lifetimes) {\r\n if (lifetime.resource.kind === 'transient') {\r\n if (!allocateAt.has(lifetime.firstUse)) {\r\n allocateAt.set(lifetime.firstUse, []);\r\n }\r\n allocateAt.get(lifetime.firstUse)!.push(resId);\r\n\r\n if (!releaseAt.has(lifetime.lastUse)) {\r\n releaseAt.set(lifetime.lastUse, []);\r\n }\r\n releaseAt.get(lifetime.lastUse)!.push(resId);\r\n }\r\n }\r\n\r\n const ctx = this._createContext();\r\n\r\n for (let i = 0; i < compiled.orderedPasses.length; i++) {\r\n const pass = compiled.orderedPasses[i];\r\n\r\n // Allocate resources that start at this pass\r\n const toAllocate = allocateAt.get(i);\r\n if (toAllocate) {\r\n for (const resId of toAllocate) {\r\n const lifetime = compiled.lifetimes.get(resId)!;\r\n const desc = lifetime.resource.desc!;\r\n const size = this._resolveSize(desc);\r\n const texture = this._allocator.allocate(desc, size);\r\n this._allocatedTextures.set(resId, texture);\r\n }\r\n }\r\n\r\n // Execute the pass\r\n if (pass.executeFn) {\r\n (pass.executeFn as RGExecuteFn<unknown>)(ctx, pass.data);\r\n }\r\n\r\n // Release resources that end at this pass\r\n const toRelease = releaseAt.get(i);\r\n if (toRelease) {\r\n for (const resId of toRelease) {\r\n const texture = this._allocatedTextures.get(resId);\r\n if (texture !== undefined) {\r\n this._allocator.release(texture);\r\n this._allocatedTextures.delete(resId);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear imported texture registrations and any leftover allocated textures.\r\n * Call this after execution or when resetting for a new frame.\r\n */\r\n reset(): void {\r\n // Release any textures that weren't released (shouldn't happen in normal flow)\r\n for (const texture of this._allocatedTextures.values()) {\r\n this._allocator.release(texture);\r\n }\r\n this._allocatedTextures.clear();\r\n this._importedTextures.clear();\r\n }\r\n\r\n // ─── Private ────────────────────────────────────────────────────────\r\n\r\n /** @internal */\r\n private _resolveSize(desc: RGTextureDesc): RGResolvedSize {\r\n const mode = desc.sizeMode ?? 'backbuffer-relative';\r\n if (mode === 'absolute') {\r\n return {\r\n width: desc.width ?? 1,\r\n height: desc.height ?? 1\r\n };\r\n }\r\n // backbuffer-relative: width/height are scale factors (default 1.0)\r\n const scaleX = desc.width ?? 1.0;\r\n const scaleY = desc.height ?? 1.0;\r\n return {\r\n width: Math.max(1, Math.floor(this._backbufferWidth * scaleX)),\r\n height: Math.max(1, Math.floor(this._backbufferHeight * scaleY))\r\n };\r\n }\r\n\r\n /** @internal */\r\n private _createContext(): RGExecuteContext {\r\n const self = this;\r\n return {\r\n getTexture<T>(handle: RGHandle): T {\r\n // Check imported first\r\n const imported = self._importedTextures.get(handle._id);\r\n if (imported !== undefined) {\r\n return imported as unknown as T;\r\n }\r\n // Check allocated transient\r\n const allocated = self._allocatedTextures.get(handle._id);\r\n if (allocated !== undefined) {\r\n return allocated as unknown as T;\r\n }\r\n throw new Error(\r\n `RenderGraphExecutor: cannot resolve resource \"${handle.name}\" (id=${handle._id}). ` +\r\n `It may not have been allocated yet or was already released.`\r\n );\r\n }\r\n };\r\n }\r\n}\r\n"],"names":["RenderGraphExecutor","_importedTextures","Map","_allocatedTextures","allocator","backbufferWidth","backbufferHeight","_allocator","_backbufferWidth","_backbufferHeight","setBackbufferSize","width","height","setImportedTexture","handle","texture","set","_id","execute","compiled","allocateAt","releaseAt","resId","lifetime","lifetimes","resource","kind","has","firstUse","get","push","lastUse","ctx","_createContext","i","orderedPasses","length","pass","toAllocate","desc","size","_resolveSize","allocate","executeFn","data","toRelease","undefined","release","delete","reset","values","clear","mode","sizeMode","scaleX","scaleY","Math","max","floor","self","getTexture","imported","allocated","Error","name"],"mappings":"AAUA;;;;;;;;;;;;;;;AAeC,IACM,MAAMA,mBAAAA,CAAAA;qBAEX,UAAiD;qBAEjD,gBAAiC;qBAEjC,iBAAkC;AAClC,qBACQC,iBAA2C,GAAA,IAAIC,GAAM,EAAA;AAC7D,qBACQC,kBAA4C,GAAA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