Dispatch precompose and postcompose events for WebGL layers

This commit is contained in:
Tim Schaub
2021-12-15 09:41:29 -07:00
parent 848965b25c
commit 68ea485e69
9 changed files with 176 additions and 14 deletions
+9 -1
View File
@@ -250,9 +250,11 @@ class WebGLPostProcessingPass {
* Render to the next postprocessing pass (or to the canvas if final pass).
* @param {import("../PluggableMap.js").FrameState} frameState current frame state
* @param {WebGLPostProcessingPass} [nextPass] Next pass, optional
* @param {function(WebGLRenderingContext, import("../PluggableMap.js").FrameState):void} [preCompose] Called before composing.
* @param {function(WebGLRenderingContext, import("../PluggableMap.js").FrameState):void} [postCompose] Called before composing.
* @api
*/
apply(frameState, nextPass) {
apply(frameState, nextPass, preCompose, postCompose) {
const gl = this.getGL();
const size = frameState.size;
@@ -288,7 +290,13 @@ class WebGLPostProcessingPass {
this.applyUniforms(frameState);
if (preCompose) {
preCompose(gl, frameState);
}
gl.drawArrays(gl.TRIANGLES, 0, 6);
if (postCompose) {
postCompose(gl, frameState);
}
}
/**