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

Redid render ordering #18

Merged
merged 1 commit into from
Dec 21, 2023
Merged

Redid render ordering #18

merged 1 commit into from
Dec 21, 2023

Conversation

pengiie
Copy link
Contributor

@pengiie pengiie commented Dec 20, 2023

Changes

  • Added a RenderMode struct to define RenderMode::ScreenSpace or RenderMode::WorldSpace .
  • Removed the Layer struct which previously defined the draw order.

Redid the render ordering to sort by the vector's z position since the transform is already being included for a 2d affine transformation so the z component doesn't go unused; this is assuming the z component of the transform isn't used to represent other things. Vectors in world-space are rendered first, then screen-space so that screen-space vectors have their own independent z-ordering.

Previously text was already rendered after other vectors so it would always appear on top, I changed this behavior to follow along with the ordering of all the other vectors, regardless if it's text or not.

Copy link
Member

@simbleau simbleau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor nits, looks fantastic!

src/renderer/render.rs Outdated Show resolved Hide resolved
src/renderer/render.rs Outdated Show resolved Hide resolved
src/renderer/render.rs Outdated Show resolved Hide resolved
@simbleau
Copy link
Member

Previously text was already rendered after other vectors so it would always appear on top, I changed this behavior to follow along with the ordering of all the other vectors, regardless if it's text or not.

This is a good change too imo. Since it's possible to spawn graphics with a transform (and hence, Z-index) it's still possible for the user to display text above all else by setting the Z to f32::MAX.

@simbleau simbleau merged commit 4783108 into linebender:main Dec 21, 2023
3 checks passed
@pengiie pengiie deleted the dev-zindex2 branch December 21, 2023 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants