File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -235,6 +235,16 @@ var WebGLPipeline = new Class({
235235 * @since 3.10.0
236236 */
237237 this . active = false ;
238+
239+ /**
240+ * Holds the most recently assigned texture unit.
241+ * Treat this value as read-only.
242+ *
243+ * @name Phaser.Renderer.WebGL.Pipelines.WebGLPipeline#currentUnit
244+ * @type {number }
245+ * @since 3.25.0
246+ */
247+ this . currentUnit = 0 ;
238248 } ,
239249
240250 /**
@@ -279,6 +289,27 @@ var WebGLPipeline = new Class({
279289 return this ;
280290 } ,
281291
292+ /**
293+ * Custom pipelines can use this method in order to perform any required pre-batch tasks
294+ * for the given Game Object. It must return the texture unit the Game Object was assigned.
295+ *
296+ * @method Phaser.Renderer.WebGL.Pipelines.WebGLPipeline#setGameObject
297+ * @since 3.25.0
298+ *
299+ * @param {Phaser.GameObjects.GameObject } gameObject - The Game Object being rendered or added to the batch.
300+ * @param {Phaser.Textures.Frame } [frame] - Optional frame to use. Can override that of the Game Object.
301+ *
302+ * @return {number } The texture unit the Game Object has been assigned.
303+ */
304+ setGameObject : function ( gameObject , frame )
305+ {
306+ if ( frame === undefined ) { frame = gameObject . frame ; }
307+
308+ this . currentUnit = this . renderer . setTextureSource ( frame . source ) ;
309+
310+ return this . currentUnit ;
311+ } ,
312+
282313 /**
283314 * Adds a description of vertex attribute to the pipeline
284315 *
You can’t perform that action at this time.
0 commit comments