@@ -458,7 +458,8 @@ var WebGLPipeline = new Class({
458458 /**
459459 * This method is called once when this pipeline has finished being set-up
460460 * at the end of the boot process. By the time this method is called, all
461- * of the shaders are ready and configured.
461+ * of the shaders are ready and configured. It's also called if the renderer
462+ * changes size.
462463 *
463464 * @method Phaser.Renderer.WebGL.WebGLPipeline#onResize
464465 * @since 3.50.0
@@ -876,6 +877,24 @@ var WebGLPipeline = new Class({
876877 {
877878 } ,
878879
880+ /**
881+ * By default this is an empty method hook that you can override and use in your own custom pipelines.
882+ *
883+ * This method is called every time the `batchQuad` or `batchTri` methods are called. If this was
884+ * as a result of a Game Object, then the Game Object refernce is passed to this hook too.
885+ *
886+ * This hook is called _after_ the quad (or tri) has been added to the batch, so you can safely
887+ * call 'flush' from within this.
888+ *
889+ * @method Phaser.Renderer.WebGL.WebGLPipeline#onBatch
890+ * @since 3.50.0
891+ *
892+ * @param {Phaser.GameObjects.GameObject } [gameObject] - The Game Object that invoked this pipeline, if any.
893+ */
894+ onBatch : function ( )
895+ {
896+ } ,
897+
879898 /**
880899 * By default this is an empty method hook that you can override and use in your own custom pipelines.
881900 *
@@ -1045,6 +1064,7 @@ var WebGLPipeline = new Class({
10451064 * @method Phaser.Renderer.WebGL.WebGLPipeline#batchQuad
10461065 * @since 3.50.0
10471066 *
1067+ * @param {(Phaser.GameObjects.GameObject|null) } gameObject - The Game Object, if any, drawing this quad.
10481068 * @param {number } x0 - The top-left x position.
10491069 * @param {number } y0 - The top-left y position.
10501070 * @param {number } x1 - The bottom-left x position.
@@ -1067,7 +1087,7 @@ var WebGLPipeline = new Class({
10671087 *
10681088 * @return {boolean } `true` if this method caused the batch to flush, otherwise `false`.
10691089 */
1070- batchQuad : function ( x0 , y0 , x1 , y1 , x2 , y2 , x3 , y3 , u0 , v0 , u1 , v1 , tintTL , tintTR , tintBL , tintBR , tintEffect , texture , unit )
1090+ batchQuad : function ( gameObject , x0 , y0 , x1 , y1 , x2 , y2 , x3 , y3 , u0 , v0 , u1 , v1 , tintTL , tintTR , tintBL , tintBR , tintEffect , texture , unit )
10711091 {
10721092 if ( unit === undefined ) { unit = this . currentUnit ; }
10731093
@@ -1089,6 +1109,8 @@ var WebGLPipeline = new Class({
10891109 this . batchVert ( x2 , y2 , u1 , v1 , unit , tintEffect , tintBR ) ;
10901110 this . batchVert ( x3 , y3 , u1 , v0 , unit , tintEffect , tintTR ) ;
10911111
1112+ this . onBatch ( gameObject ) ;
1113+
10921114 return hasFlushed ;
10931115 } ,
10941116
@@ -1110,6 +1132,7 @@ var WebGLPipeline = new Class({
11101132 * @method Phaser.Renderer.WebGL.WebGLPipeline#batchTri
11111133 * @since 3.50.0
11121134 *
1135+ * @param {(Phaser.GameObjects.GameObject|null) } gameObject - The Game Object, if any, drawing this quad.
11131136 * @param {number } x1 - The bottom-left x position.
11141137 * @param {number } y1 - The bottom-left y position.
11151138 * @param {number } x2 - The bottom-right x position.
@@ -1129,7 +1152,7 @@ var WebGLPipeline = new Class({
11291152 *
11301153 * @return {boolean } `true` if this method caused the batch to flush, otherwise `false`.
11311154 */
1132- batchTri : function ( x0 , y0 , x1 , y1 , x2 , y2 , u0 , v0 , u1 , v1 , tintTL , tintTR , tintBL , tintEffect , texture , unit )
1155+ batchTri : function ( gameObject , x0 , y0 , x1 , y1 , x2 , y2 , u0 , v0 , u1 , v1 , tintTL , tintTR , tintBL , tintEffect , texture , unit )
11331156 {
11341157 if ( unit === undefined ) { unit = this . currentUnit ; }
11351158
@@ -1148,6 +1171,8 @@ var WebGLPipeline = new Class({
11481171 this . batchVert ( x1 , y1 , u0 , v1 , unit , tintEffect , tintTR ) ;
11491172 this . batchVert ( x2 , y2 , u1 , v1 , unit , tintEffect , tintBL ) ;
11501173
1174+ this . onBatch ( gameObject ) ;
1175+
11511176 return hasFlushed ;
11521177 } ,
11531178
0 commit comments