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

@ -18,7 +18,7 @@ var TilemapComponents = require('../components');
* A Dynamic Tilemap Layer trades some speed for being able to apply powerful effects. Unlike a
* Static Tilemap Layer, you can apply per-tile effects like tint or alpha, and you can change the
* tiles in a DynamicTilemapLayer.
*
*
* Use this over a Static Tilemap Layer when you need those features.
*
* @class DynamicTilemapLayer
@ -114,7 +114,7 @@ var DynamicTilemapLayer = new Class({
/**
* The Tileset/s associated with this layer.
*
*
* As of Phaser 3.14 this property is now an array of Tileset objects, previously it was a single reference.
*
* @name Phaser.Tilemaps.DynamicTilemapLayer#tileset
@ -211,17 +211,17 @@ var DynamicTilemapLayer = new Class({
/**
* The rendering (draw) order of the tiles in this layer.
*
*
* The default is 0 which is 'right-down', meaning it will draw the tiles starting from the top-left,
* drawing to the right and then moving down to the next row.
*
*
* The draw orders are:
*
*
* 0 = right-down
* 1 = left-down
* 2 = right-up
* 3 = left-up
*
*
* This can be changed via the `setRenderOrder` method.
*
* @name Phaser.Tilemaps.DynamicTilemapLayer#_renderOrder
@ -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');
},
/**
@ -256,7 +256,7 @@ var DynamicTilemapLayer = new Class({
* @method Phaser.Tilemaps.DynamicTilemapLayer#setTilesets
* @private
* @since 3.14.0
*
*
* @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object.
*/
setTilesets: function (tilesets)
@ -298,20 +298,20 @@ var DynamicTilemapLayer = new Class({
/**
* Sets the rendering (draw) order of the tiles in this layer.
*
*
* The default is 'right-down', meaning it will order the tiles starting from the top-left,
* drawing to the right and then moving down to the next row.
*
*
* The draw orders are:
*
*
* 0 = right-down
* 1 = left-down
* 2 = right-up
* 3 = left-up
*
*
* Setting the render order does not change the tiles or how they are stored in the layer,
* it purely impacts the order in which they are rendered.
*
*
* You can provide either an integer (0 to 3), or the string version of the order.
*
* @method Phaser.Tilemaps.DynamicTilemapLayer#setRenderOrder
@ -451,7 +451,7 @@ var DynamicTilemapLayer = new Class({
*
* @method Phaser.Tilemaps.DynamicTilemapLayer#destroy
* @since 3.0.0
*
*
* @param {boolean} [removeFromTilemap=true] - Remove this layer from the parent Tilemap?
*/
destroy: function (removeFromTilemap)

View file

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