Skip to content

Commit 85f63c4

Browse files
committed
WebGLRenderer.isNewNormalMap is a new method that returns a boolean if the given parameters are not currently used.
1 parent 5db55a8 commit 85f63c4

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

src/renderer/webgl/WebGLRenderer.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ var WebGLRenderer = new Class({
778778

779779
gl.bindTexture(gl.TEXTURE_2D, tempTexture);
780780

781-
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([ 0, 0, 255, 255 ]));
781+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([ 255, 255, 255, 255 ]));
782782

783783
tempTextures[index] = tempTexture;
784784

@@ -1416,6 +1416,22 @@ var WebGLRenderer = new Class({
14161416
return textureSource.glIndex;
14171417
},
14181418

1419+
/**
1420+
* Checks to see if the given diffuse and normal map textures are already bound, or not.
1421+
*
1422+
* @method Phaser.Renderer.WebGL.WebGLRenderer#isNewNormalMap
1423+
* @since 3.25.0
1424+
*
1425+
* @param {WebGLTexture} texture - The WebGL diffuse texture.
1426+
* @param {WebGLTexture} normalMap - The WebGL normal map texture.
1427+
*
1428+
* @return {boolean} Returns `false` if this combination is already set, or `true` if it's a new combination.
1429+
*/
1430+
isNewNormalMap: function (texture, normalMap)
1431+
{
1432+
return (this.textureZero !== texture || this.normalTexture !== normalMap);
1433+
},
1434+
14191435
/**
14201436
* Binds a texture directly to texture unit zero then activates it.
14211437
* If the texture is already at unit zero, it skips the bind.

0 commit comments

Comments
 (0)