Skip to content

Commit 39b381d

Browse files
committed
Clearer responsibility via method parameters
1 parent 0d23aea commit 39b381d

1 file changed

Lines changed: 8 additions & 18 deletions

File tree

src/gameobjects/components/Pipeline.js

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,12 @@ var Pipeline = {
110110
* @since 3.0.0
111111
*
112112
* @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline, or a pipeline instance to set.
113-
* @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} [postPipeline] - The post-render pipeline. Set to `null` to skip if you need to set `pipelineData`. Can be either the string-based name of the pipeline, or a pipeline instance to set.
114113
* @param {object} [pipelineData] - Optional pipeline data object that is _deep copied_ into the `pipelineData` property of this Game Object.
115114
* @param {boolean} [copyData=true] - Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead.
116115
*
117116
* @return {this} This Game Object instance.
118117
*/
119-
setPipeline: function (pipeline, postPipeline, pipelineData, copyData)
118+
setPipeline: function (pipeline, pipelineData, copyData)
120119
{
121120
var renderer = this.scene.sys.renderer;
122121
var pipelines = renderer.pipelines;
@@ -130,16 +129,6 @@ var Pipeline = {
130129
this.pipeline = instance;
131130
}
132131

133-
if (postPipeline)
134-
{
135-
instance = pipelines.get(postPipeline);
136-
137-
if (instance)
138-
{
139-
this.postPipeline = instance;
140-
}
141-
}
142-
143132
if (pipelineData)
144133
{
145134
this.pipelineData = (copyData) ? DeepCopy(pipelineData) : pipelineData;
@@ -165,10 +154,11 @@ var Pipeline = {
165154
*
166155
* @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline, or a pipeline instance to set.
167156
* @param {object} [pipelineData] - Optional pipeline data object that is _deep copied_ into the `pipelineData` property of this Game Object.
157+
* @param {boolean} [copyData=true] - Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead.
168158
*
169159
* @return {this} This Game Object instance.
170160
*/
171-
setPostPipeline: function (pipeline, pipelineData)
161+
setPostPipeline: function (pipeline, pipelineData, copyData)
172162
{
173163
var renderer = this.scene.sys.renderer;
174164
var pipelines = renderer.pipelines;
@@ -180,16 +170,16 @@ var Pipeline = {
180170
if (instance)
181171
{
182172
this.postPipeline = instance;
183-
184-
if (pipelineData)
185-
{
186-
this.pipelineData = DeepCopy(pipelineData);
187-
}
188173
}
189174
else
190175
{
191176
this.postPipeline = null;
192177
}
178+
179+
if (pipelineData)
180+
{
181+
this.pipelineData = (copyData) ? DeepCopy(pipelineData) : pipelineData;
182+
}
193183
}
194184

195185
return this;

0 commit comments

Comments
 (0)