LDrawLoader: Start removing stored derivative data during initial parse #23139
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related issue: --
Description
This PR starts to remove storage of some derivative data of LDraw files during the parsing process in an effort to work towards making the parsed representation more cache-able. Specifically this PR focuses on removing "faceNormals" produced during the initial file parsing and moves the generation to when they're needed since the face normals will change depending on the final transformation of the faces for use in a part.
In another PR I'd also like to move "main" material interpretation from the parent scope out of object parse as well as any matrix operations. Once that's done it should be easier to cache an initial parsed representation of a file and clone it rather than reparse it as needed and eventually reuse any normal smoothing operations per part, as well. Once all that's done it should provide a big improvement in parse time.
@yomboprime how does removing the
separateParts
code path and always behaving as though it were "true" sound? It should make this process easier and can be added back later if needed. Also since we now group primitives by part rather than creating a new mesh for every LDraw file the draw call issue that that field was originally meant to alleviate isn't quite as much of an issue. Pieces can also be merged into a single geometry afterward if needed.