-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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: Lazy dependencies loading #18414
Conversation
4acbb32
to
99e3e03
Compare
Hi, Thanks for making PR. Some thoughts.
|
99e3e03
to
cc24b56
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're already returning the parser with GLTFLoader's response – I think it's fine for this PR to return the same parser sooner. Per discussion in #15508, I agree that parse()
and getDependency()
are probably the only methods that should be considered public. With the API that small, we can always add a wrapper later, although I prefer the concept of public/private methods instead of wrapping classes here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with considering private/public methods or wrapper later in another PR if needed.
dc4951f
to
5ec904d
Compare
Since this change is very small and backwards-compatible could anyone from the participants take another look into it? Thanks :) |
I'm happy with the implementation, but having a hard time deciding what to name it. The "lazy loading" term implies some amount of automatic-ness to me, like it'll be there when it's needed, or it'll load the whole scene graph but stream the textures in gradually. In this case, the user has to manually request every resource they want, when they need it. Other suggestions:
The last seems most explicit, and might be my vote. @takahirox @Mugen87 thoughts? |
I agree with renaming to more explicit one. I have a question before deciding the name. I think the original purpose of returning the I'm considering it may be ok to stop returning the If we stop returning the So, what do you think of these two?
If we don't go with the above two and we go with |
It might be OK not to return Between these two... // (A)
loader
.setParserOnly( true )
.load( url, ( parser ) => {
// ...
}, onProgress, onError );
// (B)
loader.getParser( url, ( parser ) => {
// ...
}, onProgress, onError );
...either one could be fine? I might prefer |
Yeah, probably we don't need to decide now because at least we don't have #18484 yet. We can revisit later if needed. If I forget about stopping to return the BTW, nit. const loader = new GLTFLoader();
loader.setParserOnly(true);
loader.load(url, gltf => {
});
loader.setParserOnly(false); I guess switching |
77e7cd9
to
65fa401
Compare
@donmccurdy and @takahirox is this change ok for you? |
It seems like the code has been lost from this PR. Perhaps a rebase accident? |
It seems that all changes are there. Why do you think something is missing? |
Isn't this PR a duplicate of #18662? |
Yeah, seems like a rebase gone wrong... |
Closing then 👍. |
In this PR I would like to revoke the problem of lazy loading in GLTFLoader. The problem hasn't been solved for a long time. Below I listed a few PRs which addressed it before.
PRs
Milestone
#15477
I made a gentle change for too eagerly resolving dependencies and if the situation is right pass the responsibility to a user. The current approach always downloads the whole scene in
GLTFParser.parse()
which is called inGLTFLoader.load()
. I would like to avoid the call offrom
GLTFParser.parse()