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

Allow authors to set the media type of a model #9

Open
keithclark opened this issue Mar 23, 2018 · 0 comments
Open

Allow authors to set the media type of a model #9

keithclark opened this issue Mar 23, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@keithclark
Copy link
Owner

keithclark commented Mar 23, 2018

The model element uses the file extension of the src URL to determine which loader to use. While this is fine when serving content from a filesystem, it's doesn't work with content dynamically created on demand using languages like PHP.

My initial solution to this problem is to follow the pattern of the <object> tag and add an optional type attribute to the element. This would allow authors to explicitly set the content type of the data by specifying its registered MIME type. Something like this:

<x-model src="createmodel.php?file=duck" type="model/gltf-binary">

Ideally, the model element would also be able to determine object format from the HTTP response Content-Type header, but this is handled by THREE so that would need to be addressed externally.

While this approach will work for models such as gLTF, which has a registered MIME type, it doesn't help with formats like OBJ, which don't have a registered MIME type.

For reference - here are the MIME types for the formats supported so far:

@keithclark keithclark added the enhancement New feature or request label Mar 23, 2018
@keithclark keithclark changed the title Allow authors to set the media type of an object Allow authors to set the media type of a model Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant