Composite zsort issue fix - #122
Open
mikz30 wants to merge 3 commits into
Open
Conversation
- Try to follow the inochi2d creator composite zsort behaviour I observed: all composite descendants' zsort must be sorted together; (TODO) for nested composites, only the top one is an active composite, treat the rest as a normal node in zsorting. - Use a stack to keep track of descendents (optimization needed)
- add readable variable naming
…ppet.end_frame(). No further optimization until PR review. - Improved comments for readability
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR tries to fix Issue #121 cleanly. I observed how zsorting with Composite and its descendants on Inochi2d Creator works and here's the difference to current inox2d implementation.
I used the pre-order iterator and a stack to keep track of ancestors on current node's branch, starting from the highest Composite, while managing a hashmap of lists which are to replace
zsorted_children_list. During bothRenderCtxinitialization and per frame update method. Finally, skip on nested composites when drawing instead of panicking, as their descendants's zsort calculation rely on them, we don't draw them but have to keep them.Other Notes
Funny enough this made puppet.end_frame() slight faster on simplest examples, although will not be as obvious on real puppets. I have only tested it on Midori (the one with meshgroups and nested composites) for real case puppet. I can't overcome compatibility issue with most models, so I'd like to please ask anyone viewing this PR to test with different models. Thank you very much.
Suggestions are welcome.