David Catuhe 6 jaren geleden
bovenliggende
commit
3ffdb9a7b7
2 gewijzigde bestanden met toevoegingen van 9 en 7 verwijderingen
  1. 7 5
      src/Materials/Textures/baseTexture.ts
  2. 2 2
      src/Materials/Textures/texture.ts

+ 7 - 5
src/Materials/Textures/baseTexture.ts

@@ -497,7 +497,7 @@ export class BaseTexture implements IAnimatable {
     }
 
     /** @hidden */
-    public _getFromCache(url: Nullable<string>, noMipmap: boolean, sampling?: number): Nullable<InternalTexture> {
+    public _getFromCache(url: Nullable<string>, noMipmap: boolean, sampling?: number, invertY?: boolean): Nullable<InternalTexture> {
         if (!this._scene) {
             return null;
         }
@@ -506,10 +506,12 @@ export class BaseTexture implements IAnimatable {
         for (var index = 0; index < texturesCache.length; index++) {
             var texturesCacheEntry = texturesCache[index];
 
-            if (texturesCacheEntry.url === url && texturesCacheEntry.generateMipMaps === !noMipmap) {
-                if (!sampling || sampling === texturesCacheEntry.samplingMode) {
-                    texturesCacheEntry.incrementReferences();
-                    return texturesCacheEntry;
+            if (invertY === undefined || invertY === texturesCacheEntry.invertY) {
+                if (texturesCacheEntry.url === url && texturesCacheEntry.generateMipMaps === !noMipmap) {
+                    if (!sampling || sampling === texturesCacheEntry.samplingMode) {
+                        texturesCacheEntry.incrementReferences();
+                        return texturesCacheEntry;
+                    }
                 }
             }
         }

+ 2 - 2
src/Materials/Textures/texture.ts

@@ -303,7 +303,7 @@ export class Texture extends BaseTexture {
             return;
         }
 
-        this._texture = this._getFromCache(this.url, noMipmap, samplingMode);
+        this._texture = this._getFromCache(this.url, noMipmap, samplingMode, invertY);
 
         if (!this._texture) {
             if (!scene.useDelayedTextureLoading) {
@@ -364,7 +364,7 @@ export class Texture extends BaseTexture {
         }
 
         this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;
-        this._texture = this._getFromCache(this.url, this._noMipmap, this.samplingMode);
+        this._texture = this._getFromCache(this.url, this._noMipmap, this.samplingMode, this._invertY);
 
         if (!this._texture) {
             this._texture = scene.getEngine().createTexture(this.url, this._noMipmap, this._invertY, scene, this.samplingMode, this._delayedOnLoad, this._delayedOnError, this._buffer, null, this._format);