WebGLRenderer.isNewNormalMap is a new method that returns a boolean if the given parameters are not currently used.

This commit is contained in:
Richard Davey 2020-07-16 15:11:43 +01:00
parent 5db55a85d7
commit 85f63c4a19

View file

@ -778,7 +778,7 @@ var WebGLRenderer = new Class({
gl.bindTexture(gl.TEXTURE_2D, tempTexture);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([ 0, 0, 255, 255 ]));
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([ 255, 255, 255, 255 ]));
tempTextures[index] = tempTexture;
@ -1416,6 +1416,22 @@ var WebGLRenderer = new Class({
return textureSource.glIndex;
},
/**
* Checks to see if the given diffuse and normal map textures are already bound, or not.
*
* @method Phaser.Renderer.WebGL.WebGLRenderer#isNewNormalMap
* @since 3.25.0
*
* @param {WebGLTexture} texture - The WebGL diffuse texture.
* @param {WebGLTexture} normalMap - The WebGL normal map texture.
*
* @return {boolean} Returns `false` if this combination is already set, or `true` if it's a new combination.
*/
isNewNormalMap: function (texture, normalMap)
{
return (this.textureZero !== texture || this.normalTexture !== normalMap);
},
/**
* Binds a texture directly to texture unit zero then activates it.
* If the texture is already at unit zero, it skips the bind.