Skip to content

Commit

Permalink
add validPunctualLightsCulling func to custom pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
troublemaker52025 committed Jul 18, 2023
1 parent c10a724 commit 8c331ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions cocos/rendering/custom/define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function validPunctualLightsCulling (pipeline: BasicPipeline, camera: Cam
const { spotLights } = camera.scene!;
for (let i = 0; i < spotLights.length; i++) {
const light = spotLights[i];
if (light.baked) {
if (light.baked && !camera.node.scene.globals.disableLightmap) {
continue;
}

Expand All @@ -88,7 +88,7 @@ export function validPunctualLightsCulling (pipeline: BasicPipeline, camera: Cam
const { sphereLights } = camera.scene!;
for (let i = 0; i < sphereLights.length; i++) {
const light = sphereLights[i];
if (light.baked) {
if (light.baked && !camera.node.scene.globals.disableLightmap) {
continue;
}
geometry.Sphere.set(_sphere, light.position.x, light.position.y, light.position.z, light.range);
Expand Down Expand Up @@ -117,8 +117,8 @@ export function validPunctualLightsCulling (pipeline: BasicPipeline, camera: Cam
validPunctualLights.push(light);
}
}
// array push not supported.
pipeline.pipelineSceneData.validPunctualLights = validPunctualLights;
// in jsb, std::vector is not synchronized, so we need to assign it manually
sceneData.validPunctualLights = validPunctualLights;
}

const _cameras: Camera[] = [];
Expand Down
3 changes: 2 additions & 1 deletion cocos/rendering/custom/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import { RenderShadowMapBatchedQueue } from '../render-shadow-map-batched-queue'
import { PlanarShadowQueue } from '../planar-shadow-queue';
import { DefaultVisitor, depthFirstSearch, ReferenceGraphView } from './graph';
import { VectorGraphColorMap } from './effect';
import { getDescBindingFromName, getDescriptorSetDataFromLayout, getDescriptorSetDataFromLayoutId, getRenderArea, mergeSrcToTargetDesc, updateGlobalDescBinding } from './define';
import { getDescBindingFromName, getDescriptorSetDataFromLayout, getDescriptorSetDataFromLayoutId, getRenderArea, mergeSrcToTargetDesc, updateGlobalDescBinding, validPunctualLightsCulling } from './define';
import { RenderReflectionProbeQueue } from '../render-reflection-probe-queue';
import { builtinResMgr } from '../../asset/asset-manager/builtin-res-mgr';
import { Texture2D } from '../../asset/assets/texture-2d';
Expand Down Expand Up @@ -1131,6 +1131,7 @@ class DevicePreSceneTask extends WebSceneTask {
}
if (sceneFlag & SceneFlags.DEFAULT_LIGHTING) {
this._submitInfo.additiveLight = context.additiveLight;
validPunctualLightsCulling(context.pipeline, this.camera);
this._submitInfo.additiveLight.gatherLightPasses(this.camera, this._cmdBuff, this._currentQueue.devicePass.layoutName);
}
if (sceneFlag & SceneFlags.PLANAR_SHADOW) {
Expand Down

0 comments on commit 8c331ba

Please sign in to comment.