hack(viewer): allow for loading assets load with data urls (data:img/png...)
This commit is contained in:
@@ -80,10 +80,20 @@ export class Assets {
|
||||
} else {
|
||||
srcUrl = asset as string
|
||||
}
|
||||
|
||||
if (this._cache[srcUrl]) {
|
||||
return Promise.resolve(this._cache[srcUrl])
|
||||
}
|
||||
|
||||
// Hack to load 'data:image's - for some reason, the frontend receives the default
|
||||
// gradient map as a data image url, rather than a file (?).
|
||||
if (srcUrl.includes('data:image')) {
|
||||
const texture = new Texture(srcUrl as unknown as HTMLImageElement)
|
||||
texture.needsUpdate = true
|
||||
this._cache[srcUrl] = texture
|
||||
return Promise.resolve(texture)
|
||||
}
|
||||
|
||||
return new Promise<Texture>((resolve, reject) => {
|
||||
const loader = Assets.getLoader(srcUrl, assetType)
|
||||
if (loader) {
|
||||
|
||||
Reference in New Issue
Block a user