Skip to content

Commit 6b1fda1

Browse files
committed
Use onActive and reset textures, fixing all rendering issues
1 parent 2687be6 commit 6b1fda1

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

src/renderer/webgl/pipelines/LightPipeline.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
var Class = require('../../../utils/Class');
99
var GetFastValue = require('../../../utils/object/GetFastValue');
1010
var LightShaderSourceFS = require('../shaders/Light-frag.js');
11-
var SinglePipeline = require('./SinglePipeline');
11+
var MultiPipeline = require('./MultiPipeline');
1212
var WebGLPipeline = require('../WebGLPipeline');
1313

1414
var LIGHT_COUNT = 10;
1515

1616
/**
1717
* @classdesc
18-
*
1918
* The Light Pipeline is an extension of the Multi Pipeline and uses a custom shader
2019
* designed to handle forward diffused rendering of 2D lights in a Scene.
2120
*
@@ -63,7 +62,7 @@ var LIGHT_COUNT = 10;
6362
*/
6463
var LightPipeline = new Class({
6564

66-
Extends: SinglePipeline,
65+
Extends: MultiPipeline,
6766

6867
initialize:
6968

@@ -73,7 +72,7 @@ var LightPipeline = new Class({
7372

7473
config.fragShader = GetFastValue(config, 'fragShader', LightShaderSourceFS).replace('%LIGHT_COUNT%', LIGHT_COUNT.toString());
7574

76-
SinglePipeline.call(this, config);
75+
MultiPipeline.call(this, config);
7776

7877
/**
7978
* Inverse rotation matrix for normal map rotations.
@@ -135,18 +134,10 @@ var LightPipeline = new Class({
135134
this.defaultNormalMap = { glTexture: tempTexture };
136135
},
137136

138-
/**
139-
* Called every time a Game Object needs to use this pipeline.
140-
*
141-
* @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#onBind
142-
* @since 3.0.0
143-
*
144-
* @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any.
145-
*
146-
* @return {this} This WebGLPipeline instance.
147-
*/
148-
onBind: function ()
137+
onActive: function ()
149138
{
139+
this.renderer.resetTextures();
140+
150141
this.set1i('uMainSampler', 0);
151142
this.set1i('uNormSampler', 1);
152143
this.set2f('uResolution', this.width / 2, this.height / 2);

0 commit comments

Comments
 (0)