Skip to content

Commit 7c929e5

Browse files
committed
Finished method docs and added clone
1 parent ec4751d commit 7c929e5

1 file changed

Lines changed: 46 additions & 3 deletions

File tree

src/renderer/webgl/WebGLPipeline.js

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,29 @@ var WebGLPipeline = new Class({
319319
*/
320320
this.projectionMatrix = new Matrix4().identity();
321321

322+
/**
323+
* A flag indicating if the MVP matrices are dirty, or not.
324+
*
325+
* Used by WebGLShader when binding the uniforms.
326+
*
327+
* @name Phaser.Renderer.WebGL.WebGLPipeline#mvpDirty
328+
* @type {boolean}
329+
* @since 3.50.0
330+
*/
322331
this.mvpDirty = true;
323332

324-
this.tempConfig = config;
333+
/**
334+
* The configuration object that was used to create this pipeline.
335+
*
336+
* Treat this object as 'read only', because changing it post-creation will not
337+
* impact this pipeline in any way. However, it is used internally for cloning
338+
* and post-boot set-up.
339+
*
340+
* @name Phaser.Renderer.WebGL.WebGLPipeline#config
341+
* @type {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig}
342+
* @since 3.50.0
343+
*/
344+
this.config = config;
325345
},
326346

327347
/**
@@ -335,7 +355,7 @@ var WebGLPipeline = new Class({
335355
*/
336356
boot: function ()
337357
{
338-
this.setShadersFromConfig(this.tempConfig);
358+
this.setShadersFromConfig(this.config);
339359

340360
this.renderer.setVertexBuffer(this.vertexBuffer);
341361

@@ -347,7 +367,7 @@ var WebGLPipeline = new Class({
347367
},
348368

349369
/**
350-
* Sets the model, projection and view matrices to identity matrices.
370+
* Resets the model, projection and view matrices to identity matrices.
351371
*
352372
* @method Phaser.Renderer.WebGL.WebGLPipeline#mvpInit
353373
* @since 3.50.0
@@ -359,6 +379,29 @@ var WebGLPipeline = new Class({
359379
this.viewMatrix.identity();
360380
},
361381

382+
/**
383+
* Creates a brand new WebGLPipeline instance based on the configuration object that
384+
* was used to create this one.
385+
*
386+
* The new instance is returned by this method. Note that the new instance is _not_
387+
* added to the Pipeline Manager. You will need to add it yourself should you require so.
388+
*
389+
* @method Phaser.Renderer.WebGL.WebGLPipeline#mvpInit
390+
* @since 3.50.0
391+
*
392+
* @param {string} name - The new name to give the cloned pipeline.
393+
*
394+
* @return {Phaser.Renderer.WebGL.WebGLPipeline} A clone of this WebGLPipeline instance.
395+
*/
396+
clone: function (name)
397+
{
398+
var clone = new WebGLPipeline(this.config);
399+
400+
clone.name = name;
401+
402+
return clone;
403+
},
404+
362405
/**
363406
* Sets the currently active shader within this pipeline.
364407
*

0 commit comments

Comments
 (0)