Orillusion / orillusion

Orillusion is a pure Web3D rendering engine which is fully developed based on the WebGPU standard.
https://www.orillusion.com
MIT License
4.47k stars 551 forks source link

[BUG]: The LoaderFunctions.OnUrl doesn't seem to be called #379

Closed sadunkit closed 5 months ago

sadunkit commented 5 months ago

Hi, I loved my experience learning about this engine for the past few days...

But I've been using SvelteKit to bootstrap my games and I have been facing some issues while loading GLTF files. I'm using svelte-kit 4.2.7 with export const ssr = false for the page

        let glb = await Engine3D.res.loadGltf('models/space_station.glb', {
            onUrl: (/** @type {string} */ url) => {
                console.log('hello url')
                console.log(url)
                return '/models/space_station.glb'
            }
        })

The logs never actually get logged and the redirect never happens. Expected behaviour for me was to change the URL before the request was sent.

Also a weird little side issue

when I come to the page from a link from the home page to my engine page /ori, the loadGltf will first send a request to domain.com/ori/models/space_station.glb but after refreshing it will send a request to domain.com/models/space_station.glb (Which happens to be the correct location for SvelteKit šŸ¤£ )

Thanks for all the amazing work you are doing; much love

JingwenBai commented 5 months ago

Thanks for your feedback! May I know first whether or not the GLTF model is loaded normally in your game?

lslzl3000 commented 5 months ago

thanks for the bug report, the onUrl callback will be fixed in next release

sadunkit commented 5 months ago

It does get loaded in the 2nd request after refresh, but not the initial link click + load