Invert the y-axis of the local coordinate space in extract_text2d_sprite#21694
Invert the y-axis of the local coordinate space in extract_text2d_sprite#21694alice-i-cecile merged 10 commits intobevyengine:mainfrom
extract_text2d_sprite#21694Conversation
…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 |
extract_text2d_spriteextract_text2d_sprite
kfc35
left a comment
There was a problem hiding this comment.
I checked out the branch and tested with the two examples mentioned, text2d and testbed. Both look the same between main and here 👍
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.
Testing
If this is correct, the output from the
text2dexample andtestbed_2d's text scenes should be unchanged.