Added setBlankTexture method

This commit is contained in:
Richard Davey 2018-07-26 15:04:46 +01:00
parent 1cc0e7d5e5
commit d3e07b519a

View file

@ -533,12 +533,16 @@ var WebGLRenderer = new Class({
*/ */
boot: function () boot: function ()
{ {
this.blankTexture = this.game.textures.getFrame('__DEFAULT').glTexture;
for (var pipelineName in this.pipelines) for (var pipelineName in this.pipelines)
{ {
this.pipelines[pipelineName].boot(); this.pipelines[pipelineName].boot();
} }
var blank = this.game.textures.getFrame('__DEFAULT');
this.pipelines.FlatTintPipeline.currentFrame = blank;
this.blankTexture = blank;
}, },
/** /**
@ -988,6 +992,24 @@ var WebGLRenderer = new Class({
return this; return this;
}, },
/**
* Sets the current active texture for texture unit zero to be a blank texture.
* This only happens if there isn't a texture already in use by texture unit zero.
*
* @method Phaser.Renderer.WebGL.WebGLRenderer#setBlankTexture
* @private
* @since 3.12.0
*
* @return {Phaser.Renderer.WebGL.WebGLRenderer} This WebGL Renderer.
*/
setBlankTexture: function ()
{
if (this.currentActiveTextureUnit !== 0 || !this.currentTextures[0])
{
this.setTexture2D(this.blankTexture.glTexture, 0);
}
},
/** /**
* Binds a texture at a texture unit. If a texture is already * Binds a texture at a texture unit. If a texture is already
* bound to that unit it will force a flush on the current pipeline. * bound to that unit it will force a flush on the current pipeline.