Jelajahi Sumber

update the .ts file

platane 11 tahun lalu
induk
melakukan
d425f04286
1 mengubah file dengan 6 tambahan dan 2 penghapusan
  1. 6 2
      Babylon/Materials/babylon.standardMaterial.ts

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

@@ -42,13 +42,17 @@
         }
 
         public needAlphaBlending(): boolean {
-            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();
         }
 
         public needAlphaTesting(): boolean {
             return this.diffuseTexture != null && this.diffuseTexture.hasAlpha;
         }
 
+        private _shouldUseAlphaFromDiffuseTexture(): boolean {
+            return this.diffuseTexture != null && this.diffuseTexture.hasAlpha && this.useAlphaFromDiffuseTexture;
+        }
+
         // Methods   
         public isReady(mesh?: Mesh): boolean {
             if (this.checkReadyOnlyOnce) {
@@ -139,7 +143,7 @@
                 defines.push("#define ALPHATEST");
             }
 
-            if( this.diffuseTexture != null && this.diffuseTexture.hasAlpha && this.useAlphaFromDiffuseTexture) {
+            if (this._shouldUseAlphaFromDiffuseTexture()) {
                 defines.push("#define ALPHAFROMDIFFUSE");
             }