@@ -135,122 +135,29 @@ var ForwardDiffuseLightPipeline = new Class({
135135 } ,
136136
137137 /**
138- * [description]
139- *
140- * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#drawStaticTilemapLayer
141- * @override
142- * @since 3.0.0
143- *
144- * @param {Phaser.Tilemaps.StaticTilemapLayer } tilemap - [description]
145- * @param {Phaser.Cameras.Scene2D.Camera } camera - [description]
146- * @param {Phaser.GameObjects.Components.TransformMatrix } parentTransformMatrix - [description]
147- */
148- drawStaticTilemapLayer : function ( tilemap , camera , parentTransformMatrix )
149- {
150- if ( ! this . active )
151- {
152- return ;
153- }
154-
155- var normalTexture = tilemap . tileset . image . dataSource [ 0 ] ;
156-
157- if ( normalTexture )
158- {
159- this . renderer . setPipeline ( this ) ;
160- this . setTexture2D ( normalTexture . glTexture , 1 ) ;
161- TextureTintPipeline . prototype . drawStaticTilemapLayer . call ( this , tilemap , camera , parentTransformMatrix ) ;
162- }
163- else
164- {
165- console . warn ( 'Normal map texture missing for using Light2D pipeline. StaticTilemapLayer rendered with default pipeline.' ) ;
166- this . renderer . pipelines . TextureTintPipeline . drawStaticTilemapLayer ( tilemap , camera , parentTransformMatrix ) ;
167- }
168- } ,
169-
170- /**
171- * [description]
172- *
173- * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#drawEmitterManager
174- * @since 3.0.0
138+ * Sets the Game Objects normal map as the active texture.
175139 *
176- * @param {Phaser.GameObjects.Particles.ParticleEmitterManager } emitterManager - [description]
177- * @param {Phaser.Cameras.Scene2D.Camera } camera - [description]
178- * @param {Phaser.GameObjects.Components.TransformMatrix } parentTransformMatrix - [description]
179- *
180- */
181- drawEmitterManager : function ( emitterManager , camera , parentTransformMatrix )
182- {
183- if ( ! this . active )
184- {
185- return ;
186- }
187-
188- var normalTexture = emitterManager . texture . dataSource [ emitterManager . frame . sourceIndex ] ;
189-
190- if ( normalTexture )
191- {
192- this . renderer . setPipeline ( this ) ;
193- this . setTexture2D ( normalTexture . glTexture , 1 ) ;
194- TextureTintPipeline . prototype . drawEmitterManager . call ( this , emitterManager , camera , parentTransformMatrix ) ;
195- }
196- else
197- {
198- console . warn ( 'Normal map texture missing for using Light2D pipeline. EmitterManager rendered with default pipeline.' ) ;
199- this . renderer . pipelines . TextureTintPipeline . drawEmitterManager ( emitterManager , camera , parentTransformMatrix ) ;
200- }
201- } ,
202-
203- /**
204- * [description]
205- *
206- * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#drawBlitter
207- * @since 3.0.0
208- *
209- * @param {Phaser.GameObjects.Blitter } blitter - [description]
210- * @param {Phaser.Cameras.Scene2D.Camera } camera - [description]
211- * @param {Phaser.GameObjects.Components.TransformMatrix } parentTransformMatrix - [description]
140+ * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#setNormalMap
141+ * @since 3.11.0
212142 *
143+ * @param {Phaser.GameObjects.GameObject } gameObject - [description]
213144 */
214- drawBlitter : function ( blitter , camera , parentTransformMatrix )
215- {
216- if ( ! this . active )
217- {
218- return ;
219- }
220-
221- var normalTexture = blitter . texture . dataSource [ blitter . frame . sourceIndex ] ;
222-
223- if ( normalTexture )
224- {
225- this . renderer . setPipeline ( this ) ;
226- this . setTexture2D ( normalTexture . glTexture , 1 ) ;
227- TextureTintPipeline . prototype . drawBlitter . call ( this , blitter , camera , parentTransformMatrix ) ;
228- }
229- else
230- {
231- console . warn ( 'Normal map texture missing for using Light2D pipeline. Blitter rendered with default pipeline.' ) ;
232- this . renderer . pipelines . TextureTintPipeline . drawBlitter ( blitter , camera , parentTransformMatrix ) ;
233- }
234- } ,
235-
236145 setNormalMap : function ( gameObject )
237146 {
238147 if ( ! this . active || ! gameObject || ! gameObject . texture )
239148 {
240149 return ;
241150 }
242151
152+ // var normalTexture = tilemapLayer.tileset.image.dataSource[0];
243153 var normalTexture = gameObject . texture . dataSource [ gameObject . frame . sourceIndex ] ;
244154
245155 if ( normalTexture )
246156 {
247- // Should already be set!
248- // this.renderer.setPipeline(this);
249-
250157 this . setTexture2D ( normalTexture . glTexture , 1 ) ;
251-
252- this . renderer . setPipeline ( gameObject . defaultPipeline ) ;
253158 }
159+
160+ this . renderer . setPipeline ( gameObject . defaultPipeline ) ;
254161 } ,
255162
256163 /**
@@ -263,6 +170,7 @@ var ForwardDiffuseLightPipeline = new Class({
263170 * @param {Phaser.Cameras.Scene2D.Camera } camera - [description]
264171 * @param {Phaser.GameObjects.Components.TransformMatrix } parentTransformMatrix - [description]
265172 *
173+ */
266174 batchSprite : function ( sprite , camera , parentTransformMatrix )
267175 {
268176 if ( ! this . active )
@@ -275,208 +183,10 @@ var ForwardDiffuseLightPipeline = new Class({
275183 if ( normalTexture )
276184 {
277185 this . renderer . setPipeline ( this ) ;
278- this.setTexture2D(normalTexture.glTexture, 1);
279- TextureTintPipeline.prototype.batchSprite.call(this, sprite, camera, parentTransformMatrix);
280- }
281- else
282- {
283- console.warn('Normal map texture missing for using Light2D pipeline. Sprite rendered with default pipeline.');
284- this.renderer.pipelines.TextureTintPipeline.batchSprite(sprite, camera, parentTransformMatrix);
285- }
286- },
287- */
288-
289- /**
290- * [description]
291- *
292- * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#batchMesh
293- * @since 3.0.0
294- *
295- * @param {Phaser.GameObjects.Mesh } mesh - [description]
296- * @param {Phaser.Cameras.Scene2D.Camera } camera - [description]
297- * @param {Phaser.GameObjects.Components.TransformMatrix } parentTransformMatrix - [description]
298- *
299- */
300- batchMesh : function ( mesh , camera , parentTransformMatrix )
301- {
302- if ( ! this . active )
303- {
304- return ;
305- }
306-
307- var normalTexture = mesh . texture . dataSource [ mesh . frame . sourceIndex ] ;
308-
309- if ( normalTexture )
310- {
311- this . renderer . setPipeline ( this ) ;
312- this . setTexture2D ( normalTexture . glTexture , 1 ) ;
313- TextureTintPipeline . prototype . batchMesh . call ( this , mesh , camera , parentTransformMatrix ) ;
314- }
315- else
316- {
317- console . warn ( 'Normal map texture missing for using Light2D pipeline. Mesh rendered with default pipeline.' ) ;
318- this . renderer . pipelines . TextureTintPipeline . batchMesh ( mesh , camera , parentTransformMatrix ) ;
319-
320- }
321- } ,
322-
323- /**
324- * [description]
325- *
326- * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#batchBitmapText
327- * @since 3.0.0
328- *
329- * @param {Phaser.GameObjects.BitmapText } bitmapText - [description]
330- * @param {Phaser.Cameras.Scene2D.Camera } camera - [description]
331- * @param {Phaser.GameObjects.Components.TransformMatrix } parentTransformMatrix - [description]
332- *
333- */
334- batchBitmapText : function ( bitmapText , camera , parentTransformMatrix )
335- {
336- if ( ! this . active )
337- {
338- return ;
339- }
340-
341- var normalTexture = bitmapText . texture . dataSource [ bitmapText . frame . sourceIndex ] ;
342-
343- if ( normalTexture )
344- {
345- this . renderer . setPipeline ( this ) ;
346- this . setTexture2D ( normalTexture . glTexture , 1 ) ;
347- TextureTintPipeline . prototype . batchBitmapText . call ( this , bitmapText , camera , parentTransformMatrix ) ;
348- }
349- else
350- {
351- console . warn ( 'Normal map texture missing for using Light2D pipeline. BitmapText rendered with default pipeline.' ) ;
352- this . renderer . pipelines . TextureTintPipeline . batchBitmapText ( bitmapText , camera , parentTransformMatrix ) ;
353- }
354- } ,
355-
356- /**
357- * [description]
358- *
359- * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#batchDynamicBitmapText
360- * @since 3.0.0
361- *
362- * @param {Phaser.GameObjects.DynamicBitmapText } bitmapText - [description]
363- * @param {Phaser.Cameras.Scene2D.Camera } camera - [description]
364- * @param {Phaser.GameObjects.Components.TransformMatrix } parentTransformMatrix - [description]
365- *
366- */
367- batchDynamicBitmapText : function ( bitmapText , camera , parentTransformMatrix )
368- {
369- var normalTexture = bitmapText . texture . dataSource [ bitmapText . frame . sourceIndex ] ;
370-
371- if ( normalTexture )
372- {
373- this . renderer . setPipeline ( this ) ;
374- this . setTexture2D ( normalTexture . glTexture , 1 ) ;
375- TextureTintPipeline . prototype . batchDynamicBitmapText . call ( this , bitmapText , camera , parentTransformMatrix ) ;
376- }
377- else
378- {
379- console . warn ( 'Normal map texture missing for using Light2D pipeline. DynamicBitmapText rendered with default pipeline.' ) ;
380- this . renderer . pipelines . TextureTintPipeline . batchDynamicBitmapText ( bitmapText , camera , parentTransformMatrix ) ;
381- }
382- } ,
383-
384- /**
385- * [description]
386- *
387- * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#batchText
388- * @since 3.0.0
389- *
390- * @param {Phaser.GameObjects.Text } text - [description]
391- * @param {Phaser.Cameras.Scene2D.Camera } camera - [description]
392- * @param {Phaser.GameObjects.Components.TransformMatrix } parentTransformMatrix - [description]
393- *
394- */
395- batchText : function ( text , camera , parentTransformMatrix )
396- {
397- if ( ! this . active )
398- {
399- return ;
400- }
401-
402- var normalTexture = text . texture . dataSource [ text . frame . sourceIndex ] ;
403-
404- if ( normalTexture )
405- {
406- this . renderer . setPipeline ( this ) ;
407- this . setTexture2D ( normalTexture . glTexture , 1 ) ;
408- TextureTintPipeline . prototype . batchText . call ( this , text , camera , parentTransformMatrix ) ;
409- }
410- else
411- {
412- console . warn ( 'Normal map texture missing for using Light2D pipeline. Text rendered with default pipeline.' ) ;
413- this . renderer . pipelines . TextureTintPipeline . batchText ( text , camera , parentTransformMatrix ) ;
414- }
415- } ,
416-
417- /**
418- * [description]
419- *
420- * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#batchDynamicTilemapLayer
421- * @since 3.0.0
422- *
423- * @param {Phaser.Tilemaps.DynamicTilemapLayer } tilemapLayer - [description]
424- * @param {Phaser.Cameras.Scene2D.Camera } camera - [description]
425- * @param {Phaser.GameObjects.Components.TransformMatrix } parentTransformMatrix - [description]
426- *
427- */
428- batchDynamicTilemapLayer : function ( tilemapLayer , camera , parentTransformMatrix )
429- {
430- if ( ! this . active )
431- {
432- return ;
433- }
434186
435- var normalTexture = tilemapLayer . tileset . image . dataSource [ 0 ] ;
436-
437- if ( normalTexture )
438- {
439- this . renderer . setPipeline ( this ) ;
440187 this . setTexture2D ( normalTexture . glTexture , 1 ) ;
441- TextureTintPipeline . prototype . batchDynamicTilemapLayer . call ( this , tilemapLayer , camera , parentTransformMatrix ) ;
442- }
443- else
444- {
445- console . warn ( 'Normal map texture missing for using Light2D pipeline. DynamicTilemapLayer rendered with default pipeline.' ) ;
446- this . renderer . pipelines . TextureTintPipeline . batchDynamicTilemapLayer ( tilemapLayer , camera , parentTransformMatrix ) ;
447- }
448- } ,
449-
450- /**
451- * [description]
452- *
453- * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#batchTileSprite
454- * @since 3.0.0
455- *
456- * @param {Phaser.GameObjects.TileSprite } tileSprite - [description]
457- * @param {Phaser.Cameras.Scene2D.Camera } camera - [description]
458- * @param {Phaser.GameObjects.Components.TransformMatrix } parentTransformMatrix - [description]
459- *
460- */
461- batchTileSprite : function ( tileSprite , camera , parentTransformMatrix )
462- {
463- if ( ! this . active )
464- {
465- return ;
466- }
467-
468- var normalTexture = tileSprite . texture . dataSource [ tileSprite . frame . sourceIndex ] ;
469188
470- if ( normalTexture )
471- {
472- this . renderer . setPipeline ( this ) ;
473- this . setTexture2D ( normalTexture . glTexture , 1 ) ;
474- TextureTintPipeline . prototype . batchTileSprite . call ( this , tileSprite , camera , parentTransformMatrix ) ;
475- }
476- else
477- {
478- console . warn ( 'Normal map texture missing for using Light2D pipeline. TileSprite rendered with default pipeline.' ) ;
479- this . renderer . pipelines . TextureTintPipeline . batchTileSprite ( tileSprite , camera , parentTransformMatrix ) ;
189+ TextureTintPipeline . prototype . batchSprite . call ( this , sprite , camera , parentTransformMatrix ) ;
480190 }
481191 }
482192
0 commit comments