feat: 地图后处理对象添加启用禁用接口

This commit is contained in:
unanmed 2025-11-26 23:52:41 +08:00
parent dce4cc5b7d
commit 9a7fb25533
2 changed files with 17 additions and 2 deletions

View File

@ -1420,7 +1420,9 @@ export class MapRenderer
this.viewportHeight
);
if (this.postEffects.length > 1) {
const postEffects = this.postEffects.filter(v => v.enabled);
if (postEffects.length > 1) {
gl.bindFramebuffer(gl.FRAMEBUFFER, pingFramebuffer);
} else {
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
@ -1484,7 +1486,7 @@ export class MapRenderer
let inputTextrue = pongTexture2D;
let outputFBO: WebGLFramebuffer | null = pingFramebuffer;
this.postEffects.forEach((v, i, a) => {
postEffects.forEach((v, i, a) => {
v.render(gl, inputTextrue, outputFBO, data);
if (inputTextrue === pongTexture2D) {
inputTextrue = pingTexture2D;

View File

@ -281,6 +281,19 @@ export interface IMapRendererTicker {
}
export interface IMapRendererPostEffect {
/** 当前后处理对象是否启用 */
readonly enabled: boolean;
/**
*
*/
enable(): void;
/**
*
*/
disable(): void;
/**
*
* @param gl WebGL2