mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-11-27 13:42:58 +08:00
feat: 地图后处理对象添加启用禁用接口
This commit is contained in:
parent
dce4cc5b7d
commit
9a7fb25533
@ -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;
|
||||
|
||||
@ -281,6 +281,19 @@ export interface IMapRendererTicker {
|
||||
}
|
||||
|
||||
export interface IMapRendererPostEffect {
|
||||
/** 当前后处理对象是否启用 */
|
||||
readonly enabled: boolean;
|
||||
|
||||
/**
|
||||
* 启用此后处理对象
|
||||
*/
|
||||
enable(): void;
|
||||
|
||||
/**
|
||||
* 禁用此后处理对象
|
||||
*/
|
||||
disable(): void;
|
||||
|
||||
/**
|
||||
* 初始化渲染器效果对象,一般是编译着色器、准备数据缓冲区等
|
||||
* @param gl WebGL2 画布上下文
|
||||
|
||||
Loading…
Reference in New Issue
Block a user