Procházet zdrojové kódy

Fix Text2D font release using bilinear

nockawa před 8 roky
rodič
revize
6a4631f6a5

+ 5 - 2
canvas2D/src/Engine/babylon.text2d.ts

@@ -338,7 +338,8 @@
                 return null;
             }
 
-            this._fontTexture = FontTexture.GetCachedFontTexture(this.owner.scene, this.fontName, this._fontSuperSample, this._fontSDF, (this._useBilinearFiltering === null) ? (this.owner instanceof WorldSpaceCanvas2D) : this._useBilinearFiltering);
+            this._fontBilinearFiltering = (this._useBilinearFiltering === null) ? (this.owner instanceof WorldSpaceCanvas2D) : this._useBilinearFiltering;
+            this._fontTexture = FontTexture.GetCachedFontTexture(this.owner.scene, this.fontName, this._fontSuperSample, this._fontSDF, this._fontBilinearFiltering);
             this._textureIsPremulAlpha = this._fontTexture.isPremultipliedAlpha;
             return this._fontTexture;
         }
@@ -352,7 +353,7 @@
             }
 
             if (this._fontTexture) {
-                FontTexture.ReleaseCachedFontTexture(this.owner.scene, this.fontName, this._fontSuperSample, this._fontSDF, this._fontTexture._samplingMode === Texture.BILINEAR_SAMPLINGMODE);
+                FontTexture.ReleaseCachedFontTexture(this.owner.scene, this.fontName, this._fontSuperSample, this._fontSDF, this._fontBilinearFiltering);
                 this._fontTexture = null;
             }
 
@@ -519,6 +520,7 @@
             }
 
             this._useBilinearFiltering = (settings.useBilinearFiltering != null) ? settings.useBilinearFiltering : null;
+            this._fontBilinearFiltering = false;
 
             // Text rendering must always be aligned to the target's pixel to ensure a good quality
             this.alignToPixel = true;
@@ -915,6 +917,7 @@
         private _sizeSetByUser: boolean;
         private _textureIsPremulAlpha: boolean;
         private _useBilinearFiltering: boolean;
+        private _fontBilinearFiltering: boolean;
 
         public textAlignmentH: number;
         public textAlignmentV: number;

+ 1 - 0
dist/preview release/canvas2D/babylon.canvas2d.d.ts

@@ -4016,6 +4016,7 @@ declare module BABYLON {
         private _sizeSetByUser;
         private _textureIsPremulAlpha;
         private _useBilinearFiltering;
+        private _fontBilinearFiltering;
         textAlignmentH: number;
         textAlignmentV: number;
     }

+ 4 - 2
dist/preview release/canvas2D/babylon.canvas2d.js

@@ -14568,6 +14568,7 @@ var BABYLON;
                 _this.size = null;
             }
             _this._useBilinearFiltering = (settings.useBilinearFiltering != null) ? settings.useBilinearFiltering : null;
+            _this._fontBilinearFiltering = false;
             // Text rendering must always be aligned to the target's pixel to ensure a good quality
             _this.alignToPixel = true;
             _this.textAlignmentH = (settings.textAlignmentH == null) ? Text2D_1.AlignLeft : settings.textAlignmentH;
@@ -14764,7 +14765,8 @@ var BABYLON;
                 if (this.fontName == null || this.owner == null || this.owner.scene == null) {
                     return null;
                 }
-                this._fontTexture = BABYLON.FontTexture.GetCachedFontTexture(this.owner.scene, this.fontName, this._fontSuperSample, this._fontSDF, (this._useBilinearFiltering === null) ? (this.owner instanceof BABYLON.WorldSpaceCanvas2D) : this._useBilinearFiltering);
+                this._fontBilinearFiltering = (this._useBilinearFiltering === null) ? (this.owner instanceof BABYLON.WorldSpaceCanvas2D) : this._useBilinearFiltering;
+                this._fontTexture = BABYLON.FontTexture.GetCachedFontTexture(this.owner.scene, this.fontName, this._fontSuperSample, this._fontSDF, this._fontBilinearFiltering);
                 this._textureIsPremulAlpha = this._fontTexture.isPremultipliedAlpha;
                 return this._fontTexture;
             },
@@ -14779,7 +14781,7 @@ var BABYLON;
                 return false;
             }
             if (this._fontTexture) {
-                BABYLON.FontTexture.ReleaseCachedFontTexture(this.owner.scene, this.fontName, this._fontSuperSample, this._fontSDF, this._fontTexture._samplingMode === BABYLON.Texture.BILINEAR_SAMPLINGMODE);
+                BABYLON.FontTexture.ReleaseCachedFontTexture(this.owner.scene, this.fontName, this._fontSuperSample, this._fontSDF, this._fontBilinearFiltering);
                 this._fontTexture = null;
             }
             return true;

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 4 - 4
dist/preview release/canvas2D/babylon.canvas2d.min.js