Skip to content

Commit 07f2c5f

Browse files
fix(custom-pipeline) addLight() func, return byte offset error (#167)
1 parent 9b17fd6 commit 07f2c5f

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

cocos/rendering/custom/scene-culling.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,11 +817,20 @@ export class LightResource {
817817
this.lightIndex.clear();
818818
}
819819

820+
/**
821+
* @en Adds a light to the light buffer and returns its byte offset.
822+
* @zh 将光源添加到光源缓冲区,并返回其字节偏移量。
823+
* @param light @en The light to add. @zh 要添加的光源。
824+
* @param bHDR @en Whether HDR rendering is enabled. @zh 是否启用 HDR 渲染。
825+
* @param exposure @en The camera exposure value. @zh 相机曝光值。
826+
* @param shadowInfo @en The shadow settings, or null if shadows are disabled. @zh 阴影设置,若禁用阴影则为 null。
827+
* @returns @en The byte offset of the light in the light buffer. @zh 光源在光源缓冲区中的字节偏移量。
828+
*/
820829
addLight (light: Light, bHDR: boolean, exposure: number, shadowInfo: Shadows | null): number {
821830
// Already added
822831
const existingLightID = this.lightIndex.get(light);
823832
if (existingLightID !== undefined) {
824-
return existingLightID;
833+
return existingLightID * this.elementSize;
825834
}
826835

827836
if (!this.lightBuffer) {

0 commit comments

Comments
 (0)