Updated to use MultiPipeline

This commit is contained in:
Richard Davey 2020-08-21 16:14:59 +01:00
parent 5f1ecfe073
commit 0dd07333af
9 changed files with 35 additions and 34 deletions

View file

@ -301,7 +301,7 @@ var Fade = new Class({
* @method Phaser.Cameras.Scene2D.Effects.Fade#postRenderWebGL
* @since 3.5.0
*
* @param {Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline} pipeline - The WebGL Pipeline to render to.
* @param {Phaser.Renderer.WebGL.Pipelines.MultiPipeline} pipeline - The WebGL Pipeline to render to. Must provide the `drawFillRect` method.
* @param {function} getTintFunction - A function that will return the gl safe tint colors.
*
* @return {boolean} `true` if the effect drew to the renderer, otherwise `false`.

View file

@ -269,7 +269,7 @@ var Flash = new Class({
* @method Phaser.Cameras.Scene2D.Effects.Flash#postRenderWebGL
* @since 3.5.0
*
* @param {Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline} pipeline - The WebGL Pipeline to render to.
* @param {Phaser.Renderer.WebGL.Pipelines.MultiPipeline} pipeline - The WebGL Pipeline to render to. Must provide the `drawFillRect` method.
* @param {function} getTintFunction - A function that will return the gl safe tint colors.
*
* @return {boolean} `true` if the effect drew to the renderer, otherwise `false`.

View file

@ -38,19 +38,20 @@ var Pipeline = {
/**
* Sets the initial WebGL Pipeline of this Game Object.
*
* This should only be called during the instantiation of the Game Object.
*
* @method Phaser.GameObjects.Components.Pipeline#initPipeline
* @webglOnly
* @since 3.0.0
*
* @param {string} [pipelineName=TextureTintPipeline] - The name of the pipeline to set on this Game Object. Defaults to the Texture Tint Pipeline.
* @param {string} [pipelineName=MultiPipeline] - The name of the pipeline to set on this Game Object. Defaults to the Multi Pipeline.
*
* @return {boolean} `true` if the pipeline was set successfully, otherwise `false`.
*/
initPipeline: function (pipelineName)
{
if (pipelineName === undefined) { pipelineName = 'TextureTintPipeline'; }
if (pipelineName === undefined) { pipelineName = 'MultiPipeline'; }
var renderer = this.scene.sys.game.renderer;

View file

@ -132,7 +132,7 @@ var MatterImage = new Class({
this.setPosition(x, y);
this.initPipeline('TextureTintPipeline');
this.initPipeline('MultiPipeline');
}
});

View file

@ -138,7 +138,7 @@ var MatterSprite = new Class({
this.setPosition(x, y);
this.initPipeline('TextureTintPipeline');
this.initPipeline('MultiPipeline');
}
});

View file

@ -2188,7 +2188,7 @@ var WebGLRenderer = new Class({
var cw = camera._cw;
var ch = camera._ch;
var TextureTintPipeline = this.pipelines.TextureTintPipeline;
var MultiPipeline = this.pipelines.MultiPipeline;
var color = camera.backgroundColor;
@ -2206,7 +2206,7 @@ var WebGLRenderer = new Class({
gl.clear(gl.COLOR_BUFFER_BIT);
ProjectOrtho(TextureTintPipeline, cx, cw + cx, cy, ch + cy, -1000, 1000);
ProjectOrtho(MultiPipeline, cx, cw + cx, cy, ch + cy, -1000, 1000);
if (camera.mask)
{
@ -2218,7 +2218,7 @@ var WebGLRenderer = new Class({
if (color.alphaGL > 0)
{
TextureTintPipeline.drawFillRect(
MultiPipeline.drawFillRect(
cx, cy, cw + cx, ch + cy,
Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1),
color.alphaGL
@ -2241,7 +2241,7 @@ var WebGLRenderer = new Class({
if (color.alphaGL > 0)
{
TextureTintPipeline.drawFillRect(
MultiPipeline.drawFillRect(
cx, cy, cw , ch,
Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1),
color.alphaGL
@ -2286,12 +2286,12 @@ var WebGLRenderer = new Class({
*/
postRenderCamera: function (camera)
{
this.setPipeline(this.pipelines.TextureTintPipeline);
this.setPipeline(this.pipelines.MultiPipeline);
var TextureTintPipeline = this.pipelines.TextureTintPipeline;
var MultiPipeline = this.pipelines.MultiPipeline;
camera.flashEffect.postRenderWebGL(TextureTintPipeline, Utils.getTintFromFloats);
camera.fadeEffect.postRenderWebGL(TextureTintPipeline, Utils.getTintFromFloats);
camera.flashEffect.postRenderWebGL(MultiPipeline, Utils.getTintFromFloats);
camera.fadeEffect.postRenderWebGL(MultiPipeline, Utils.getTintFromFloats);
camera.dirty = false;
@ -2299,7 +2299,7 @@ var WebGLRenderer = new Class({
if (camera.renderToTexture)
{
TextureTintPipeline.flush();
MultiPipeline.flush();
this.setFramebuffer(null);
@ -2307,11 +2307,11 @@ var WebGLRenderer = new Class({
if (camera.renderToGame)
{
ProjectOrtho(TextureTintPipeline, 0, TextureTintPipeline.width, TextureTintPipeline.height, 0, -1000.0, 1000.0);
ProjectOrtho(MultiPipeline, 0, MultiPipeline.width, MultiPipeline.height, 0, -1000.0, 1000.0);
var getTint = Utils.getTintAppendFloatAlpha;
var pipeline = (camera.pipeline) ? camera.pipeline : TextureTintPipeline;
var pipeline = (camera.pipeline) ? camera.pipeline : MultiPipeline;
pipeline.batchTexture(
camera,
@ -2397,7 +2397,7 @@ var WebGLRenderer = new Class({
this.textureFlush = 0;
this.setPipeline(this.pipelines.TextureTintPipeline);
this.setPipeline(this.pipelines.MultiPipeline);
},
/**

View file

@ -107,7 +107,7 @@ var BitmapMaskPipeline = new Class({
* Sets the shader program, vertex buffer and other resources.
* Should only be called when changing pipeline.
*
* @method Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline#bind
* @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#bind
* @since 3.50.0
*
* @return {this} This WebGLPipeline instance.

View file

@ -247,7 +247,7 @@ var DynamicTilemapLayer = new Class({
this.setOrigin();
this.setSize(tilemap.tileWidth * this.layer.width, tilemap.tileHeight * this.layer.height);
this.initPipeline('TextureTintPipeline');
this.initPipeline('MultiPipeline');
},
/**

View file

@ -360,7 +360,7 @@ var StaticTilemapLayer = new Class({
this.updateVBOData();
this.initPipeline('TextureTintPipeline');
this.initPipeline('MultiPipeline');
this.mvpInit();