Skip to content

Commit d11a16d

Browse files
committed
Added forceZero and setAttribPointers
`WebGLPipeline.forceZero` is a new property that informs Game Objects if the pipeline requires a zero bound texture unit. * `WebGLPipeline.setAttribPointers` is a new method that will set the vertex attribute pointers for the pipeline.
1 parent dc04949 commit d11a16d

1 file changed

Lines changed: 30 additions & 5 deletions

File tree

src/renderer/webgl/WebGLPipeline.js

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,16 @@ var WebGLPipeline = new Class({
245245
* @since 3.25.0
246246
*/
247247
this.currentUnit = 0;
248+
249+
/**
250+
* Some pipelines require the forced use of texture zero (like the light pipeline).
251+
* This boolean should be set when that is the case.
252+
*
253+
* @name Phaser.Renderer.WebGL.WebGLPipeline#forceZero
254+
* @type {boolean}
255+
* @since 3.25.0
256+
*/
257+
this.forceZero = false;
248258
},
249259

250260
/**
@@ -387,16 +397,33 @@ var WebGLPipeline = new Class({
387397
*/
388398
bind: function ()
389399
{
390-
var gl = this.gl;
391400
var vertexBuffer = this.vertexBuffer;
392-
var attributes = this.attributes;
393401
var program = this.program;
394402
var renderer = this.renderer;
395-
var vertexSize = this.vertexSize;
396403

397404
renderer.setProgram(program);
398405
renderer.setVertexBuffer(vertexBuffer);
399406

407+
this.setAttribPointers();
408+
409+
return this;
410+
},
411+
412+
/**
413+
* Sets the vertex attribute pointers.
414+
* This should only be called after the vertex buffer has been bound.
415+
*
416+
* @method Phaser.Renderer.WebGL.WebGLPipeline#setAttribPointers
417+
* @since 3.25.0
418+
*
419+
* @return {this} This WebGLPipeline instance.
420+
*/
421+
setAttribPointers: function ()
422+
{
423+
var gl = this.gl;
424+
var attributes = this.attributes;
425+
var vertexSize = this.vertexSize;
426+
400427
for (var i = 0; i < attributes.length; i++)
401428
{
402429
var element = attributes[i];
@@ -411,8 +438,6 @@ var WebGLPipeline = new Class({
411438
element.location = -1;
412439
}
413440
}
414-
415-
return this;
416441
},
417442

418443
/**

0 commit comments

Comments
 (0)