@zephyr3d/scene 0.8.2 → 0.9.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 +473 -60
- package/dist/animation/animationset.js.map +1 -1
- package/dist/animation/cloth/gpu_cloth_system.js +2516 -0
- package/dist/animation/cloth/gpu_cloth_system.js.map +1 -0
- package/dist/animation/fixed_geometry_cache_track.js +138 -0
- package/dist/animation/fixed_geometry_cache_track.js.map +1 -0
- package/dist/animation/geometry_cache_utils.js +120 -0
- package/dist/animation/geometry_cache_utils.js.map +1 -0
- package/dist/animation/ik_modifier.js +9 -1
- package/dist/animation/ik_modifier.js.map +1 -1
- package/dist/animation/joint_dynamics/collision.js +469 -0
- package/dist/animation/joint_dynamics/collision.js.map +1 -0
- package/dist/animation/joint_dynamics/constraints.js +329 -0
- package/dist/animation/joint_dynamics/constraints.js.map +1 -0
- package/dist/animation/joint_dynamics/controller.js +699 -0
- package/dist/animation/joint_dynamics/controller.js.map +1 -0
- package/dist/animation/joint_dynamics/joint_dynamics_system.js +393 -0
- package/dist/animation/joint_dynamics/joint_dynamics_system.js.map +1 -0
- package/dist/animation/joint_dynamics/solver.js +794 -0
- package/dist/animation/joint_dynamics/solver.js.map +1 -0
- package/dist/animation/joint_dynamics/types.js +19 -0
- package/dist/animation/joint_dynamics/types.js.map +1 -0
- package/dist/animation/joint_dynamics/vrm_spring_bone.js +46 -0
- package/dist/animation/joint_dynamics/vrm_spring_bone.js.map +1 -0
- package/dist/animation/joint_dynamics_modifier.js +51 -0
- package/dist/animation/joint_dynamics_modifier.js.map +1 -0
- package/dist/animation/pca_geometry_cache_track.js +222 -0
- package/dist/animation/pca_geometry_cache_track.js.map +1 -0
- package/dist/animation/skeleton.js +2011 -139
- package/dist/animation/skeleton.js.map +1 -1
- package/dist/animation/skeleton_modifier.js +3 -5
- package/dist/animation/skeleton_modifier.js.map +1 -1
- package/dist/animation/spring/multi_chain_spring_system.js +2 -0
- package/dist/animation/spring/multi_chain_spring_system.js.map +1 -1
- package/dist/animation/spring/spring_chain.js +3 -2
- package/dist/animation/spring/spring_chain.js.map +1 -1
- package/dist/animation/spring/spring_collider.js +35 -5
- package/dist/animation/spring/spring_collider.js.map +1 -1
- package/dist/animation/spring/spring_particle.js +1 -0
- package/dist/animation/spring/spring_particle.js.map +1 -1
- package/dist/animation/spring/spring_system.js +325 -28
- package/dist/animation/spring/spring_system.js.map +1 -1
- package/dist/animation/spring2/collision.js +469 -0
- package/dist/animation/spring2/collision.js.map +1 -0
- package/dist/animation/spring2/constraints.js +329 -0
- package/dist/animation/spring2/constraints.js.map +1 -0
- package/dist/animation/spring2/controller.js +434 -0
- package/dist/animation/spring2/controller.js.map +1 -0
- package/dist/animation/spring2/math.js +16 -0
- package/dist/animation/spring2/math.js.map +1 -0
- package/dist/animation/spring2/solver.js +624 -0
- package/dist/animation/spring2/solver.js.map +1 -0
- package/dist/animation/spring2/spring_system.js +118 -0
- package/dist/animation/spring2/spring_system.js.map +1 -0
- package/dist/animation/spring2/types.js +19 -0
- package/dist/animation/spring2/types.js.map +1 -0
- package/dist/animation/spring_modifier.js +17 -1
- package/dist/animation/spring_modifier.js.map +1 -1
- package/dist/app/engine.js +42 -15
- package/dist/app/engine.js.map +1 -1
- package/dist/app/runtimescript.js +132 -1
- package/dist/app/runtimescript.js.map +1 -1
- package/dist/app/screen.js +3 -3
- package/dist/app/screen.js.map +1 -1
- package/dist/app/scriptingsystem.js +69 -37
- package/dist/app/scriptingsystem.js.map +1 -1
- package/dist/app/scriptregistry.js +14 -3
- package/dist/app/scriptregistry.js.map +1 -1
- package/dist/asset/assetmanager.js +2 -1
- package/dist/asset/assetmanager.js.map +1 -1
- package/dist/asset/loaders/zabc/zabc_loader.js +570 -0
- package/dist/asset/loaders/zabc/zabc_loader.js.map +1 -0
- package/dist/asset/model.js +192 -0
- package/dist/asset/model.js.map +1 -1
- package/dist/camera/base.js +26 -7
- package/dist/camera/base.js.map +1 -1
- package/dist/camera/camera.js +146 -24
- package/dist/camera/camera.js.map +1 -1
- package/dist/camera/fps.js +2 -2
- package/dist/camera/fps.js.map +1 -1
- package/dist/camera/orbit.js +2 -2
- package/dist/camera/orbit.js.map +1 -1
- package/dist/index.d.ts +11728 -8535
- package/dist/index.js +29 -8
- package/dist/index.js.map +1 -1
- package/dist/material/lambert.js +1 -1
- package/dist/material/lambert.js.map +1 -1
- package/dist/material/material.js +9 -3
- package/dist/material/material.js.map +1 -1
- package/dist/material/meshmaterial.js +54 -7
- package/dist/material/meshmaterial.js.map +1 -1
- package/dist/material/mixins/lightmodel/blinnphong.js +17 -7
- package/dist/material/mixins/lightmodel/blinnphong.js.map +1 -1
- package/dist/material/mixins/lightmodel/lambert.js +7 -2
- package/dist/material/mixins/lightmodel/lambert.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js +108 -16
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js +209 -14
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js +24 -12
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -1
- package/dist/material/mixins/lit.js +11 -8
- package/dist/material/mixins/lit.js.map +1 -1
- package/dist/material/mixins/pbr/common.js +72 -5
- package/dist/material/mixins/pbr/common.js.map +1 -1
- package/dist/material/pbrblueprint.js +148 -1
- package/dist/material/pbrblueprint.js.map +1 -1
- package/dist/material/pbrmr.js +115 -2
- package/dist/material/pbrmr.js.map +1 -1
- package/dist/material/shader/helper.js +10 -4
- package/dist/material/shader/helper.js.map +1 -1
- package/dist/material/water.js +2 -2
- package/dist/material/water.js.map +1 -1
- package/dist/posteffect/coloradjust.js +145 -0
- package/dist/posteffect/coloradjust.js.map +1 -0
- package/dist/posteffect/taa.js +68 -32
- package/dist/posteffect/taa.js.map +1 -1
- package/dist/render/cluster_light.js +17 -12
- package/dist/render/cluster_light.js.map +1 -1
- package/dist/render/deferredlightpass.js +510 -0
- package/dist/render/deferredlightpass.js.map +1 -0
- package/dist/render/deferredshadowlightpass.js +428 -0
- package/dist/render/deferredshadowlightpass.js.map +1 -0
- package/dist/render/drawable.js.map +1 -1
- package/dist/render/drawable_mixin.js +21 -12
- package/dist/render/drawable_mixin.js.map +1 -1
- package/dist/render/envlight.js +20 -22
- package/dist/render/envlight.js.map +1 -1
- package/dist/render/gbufferpass.js +50 -0
- package/dist/render/gbufferpass.js.map +1 -0
- package/dist/render/lightpass.js +1 -2
- package/dist/render/lightpass.js.map +1 -1
- package/dist/render/primitive.js +1 -1
- package/dist/render/primitive.js.map +1 -1
- package/dist/render/render_queue.js +3 -2
- package/dist/render/render_queue.js.map +1 -1
- package/dist/render/renderer.js +5 -358
- package/dist/render/renderer.js.map +1 -1
- package/dist/render/rendergraph/executor.js +15 -12
- package/dist/render/rendergraph/executor.js.map +1 -1
- package/dist/render/rendergraph/forward_plus_builder.js +144 -88
- package/dist/render/rendergraph/forward_plus_builder.js.map +1 -1
- package/dist/render/rendergraph/history_resource_manager.js +178 -0
- package/dist/render/rendergraph/history_resource_manager.js.map +1 -0
- package/dist/render/rendergraph/rendergraph.js +12 -1
- package/dist/render/rendergraph/rendergraph.js.map +1 -1
- package/dist/render/rendergraph/types.js +2 -2
- package/dist/render/rendergraph/types.js.map +1 -1
- package/dist/render/sky.js +26 -9
- package/dist/render/sky.js.map +1 -1
- package/dist/scene/basesprite.js +4 -3
- package/dist/scene/basesprite.js.map +1 -1
- package/dist/scene/batchgroup.js +4 -4
- package/dist/scene/environment.js +7 -4
- package/dist/scene/environment.js.map +1 -1
- package/dist/scene/light.js +184 -18
- package/dist/scene/light.js.map +1 -1
- package/dist/scene/mesh.js +30 -0
- package/dist/scene/mesh.js.map +1 -1
- package/dist/scene/particlesys.js +3 -2
- package/dist/scene/particlesys.js.map +1 -1
- package/dist/scene/raycast_visitor.js +29 -3
- package/dist/scene/raycast_visitor.js.map +1 -1
- package/dist/scene/scene.js +86 -19
- package/dist/scene/scene.js.map +1 -1
- package/dist/scene/scene_node.js +87 -31
- package/dist/scene/scene_node.js.map +1 -1
- package/dist/scene/script_attachment.js +59 -0
- package/dist/scene/script_attachment.js.map +1 -0
- package/dist/scene/terrain-cm/grass.js +3 -2
- package/dist/scene/terrain-cm/grass.js.map +1 -1
- package/dist/scene/terrain-cm/terrain-cm.js +4 -3
- package/dist/scene/terrain-cm/terrain-cm.js.map +1 -1
- package/dist/scene/water.js +3 -2
- package/dist/scene/water.js.map +1 -1
- package/dist/shaders/shadow.js +2 -2
- package/dist/shaders/shadow.js.map +1 -1
- package/dist/shadow/shadowmapper.js +74 -4
- package/dist/shadow/shadowmapper.js.map +1 -1
- package/dist/shapes/box.js +163 -0
- package/dist/shapes/box.js.map +1 -1
- package/dist/shapes/capsule.js +216 -0
- package/dist/shapes/capsule.js.map +1 -0
- package/dist/shapes/cylinder.js +91 -0
- package/dist/shapes/cylinder.js.map +1 -1
- package/dist/shapes/plane.js +32 -0
- package/dist/shapes/plane.js.map +1 -1
- package/dist/shapes/tetrahedron.js +211 -0
- package/dist/shapes/tetrahedron.js.map +1 -1
- package/dist/shapes/torus.js +173 -0
- package/dist/shapes/torus.js.map +1 -1
- package/dist/utility/blueprint/common/math.js +111 -1
- package/dist/utility/blueprint/common/math.js.map +1 -1
- package/dist/utility/blueprint/material/inputs.js +235 -1
- package/dist/utility/blueprint/material/inputs.js.map +1 -1
- package/dist/utility/blueprint/material/ir.js +154 -10
- package/dist/utility/blueprint/material/ir.js.map +1 -1
- package/dist/utility/blueprint/material/texture.js +273 -19
- package/dist/utility/blueprint/material/texture.js.map +1 -1
- package/dist/utility/serialization/json.js +12 -2
- package/dist/utility/serialization/json.js.map +1 -1
- package/dist/utility/serialization/manager.js +30 -11
- package/dist/utility/serialization/manager.js.map +1 -1
- package/dist/utility/serialization/scene/animation.js +250 -7
- package/dist/utility/serialization/scene/animation.js.map +1 -1
- package/dist/utility/serialization/scene/batch.js +4 -2
- package/dist/utility/serialization/scene/batch.js.map +1 -1
- package/dist/utility/serialization/scene/camera.js +154 -2
- package/dist/utility/serialization/scene/camera.js.map +1 -1
- package/dist/utility/serialization/scene/cloth_script.js +834 -0
- package/dist/utility/serialization/scene/cloth_script.js.map +1 -0
- package/dist/utility/serialization/scene/common.js +7 -0
- package/dist/utility/serialization/scene/common.js.map +1 -1
- package/dist/utility/serialization/scene/light.js +120 -4
- package/dist/utility/serialization/scene/light.js.map +1 -1
- package/dist/utility/serialization/scene/material.js +453 -1
- package/dist/utility/serialization/scene/material.js.map +1 -1
- package/dist/utility/serialization/scene/mesh.js +4 -2
- package/dist/utility/serialization/scene/mesh.js.map +1 -1
- package/dist/utility/serialization/scene/node.js +298 -10
- package/dist/utility/serialization/scene/node.js.map +1 -1
- package/dist/utility/serialization/scene/particle.js +4 -2
- package/dist/utility/serialization/scene/particle.js.map +1 -1
- package/dist/utility/serialization/scene/primitive.js +100 -3
- package/dist/utility/serialization/scene/primitive.js.map +1 -1
- package/dist/utility/serialization/scene/scene.js +130 -3
- package/dist/utility/serialization/scene/scene.js.map +1 -1
- package/dist/utility/serialization/scene/script.js +66 -0
- package/dist/utility/serialization/scene/script.js.map +1 -0
- package/dist/utility/serialization/scene/spring_script.js +596 -0
- package/dist/utility/serialization/scene/spring_script.js.map +1 -0
- package/dist/utility/serialization/scene/sprite.js +5 -3
- package/dist/utility/serialization/scene/sprite.js.map +1 -1
- package/dist/utility/serialization/scene/terrain.js +4 -2
- package/dist/utility/serialization/scene/terrain.js.map +1 -1
- package/dist/utility/serialization/scene/water.js +4 -2
- package/dist/utility/serialization/scene/water.js.map +1 -1
- package/dist/utility/serialization/types.js.map +1 -1
- package/dist/values.js +5 -1
- package/dist/values.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render_queue.js","sources":["../../src/render/render_queue.ts"],"sourcesContent":["import type { Nullable, Vector4 } from '@zephyr3d/base';\r\nimport { Disposable, objectKeys, Vector3 } from '@zephyr3d/base';\r\nimport type { Camera } from '../camera/camera';\r\nimport type { BatchDrawable, Drawable } from './drawable';\r\nimport type { DirectionalLight, PunctualLight } from '../scene/light';\r\nimport type { RenderPass } from '.';\r\nimport { QUEUE_TRANSPARENT } from '../values';\r\nimport type { BindGroup, BindGroupLayout } from '@zephyr3d/device';\r\nimport { ProgramBuilder } from '@zephyr3d/device';\r\nimport type { Material } from '../material';\r\nimport { ShaderHelper } from '../material';\r\nimport { RenderBundleWrapper } from './renderbundle_wrapper';\r\nimport { getDevice } from '../app/api';\r\n\r\n/** @public */\r\nexport type CachedBindGroup = {\r\n bindGroup: BindGroup;\r\n buffer: Float32Array;\r\n offset: number;\r\n dirty: boolean;\r\n};\r\n\r\nconst maxBufferSizeInFloats = 65536 / 4;\r\n\r\n/**\r\n * Instance bind group allocator\r\n * @public\r\n */\r\nexport class InstanceBindGroupAllocator {\r\n private static _instanceBindGroupLayout: Nullable<BindGroupLayout> = null;\r\n _bindGroupList: CachedBindGroup[] = [];\r\n private _allocFrameStamp: number;\r\n constructor() {\r\n this._allocFrameStamp = -1;\r\n this._bindGroupList = [];\r\n }\r\n allocateInstanceBindGroup(framestamp: number, sizeInFloats: number) {\r\n // Reset if render frame changed\r\n if (this._allocFrameStamp !== framestamp) {\r\n this._allocFrameStamp = framestamp;\r\n for (const k of this._bindGroupList) {\r\n k.offset = 0;\r\n }\r\n }\r\n for (const k of this._bindGroupList) {\r\n if (k.offset + sizeInFloats <= maxBufferSizeInFloats) {\r\n k.dirty = true;\r\n return k;\r\n }\r\n }\r\n if (!InstanceBindGroupAllocator._instanceBindGroupLayout) {\r\n const buildInfo = new ProgramBuilder(getDevice()).buildRender({\r\n vertex(pb) {\r\n this[ShaderHelper.getInstanceDataUniformName()] = pb.vec4[65536 >> 4]().uniformBuffer(3);\r\n pb.main(function () {});\r\n },\r\n fragment(pb) {\r\n pb.main(function () {});\r\n }\r\n });\r\n InstanceBindGroupAllocator._instanceBindGroupLayout = buildInfo[2][3];\r\n }\r\n const bindGroup = {\r\n bindGroup: getDevice().createBindGroup(InstanceBindGroupAllocator._instanceBindGroupLayout),\r\n buffer: new Float32Array(maxBufferSizeInFloats),\r\n offset: 0,\r\n dirty: true\r\n };\r\n this._bindGroupList.push(bindGroup);\r\n return bindGroup;\r\n }\r\n}\r\n\r\nconst defaultInstanceBindGroupAlloator = new InstanceBindGroupAllocator();\r\n\r\n/**\r\n * Instance data\r\n * @public\r\n */\r\nexport interface InstanceData {\r\n bindGroup: CachedBindGroup;\r\n stride: number;\r\n offset: number;\r\n numInstances: number;\r\n}\r\n\r\n/**\r\n * Render queue item\r\n * @public\r\n */\r\nexport interface RenderQueueItem {\r\n drawable: Drawable;\r\n sortDistance: number;\r\n instanceColor?: Vector4;\r\n instanceData: Nullable<InstanceData>;\r\n}\r\n\r\n/**\r\n * Render item list information\r\n * @public\r\n */\r\nexport interface RenderItemListInfo {\r\n itemList: RenderQueueItem[];\r\n renderBundle?: RenderBundleWrapper;\r\n skinItemList: RenderQueueItem[];\r\n skinRenderBundle?: RenderBundleWrapper;\r\n morphItemList: RenderQueueItem[];\r\n morphRenderBundle?: RenderBundleWrapper;\r\n skinAndMorphItemList: RenderQueueItem[];\r\n skinAndMorphRenderBundle?: RenderBundleWrapper;\r\n instanceItemList: RenderQueueItem[];\r\n instanceRenderBundle?: RenderBundleWrapper;\r\n instanceList: Record<string, BatchDrawable[]>;\r\n materialList: Set<Material>;\r\n renderQueue: RenderQueue;\r\n}\r\n\r\n/**\r\n * Render item list bundle\r\n * @public\r\n */\r\nexport interface RenderItemListBundle {\r\n lit: RenderItemListInfo[];\r\n unlit: RenderItemListInfo[];\r\n}\r\n\r\n/**\r\n * Item list of render queue\r\n * @public\r\n */\r\nexport interface RenderItemList {\r\n opaque: RenderItemListBundle;\r\n transmission: RenderItemListBundle;\r\n transparent: RenderItemListBundle;\r\n transmission_trans: RenderItemListBundle;\r\n}\r\n\r\n/**\r\n * Render queue reference\r\n * @public\r\n */\r\nexport interface RenderQueueRef {\r\n ref: RenderQueue;\r\n}\r\n\r\n/**\r\n * Drawable instance information\r\n * @public\r\n */\r\nexport interface DrawableInstanceInfo {\r\n bindGroup: CachedBindGroup;\r\n offset: number;\r\n}\r\n\r\n/**\r\n * A queue that contains the items to be rendered\r\n * @public\r\n */\r\nexport class RenderQueue extends Disposable {\r\n /** @internal */\r\n private _itemList: Nullable<RenderItemList>;\r\n /** @internal */\r\n private readonly _renderPass: RenderPass;\r\n /** @internal */\r\n private _shadowedLightList: PunctualLight[];\r\n /** @internal */\r\n private _unshadowedLightList: PunctualLight[];\r\n /** @internal */\r\n private _sunLight: Nullable<DirectionalLight>;\r\n /** @internal */\r\n private readonly _bindGroupAllocator: InstanceBindGroupAllocator;\r\n /** @internal */\r\n private readonly _ref: RenderQueueRef;\r\n /** @internal */\r\n private readonly _instanceInfo: Map<Drawable, DrawableInstanceInfo>;\r\n /** @internal */\r\n private _needSceneColor: boolean;\r\n private _needSceneDepth: boolean;\r\n private _needSceneColorWithDepth: boolean;\r\n /** @internal */\r\n private _drawTransparent: boolean;\r\n /** @internal */\r\n private readonly _objectColorMaps: Map<number, Drawable>[];\r\n /**\r\n * Creates an instance of a render queue\r\n * @param renderPass - The render pass to which the render queue belongs\r\n */\r\n constructor(renderPass: RenderPass, bindGroupAllocator?: InstanceBindGroupAllocator) {\r\n super();\r\n this._bindGroupAllocator = bindGroupAllocator ?? defaultInstanceBindGroupAlloator;\r\n this._itemList = null;\r\n this._renderPass = renderPass;\r\n this._shadowedLightList = [];\r\n this._unshadowedLightList = [];\r\n this._sunLight = null;\r\n this._ref = { ref: this };\r\n this._instanceInfo = new Map();\r\n this._needSceneColor = false;\r\n this._needSceneDepth = false;\r\n this._needSceneColorWithDepth = false;\r\n this._drawTransparent = false;\r\n this._objectColorMaps = [new Map()];\r\n }\r\n /** The sun light */\r\n get sunLight() {\r\n return this._sunLight;\r\n }\r\n set sunLight(light) {\r\n this._sunLight = light;\r\n }\r\n /** @internal */\r\n needSceneColor() {\r\n return this._needSceneColor;\r\n }\r\n /** @internal */\r\n needSceneDepth() {\r\n return this._needSceneDepth;\r\n }\r\n /** @internal */\r\n needSceneColorWithDepth() {\r\n return this._needSceneColorWithDepth;\r\n }\r\n /** Whether this render queue has transparent objects to be drawn */\r\n get drawTransparent() {\r\n return this._drawTransparent;\r\n }\r\n /** The render pass to which the render queue belongs */\r\n get renderPass() {\r\n return this._renderPass;\r\n }\r\n /**\r\n * Gets the items of the render queue\r\n */\r\n get itemList() {\r\n return this._itemList;\r\n }\r\n /**\r\n * Gets the shadowed lights\r\n */\r\n get shadowedLights() {\r\n return this._shadowedLightList;\r\n }\r\n /**\r\n * Gets the unshadowed lights\r\n */\r\n get unshadowedLights() {\r\n return this._unshadowedLightList;\r\n }\r\n /**\r\n * Gets the indirect reference of this\r\n */\r\n get ref() {\r\n return this._ref;\r\n }\r\n /**\r\n * Gets the instance information for given drawable object\r\n * @param drawable - The drawable object\r\n * @returns The instane information for given drawable object, null if no exists\r\n */\r\n getInstanceInfo(drawable: Drawable) {\r\n return this._instanceInfo.get(drawable);\r\n }\r\n /**\r\n * Gets the maximum batch size of a given device\r\n * @returns The maximum batch size of the device\r\n *\r\n * @internal\r\n */\r\n getMaxBatchSize() {\r\n return getDevice().getDeviceCaps().shaderCaps.maxUniformBufferSize / 64;\r\n }\r\n /**\r\n * Push a punctual light\r\n * @param light - The light to be pushed\r\n */\r\n pushLight(light: PunctualLight) {\r\n if (light.castShadow) {\r\n this._shadowedLightList.push(light);\r\n } else {\r\n this._unshadowedLightList.push(light);\r\n }\r\n if (light.isDirectionLight() && light.sunLight) {\r\n this.sunLight = light;\r\n }\r\n }\r\n /**\r\n * Push items from another render queue\r\n * @param queue - The render queue to be pushed\r\n */\r\n pushRenderQueue(queue: RenderQueue) {\r\n const newItemLists = queue._itemList;\r\n if (!newItemLists) {\r\n return;\r\n }\r\n if (!this._itemList) {\r\n this._itemList = this.newRenderItemList();\r\n }\r\n this._itemList.opaque.lit.push(...newItemLists.opaque.lit);\r\n this._itemList.opaque.unlit.push(...newItemLists.opaque.unlit);\r\n this._itemList.transmission.lit.push(...newItemLists.transmission.lit);\r\n this._itemList.transmission.unlit.push(...newItemLists.transmission.unlit);\r\n this._itemList.transparent.lit.push(...newItemLists.transparent.lit);\r\n this._itemList.transparent.unlit.push(...newItemLists.transparent.unlit);\r\n this._itemList.transmission_trans.lit.push(...newItemLists.transmission_trans.lit);\r\n this._itemList.transmission_trans.unlit.push(...newItemLists.transmission_trans.unlit);\r\n this._needSceneColor ||= queue._needSceneColor;\r\n this._needSceneDepth ||= queue._needSceneDepth;\r\n this._needSceneColorWithDepth ||= queue._needSceneColorWithDepth;\r\n this._drawTransparent ||= queue._drawTransparent;\r\n this._objectColorMaps.push(...queue._objectColorMaps);\r\n }\r\n /**\r\n * Push an item to the render queue\r\n * @param camera - The camera for drawing the item\r\n * @param drawable - The object to be drawn\r\n */\r\n push(camera: Camera, drawable: Drawable) {\r\n if (drawable) {\r\n drawable.pushRenderQueueRef(this._ref);\r\n if (!this._itemList) {\r\n this._itemList = this.newRenderItemList();\r\n }\r\n const trans = drawable.getQueueType() === QUEUE_TRANSPARENT;\r\n const unlit = drawable.isUnlit();\r\n const needDepth = !!drawable.needSceneDepth();\r\n const transmission = !!drawable.needSceneColor() || needDepth;\r\n this._needSceneColor ||= transmission;\r\n this._needSceneDepth ||= drawable.needSceneDepth();\r\n this._needSceneColorWithDepth ||= transmission && needDepth;\r\n this._drawTransparent ||= trans;\r\n if (camera.getPickResultResolveFunc()) {\r\n drawable.getMaterial()!.objectColor = drawable.getObjectColor();\r\n this._objectColorMaps[0].set(drawable.getDrawableId(), drawable);\r\n }\r\n if (drawable.isBatchable()) {\r\n const instanceList = trans\r\n ? transmission\r\n ? unlit\r\n ? this._itemList.transmission_trans.unlit[0].instanceList\r\n : this._itemList.transmission_trans.lit[0].instanceList\r\n : unlit\r\n ? this._itemList.transparent.unlit[0].instanceList\r\n : this._itemList.transparent.lit[0].instanceList\r\n : transmission\r\n ? unlit\r\n ? this._itemList.transmission.unlit[0].instanceList\r\n : this._itemList.transmission.lit[0].instanceList\r\n : unlit\r\n ? this._itemList.opaque.unlit[0].instanceList\r\n : this._itemList.opaque.lit[0].instanceList;\r\n const hash = drawable.getInstanceId(this._renderPass);\r\n let drawableList = instanceList[hash];\r\n if (!drawableList) {\r\n drawableList = [];\r\n instanceList[hash] = drawableList;\r\n }\r\n drawableList.push(drawable);\r\n } else {\r\n const list = trans\r\n ? transmission\r\n ? unlit\r\n ? this._itemList.transmission_trans.unlit[0]\r\n : this._itemList.transmission_trans.lit[0]\r\n : unlit\r\n ? this._itemList.transparent.unlit[0]\r\n : this._itemList.transparent.lit[0]\r\n : transmission\r\n ? unlit\r\n ? this._itemList.transmission.unlit[0]\r\n : this._itemList.transmission.lit[0]\r\n : unlit\r\n ? this._itemList.opaque.unlit[0]\r\n : this._itemList.opaque.lit[0];\r\n const skinAnimation = !!drawable.getBoneMatrices();\r\n const morphAnimation = !!drawable.getMorphData();\r\n let queue: RenderQueueItem[];\r\n if (skinAnimation && morphAnimation) {\r\n queue = list.skinAndMorphItemList;\r\n } else if (skinAnimation) {\r\n queue = list.skinItemList;\r\n } else if (morphAnimation) {\r\n queue = list.morphItemList;\r\n } else {\r\n queue = list.itemList;\r\n }\r\n this.binaryInsert(queue, {\r\n drawable,\r\n sortDistance: drawable.getSortDistance(camera),\r\n instanceData: null\r\n });\r\n const mat = drawable.getMaterial();\r\n if (mat) {\r\n list.materialList.add(mat.coreMaterial);\r\n }\r\n drawable.applyTransformUniforms(this);\r\n }\r\n }\r\n }\r\n /** @internal */\r\n getDrawableByColor(c: Uint8Array<ArrayBuffer>) {\r\n const id = (c[0] << 24) + (c[1] << 16) + (c[2] << 8) + c[3];\r\n for (const m of this._objectColorMaps) {\r\n const drawable = m.get(id);\r\n if (drawable) {\r\n return drawable;\r\n }\r\n }\r\n return null;\r\n }\r\n /**\r\n * Removes all items in the render queue\r\n */\r\n reset() {\r\n if (this._itemList) {\r\n // Release all render bundles\r\n for (const k of objectKeys(this._itemList)) {\r\n const itemListBundle: RenderItemListBundle = this._itemList[k];\r\n for (const l of objectKeys(itemListBundle)) {\r\n const listInfo: RenderItemListInfo[] = itemListBundle[l];\r\n for (const info of listInfo) {\r\n if (info.renderQueue === this) {\r\n if (info.renderBundle) {\r\n info.renderBundle.dispose();\r\n }\r\n if (info.skinRenderBundle) {\r\n info.skinRenderBundle.dispose();\r\n }\r\n if (info.morphRenderBundle) {\r\n info.morphRenderBundle.dispose();\r\n }\r\n if (info.skinAndMorphRenderBundle) {\r\n info.skinAndMorphRenderBundle.dispose();\r\n }\r\n if (info.instanceRenderBundle) {\r\n info.instanceRenderBundle.dispose();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n this._itemList = null;\r\n }\r\n this._shadowedLightList = [];\r\n this._unshadowedLightList = [];\r\n this._sunLight = null;\r\n this._needSceneColor = false;\r\n this._needSceneDepth = false;\r\n this._needSceneColorWithDepth = false;\r\n this._drawTransparent = false;\r\n }\r\n /** @internal */\r\n end(camera: Camera, createRenderBundles?: boolean) {\r\n const frameCounter = getDevice().frameInfo.frameCounter;\r\n const itemList = this._itemList!;\r\n if (!this.itemList) {\r\n return this;\r\n }\r\n const lists = [\r\n itemList.opaque.lit,\r\n itemList.opaque.unlit,\r\n itemList.transmission.lit,\r\n itemList.transmission.unlit,\r\n itemList.transparent.lit,\r\n itemList.transparent.unlit,\r\n itemList.transmission_trans.lit,\r\n itemList.transmission_trans.unlit\r\n ];\r\n for (let i = 0; i < lists.length; i++) {\r\n const list = lists[i];\r\n for (const info of list) {\r\n if (info.renderQueue !== this) {\r\n continue;\r\n }\r\n const instanceList = info.instanceList;\r\n for (const x in instanceList) {\r\n const drawables = instanceList[x];\r\n let bindGroup: Nullable<CachedBindGroup> = null;\r\n let item: Nullable<RenderQueueItem> = null;\r\n for (let i = 0; i < drawables.length; i++) {\r\n const drawable = drawables[i];\r\n const instanceUniforms = drawable.getInstanceUniforms();\r\n const instanceUniformsSize = instanceUniforms?.length ?? 0;\r\n const stride = ShaderHelper.MATERIAL_INSTANCE_DATA_OFFSET * 4 + instanceUniformsSize;\r\n if (!bindGroup || bindGroup.offset + stride > maxBufferSizeInFloats) {\r\n bindGroup = this._bindGroupAllocator.allocateInstanceBindGroup(frameCounter, stride);\r\n item = {\r\n drawable,\r\n sortDistance: drawable.getSortDistance(camera),\r\n instanceData: {\r\n bindGroup,\r\n offset: bindGroup.offset,\r\n numInstances: 0,\r\n stride\r\n }\r\n };\r\n this.binaryInsert(info.instanceItemList, item);\r\n drawable.applyInstanceOffsetAndStride(this, stride, bindGroup.offset);\r\n }\r\n const instanceInfo = { bindGroup, offset: bindGroup.offset };\r\n this._instanceInfo.set(drawable, instanceInfo);\r\n drawable.applyTransformUniforms(this);\r\n drawable.applyMaterialUniforms(instanceInfo);\r\n bindGroup.offset += stride;\r\n item!.instanceData!.numInstances++;\r\n const mat = drawable.getMaterial();\r\n if (mat) {\r\n info.materialList.add(mat.coreMaterial);\r\n }\r\n }\r\n }\r\n info.instanceList = {};\r\n if (createRenderBundles) {\r\n if (info.itemList.length > 0) {\r\n info.renderBundle = new RenderBundleWrapper();\r\n }\r\n if (info.skinItemList.length > 0) {\r\n info.skinRenderBundle = new RenderBundleWrapper();\r\n }\r\n if (info.morphItemList.length > 0) {\r\n info.morphRenderBundle = new RenderBundleWrapper();\r\n }\r\n if (info.skinAndMorphItemList.length > 0) {\r\n info.skinAndMorphRenderBundle = new RenderBundleWrapper();\r\n }\r\n if (info.instanceItemList.length > 0) {\r\n info.instanceRenderBundle = new RenderBundleWrapper();\r\n }\r\n }\r\n }\r\n }\r\n return this;\r\n }\r\n binaryInsert(itemList: RenderQueueItem[], item: RenderQueueItem) {\r\n let left = 0;\r\n let right = itemList.length - 1;\r\n const newInstanceId = item.drawable.getMaterial()!.instanceId;\r\n while (left <= right) {\r\n const mid = Math.floor((left + right) / 2);\r\n const instanceId = itemList[mid].drawable.getMaterial()!.instanceId;\r\n if (instanceId === newInstanceId) {\r\n itemList.splice(mid + 1, 0, item);\r\n return;\r\n } else if (instanceId < newInstanceId) {\r\n left = mid + 1;\r\n } else {\r\n right = mid - 1;\r\n }\r\n }\r\n itemList.splice(left, 0, item);\r\n }\r\n /**\r\n * Sorts the items in the render queue for rendering\r\n */\r\n sortTransparentItems(cameraPos: Vector3) {\r\n if (this._itemList) {\r\n this._itemList.transparent.lit[0].itemList.sort(\r\n (a, b) =>\r\n this.drawableDistanceToCamera(b.drawable, cameraPos) -\r\n this.drawableDistanceToCamera(a.drawable, cameraPos)\r\n );\r\n this._itemList.transparent.lit[0].skinItemList.sort(\r\n (a, b) =>\r\n this.drawableDistanceToCamera(b.drawable, cameraPos) -\r\n this.drawableDistanceToCamera(a.drawable, cameraPos)\r\n );\r\n this._itemList.transparent.lit[0].morphItemList.sort(\r\n (a, b) =>\r\n this.drawableDistanceToCamera(b.drawable, cameraPos) -\r\n this.drawableDistanceToCamera(a.drawable, cameraPos)\r\n );\r\n this._itemList.transparent.lit[0].skinAndMorphItemList.sort(\r\n (a, b) =>\r\n this.drawableDistanceToCamera(b.drawable, cameraPos) -\r\n this.drawableDistanceToCamera(a.drawable, cameraPos)\r\n );\r\n this._itemList.transparent.unlit[0].itemList.sort(\r\n (a, b) =>\r\n this.drawableDistanceToCamera(b.drawable, cameraPos) -\r\n this.drawableDistanceToCamera(a.drawable, cameraPos)\r\n );\r\n this._itemList.transparent.unlit[0].skinItemList.sort(\r\n (a, b) =>\r\n this.drawableDistanceToCamera(b.drawable, cameraPos) -\r\n this.drawableDistanceToCamera(a.drawable, cameraPos)\r\n );\r\n this._itemList.transparent.unlit[0].morphItemList.sort(\r\n (a, b) =>\r\n this.drawableDistanceToCamera(b.drawable, cameraPos) -\r\n this.drawableDistanceToCamera(a.drawable, cameraPos)\r\n );\r\n this._itemList.transparent.unlit[0].skinAndMorphItemList.sort(\r\n (a, b) =>\r\n this.drawableDistanceToCamera(b.drawable, cameraPos) -\r\n this.drawableDistanceToCamera(a.drawable, cameraPos)\r\n );\r\n }\r\n }\r\n /** Disposes the render queue */\r\n protected onDispose() {\r\n super.onDispose();\r\n this.reset();\r\n }\r\n\r\n private drawableDistanceToCamera(drawable: Drawable, cameraPos: Vector3) {\r\n const drawablePos = drawable.getNode().position;\r\n return Vector3.distanceSq(drawablePos, cameraPos);\r\n }\r\n private newRenderItemListInfo() {\r\n return {\r\n itemList: [],\r\n skinItemList: [],\r\n morphItemList: [],\r\n skinAndMorphItemList: [],\r\n instanceItemList: [],\r\n materialList: new Set(),\r\n instanceList: {},\r\n renderQueue: this\r\n } as RenderItemListInfo;\r\n }\r\n private newRenderItemListBundle() {\r\n return {\r\n lit: [this.newRenderItemListInfo()],\r\n unlit: [this.newRenderItemListInfo()]\r\n };\r\n }\r\n private newRenderItemList() {\r\n return {\r\n opaque: this.newRenderItemListBundle(),\r\n transmission: this.newRenderItemListBundle(),\r\n transparent: this.newRenderItemListBundle(),\r\n transmission_trans: this.newRenderItemListBundle()\r\n };\r\n }\r\n}\r\n"],"names":["maxBufferSizeInFloats","InstanceBindGroupAllocator","_instanceBindGroupLayout","_bindGroupList","_allocFrameStamp","allocateInstanceBindGroup","framestamp","sizeInFloats","k","offset","dirty","buildInfo","ProgramBuilder","getDevice","buildRender","vertex","pb","ShaderHelper","getInstanceDataUniformName","vec4","uniformBuffer","main","fragment","bindGroup","createBindGroup","buffer","Float32Array","push","defaultInstanceBindGroupAlloator","RenderQueue","Disposable","_needSceneDepth","_needSceneColorWithDepth","renderPass","bindGroupAllocator","_bindGroupAllocator","_itemList","_renderPass","_shadowedLightList","_unshadowedLightList","_sunLight","_ref","ref","_instanceInfo","Map","_needSceneColor","_drawTransparent","_objectColorMaps","sunLight","light","needSceneColor","needSceneDepth","needSceneColorWithDepth","drawTransparent","itemList","shadowedLights","unshadowedLights","getInstanceInfo","drawable","get","getMaxBatchSize","getDeviceCaps","shaderCaps","maxUniformBufferSize","pushLight","castShadow","isDirectionLight","pushRenderQueue","queue","newItemLists","newRenderItemList","opaque","lit","unlit","transmission","transparent","transmission_trans","camera","pushRenderQueueRef","trans","getQueueType","QUEUE_TRANSPARENT","isUnlit","needDepth","getPickResultResolveFunc","getMaterial","objectColor","getObjectColor","set","getDrawableId","isBatchable","instanceList","hash","getInstanceId","drawableList","list","skinAnimation","getBoneMatrices","morphAnimation","getMorphData","skinAndMorphItemList","skinItemList","morphItemList","binaryInsert","sortDistance","getSortDistance","instanceData","mat","materialList","add","coreMaterial","applyTransformUniforms","getDrawableByColor","c","id","m","reset","objectKeys","itemListBundle","l","listInfo","info","renderQueue","renderBundle","dispose","skinRenderBundle","morphRenderBundle","skinAndMorphRenderBundle","instanceRenderBundle","end","createRenderBundles","frameCounter","frameInfo","lists","i","length","x","drawables","item","instanceUniforms","getInstanceUniforms","instanceUniformsSize","stride","MATERIAL_INSTANCE_DATA_OFFSET","numInstances","instanceItemList","applyInstanceOffsetAndStride","instanceInfo","applyMaterialUniforms","RenderBundleWrapper","left","right","newInstanceId","instanceId","mid","Math","floor","splice","sortTransparentItems","cameraPos","sort","a","b","drawableDistanceToCamera","onDispose","drawablePos","getNode","position","Vector3","distanceSq","newRenderItemListInfo","Set","newRenderItemListBundle"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,wBAAwB,KAAQ,GAAA,CAAA;AAEtC;;;AAGC,IACM,MAAMC,0BAAAA,CAAAA;AACX,IAAA,OAAeC,2BAAsD,IAAK;AAC1EC,IAAAA,cAAAA,GAAoC,EAAE;IAC9BC,gBAAyB;IACjC,WAAc,EAAA;QACZ,IAAI,CAACA,gBAAgB,GAAG,EAAC;QACzB,IAAI,CAACD,cAAc,GAAG,EAAE;AAC1B;IACAE,yBAA0BC,CAAAA,UAAkB,EAAEC,YAAoB,EAAE;;AAElE,QAAA,IAAI,IAAI,CAACH,gBAAgB,KAAKE,UAAY,EAAA;YACxC,IAAI,CAACF,gBAAgB,GAAGE,U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C1B,OAAO;YACLC,MAAQ,EAAA,IAAI,CAACqG,uBAAuB,EAAA;YACpClG,YAAc,EAAA,IAAI,CAACkG,uBAAuB,EAAA;YAC1CjG,WAAa,EAAA,IAAI,CAACiG,uBAAuB,EAAA;YACzChG,kBAAoB,EAAA,IAAI,CAACgG,uBAAuB;AAClD,SAAA;AACF;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"render_queue.js","sources":["../../src/render/render_queue.ts"],"sourcesContent":["import type { Nullable, Vector4 } from '@zephyr3d/base';\r\nimport { Disposable, objectKeys, Vector3 } from '@zephyr3d/base';\r\nimport type { Camera } from '../camera/camera';\r\nimport type { BatchDrawable, Drawable } from './drawable';\r\nimport type { DirectionalLight, PunctualLight } from '../scene/light';\r\nimport type { RenderPass } from '.';\r\nimport { QUEUE_TRANSPARENT } from '../values';\r\nimport type { BindGroup, BindGroupLayout } from '@zephyr3d/device';\r\nimport { ProgramBuilder } from '@zephyr3d/device';\r\nimport type { Material } from '../material';\r\nimport { ShaderHelper } from '../material';\r\nimport { RenderBundleWrapper } from './renderbundle_wrapper';\r\nimport { getDevice } from '../app/api';\r\n\r\n/** @public */\r\nexport type CachedBindGroup = {\r\n bindGroup: BindGroup;\r\n buffer: Float32Array;\r\n offset: number;\r\n dirty: boolean;\r\n};\r\n\r\nconst maxBufferSizeInFloats = 65536 / 4;\r\n\r\n/**\r\n * Instance bind group allocator\r\n * @public\r\n */\r\nexport class InstanceBindGroupAllocator {\r\n private static _instanceBindGroupLayout: Nullable<BindGroupLayout> = null;\r\n _bindGroupList: CachedBindGroup[] = [];\r\n private _allocFrameStamp: number;\r\n constructor() {\r\n this._allocFrameStamp = -1;\r\n this._bindGroupList = [];\r\n }\r\n allocateInstanceBindGroup(framestamp: number, sizeInFloats: number) {\r\n // Reset if render frame changed\r\n if (this._allocFrameStamp !== framestamp) {\r\n this._allocFrameStamp = framestamp;\r\n for (const k of this._bindGroupList) {\r\n k.offset = 0;\r\n }\r\n }\r\n for (const k of this._bindGroupList) {\r\n if (k.offset + sizeInFloats <= maxBufferSizeInFloats) {\r\n k.dirty = true;\r\n return k;\r\n }\r\n }\r\n if (!InstanceBindGroupAllocator._instanceBindGroupLayout) {\r\n const buildInfo = new ProgramBuilder(getDevice()).buildRender({\r\n vertex(pb) {\r\n this[ShaderHelper.getInstanceDataUniformName()] = pb.vec4[65536 >> 4]().uniformBuffer(3);\r\n pb.main(function () {});\r\n },\r\n fragment(pb) {\r\n pb.main(function () {});\r\n }\r\n });\r\n InstanceBindGroupAllocator._instanceBindGroupLayout = buildInfo[2][3];\r\n }\r\n const bindGroup = {\r\n bindGroup: getDevice().createBindGroup(InstanceBindGroupAllocator._instanceBindGroupLayout),\r\n buffer: new Float32Array(maxBufferSizeInFloats),\r\n offset: 0,\r\n dirty: true\r\n };\r\n this._bindGroupList.push(bindGroup);\r\n return bindGroup;\r\n }\r\n}\r\n\r\nconst defaultInstanceBindGroupAlloator = new InstanceBindGroupAllocator();\r\nconst tmpDrawablePos = new Vector3();\r\n\r\n/**\r\n * Instance data\r\n * @public\r\n */\r\nexport interface InstanceData {\r\n bindGroup: CachedBindGroup;\r\n stride: number;\r\n offset: number;\r\n numInstances: number;\r\n}\r\n\r\n/**\r\n * Render queue item\r\n * @public\r\n */\r\nexport interface RenderQueueItem {\r\n drawable: Drawable;\r\n sortDistance: number;\r\n instanceColor?: Vector4;\r\n instanceData: Nullable<InstanceData>;\r\n}\r\n\r\n/**\r\n * Render item list information\r\n * @public\r\n */\r\nexport interface RenderItemListInfo {\r\n itemList: RenderQueueItem[];\r\n renderBundle?: RenderBundleWrapper;\r\n skinItemList: RenderQueueItem[];\r\n skinRenderBundle?: RenderBundleWrapper;\r\n morphItemList: RenderQueueItem[];\r\n morphRenderBundle?: RenderBundleWrapper;\r\n skinAndMorphItemList: RenderQueueItem[];\r\n skinAndMorphRenderBundle?: RenderBundleWrapper;\r\n instanceItemList: RenderQueueItem[];\r\n instanceRenderBundle?: RenderBundleWrapper;\r\n instanceList: Record<string, BatchDrawable[]>;\r\n materialList: Set<Material>;\r\n renderQueue: RenderQueue;\r\n}\r\n\r\n/**\r\n * Render item list bundle\r\n * @public\r\n */\r\nexport interface RenderItemListBundle {\r\n lit: RenderItemListInfo[];\r\n unlit: RenderItemListInfo[];\r\n}\r\n\r\n/**\r\n * Item list of render queue\r\n * @public\r\n */\r\nexport interface RenderItemList {\r\n opaque: RenderItemListBundle;\r\n transmission: RenderItemListBundle;\r\n transparent: RenderItemListBundle;\r\n transmission_trans: RenderItemListBundle;\r\n}\r\n\r\n/**\r\n * Render queue reference\r\n * @public\r\n */\r\nexport interface RenderQueueRef {\r\n ref: RenderQueue;\r\n}\r\n\r\n/**\r\n * Drawable instance information\r\n * @public\r\n */\r\nexport interface DrawableInstanceInfo {\r\n bindGroup: CachedBindGroup;\r\n offset: number;\r\n}\r\n\r\n/**\r\n * A queue that contains the items to be rendered\r\n * @public\r\n */\r\nexport class RenderQueue extends Disposable {\r\n /** @internal */\r\n private _itemList: Nullable<RenderItemList>;\r\n /** @internal */\r\n private readonly _renderPass: RenderPass;\r\n /** @internal */\r\n private _shadowedLightList: PunctualLight[];\r\n /** @internal */\r\n private _unshadowedLightList: PunctualLight[];\r\n /** @internal */\r\n private _sunLight: Nullable<DirectionalLight>;\r\n /** @internal */\r\n private readonly _bindGroupAllocator: InstanceBindGroupAllocator;\r\n /** @internal */\r\n private readonly _ref: RenderQueueRef;\r\n /** @internal */\r\n private readonly _instanceInfo: Map<Drawable, DrawableInstanceInfo>;\r\n /** @internal */\r\n private _needSceneColor: boolean;\r\n private _needSceneDepth: boolean;\r\n private _needSceneColorWithDepth: boolean;\r\n /** @internal */\r\n private _drawTransparent: boolean;\r\n /** @internal */\r\n private readonly _objectColorMaps: Map<number, Drawable>[];\r\n /**\r\n * Creates an instance of a render queue\r\n * @param renderPass - The render pass to which the render queue belongs\r\n */\r\n constructor(renderPass: RenderPass, bindGroupAllocator?: InstanceBindGroupAllocator) {\r\n super();\r\n this._bindGroupAllocator = bindGroupAllocator ?? defaultInstanceBindGroupAlloator;\r\n this._itemList = null;\r\n this._renderPass = renderPass;\r\n this._shadowedLightList = [];\r\n this._unshadowedLightList = [];\r\n this._sunLight = null;\r\n this._ref = { ref: this };\r\n this._instanceInfo = new Map();\r\n this._needSceneColor = false;\r\n this._needSceneDepth = false;\r\n this._needSceneColorWithDepth = false;\r\n this._drawTransparent = false;\r\n this._objectColorMaps = [new Map()];\r\n }\r\n /** The sun light */\r\n get sunLight() {\r\n return this._sunLight;\r\n }\r\n set sunLight(light) {\r\n this._sunLight = light;\r\n }\r\n /** @internal */\r\n needSceneColor() {\r\n return this._needSceneColor;\r\n }\r\n /** @internal */\r\n needSceneDepth() {\r\n return this._needSceneDepth;\r\n }\r\n /** @internal */\r\n needSceneColorWithDepth() {\r\n return this._needSceneColorWithDepth;\r\n }\r\n /** Whether this render queue has transparent objects to be drawn */\r\n get drawTransparent() {\r\n return this._drawTransparent;\r\n }\r\n /** The render pass to which the render queue belongs */\r\n get renderPass() {\r\n return this._renderPass;\r\n }\r\n /**\r\n * Gets the items of the render queue\r\n */\r\n get itemList() {\r\n return this._itemList;\r\n }\r\n /**\r\n * Gets the shadowed lights\r\n */\r\n get shadowedLights() {\r\n return this._shadowedLightList;\r\n }\r\n /**\r\n * Gets the unshadowed lights\r\n */\r\n get unshadowedLights() {\r\n return this._unshadowedLightList;\r\n }\r\n /**\r\n * Gets the indirect reference of this\r\n */\r\n get ref() {\r\n return this._ref;\r\n }\r\n /**\r\n * Gets the instance information for given drawable object\r\n * @param drawable - The drawable object\r\n * @returns The instane information for given drawable object, null if no exists\r\n */\r\n getInstanceInfo(drawable: Drawable) {\r\n return this._instanceInfo.get(drawable);\r\n }\r\n /**\r\n * Gets the maximum batch size of a given device\r\n * @returns The maximum batch size of the device\r\n *\r\n * @internal\r\n */\r\n getMaxBatchSize() {\r\n return getDevice().getDeviceCaps().shaderCaps.maxUniformBufferSize / 64;\r\n }\r\n /**\r\n * Push a punctual light\r\n * @param light - The light to be pushed\r\n */\r\n pushLight(light: PunctualLight) {\r\n if (light.castShadow) {\r\n this._shadowedLightList.push(light);\r\n } else {\r\n this._unshadowedLightList.push(light);\r\n }\r\n if (light.isDirectionLight() && light.sunLight) {\r\n this.sunLight = light;\r\n }\r\n }\r\n /**\r\n * Push items from another render queue\r\n * @param queue - The render queue to be pushed\r\n */\r\n pushRenderQueue(queue: RenderQueue) {\r\n const newItemLists = queue._itemList;\r\n if (!newItemLists) {\r\n return;\r\n }\r\n if (!this._itemList) {\r\n this._itemList = this.newRenderItemList();\r\n }\r\n this._itemList.opaque.lit.push(...newItemLists.opaque.lit);\r\n this._itemList.opaque.unlit.push(...newItemLists.opaque.unlit);\r\n this._itemList.transmission.lit.push(...newItemLists.transmission.lit);\r\n this._itemList.transmission.unlit.push(...newItemLists.transmission.unlit);\r\n this._itemList.transparent.lit.push(...newItemLists.transparent.lit);\r\n this._itemList.transparent.unlit.push(...newItemLists.transparent.unlit);\r\n this._itemList.transmission_trans.lit.push(...newItemLists.transmission_trans.lit);\r\n this._itemList.transmission_trans.unlit.push(...newItemLists.transmission_trans.unlit);\r\n this._needSceneColor ||= queue._needSceneColor;\r\n this._needSceneDepth ||= queue._needSceneDepth;\r\n this._needSceneColorWithDepth ||= queue._needSceneColorWithDepth;\r\n this._drawTransparent ||= queue._drawTransparent;\r\n this._objectColorMaps.push(...queue._objectColorMaps);\r\n }\r\n /**\r\n * Push an item to the render queue\r\n * @param camera - The camera for drawing the item\r\n * @param drawable - The object to be drawn\r\n */\r\n push(camera: Camera, drawable: Drawable) {\r\n if (drawable) {\r\n drawable.pushRenderQueueRef(this._ref);\r\n if (!this._itemList) {\r\n this._itemList = this.newRenderItemList();\r\n }\r\n const trans = drawable.getQueueType() === QUEUE_TRANSPARENT;\r\n const unlit = drawable.isUnlit();\r\n const needDepth = !!drawable.needSceneDepth();\r\n const transmission = !!drawable.needSceneColor() || needDepth;\r\n this._needSceneColor ||= transmission;\r\n this._needSceneDepth ||= drawable.needSceneDepth();\r\n this._needSceneColorWithDepth ||= transmission && needDepth;\r\n this._drawTransparent ||= trans;\r\n if (camera.getPickResultResolveFunc()) {\r\n drawable.getMaterial()!.objectColor = drawable.getObjectColor();\r\n this._objectColorMaps[0].set(drawable.getDrawableId(), drawable);\r\n }\r\n if (drawable.isBatchable()) {\r\n const instanceList = trans\r\n ? transmission\r\n ? unlit\r\n ? this._itemList.transmission_trans.unlit[0].instanceList\r\n : this._itemList.transmission_trans.lit[0].instanceList\r\n : unlit\r\n ? this._itemList.transparent.unlit[0].instanceList\r\n : this._itemList.transparent.lit[0].instanceList\r\n : transmission\r\n ? unlit\r\n ? this._itemList.transmission.unlit[0].instanceList\r\n : this._itemList.transmission.lit[0].instanceList\r\n : unlit\r\n ? this._itemList.opaque.unlit[0].instanceList\r\n : this._itemList.opaque.lit[0].instanceList;\r\n const hash = drawable.getInstanceId(this._renderPass);\r\n let drawableList = instanceList[hash];\r\n if (!drawableList) {\r\n drawableList = [];\r\n instanceList[hash] = drawableList;\r\n }\r\n drawableList.push(drawable);\r\n } else {\r\n const list = trans\r\n ? transmission\r\n ? unlit\r\n ? this._itemList.transmission_trans.unlit[0]\r\n : this._itemList.transmission_trans.lit[0]\r\n : unlit\r\n ? this._itemList.transparent.unlit[0]\r\n : this._itemList.transparent.lit[0]\r\n : transmission\r\n ? unlit\r\n ? this._itemList.transmission.unlit[0]\r\n : this._itemList.transmission.lit[0]\r\n : unlit\r\n ? this._itemList.opaque.unlit[0]\r\n : this._itemList.opaque.lit[0];\r\n const skinAnimation = !!drawable.getBoneMatrices();\r\n const morphAnimation = !!drawable.getMorphData();\r\n let queue: RenderQueueItem[];\r\n if (skinAnimation && morphAnimation) {\r\n queue = list.skinAndMorphItemList;\r\n } else if (skinAnimation) {\r\n queue = list.skinItemList;\r\n } else if (morphAnimation) {\r\n queue = list.morphItemList;\r\n } else {\r\n queue = list.itemList;\r\n }\r\n this.binaryInsert(queue, {\r\n drawable,\r\n sortDistance: drawable.getSortDistance(camera),\r\n instanceData: null\r\n });\r\n const mat = drawable.getMaterial();\r\n if (mat) {\r\n list.materialList.add(mat.coreMaterial);\r\n }\r\n drawable.applyTransformUniforms(this);\r\n }\r\n }\r\n }\r\n /** @internal */\r\n getDrawableByColor(c: Uint8Array<ArrayBuffer>) {\r\n const id = (c[0] << 24) + (c[1] << 16) + (c[2] << 8) + c[3];\r\n for (const m of this._objectColorMaps) {\r\n const drawable = m.get(id);\r\n if (drawable) {\r\n return drawable;\r\n }\r\n }\r\n return null;\r\n }\r\n /**\r\n * Removes all items in the render queue\r\n */\r\n reset() {\r\n if (this._itemList) {\r\n // Release all render bundles\r\n for (const k of objectKeys(this._itemList)) {\r\n const itemListBundle: RenderItemListBundle = this._itemList[k];\r\n for (const l of objectKeys(itemListBundle)) {\r\n const listInfo: RenderItemListInfo[] = itemListBundle[l];\r\n for (const info of listInfo) {\r\n if (info.renderQueue === this) {\r\n if (info.renderBundle) {\r\n info.renderBundle.dispose();\r\n }\r\n if (info.skinRenderBundle) {\r\n info.skinRenderBundle.dispose();\r\n }\r\n if (info.morphRenderBundle) {\r\n info.morphRenderBundle.dispose();\r\n }\r\n if (info.skinAndMorphRenderBundle) {\r\n info.skinAndMorphRenderBundle.dispose();\r\n }\r\n if (info.instanceRenderBundle) {\r\n info.instanceRenderBundle.dispose();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n this._itemList = null;\r\n }\r\n this._shadowedLightList = [];\r\n this._unshadowedLightList = [];\r\n this._sunLight = null;\r\n this._needSceneColor = false;\r\n this._needSceneDepth = false;\r\n this._needSceneColorWithDepth = false;\r\n this._drawTransparent = false;\r\n }\r\n /** @internal */\r\n end(camera: Camera, createRenderBundles?: boolean) {\r\n const frameCounter = getDevice().frameInfo.frameCounter;\r\n const itemList = this._itemList!;\r\n if (!this.itemList) {\r\n return this;\r\n }\r\n const lists = [\r\n itemList.opaque.lit,\r\n itemList.opaque.unlit,\r\n itemList.transmission.lit,\r\n itemList.transmission.unlit,\r\n itemList.transparent.lit,\r\n itemList.transparent.unlit,\r\n itemList.transmission_trans.lit,\r\n itemList.transmission_trans.unlit\r\n ];\r\n for (let i = 0; i < lists.length; i++) {\r\n const list = lists[i];\r\n for (const info of list) {\r\n if (info.renderQueue !== this) {\r\n continue;\r\n }\r\n const instanceList = info.instanceList;\r\n for (const x in instanceList) {\r\n const drawables = instanceList[x];\r\n let bindGroup: Nullable<CachedBindGroup> = null;\r\n let item: Nullable<RenderQueueItem> = null;\r\n for (let i = 0; i < drawables.length; i++) {\r\n const drawable = drawables[i];\r\n const instanceUniforms = drawable.getInstanceUniforms();\r\n const instanceUniformsSize = instanceUniforms?.length ?? 0;\r\n const stride = ShaderHelper.MATERIAL_INSTANCE_DATA_OFFSET * 4 + instanceUniformsSize;\r\n if (!bindGroup || bindGroup.offset + stride > maxBufferSizeInFloats) {\r\n bindGroup = this._bindGroupAllocator.allocateInstanceBindGroup(frameCounter, stride);\r\n item = {\r\n drawable,\r\n sortDistance: drawable.getSortDistance(camera),\r\n instanceData: {\r\n bindGroup,\r\n offset: bindGroup.offset,\r\n numInstances: 0,\r\n stride\r\n }\r\n };\r\n this.binaryInsert(info.instanceItemList, item);\r\n drawable.applyInstanceOffsetAndStride(this, stride, bindGroup.offset);\r\n }\r\n const instanceInfo = { bindGroup, offset: bindGroup.offset };\r\n this._instanceInfo.set(drawable, instanceInfo);\r\n drawable.applyTransformUniforms(this);\r\n drawable.applyMaterialUniforms(instanceInfo);\r\n bindGroup.offset += stride;\r\n item!.instanceData!.numInstances++;\r\n const mat = drawable.getMaterial();\r\n if (mat) {\r\n info.materialList.add(mat.coreMaterial);\r\n }\r\n }\r\n }\r\n info.instanceList = {};\r\n if (createRenderBundles) {\r\n if (info.itemList.length > 0) {\r\n info.renderBundle = new RenderBundleWrapper();\r\n }\r\n if (info.skinItemList.length > 0) {\r\n info.skinRenderBundle = new RenderBundleWrapper();\r\n }\r\n if (info.morphItemList.length > 0) {\r\n info.morphRenderBundle = new RenderBundleWrapper();\r\n }\r\n if (info.skinAndMorphItemList.length > 0) {\r\n info.skinAndMorphRenderBundle = new RenderBundleWrapper();\r\n }\r\n if (info.instanceItemList.length > 0) {\r\n info.instanceRenderBundle = new RenderBundleWrapper();\r\n }\r\n }\r\n }\r\n }\r\n return this;\r\n }\r\n binaryInsert(itemList: RenderQueueItem[], item: RenderQueueItem) {\r\n let left = 0;\r\n let right = itemList.length - 1;\r\n const newInstanceId = item.drawable.getMaterial()!.instanceId;\r\n while (left <= right) {\r\n const mid = Math.floor((left + right) / 2);\r\n const instanceId = itemList[mid].drawable.getMaterial()!.instanceId;\r\n if (instanceId === newInstanceId) {\r\n itemList.splice(mid + 1, 0, item);\r\n return;\r\n } else if (instanceId < newInstanceId) {\r\n left = mid + 1;\r\n } else {\r\n right = mid - 1;\r\n }\r\n }\r\n itemList.splice(left, 0, item);\r\n }\r\n /**\r\n * Sorts the items in the render queue for rendering\r\n */\r\n sortTransparentItems(cameraPos: Vector3) {\r\n if (this._itemList) {\r\n this._itemList.transparent.lit[0].itemList.sort(\r\n (a, b) =>\r\n this.drawableDistanceToCamera(b.drawable, cameraPos) -\r\n this.drawableDistanceToCamera(a.drawable, cameraPos)\r\n );\r\n this._itemList.transparent.lit[0].skinItemList.sort(\r\n (a, b) =>\r\n this.drawableDistanceToCamera(b.drawable, cameraPos) -\r\n this.drawableDistanceToCamera(a.drawable, cameraPos)\r\n );\r\n this._itemList.transparent.lit[0].morphItemList.sort(\r\n (a, b) =>\r\n this.drawableDistanceToCamera(b.drawable, cameraPos) -\r\n this.drawableDistanceToCamera(a.drawable, cameraPos)\r\n );\r\n this._itemList.transparent.lit[0].skinAndMorphItemList.sort(\r\n (a, b) =>\r\n this.drawableDistanceToCamera(b.drawable, cameraPos) -\r\n this.drawableDistanceToCamera(a.drawable, cameraPos)\r\n );\r\n this._itemList.transparent.unlit[0].itemList.sort(\r\n (a, b) =>\r\n this.drawableDistanceToCamera(b.drawable, cameraPos) -\r\n this.drawableDistanceToCamera(a.drawable, cameraPos)\r\n );\r\n this._itemList.transparent.unlit[0].skinItemList.sort(\r\n (a, b) =>\r\n this.drawableDistanceToCamera(b.drawable, cameraPos) -\r\n this.drawableDistanceToCamera(a.drawable, cameraPos)\r\n );\r\n this._itemList.transparent.unlit[0].morphItemList.sort(\r\n (a, b) =>\r\n this.drawableDistanceToCamera(b.drawable, cameraPos) -\r\n this.drawableDistanceToCamera(a.drawable, cameraPos)\r\n );\r\n this._itemList.transparent.unlit[0].skinAndMorphItemList.sort(\r\n (a, b) =>\r\n this.drawableDistanceToCamera(b.drawable, cameraPos) -\r\n this.drawableDistanceToCamera(a.drawable, cameraPos)\r\n );\r\n }\r\n }\r\n /** Disposes the render queue */\r\n protected onDispose() {\r\n super.onDispose();\r\n this.reset();\r\n }\r\n\r\n private drawableDistanceToCamera(drawable: Drawable, cameraPos: Vector3) {\r\n const drawablePos = drawable.getNode().getWorldPosition(tmpDrawablePos);\r\n return Vector3.distanceSq(drawablePos, cameraPos);\r\n }\r\n private newRenderItemListInfo() {\r\n return {\r\n itemList: [],\r\n skinItemList: [],\r\n morphItemList: [],\r\n skinAndMorphItemList: [],\r\n instanceItemList: [],\r\n materialList: new Set(),\r\n instanceList: {},\r\n renderQueue: this\r\n } as RenderItemListInfo;\r\n }\r\n private newRenderItemListBundle() {\r\n return {\r\n lit: [this.newRenderItemListInfo()],\r\n unlit: [this.newRenderItemListInfo()]\r\n };\r\n }\r\n private newRenderItemList() {\r\n return {\r\n opaque: this.newRenderItemListBundle(),\r\n transmission: this.newRenderItemListBundle(),\r\n transparent: this.newRenderItemListBundle(),\r\n transmission_trans: this.newRenderItemListBundle()\r\n };\r\n }\r\n}\r\n"],"names":["maxBufferSizeInFloats","InstanceBindGroupAllocator","_instanceBindGroupLayout","_bindGroupList","_allocFrameStamp","allocateInstanceBindGroup","framestamp","sizeInFloats","k","offset","dirty","buildInfo","ProgramBuilder","getDevice","buildRender","vertex","pb","ShaderHelper","getInstanceDataUniformName","vec4","uniformBuffer","main","fragment","bindGroup","createBindGroup","buffer","Float32Array","push","defaultInstanceBindGroupAlloator","tmpDrawablePos","Vector3","RenderQueue","Disposable","_needSceneDepth","_needSceneColorWithDepth","renderPass","bindGroupAllocator","_bindGroupAllocator","_itemList","_renderPass","_shadowedLightList","_unshadowedLightList","_sunLight","_ref","ref","_instanceInfo","Map","_needSceneColor","_drawTransparent","_objectColorMaps","sunLight","light","needSceneColor","needSceneDepth","needSceneColorWithDepth","drawTransparent","itemList","shadowedLights","unshadowedLights","getInstanceInfo","drawable","get","getMaxBatchSize","getDeviceCaps","shaderCaps","maxUniformBufferSize","pushLight","castShadow","isDirectionLight","pushRenderQueue","queue","newItemLists","newRenderItemList","opaque","lit","unlit","transmission","transparent","transmission_trans","camera","pushRenderQueueRef","trans","getQueueType","QUEUE_TRANSPARENT","isUnlit","needDepth","getPickResultResolveFunc","getMaterial","objectColor","getObjectColor","set","getDrawableId","isBatchable","instanceList","hash","getInstanceId","drawableList","list","skinAnimation","getBoneMatrices","morphAnimation","getMorphData","skinAndMorphItemList","skinItemList","morphItemList","binaryInsert","sortDistance","getSortDistance","instanceData","mat","materialList","add","coreMaterial","applyTransformUniforms","getDrawableByColor","c","id","m","reset","objectKeys","itemListBundle","l","listInfo","info","renderQueue","renderBundle","dispose","skinRenderBundle","morphRenderBundle","skinAndMorphRenderBundle","instanceRenderBundle","end","createRenderBundles","frameCounter","frameInfo","lists","i","length","x","drawables","item","instanceUniforms","getInstanceUniforms","instanceUniformsSize","stride","MATERIAL_INSTANCE_DATA_OFFSET","numInstances","instanceItemList","applyInstanceOffsetAndStride","instanceInfo","applyMaterialUniforms","RenderBundleWrapper","left","right","newInstanceId","instanceId","mid","Math","floor","splice","sortTransparentItems","cameraPos","sort","a","b","drawableDistanceToCamera","onDispose","drawablePos","getNode","getWorldPosition","distanceSq","newRenderItemListInfo","Set","newRenderItemListBundle"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,wBAAwB,KAAQ,GAAA,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C,YAAAA,aAAAA,EAAe,EAAE;AACjBF,YAAAA,oBAAAA,EAAsB,EAAE;AACxB6C,YAAAA,gBAAAA,EAAkB,EAAE;AACpBrC,YAAAA,YAAAA,EAAc,IAAI8D,GAAAA,EAAAA;AAClB/E,YAAAA,YAAAA,EAAc,EAAC;AACf+B,YAAAA,WAAAA,EAAa;AACf,SAAA;AACF;IACQiD,uBAA0B,GAAA;QAChC,OAAO;YACLnG,GAAK,EAAA;AAAC,gBAAA,IAAI,CAACiG,qBAAqB;AAAG,aAAA;YACnChG,KAAO,EAAA;AAAC,gBAAA,IAAI,CAACgG,qBAAqB;AAAG;AACvC,SAAA;AACF;IACQnG,iBAAoB,GAAA;QAC1B,OAAO;YACLC,MAAQ,EAAA,IAAI,CAACoG,uBAAuB,EAAA;YACpCjG,YAAc,EAAA,IAAI,CAACiG,uBAAuB,EAAA;YAC1ChG,WAAa,EAAA,IAAI,CAACgG,uBAAuB,EAAA;YACzC/F,kBAAoB,EAAA,IAAI,CAAC+F,uBAAuB;AAClD,SAAA;AACF;AACF;;;;"}
|
package/dist/render/renderer.js
CHANGED
|
@@ -1,64 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ShadowMapPass } from './shadowmap_pass.js';
|
|
3
|
-
import { DepthPass } from './depthpass.js';
|
|
4
|
-
import { Vector4, isPowerOf2, nextPowerOf2, Matrix4x4, Vector3 } from '@zephyr3d/base';
|
|
1
|
+
import '@zephyr3d/base';
|
|
5
2
|
import './primitive.js';
|
|
6
3
|
import '@zephyr3d/device';
|
|
7
4
|
import { getDevice } from '../app/api.js';
|
|
8
5
|
import { CopyBlitter } from '../blitter/copy.js';
|
|
9
|
-
import { Camera } from '../camera/camera.js';
|
|
10
|
-
import { PostEffectLayer, AbstractPostEffect } from '../posteffect/posteffect.js';
|
|
11
|
-
import { ClusteredLight } from './cluster_light.js';
|
|
12
6
|
import { GlobalBindGroupAllocator } from './globalbindgroup_allocator.js';
|
|
13
|
-
import { ObjectColorPass } from './objectcolorpass.js';
|
|
14
|
-
import { buildHiZ } from './hzb.js';
|
|
15
|
-
import { MaterialVaryingFlags } from '../values.js';
|
|
16
7
|
import { fetchSampler } from '../utility/misc.js';
|
|
17
|
-
import {
|
|
18
|
-
import '../shapes/cylinder.js';
|
|
19
|
-
import '../shapes/torus.js';
|
|
20
|
-
import '../shapes/plane.js';
|
|
21
|
-
import '../shapes/sphere.js';
|
|
22
|
-
import '../shapes/tetrahedron.js';
|
|
8
|
+
import { executeForwardPlusGraph } from './rendergraph/forward_plus_builder.js';
|
|
23
9
|
|
|
24
10
|
/**
|
|
25
11
|
* Forward render scheme
|
|
26
12
|
* @internal
|
|
27
13
|
*/ class SceneRenderer {
|
|
28
|
-
/** @internal */ static _skyMotionVectorProgram = null;
|
|
29
|
-
/** @internal */ static _skyMotionVectorBindGroup = null;
|
|
30
|
-
static _box = null;
|
|
31
|
-
/** @internal */ static _pickCamera = new Camera(null);
|
|
32
|
-
/** @internal */ static _scenePass = new LightPass();
|
|
33
|
-
/** @internal */ static _depthPass = new DepthPass();
|
|
34
|
-
/** @internal */ static _shadowMapPass = new ShadowMapPass();
|
|
35
|
-
/** @internal */ static _objectColorPass = new ObjectColorPass();
|
|
36
|
-
/** @internal */ static _frontDepthColorState = null;
|
|
37
|
-
/** @internal */ static _backDepthColorState = null;
|
|
38
|
-
/** @internal */ static _clusters = [];
|
|
39
|
-
/** lighting render pass */ static get sceneRenderPass() {
|
|
40
|
-
return this._scenePass;
|
|
41
|
-
}
|
|
42
|
-
/** depth render pass */ static get depthRenderPass() {
|
|
43
|
-
return this._depthPass;
|
|
44
|
-
}
|
|
45
|
-
/** shadow map render pass */ static get shadowMapRenderPass() {
|
|
46
|
-
return this._shadowMapPass;
|
|
47
|
-
}
|
|
48
|
-
/** @internal */ static getClusteredLight() {
|
|
49
|
-
if (this._clusters.length > 0) {
|
|
50
|
-
return this._clusters.pop();
|
|
51
|
-
}
|
|
52
|
-
return new ClusteredLight();
|
|
53
|
-
}
|
|
54
|
-
/** @internal */ static freeClusteredLight(clusteredLight) {
|
|
55
|
-
this._clusters.push(clusteredLight);
|
|
56
|
-
}
|
|
57
14
|
/**
|
|
58
15
|
* Renders a scene by given camera
|
|
59
|
-
* @param scene - The scene
|
|
16
|
+
* @param scene - The scene to render
|
|
60
17
|
* @param camera - The camera that will be used to render the scene
|
|
61
|
-
* @param compositor - The compositor that will be used to apply postprocess effects
|
|
62
18
|
*/ static renderScene(scene, camera) {
|
|
63
19
|
const device = getDevice();
|
|
64
20
|
const colorFormat = camera.HDR && device.getDeviceCaps().textureCaps.supportHalfFloatColorBuffer ? 'rgba16f' : 'rgba8unorm';
|
|
@@ -67,7 +23,7 @@ import '../shapes/tetrahedron.js';
|
|
|
67
23
|
scene.frameUpdate();
|
|
68
24
|
scene.frameUpdatePerCamera(camera);
|
|
69
25
|
if (camera && !device.isContextLost()) {
|
|
70
|
-
const defaultViewport = !camera.viewport && !camera.scissor;
|
|
26
|
+
const defaultViewport = (!camera.TAA || device.type === 'webgl') && !camera.viewport && !camera.scissor;
|
|
71
27
|
const renderX = camera.viewport ? device.screenXToDevice(camera.viewport[0]) : 0;
|
|
72
28
|
const renderY = camera.viewport ? device.screenYToDevice(camera.viewport[1]) : 0;
|
|
73
29
|
const renderWidth = camera.viewport ? device.screenXToDevice(camera.viewport[2]) : device.getDrawingBufferWidth();
|
|
@@ -136,317 +92,8 @@ import '../shapes/tetrahedron.js';
|
|
|
136
92
|
}
|
|
137
93
|
GlobalBindGroupAllocator.release(globalBindGroupAllocator);
|
|
138
94
|
}
|
|
139
|
-
static renderSceneDepth(ctx, renderQueue, depthFramebuffer) {
|
|
140
|
-
const transmission = !!depthFramebuffer;
|
|
141
|
-
if (!depthFramebuffer) {
|
|
142
|
-
const format = ctx.device.type === 'webgl' ? ctx.SSRCalcThickness ? 'rgba16f' : 'rgba8unorm' : ctx.SSRCalcThickness ? 'rg32f' : 'r32f';
|
|
143
|
-
const mvFormat = 'rgba16f';
|
|
144
|
-
if (!ctx.finalFramebuffer) {
|
|
145
|
-
depthFramebuffer = ctx.device.pool.fetchTemporalFramebuffer(true, ctx.renderWidth, ctx.renderHeight, ctx.motionVectors ? [
|
|
146
|
-
format,
|
|
147
|
-
mvFormat
|
|
148
|
-
] : format, ctx.depthFormat, false);
|
|
149
|
-
} else {
|
|
150
|
-
const originDepth = ctx.finalFramebuffer?.getDepthAttachment();
|
|
151
|
-
depthFramebuffer = originDepth?.isTexture2D() ? ctx.device.pool.fetchTemporalFramebuffer(true, originDepth.width, originDepth.height, ctx.motionVectors ? [
|
|
152
|
-
format,
|
|
153
|
-
mvFormat
|
|
154
|
-
] : format, originDepth, false) : ctx.device.pool.fetchTemporalFramebuffer(true, ctx.renderWidth, ctx.renderHeight, ctx.motionVectors ? [
|
|
155
|
-
format,
|
|
156
|
-
mvFormat
|
|
157
|
-
] : format, ctx.depthFormat, false);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
ctx.device.pushDeviceStates();
|
|
161
|
-
ctx.device.setFramebuffer(depthFramebuffer);
|
|
162
|
-
this._depthPass.encodeDepth = depthFramebuffer.getColorAttachments()[0].format === 'rgba8unorm';
|
|
163
|
-
this._depthPass.clearColor = transmission ? null : this._depthPass.encodeDepth ? new Vector4(0, 0, 0, 1) : new Vector4(1, 1, 1, 1);
|
|
164
|
-
this._depthPass.clearDepth = transmission ? null : 1;
|
|
165
|
-
this._depthPass.clearStencil = null;
|
|
166
|
-
this._depthPass.transmission = transmission;
|
|
167
|
-
if (ctx.SSRCalcThickness && !transmission) {
|
|
168
|
-
if (!this._backDepthColorState) {
|
|
169
|
-
this._backDepthColorState = ctx.device.createColorState().setColorMask(false, true, false, false);
|
|
170
|
-
}
|
|
171
|
-
if (!this._frontDepthColorState) {
|
|
172
|
-
this._frontDepthColorState = ctx.device.createColorState().setColorMask(true, false, false, false);
|
|
173
|
-
}
|
|
174
|
-
ctx.forceColorState = this._backDepthColorState;
|
|
175
|
-
ctx.forceCullMode = 'front';
|
|
176
|
-
this._depthPass.renderBackface = true;
|
|
177
|
-
this._depthPass.transmission = false;
|
|
178
|
-
this._depthPass.render(ctx, null, null, renderQueue);
|
|
179
|
-
this._depthPass.clearColor = null;
|
|
180
|
-
this._depthPass.renderBackface = false;
|
|
181
|
-
ctx.forceColorState = this._frontDepthColorState;
|
|
182
|
-
ctx.forceCullMode = null;
|
|
183
|
-
}
|
|
184
|
-
this._depthPass.render(ctx, null, null, renderQueue);
|
|
185
|
-
ctx.forceColorState = null;
|
|
186
|
-
ctx.device.popDeviceStates();
|
|
187
|
-
if (!transmission) {
|
|
188
|
-
ctx.motionVectorTexture = ctx.motionVectors ? depthFramebuffer.getColorAttachments()[1] : null;
|
|
189
|
-
ctx.linearDepthTexture = depthFramebuffer.getColorAttachments()[0];
|
|
190
|
-
ctx.depthTexture = depthFramebuffer.getDepthAttachment();
|
|
191
|
-
if (ctx.motionVectorTexture) {
|
|
192
|
-
this.renderSkyMotionVectors(ctx);
|
|
193
|
-
}
|
|
194
|
-
if (ctx.HiZ) {
|
|
195
|
-
let w = isPowerOf2(ctx.linearDepthTexture.width) ? ctx.linearDepthTexture.width : nextPowerOf2(ctx.linearDepthTexture.width);
|
|
196
|
-
let h = isPowerOf2(ctx.linearDepthTexture.height) ? ctx.linearDepthTexture.height : nextPowerOf2(ctx.linearDepthTexture.height);
|
|
197
|
-
w = Math.max(1, w >> 1);
|
|
198
|
-
h = Math.max(1, h >> 1);
|
|
199
|
-
w = ctx.linearDepthTexture.width;
|
|
200
|
-
h = ctx.linearDepthTexture.height;
|
|
201
|
-
const HiZFrameBuffer = ctx.device.pool.fetchTemporalFramebuffer(true, w, h, ctx.linearDepthTexture.format, null, true);
|
|
202
|
-
buildHiZ(ctx.depthTexture, HiZFrameBuffer);
|
|
203
|
-
ctx.HiZTexture = HiZFrameBuffer.getColorAttachments()[0];
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return depthFramebuffer;
|
|
207
|
-
}
|
|
208
95
|
/** @internal */ static _renderScene(ctx) {
|
|
209
|
-
|
|
210
|
-
// Cull scene
|
|
211
|
-
const renderQueue = this._scenePass.cullScene(ctx, ctx.camera);
|
|
212
|
-
// Update sky
|
|
213
|
-
const sunLightColor = ctx.scene.env.sky.update(ctx);
|
|
214
|
-
// Gather lights
|
|
215
|
-
ctx.clusteredLight = this.getClusteredLight();
|
|
216
|
-
ctx.clusteredLight.calculateLightIndex(ctx.camera, renderQueue);
|
|
217
|
-
// Do GPU ray picking if required
|
|
218
|
-
const pickResolveFunc = ctx.camera.getPickResultResolveFunc();
|
|
219
|
-
if (pickResolveFunc) {
|
|
220
|
-
this.renderObjectColors(ctx, pickResolveFunc, renderQueue);
|
|
221
|
-
}
|
|
222
|
-
// Render shadow maps
|
|
223
|
-
this.renderShadowMaps(ctx, renderQueue.shadowedLights);
|
|
224
|
-
// Render scene depth first
|
|
225
|
-
const depthFramebuffer = this.renderSceneDepth(ctx, renderQueue, null);
|
|
226
|
-
if (ctx.depthTexture === ctx.finalFramebuffer?.getDepthAttachment()) {
|
|
227
|
-
ctx.intermediateFramebuffer = ctx.finalFramebuffer;
|
|
228
|
-
} else {
|
|
229
|
-
// TODO: fetch resizable framebuffer if ctx.defaultViewport is true
|
|
230
|
-
ctx.intermediateFramebuffer = device.pool.fetchTemporalFramebuffer(false, ctx.depthTexture.width, ctx.depthTexture.height, ctx.colorFormat, ctx.depthTexture);
|
|
231
|
-
}
|
|
232
|
-
if (ctx.intermediateFramebuffer && ctx.intermediateFramebuffer !== ctx.finalFramebuffer) {
|
|
233
|
-
device.pushDeviceStates();
|
|
234
|
-
device.setFramebuffer(ctx.intermediateFramebuffer);
|
|
235
|
-
} else {
|
|
236
|
-
device.setViewport(null);
|
|
237
|
-
device.setScissor(null);
|
|
238
|
-
}
|
|
239
|
-
this._scenePass.transmission = false; // transmission
|
|
240
|
-
this._scenePass.clearDepth = ctx.depthTexture ? null : 1;
|
|
241
|
-
this._scenePass.clearStencil = ctx.depthTexture ? null : 0;
|
|
242
|
-
if (ctx.SSR && !renderQueue.needSceneColor()) {
|
|
243
|
-
ctx.materialFlags |= MaterialVaryingFlags.SSR_STORE_ROUGHNESS;
|
|
244
|
-
}
|
|
245
|
-
ctx.compositor?.begin(ctx);
|
|
246
|
-
if (renderQueue.needSceneColor()) {
|
|
247
|
-
const compositor = ctx.compositor;
|
|
248
|
-
ctx.compositor = null;
|
|
249
|
-
const sceneColorFramebuffer = device.pool.fetchTemporalFramebuffer(true, ctx.depthTexture.width, ctx.depthTexture.height, ctx.materialFlags & MaterialVaryingFlags.SSR_STORE_ROUGHNESS ? [
|
|
250
|
-
ctx.colorFormat,
|
|
251
|
-
device.getFramebuffer().getColorAttachments()[1],
|
|
252
|
-
device.getFramebuffer().getColorAttachments()[2]
|
|
253
|
-
] : ctx.colorFormat, ctx.depthTexture, false);
|
|
254
|
-
device.pushDeviceStates();
|
|
255
|
-
device.setFramebuffer(sceneColorFramebuffer);
|
|
256
|
-
this._scenePass.transmission = false;
|
|
257
|
-
this._scenePass.render(ctx, null, null, renderQueue);
|
|
258
|
-
device.popDeviceStates();
|
|
259
|
-
ctx.sceneColorTexture = sceneColorFramebuffer.getColorAttachments()[0];
|
|
260
|
-
new CopyBlitter().blit(ctx.sceneColorTexture, device.getFramebuffer() ?? null, fetchSampler('clamp_nearest_nomip'));
|
|
261
|
-
this._scenePass.transmission = true;
|
|
262
|
-
this._scenePass.clearColor = null;
|
|
263
|
-
this._scenePass.clearDepth = null;
|
|
264
|
-
this._scenePass.clearStencil = null;
|
|
265
|
-
ctx.compositor = compositor;
|
|
266
|
-
}
|
|
267
|
-
this._scenePass.render(ctx, null, null, renderQueue);
|
|
268
|
-
if (renderQueue.needSceneColor()) {
|
|
269
|
-
this.renderSceneDepth(ctx, renderQueue, depthFramebuffer);
|
|
270
|
-
}
|
|
271
|
-
ctx.compositor?.drawPostEffects(ctx, PostEffectLayer.end, ctx.linearDepthTexture);
|
|
272
|
-
ctx.compositor?.end(ctx);
|
|
273
|
-
renderQueue.dispose();
|
|
274
|
-
ctx.materialFlags &= ~MaterialVaryingFlags.SSR_STORE_ROUGHNESS;
|
|
275
|
-
if (ctx.intermediateFramebuffer && ctx.intermediateFramebuffer !== ctx.finalFramebuffer) {
|
|
276
|
-
const blitter = new CopyBlitter();
|
|
277
|
-
blitter.srgbOut = !ctx.finalFramebuffer;
|
|
278
|
-
const srcTex = ctx.intermediateFramebuffer.getColorAttachments()[0];
|
|
279
|
-
blitter.blit(srcTex, ctx.finalFramebuffer ?? null, fetchSampler('clamp_nearest_nomip'));
|
|
280
|
-
device.popDeviceStates();
|
|
281
|
-
device.pool.releaseFrameBuffer(ctx.intermediateFramebuffer);
|
|
282
|
-
}
|
|
283
|
-
//ShadowMapper.releaseTemporalResources(ctx);
|
|
284
|
-
this.freeClusteredLight(ctx.clusteredLight);
|
|
285
|
-
// Restore sun color
|
|
286
|
-
if (sunLightColor) {
|
|
287
|
-
ctx.sunLight.color = sunLightColor;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
static _getSkyMotionVectorProgram(ctx) {
|
|
291
|
-
if (!this._skyMotionVectorProgram) {
|
|
292
|
-
this._skyMotionVectorProgram = ctx.device.buildRenderProgram({
|
|
293
|
-
vertex (pb) {
|
|
294
|
-
this.$inputs.pos = pb.vec3().attrib('position');
|
|
295
|
-
this.VPMatrix = pb.mat4().uniform(0);
|
|
296
|
-
this.prevVPMatrix = pb.mat4().uniform(0);
|
|
297
|
-
this.cameraPos = pb.vec3().uniform(0);
|
|
298
|
-
this.prevCameraPos = pb.vec3().uniform(0);
|
|
299
|
-
pb.main(function() {
|
|
300
|
-
this.$l.worldPos = pb.add(this.$inputs.pos, this.cameraPos);
|
|
301
|
-
this.$l.prevWorldPos = pb.add(this.$inputs.pos, this.prevCameraPos);
|
|
302
|
-
this.$l.clipPos = pb.mul(this.VPMatrix, pb.vec4(this.worldPos, 1));
|
|
303
|
-
this.$l.prevClipPos = pb.mul(this.prevVPMatrix, pb.vec4(this.prevWorldPos, 1));
|
|
304
|
-
this.clipPos.z = this.clipPos.w;
|
|
305
|
-
this.$builtins.position = this.clipPos;
|
|
306
|
-
this.$outputs.currentPos = this.clipPos;
|
|
307
|
-
this.$outputs.prevPos = this.prevClipPos;
|
|
308
|
-
});
|
|
309
|
-
},
|
|
310
|
-
fragment (pb) {
|
|
311
|
-
this.$outputs.color = pb.vec4();
|
|
312
|
-
pb.main(function() {
|
|
313
|
-
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);
|
|
314
|
-
this.$outputs.color = pb.vec4(this.motionVector, 0, 1);
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
this._skyMotionVectorProgram.name = '@TAA_SkyMotionVector';
|
|
319
|
-
}
|
|
320
|
-
return this._skyMotionVectorProgram;
|
|
321
|
-
}
|
|
322
|
-
static _getBox(_ctx) {
|
|
323
|
-
if (!this._box) {
|
|
324
|
-
this._box = new BoxShape({
|
|
325
|
-
size: 2,
|
|
326
|
-
needNormal: false,
|
|
327
|
-
needUV: false
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
return this._box;
|
|
331
|
-
}
|
|
332
|
-
/** @internal */ static renderSkyMotionVectors(ctx) {
|
|
333
|
-
if (!ctx.motionVectorTexture) {
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
const fb = ctx.device.pool.fetchTemporalFramebuffer(false, 0, 0, ctx.motionVectorTexture, ctx.depthTexture);
|
|
337
|
-
const program = this._getSkyMotionVectorProgram(ctx);
|
|
338
|
-
if (!this._skyMotionVectorBindGroup) {
|
|
339
|
-
this._skyMotionVectorBindGroup = ctx.device.createBindGroup(program.bindGroupLayouts[0]);
|
|
340
|
-
}
|
|
341
|
-
const box = this._getBox(ctx);
|
|
342
|
-
this._skyMotionVectorBindGroup.setValue('VPMatrix', ctx.camera.viewProjectionMatrix);
|
|
343
|
-
this._skyMotionVectorBindGroup.setValue('prevVPMatrix', ctx.camera.prevVPMatrix);
|
|
344
|
-
this._skyMotionVectorBindGroup.setValue('cameraPos', ctx.camera.getWorldPosition());
|
|
345
|
-
this._skyMotionVectorBindGroup.setValue('prevCameraPos', ctx.camera.prevPosition);
|
|
346
|
-
ctx.device.pushDeviceStates();
|
|
347
|
-
ctx.device.setProgram(program);
|
|
348
|
-
ctx.device.setBindGroup(0, this._skyMotionVectorBindGroup);
|
|
349
|
-
ctx.device.setRenderStates(AbstractPostEffect.getDefaultRenderState(ctx, 'le'));
|
|
350
|
-
ctx.device.setFramebuffer(fb);
|
|
351
|
-
box.draw();
|
|
352
|
-
ctx.device.popDeviceStates();
|
|
353
|
-
ctx.device.pool.releaseFrameBuffer(fb);
|
|
354
|
-
}
|
|
355
|
-
/** @internal */ static renderShadowMaps(ctx, lights) {
|
|
356
|
-
ctx.renderPass = this._shadowMapPass;
|
|
357
|
-
ctx.device.pushDeviceStates();
|
|
358
|
-
for (const light of lights){
|
|
359
|
-
light.shadow.render(ctx, this._shadowMapPass);
|
|
360
|
-
}
|
|
361
|
-
ctx.device.popDeviceStates();
|
|
362
|
-
}
|
|
363
|
-
/** @internal */ static decodeNormalizedFloat(rgba) {
|
|
364
|
-
const a = rgba[0] / 255;
|
|
365
|
-
const b = rgba[1] / 255;
|
|
366
|
-
const c = rgba[2] / 255;
|
|
367
|
-
const d = rgba[3] / 255;
|
|
368
|
-
return a / (256 * 256 * 256) + b / (256 * 256) + c / 256 + d;
|
|
369
|
-
}
|
|
370
|
-
/** @internal */ static renderObjectColors(ctx, pickResolveFunc, renderQueue) {
|
|
371
|
-
const camera = ctx.camera;
|
|
372
|
-
const isWebGL1 = ctx.device.type === 'webgl';
|
|
373
|
-
ctx.renderPass = this._objectColorPass;
|
|
374
|
-
ctx.device.pushDeviceStates();
|
|
375
|
-
const fb = ctx.device.pool.fetchTemporalFramebuffer(false, 1, 1, isWebGL1 ? [
|
|
376
|
-
'rgba8unorm',
|
|
377
|
-
'rgba8unorm'
|
|
378
|
-
] : [
|
|
379
|
-
'rgba8unorm',
|
|
380
|
-
'rgba32f'
|
|
381
|
-
], ctx.depthFormat, false);
|
|
382
|
-
ctx.device.setViewport(camera.viewport);
|
|
383
|
-
const vp = ctx.device.getViewport();
|
|
384
|
-
const windowX = camera.getPickPosX() / vp.width;
|
|
385
|
-
const windowY = (vp.height - camera.getPickPosY() - 1) / vp.height;
|
|
386
|
-
const windowW = 1 / vp.width;
|
|
387
|
-
const windowH = 1 / vp.height;
|
|
388
|
-
const pickCamera = this._pickCamera;
|
|
389
|
-
camera.worldMatrix.decompose(pickCamera.scale, pickCamera.rotation, pickCamera.position);
|
|
390
|
-
let left = camera.getProjectionMatrix().getLeftPlane();
|
|
391
|
-
let right = camera.getProjectionMatrix().getRightPlane();
|
|
392
|
-
let bottom = camera.getProjectionMatrix().getBottomPlane();
|
|
393
|
-
let top = camera.getProjectionMatrix().getTopPlane();
|
|
394
|
-
const near = camera.getProjectionMatrix().getNearPlane();
|
|
395
|
-
const far = camera.getProjectionMatrix().getFarPlane();
|
|
396
|
-
const width = right - left;
|
|
397
|
-
const height = top - bottom;
|
|
398
|
-
left += width * windowX;
|
|
399
|
-
bottom += height * windowY;
|
|
400
|
-
right = left + width * windowW;
|
|
401
|
-
top = bottom + height * windowH;
|
|
402
|
-
pickCamera.setProjectionMatrix(camera.isPerspective() ? Matrix4x4.frustum(left, right, bottom, top, near, far) : Matrix4x4.ortho(left, right, bottom, top, near, far));
|
|
403
|
-
const cameraPos = isWebGL1 ? new Vector3(pickCamera.position) : null;
|
|
404
|
-
const ray = isWebGL1 ? camera.constructRay(camera.getPickPosX(), camera.getPickPosY()) : null;
|
|
405
|
-
ctx.device.setFramebuffer(fb);
|
|
406
|
-
this._objectColorPass.clearColor = Vector4.zero();
|
|
407
|
-
this._objectColorPass.clearDepth = 1;
|
|
408
|
-
const rq = this._objectColorPass.cullScene(ctx, pickCamera);
|
|
409
|
-
this._objectColorPass.render(ctx, pickCamera, null, rq);
|
|
410
|
-
rq.dispose();
|
|
411
|
-
ctx.device.popDeviceStates();
|
|
412
|
-
const colorTex = fb.getColorAttachments()[0];
|
|
413
|
-
const distanceTex = fb.getColorAttachments()[1];
|
|
414
|
-
const colorPixels = new Uint8Array(4);
|
|
415
|
-
const distancePixels = isWebGL1 ? new Uint8Array(4) : new Float32Array(4);
|
|
416
|
-
const device = ctx.device;
|
|
417
|
-
let fence;
|
|
418
|
-
if (ctx.device.type === 'webgl') {
|
|
419
|
-
fence = Promise.all([
|
|
420
|
-
ctx.device.runNextFrameAsync(()=>colorTex.readPixels(0, 0, 1, 1, 0, 0, colorPixels)),
|
|
421
|
-
ctx.device.runNextFrameAsync(()=>distanceTex.readPixels(0, 0, 1, 1, 0, 0, distancePixels))
|
|
422
|
-
]);
|
|
423
|
-
} else {
|
|
424
|
-
fence = Promise.all([
|
|
425
|
-
colorTex.readPixels(0, 0, 1, 1, 0, 0, colorPixels),
|
|
426
|
-
distanceTex.readPixels(0, 0, 1, 1, 0, 0, distancePixels)
|
|
427
|
-
]);
|
|
428
|
-
}
|
|
429
|
-
fence.then(()=>{
|
|
430
|
-
const drawable = renderQueue.getDrawableByColor(colorPixels);
|
|
431
|
-
let d = isWebGL1 ? this.decodeNormalizedFloat(distancePixels) * far : distancePixels[0];
|
|
432
|
-
const intersectedPoint = new Vector3(distancePixels[0], distancePixels[1], distancePixels[2]);
|
|
433
|
-
if (isWebGL1) {
|
|
434
|
-
intersectedPoint.x = cameraPos.x + ray.direction.x * d;
|
|
435
|
-
intersectedPoint.y = cameraPos.y + ray.direction.y * d;
|
|
436
|
-
intersectedPoint.z = cameraPos.z + ray.direction.z * d;
|
|
437
|
-
d = Vector3.distance(intersectedPoint, cameraPos);
|
|
438
|
-
}
|
|
439
|
-
pickResolveFunc(drawable ? {
|
|
440
|
-
distance: d,
|
|
441
|
-
intersectedPoint,
|
|
442
|
-
drawable,
|
|
443
|
-
target: drawable.getPickTarget()
|
|
444
|
-
} : null);
|
|
445
|
-
device.pool.releaseFrameBuffer(fb);
|
|
446
|
-
}).catch((_err)=>{
|
|
447
|
-
camera.getPickResultResolveFunc()?.(null);
|
|
448
|
-
device.pool.releaseFrameBuffer(fb);
|
|
449
|
-
});
|
|
96
|
+
executeForwardPlusGraph(ctx);
|
|
450
97
|
}
|
|
451
98
|
}
|
|
452
99
|
|