Skip to content

Commit

Permalink
Remove duplicate judgments v3.6.0 (cocos#11868)
Browse files Browse the repository at this point in the history
  • Loading branch information
troublemaker52025 authored Jul 6, 2022
1 parent 6da98e7 commit 1f1ddb2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
35 changes: 17 additions & 18 deletions cocos/core/pipeline/render-shadow-map-batched-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,23 @@ export class RenderShadowMapBatchedQueue {
if (light && shadowInfo.enabled && shadowInfo.type === ShadowType.ShadowMap) {
switch (light.type) {
case LightType.DIRECTIONAL:
if (shadowInfo.enabled && shadowInfo.type === ShadowType.ShadowMap) {
const dirLight = light as DirectionalLight;
if (dirLight.shadowEnabled) {
const csmLayers = sceneData.csmLayers;
let layer;
if (dirLight.shadowFixedArea) {
layer = csmLayers.specialLayer;
} else {
layer = csmLayers.layers[level];
}
shadowCulling(camera, sceneData, layer);
const dirShadowObjects = layer.shadowObjects;
for (let i = 0; i < dirShadowObjects.length; i++) {
const ro = dirShadowObjects[i];
const model = ro.model;
if (!getShadowPassIndex(model.subModels, _shadowPassIndices)) { continue; }
this.add(model, _shadowPassIndices);
}
// eslint-disable-next-line no-case-declarations
const dirLight = light as DirectionalLight;
if (dirLight.shadowEnabled) {
const csmLayers = sceneData.csmLayers;
let layer;
if (dirLight.shadowFixedArea) {
layer = csmLayers.specialLayer;
} else {
layer = csmLayers.layers[level];
}
shadowCulling(camera, sceneData, layer);
const dirShadowObjects = layer.shadowObjects;
for (let i = 0; i < dirShadowObjects.length; i++) {
const ro = dirShadowObjects[i];
const model = ro.model;
if (!getShadowPassIndex(model.subModels, _shadowPassIndices)) { continue; }
this.add(model, _shadowPassIndices);
}
}

Expand Down
2 changes: 1 addition & 1 deletion cocos/core/pipeline/scene-culling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export function shadowCulling (camera: Camera, sceneData: PipelineSceneData, lay
dirShadowObjects.length = 0;
const visibility = camera.visibility;

for (let i = csmLayerObjects.length; i >= 0; i--) {
for (let i = csmLayerObjects.length - 1; i >= 0; i--) {
const csmLayerObject = csmLayerObjects.array[i];
if (csmLayerObject) {
const model = csmLayerObject.model;
Expand Down

0 comments on commit 1f1ddb2

Please sign in to comment.