Skip to content

Commit 23ad568

Browse files
committed
Enable use of 'active'
1 parent 35829bc commit 23ad568

2 files changed

Lines changed: 38 additions & 15 deletions

File tree

src/renderer/webgl/PipelineManager.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,12 @@ var PipelineManager = new Class({
593593
// Iterate in reverse because we need them stacked in the order they're in the array
594594
for (var i = pipelines.length - 1; i >= 0; i--)
595595
{
596-
pipelines[i].preBatch(gameObject);
596+
var pipeline = pipelines[i];
597+
598+
if (pipeline.active)
599+
{
600+
pipeline.preBatch(gameObject);
601+
}
597602
}
598603
}
599604
},
@@ -619,7 +624,12 @@ var PipelineManager = new Class({
619624

620625
for (var i = 0; i < pipelines.length; i++)
621626
{
622-
pipelines[i].postBatch(gameObject);
627+
var pipeline = pipelines[i];
628+
629+
if (pipeline.active)
630+
{
631+
pipeline.postBatch(gameObject);
632+
}
623633
}
624634
}
625635
},
@@ -646,7 +656,12 @@ var PipelineManager = new Class({
646656
// Iterate in reverse because we need them stacked in the order they're in the array
647657
for (var i = pipelines.length - 1; i >= 0; i--)
648658
{
649-
pipelines[i].preBatch(camera);
659+
var pipeline = pipelines[i];
660+
661+
if (pipeline.active)
662+
{
663+
pipeline.preBatch(camera);
664+
}
650665
}
651666
}
652667
},
@@ -672,7 +687,12 @@ var PipelineManager = new Class({
672687

673688
for (var i = 0; i < pipelines.length; i++)
674689
{
675-
pipelines[i].postBatch(camera);
690+
var pipeline = pipelines[i];
691+
692+
if (pipeline.active)
693+
{
694+
pipeline.postBatch(camera);
695+
}
676696
}
677697
}
678698
},

src/renderer/webgl/WebGLPipeline.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,15 @@ var WebGLPipeline = new Class({
215215
this.vertexViewU32;
216216

217217
/**
218-
* Indicates if the current pipeline is active, or not, for this frame only.
218+
* Indicates if the current pipeline is active, or not.
219219
*
220-
* Reset to `true` in the `onRender` method.
220+
* Toggle this property to enable or disable a pipeline from rendering anything.
221221
*
222222
* @name Phaser.Renderer.WebGL.WebGLPipeline#active
223223
* @type {boolean}
224224
* @since 3.10.0
225225
*/
226-
this.active = false;
226+
this.active = true;
227227

228228
/**
229229
* Holds the most recently assigned texture unit.
@@ -885,16 +885,19 @@ var WebGLPipeline = new Class({
885885
var gl = this.gl;
886886
var vertexSize = this.currentShader.vertexSize;
887887

888-
if (vertexCount === this.vertexCapacity)
888+
if (this.active)
889889
{
890-
gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.DYNAMIC_DRAW);
891-
}
892-
else
893-
{
894-
gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize));
895-
}
890+
if (vertexCount === this.vertexCapacity)
891+
{
892+
gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.DYNAMIC_DRAW);
893+
}
894+
else
895+
{
896+
gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize));
897+
}
896898

897-
gl.drawArrays(this.topology, 0, vertexCount);
899+
gl.drawArrays(this.topology, 0, vertexCount);
900+
}
898901

899902
this.vertexCount = 0;
900903

0 commit comments

Comments
 (0)