Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve MIME type for unknown extensions during import #18

Closed
emackey opened this issue May 18, 2022 · 5 comments
Closed

Preserve MIME type for unknown extensions during import #18

emackey opened this issue May 18, 2022 · 5 comments

Comments

@emackey
Copy link
Contributor

emackey commented May 18, 2022

Hi @najadojo, hope you're doing well! Here's a suggestion from @rawnsley and Mozilla Hubs.

During GLB to GLTF conversion, it might be good to preserve the mimeType field, at least for types that are unknown to the guessFileExtension function. This would enable RGBE environment maps that Hubs has an extension for. Even if these files got a .bin extension, they would have a MIME type applied.

via AnalyticalGraphicsInc/gltf-vscode#243

@najadojo
Copy link
Owner

@rawnsley do you have a sample file I could use to test this out? If not I can hack something up quickly enough.

@rawnsley
Copy link

Thanks for looking into this @najadojo. This GLB file is a complete Hubs scene file with a mix of extensions as described in the original issue. You can see the scene itself live here: https://hubs.mozilla.com/scenes/HQLCKaM/gltf-test-scene

najadojo pushed a commit that referenced this issue May 18, 2022
@najadojo
Copy link
Owner

@rawnsley and @emackey I've merged a change and published the npm package that addresses this. Here is a section of the sample gltf after conversion:

{
  "images": [
    {
      "name": "skybox",
      "uri": "hubs-scene-sample-dw0.1.0_img0.png"
    },
    {
      "name": "envmap-category",
      "mimeType": "image/vnd.radiance",
      "uri": "hubs-scene-sample-dw0.1.0_img1.bin"
    },
    {
      "name": "lightmap",
      "mimeType": "image/vnd.radiance",
      "uri": "hubs-scene-sample-dw0.1.0_img2.bin"
    },
    {
      "name": "WoodFloor040_4K_Color",
      "uri": "hubs-scene-sample-dw0.1.0_img3.ktx2"
    }
  ],
  "buffers": [
    {
      "uri": "hubs-scene-sample-dw0.1.0_data.bin",
      "byteLength": 33384
    }
  ]
}

@emackey
Copy link
Contributor Author

emackey commented May 18, 2022

Wow that was fast, thanks!

@rawnsley
Copy link

🤯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants