Просмотр исходного кода

avoid redondancy with the private method _shouldUseAlphaFromDiffuseTexture

platane 11 лет назад
Родитель
Сommit
d54088f41a
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      Babylon/Materials/babylon.standardMaterial.js

+ 6 - 2
Babylon/Materials/babylon.standardMaterial.js

@@ -39,13 +39,17 @@ var BABYLON;
             };
         }
         StandardMaterial.prototype.needAlphaBlending = function () {
-            return (this.alpha < 1.0) || (this.opacityTexture != null) || (this.diffuseTexture != null && this.diffuseTexture.hasAlpha && this.useAlphaFromDiffuseTexture);
+            return (this.alpha < 1.0) || (this.opacityTexture != null) || this._shouldUseAlphaFromDiffuseTexture();
         };
 
         StandardMaterial.prototype.needAlphaTesting = function () {
             return this.diffuseTexture != null && this.diffuseTexture.hasAlpha;
         };
 
+        StandardMaterial.prototype._shouldUseAlphaFromDiffuseTexture = function(){
+            return this.diffuseTexture != null && this.diffuseTexture.hasAlpha && this.useAlphaFromDiffuseTexture;
+        };
+
         // Methods
         StandardMaterial.prototype.isReady = function (mesh) {
             if (this.checkReadyOnlyOnce) {
@@ -136,7 +140,7 @@ var BABYLON;
                 defines.push("#define ALPHATEST");
             }
 
-            if( this.diffuseTexture != null && this.diffuseTexture.hasAlpha && this.useAlphaFromDiffuseTexture) {
+            if(this._shouldUseAlphaFromDiffuseTexture()) {
                 defines.push("#define ALPHAFROMDIFFUSE");
             }