@@ -402,7 +402,19 @@ var UtilityPipeline = new Class({
402402 gl . activeTexture ( gl . TEXTURE0 ) ;
403403 gl . bindTexture ( gl . TEXTURE_2D , source . texture ) ;
404404
405- gl . viewport ( 0 , 0 , source . width , source . height ) ;
405+ if ( source . height >= target . height )
406+ {
407+ gl . viewport ( 0 , 0 , source . width , source . height ) ;
408+
409+ this . setVerticesFromTarget ( source , target ) ;
410+ }
411+ else
412+ {
413+ var diff = target . height - source . height ;
414+
415+ gl . viewport ( 0 , diff , source . width , source . height ) ;
416+ }
417+
406418 gl . bindFramebuffer ( gl . FRAMEBUFFER , target . framebuffer ) ;
407419 gl . framebufferTexture2D ( gl . FRAMEBUFFER , gl . COLOR_ATTACHMENT0 , gl . TEXTURE_2D , target . texture , 0 ) ;
408420
@@ -420,15 +432,15 @@ var UtilityPipeline = new Class({
420432 gl . clear ( gl . COLOR_BUFFER_BIT ) ;
421433 }
422434
423- this . setVerticesFromTarget ( source , target ) ;
435+ gl . disable ( gl . SCISSOR_TEST ) ;
424436
425437 gl . bufferData ( gl . ARRAY_BUFFER , this . vertexData , gl . STATIC_DRAW ) ;
426438 gl . drawArrays ( gl . TRIANGLES , 0 , 6 ) ;
427439
428440 gl . bindFramebuffer ( gl . FRAMEBUFFER , null ) ;
429441 gl . bindTexture ( gl . TEXTURE_2D , null ) ;
430442
431- this . resetVertices ( ) ;
443+ this . resetUVs ( ) ;
432444 } ,
433445
434446 /**
@@ -692,19 +704,6 @@ var UtilityPipeline = new Class({
692704 gl . bindFramebuffer ( gl . FRAMEBUFFER , fbo ) ;
693705 } ,
694706
695- /**
696- * Resets the quad vertices to their default values.
697- *
698- * The quad is used by all shaders of the Utility Pipeline.
699- *
700- * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#resetVertices
701- * @since 3.50.0
702- */
703- resetVertices : function ( )
704- {
705- this . vertexViewF32 . set ( [ - 1 , - 1 , 0 , 0 , - 1 , 1 , 0 , 1 , 1 , 1 , 1 , 1 , - 1 , - 1 , 0 , 0 , 1 , 1 , 1 , 1 , 1 , - 1 , 1 , 0 ] ) ;
706- } ,
707-
708707 /**
709708 * Set the UV values for the 6 vertices that make up the quad used by the shaders
710709 * in the Utility Pipeline.
@@ -766,16 +765,7 @@ var UtilityPipeline = new Class({
766765 diff = 0.5 + ( 0.5 - diff ) ;
767766 }
768767
769- console . log ( 'setVerticesFromTarget UVs' , 'game' , source . height , 'rt' , target . height , diff ) ;
770-
771768 this . setUVs ( 0 , diff , 0 , 1 + diff , 1 , 1 + diff , 1 , diff ) ;
772-
773- if ( target . height >= source . height )
774- {
775- console . log ( 'Adjusting Quad Y position' ) ;
776-
777-
778- }
779769 } ,
780770
781771 /**
@@ -806,40 +796,30 @@ var UtilityPipeline = new Class({
806796 this . setUVs ( 0 , 1 , 0 , 0 , 1 , 0 , 1 , 1 ) ;
807797 } ,
808798
809- setAPos : function ( x , y )
810- {
811- var vertexViewF32 = this . vertexViewF32 ;
812-
813- vertexViewF32 [ 0 ] = x ;
814- vertexViewF32 [ 1 ] = y ;
815- vertexViewF32 [ 12 ] = x ;
816- vertexViewF32 [ 13 ] = y ;
817- } ,
818-
819- setBPos : function ( x , y )
820- {
821- var vertexViewF32 = this . vertexViewF32 ;
822-
823- vertexViewF32 [ 4 ] = x ;
824- vertexViewF32 [ 5 ] = y ;
825- } ,
826-
827- setCPos : function ( x , y )
799+ /**
800+ * Resets the quad vertices to their default values.
801+ *
802+ * The quad is used by all shaders of the Utility Pipeline.
803+ *
804+ * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#resetVertices
805+ * @since 3.50.0
806+ */
807+ resetVertices : function ( )
828808 {
829- var vertexViewF32 = this . vertexViewF32 ;
830-
831- vertexViewF32 [ 8 ] = x ;
832- vertexViewF32 [ 9 ] = y ;
833- vertexViewF32 [ 16 ] = x ;
834- vertexViewF32 [ 17 ] = y ;
809+ this . vertexViewF32 . set ( [ - 1 , - 1 , 0 , 0 , - 1 , 1 , 0 , 1 , 1 , 1 , 1 , 1 , - 1 , - 1 , 0 , 0 , 1 , 1 , 1 , 1 , 1 , - 1 , 1 , 0 ] ) ;
835810 } ,
836811
837- setDPos : function ( x , y )
812+ /**
813+ * Resets the quad vertice UV values to their default settings.
814+ *
815+ * The quad is used by all shaders of the Utility Pipeline.
816+ *
817+ * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#resetUVs
818+ * @since 3.50.0
819+ */
820+ resetUVs : function ( )
838821 {
839- var vertexViewF32 = this . vertexViewF32 ;
840-
841- vertexViewF32 [ 20 ] = x ;
842- vertexViewF32 [ 21 ] = y ;
822+ this . setUVs ( 0 , 0 , 0 , 1 , 1 , 1 , 1 , 0 ) ;
843823 }
844824
845825} ) ;
0 commit comments