Ver código fonte

Add querystring to texture urls (#8625)

* fix: add persistent querystring for KTX files

* chore: fix linting

* chore: update what's new

Co-authored-by: Alex Bogartz <alex.bogartz@nike.com>
Alex Bogartz 5 anos atrás
pai
commit
83461473b4

+ 1 - 0
dist/preview release/what's new.md

@@ -17,6 +17,7 @@
 
 
 ### General
 ### General
 
 
+- Added support for querystrings on KTX file URLs ([abogartz](https://github.com/abogartz/Babylon.js)
 - Refactored React refs from old string API to React.createRef() API ([belfortk](https://github.com/belfortk))
 - Refactored React refs from old string API to React.createRef() API ([belfortk](https://github.com/belfortk))
 - Scale on one axis for `BoundingBoxGizmo` ([cedricguillemet](https://github.com/cedricguillemet))
 - Scale on one axis for `BoundingBoxGizmo` ([cedricguillemet](https://github.com/cedricguillemet))
 - Node support (Transform, Bone) for gizmos ([cedricguillemet](https://github.com/cedricguillemet))
 - Node support (Transform, Bone) for gizmos ([cedricguillemet](https://github.com/cedricguillemet))

+ 3 - 1
src/Engines/Extensions/engine.textureSelector.ts

@@ -62,7 +62,9 @@ function transformTextureUrl(this: Engine, url: string): string {
     }
     }
 
 
     const lastDot = url.lastIndexOf('.');
     const lastDot = url.lastIndexOf('.');
-    return (lastDot > -1 ? url.substring(0, lastDot) : url) + this._textureFormatInUse;
+    const lastQuestionMark = url.lastIndexOf('?');
+    const querystring = lastQuestionMark > -1 ? url.substring(lastQuestionMark, url.length) : '';
+    return (lastDot > -1 ? url.substring(0, lastDot) : url) + this._textureFormatInUse + querystring;
 }
 }
 
 
 Object.defineProperty(Engine.prototype, "texturesSupported", {
 Object.defineProperty(Engine.prototype, "texturesSupported", {