-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
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
GLTFLoader: exposing GLTFParser class and Constants #15477
Comments
One option available now is the We've also discussed (#14492) adding a Between the two, I think that would cover everything you suggest except the constants? Exposing the constants could be OK, and has been suggested before (#11978). Another option would be to put these constants on NPM separately, similar to DefinitelyTyped/DefinitelyTyped#29801. |
Thanks for your suggestions and comments. I didn't know that the loader can call What I wanted to do is inject some function in But using Anyway looking forward to Regarding the constants, I think ideally it should be in one place, rather than in both GLTFLoader.js and NPM, but it still sounds good! |
Wouldn't be opposed to move The module version of the file could eventually export |
Rather than another top-level object, maybe just
The idea here would be that there should be official glTF constants on NPM (e.g. maintained by Khronos, not just for three.js), so users can install them in the rare case that they need custom parsing. But threejs examples cannot have dependencies, so the constants will have to be duplicated for GLTFLoader. |
^Feel free to open a PR for moving the parser and constants out of the closure if this is still helpful. I would wait on other PRs for the rest. |
Just curious to know what "glTF-ish file" means by. |
Voting for non top-level object. I think putting under |
@takahirox
I meant VRM and maybe eVRM (can be seen in ニコニ立体), or othrer Web App oriented models. |
Making |
@yomotsu My understanding is VRM consists of glTF 2.0 core spec with some limitation + VRM custom extension. And |
That's right. VRM is a glTF based extended format, and the Parser may need to handle HumanBones, Facial expression blendings, MToon Materials, and others. In addition, some Web App like ニコニ立体 may use encrypted VRM like "eVRM" in order to protect user upload models, and injecting user-land function to the parser may be needed as well. |
To be clear, we can't guarantee that the parser's API will remain the same over time. Internal methods might be renamed or removed, and extending them may be fragile. If you're really customizing the loader for new formats and extensions, it's very possible you'll want to just fork the loader. But if you're OK with all that, a PR is still fine with me. |
Thanks for your suggestions. I understand and @takahirox Would it be okay? |
I wanna suggest that we first go with |
Okay, I will wait for it 👍 |
Do we still need this, with access to the |
It would be better for me. |
Yes, exposed parser and the plugin system is working well. |
The plugin system provides the extensibility of the loader. How do you want to use the exposed parser class? In other words, What are the use cases the plugin system still doesn't cover? |
If I understand @fms-cat correctly, he's saying that this issue can be closed. |
I mean, the constructor of GLTFParser is okay to not be exposed I think. my bad. |
OK, thanks for clarifying. Then, let's close this issue for now. And let's reopen or create a new one if you folks encounter a use case the plugin system doesn't cover. |
Currently, GLTFParser and constants in GLTFLoader are scoped and cannot be used in user-land.
However, sometimes it is needed.
Usecases:
Also,
WEBGL_CONSTANTS
and other constants would be useful if available underTHREE
or somewhereWhat I would like to have is:
THREE.GLTFParser
and maybe:
gltfLoaderInstance.gltfParser
THREE.WEBGL_CONSTANTS.FLOAT = 5126
and so onThe text was updated successfully, but these errors were encountered: