Loading local images as texture

@sebavan
Sadly, Mixing protocols is considered different origins since chrome 76. For ex, if you right click a html file and copy the url path and then paste it into a browser, some browser apis stop working. Fetch for sure, i think dynamic import and worker modules too, among others.

@Simon_Weck
Are you loading babylon from a cdn? Mixing http/https with (implicit) file protocol loading is probably a no go.

You can definitely make this work though. Babylon accepts objects not just string urls so you can get a reference to it whatever way you find easiest. If all else fails, you can manually inline the assets as string base64 data uris. Ive been meaning to test some things in electron related to using file protocols, maybe i will work on that later and report back. (I have been using electron’s loadFile api to develop for years)

Notes for future me:
.Local caching using IndexedDB
. Using rel="preload" with SceneLoader

1 Like