When Babylon converts a PNG file URL to any of the supported KTX formats, it strips off any query parameters from the URL. This breaks our attempt to use a version ID to force the browser to load the updated texture. Is there a way to get around this? I haven’t been able to figure it out.
Pinging @bghgary
If it helps, I think this method needs to be slightly updated:
const lastQuestionMark = url.lastIndexOf('?');
const querystring = lastQuestionMark > -1 ? url.substring(lastQuestionMark, url.length) : ''
return (lastDot > -1 ? url.substring(0, lastDot) : url) + this._textureFormatInUse + querystring;
I opened a PR, if that works for you guys…
merged! and thanks!
Unfortunately, I seem to have caused a bug in Babylon. If you look here, you can see that adding any querystring to the url causes Babylon to fail loading the KTX and they all fall back to PNG. I’m not sure why adding a query param to the URL would do this, since the KTX file returns with a 200
.
Let me check
Another example is doing the KTX directly like this:
Is it possibly using the URL as a lookup key somewhere?
I have it. This is when we extract the extension to find the correct loader
With your change the extension is “.ktx?v=foo” so the loader does not catch it
I’ll fix it. Will be live in a couple of hours
You, sir, are a boss!
Playground is fixed!