-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Invert the y-axis for the local coordinate space in extract_text2d_sprite
#21694
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
base: main
Are you sure you want to change the base?
Conversation
…negating the individual y-coords. Flip the sprites on the y-axis so the glyphs are still drawn with the correct orientation.
|
Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. |
|
Is there a reason why I’m very new here and just trying to understand things better; this is not a blocking comment! |
The underline and strikethrough lines are untextured, so |
Objective
We've got two parallel text renderings implementations, one for UI and one for 2d, that we try to keep feature equivalent.
bevy_uiandbevy_textuse coordinates increasing downwards, butbevy_spriteuses coordinates increasing upwards.In the
extract_text2d_spritetext extraction function each y-coordinate is negated individually. If instead, inextract_text2d_sprite, we invert the y-axis for each text layout's local coordinate space, then the function can be made to more closely matchbevy_ui_render's extraction code. Which should make it easier to maintain and extend the parallel implementations.Fixes #21693
Solution
Invert the y-axis for the local coordinate space instead of negating each glyph’s y value. Flip the glyph sprites so their orientation is unchanged.