Skip to content

Commit 209b39b

Browse files
committed
New pipeline names and single texture flag
1 parent 468c03d commit 209b39b

1 file changed

Lines changed: 33 additions & 10 deletions

File tree

src/renderer/webgl/WebGLRenderer.js

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ var WebGLSnapshot = require('../snapshot/WebGLSnapshot');
2222

2323
// Default Pipelines
2424
var BitmapMaskPipeline = require('./pipelines/BitmapMaskPipeline');
25-
var ForwardDiffuseLightPipeline = require('./pipelines/ForwardDiffuseLightPipeline');
26-
var TextureTintPipeline = require('./pipelines/TextureTintPipeline');
27-
var TextureTintStripPipeline = require('./pipelines/TextureTintStripPipeline');
25+
var LightPipeline = require('./pipelines/LightPipeline');
26+
var MultiPipeline = require('./pipelines/MultiPipeline');
27+
var RopePipeline = require('./pipelines/RopePipeline');
28+
var SinglePipeline = require('./pipelines/SinglePipeline');
2829

2930
/**
3031
* @callback WebGLContextCallback
@@ -822,14 +823,16 @@ var WebGLRenderer = new Class({
822823
{
823824
var game = this.game;
824825

825-
var ttp = this.addPipeline('TextureTintPipeline', new TextureTintPipeline({ game: game, renderer: this }));
826-
this.addPipeline('TextureTintStripPipeline', new TextureTintStripPipeline({ game: game, renderer: this }));
827-
this.addPipeline('BitmapMaskPipeline', new BitmapMaskPipeline({ game: game, renderer: this }));
828-
this.addPipeline('Light2D', new ForwardDiffuseLightPipeline({ game: game, renderer: this, maxLights: this.config.maxLights }));
826+
var multi = this.addPipeline('MultiPipeline', new MultiPipeline({ game: game }));
827+
828+
this.addPipeline('SinglePipeline', new SinglePipeline({ game: game }));
829+
this.addPipeline('RopePipeline', new RopePipeline({ game: game }));
830+
this.addPipeline('BitmapMaskPipeline', new BitmapMaskPipeline({ game: game }));
831+
this.addPipeline('Light2D', new LightPipeline({ game: game }));
829832

830833
var blank = game.textures.getFrame('__DEFAULT');
831834

832-
ttp.currentFrame = blank;
835+
multi.currentFrame = blank;
833836

834837
this.blankTexture = blank;
835838

@@ -839,7 +842,7 @@ var WebGLRenderer = new Class({
839842

840843
gl.enable(gl.SCISSOR_TEST);
841844

842-
this.setPipeline(ttp);
845+
this.setPipeline(multi);
843846

844847
game.scale.on(ScaleEvents.RESIZE, this.onResize, this);
845848

@@ -1391,6 +1394,13 @@ var WebGLRenderer = new Class({
13911394
*/
13921395
setTextureSource: function (textureSource)
13931396
{
1397+
if (this.currentPipeline.forceZero)
1398+
{
1399+
this.setTextureZero(textureSource.glTexture, true);
1400+
1401+
return 0;
1402+
}
1403+
13941404
var gl = this.gl;
13951405
var currentActiveTexture = this.currentActiveTexture;
13961406

@@ -1455,11 +1465,17 @@ var WebGLRenderer = new Class({
14551465
* @since 3.50.0
14561466
*
14571467
* @param {WebGLTexture} texture - The WebGL texture that needs to be bound.
1468+
* @param {boolean} [flush=false] - Flush the pipeline if the texture is different?
14581469
*/
1459-
setTextureZero: function (texture)
1470+
setTextureZero: function (texture, flush)
14601471
{
14611472
if (this.textureZero !== texture)
14621473
{
1474+
if (flush)
1475+
{
1476+
this.flush();
1477+
}
1478+
14631479
var gl = this.gl;
14641480

14651481
gl.activeTexture(gl.TEXTURE0);
@@ -1608,6 +1624,13 @@ var WebGLRenderer = new Class({
16081624
*/
16091625
setTexture2D: function (texture)
16101626
{
1627+
if (this.currentPipeline.forceZero)
1628+
{
1629+
this.setTextureZero(texture, true);
1630+
1631+
return 0;
1632+
}
1633+
16111634
var gl = this.gl;
16121635
var currentActiveTexture = this.currentActiveTexture;
16131636

0 commit comments

Comments
 (0)