I’m developing a react web app. I got a requirement to make needle-engine to dynamiclly load scenes when users drag their own glb or gltf or an asset folder to needle-engine ui element.
I tried to save user’s files into indexDB.For single model it was fine, but for glb with dependencies like images, fonts, needle-engine can only load the glb set in src property but without any images,fonts.Because needle-engine loads the dependencies by a http request to static assets.Then I tried to use onCreateCustomModelLoader to custom the way of loading assets but i failed to write it out.
Then I tried to localhost dist folder in generated project and set src to the asset server. It is fine for the src resource but when needle-engine requests for depencies it still uses the localhost:3000(where i start my vite dev server).In the end, i configured vite server proxy to rewrite the request path to asset server to solve this problem.
If needle-engine supports compacting everything in the scene into one single glb file this will be much easier without considering how to resolve the dependency file loading problem.Or if there is already a config to set? I tried to find it in the docs but i failed.
Fonts and Audiofiles are currently stored externally. Images are packaged inside the glTF unless they’re referenced using an ImageReference field.
When a user drags a model on your UI element wouldnt it be sufficient to capture the Files that are dropped (e.g. a folder which contains glTF files + dependencies) ?
Looking forward to hearing from you. Sorry about the long-winded posts , it says i’m not allowed to upload more than one media per post for i’m new here.