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
Use tie breaks to determine sort order in WorldRenderer.GenerateRenderables #18774
Conversation
859884a
to
46c81b3
Compare
compared = x.Pos.Z.CompareTo(y.Pos.Z); | ||
return compared; |
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.
This can simplify to return x.Pos.Z.CompareTo(y.Pos.Z)
.
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.
Also, wouldn't it make sense to compare z before x or y?
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.
Simplified.
I chose this order as X is often a useful first-element-that-actually-differs. Z often is no help. That said, it is arbitrary so I can switch it if that's better in some way?
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 can leave it like this then.
46c81b3
to
9b0c5ea
Compare
Fixes #18761
#18709 introduced a bug where renderables with the same z position would swap at random each frame, leading to flickering. This addresses that issue by using some tie-breaks to arbitrarily, but consistently, decide on the top-most element.