gltf-rs / gltf

A crate for loading glTF 2.0
Apache License 2.0
536 stars 124 forks source link

Separate image+base64 vs. import #243

Closed dakom closed 5 years ago

dakom commented 5 years ago

There are two steps to loading images:

  1. Parse the data, and determine if it's a uri, raw bytes, etc.
  2. Load the results of that into a proper image

Step 1 is totally internal to the crate and doesn't have any dependencies. Makes sense that this is behind the "import" feature.

However, step 2 has external dependencies, and in some environments (e.g. the web), loading the data would be done some other way.

Can I request that anything which depends on image_crate be put behind some other feature flag, perhaps "import-image-data" ? (the import_image_data function itself, from import, could be put behind this as well)

bwasty commented 5 years ago

Hmm, it's not just the image crate - base64 is also not required on the web (since the browser can decode data URIs) and should not be included I think.

dakom commented 5 years ago

good point! updated the title to reflect that :)

dakom commented 5 years ago

From trying it out with an external loader that doesn't use the reference, I think they'd travel together - but they should both be excluded

Will make a PR which separates "import" vs. `import_data_reference"