-
-
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
Report progress in loader .parse() #10731
Comments
Why do you need something like that? |
How do you avoid huge parse time with 10-100mb models? |
Parsing is usually done in the main thread and a sequential process. While parsing, everything else in your application is blocked. Even UI updates are not possible. One approach to avoid this problem is to encapsulate your parsing logic into a separate thread (Web Worker) and report the results via messaging into your main thread. See: https://www.html5rocks.com/en/tutorials/workers/basics/ |
Looks good 😉 |
Stay away from JSON, OBJ, DAE and other text formats. |
what would you need progress event for if you cant actually display the progress? unless you use the worker, as suggested above, your UI is locked until parse method is done |
|
@mrdoob you could use replacer argument, I guess |
Every time we try to put hacks in the hack bites us in the butt... |
Description of the problem
TL;DR:
Does it make sense to have
onProgress
reporting during a Loader's.parse()
method?Keep reading...
Recently I switched from using
ObjectLoader.load()
toObjectLoader.parse()
. The reasons for switching are that I really had no need for actually loading a file, I can just parse the information just the same. I gain one less dependency on XHR, on the other hand however, I loose onProgress information while things are being parsed.Loaders work well to report
onProgress
information in theload()
method. I'd be interested to hear if anyone would find it useful to also include a similaronProgress
on the.parse()
method. I understand the mechanism to report the progress is different,.load()
usesXHR
total vs loaded bytes, whereas in.parse()
, there is no mechanism in place to understand the bytes parsed vs total. There could be, however, an understanding of total things to parse. I'm mainly thinking of theObjectLoader
where there isparseGeometries
,parseTextures
, etc.Loading Manager works to a certain extent to describe if 'files' are being loaded, and in my case, I do have base64 encoded images in the JSON data which it does report loading during the progress. But if I have a rather large set of geometries with say, only one texture, I don't get any meaningful information regarding where we are in the geometry loading. My files tend to have a lot of geometry pieces.
I do not want to add unnecessary overhead, and it would be great if there was an abstract way to handle all loading situations, as well as allow people to opt in or out of such progress reporting.
The text was updated successfully, but these errors were encountered: