drei icon indicating copy to clipboard operation
drei copied to clipboard

useTexture support local urls and data urls

Open earonesty opened this issue 1 year ago • 1 comments

If i use a file url:

ERROR  Error: Could not load file:///data/user/0/host.exp.exponent/cache/ExponentAsset-3a1479866a477808fa78b5422265ea6f.jpg: Call to function 'ExponentFileSystem.downloadAsync' has been rejected.

→ Caused by: java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but was 'file')

if i use a data url:

→ Caused by: java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but was 'data')

however, both these urls load fine if i use them in an img tag

also tried this funky thing:

     const data_url = 'data:image/jpeg;base64,' + skybox.data
     const img = <image src={data_url}></image>
     texture = new Texture(img)
     img.onload= () => {
      console.log("loaded")
      texture.needUpdate = true;
     }

and many others... can't get a remote loaded and cached asset to be a texture

tried setting the original, remote, url as well, and made a small one... so it's easy to load https://faerie.s3.us-east-2.amazonaws.com/skyboxes/sky.jpeg

earonesty avatar Jul 28 '23 20:07 earonesty

really need this :((

mmb12345 avatar Mar 25 '24 02:03 mmb12345