From 8bf65d34bb3ecef49153da9967f7ab5659d8eb0c Mon Sep 17 00:00:00 2001 From: cary <39078800+caryliu1999@users.noreply.github.com> Date: Tue, 12 Jan 2021 18:38:55 +0800 Subject: [PATCH] Fix the problem of planar shadow in editor. (#8127) --- cocos/core/pipeline/forward/planar-shadow-queue.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cocos/core/pipeline/forward/planar-shadow-queue.ts b/cocos/core/pipeline/forward/planar-shadow-queue.ts index ffbb84a393..f2cb811be5 100644 --- a/cocos/core/pipeline/forward/planar-shadow-queue.ts +++ b/cocos/core/pipeline/forward/planar-shadow-queue.ts @@ -48,6 +48,7 @@ export class PlanarShadowQueue { public gatherShadowPasses (camera: Camera, cmdBuff: CommandBuffer) { const shadows = this._pipeline.shadows; + this._pendingModels.length = 0; if (!shadows.enabled || shadows.type !== ShadowType.Planar) { return; } const scene = camera.scene!; @@ -55,13 +56,12 @@ export class PlanarShadowQueue { const shadowVisible = (camera.visibility & Layers.BitMask.DEFAULT) !== 0; if (!scene.mainLight || !shadowVisible) { return; } - const models = scene.models; - this._pendingModels.length = 0; + const models = this._pipeline.renderObjects; const instancedBuffer = InstancedBuffer.get(shadows.instancingMaterial.passes[0]); this._instancedQueue.clear(); this._instancedQueue.queue.add(instancedBuffer); for (let i = 0; i < models.length; i++) { - const model = models[i]; + const model = models[i].model; if (!model.enabled || !model.node || !model.castShadow) { continue; } if (model.worldBounds) { AABB.transform(_ab, model.worldBounds, shadows.matLight);