Skip to content
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

Merged
merged 1 commit into from Nov 1, 2020

Conversation

RoosterDragon
Copy link
Member

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.

OpenRA.Game/Graphics/WorldRenderer.cs Outdated Show resolved Hide resolved
Comment on lines 154 to 155
compared = x.Pos.Z.CompareTo(y.Pos.Z);
return compared;
Copy link
Member

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).

Copy link
Member

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?

Copy link
Member Author

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?

Copy link
Member

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.

@pchote pchote merged commit 4daa519 into OpenRA:bleed Nov 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bleed: TD Campaign Trees disappearing while zooming (Spooky!)
3 participants