-
-
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
LDrawLoader example: Add option to merge geometries after loading #23173
Conversation
Umm I think I had my git repo a bit dirty. Only the last commit of those 11 is relevant for this PR. @gkjohnson Is it Ok or should I clean my repo and make another PR? |
I've enabled again the conditional lines hide option because I've seen it could be done easily. |
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.
Awesome! This is a nice utility function and keeps the LDrawLoader more clean.
In the previous merge objects code path the merged geometry resulted in one mesh with different groups and a material array (in addition to the two line segment objects) which simplifies the final object. It might be nice but I don't necessarily have strong opinions on it!
Live demo:
https://raw.githack.com/yomboprime/three.js/ldraw_merge_model/examples/webgl_loader_ldraw.html
This is more a question for @mrdoob. The PR is easy enough to look at on its own for me and the commits will be squashed on merge. |
@mrdoob The PR is ready to merge if those old commits are ok to be squashed. |
Done, ready to merge. |
I made the You can see the new doc page here: |
Thanks! |
Related comment: #23168 (comment)
Description
In the LDrawLoader example, add a gui option (and function) to merge model geometries by material after model loading. The option is named 'Merge model' and gives better render performance. This option disables the 'Construction steps' and the 'Show conditional lines' options.
The results are more noticeable in Firefox, where frames are almost not dropped where they dropped before even on small models. The model process time is somewhat 1/5 of loading time.
The function
mergeObject()
is 180 lines out of 560 of the example and it is fairly complex, so I'd rather move it to the LDrawLoader. But this can be done at any time.