-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Merged by Bors] - simplified API to get NDC from camera and world position #4041
Conversation
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.
Code-wise fine. Just @alice-i-cecile 's documentation comment to address.
nevermind, it's already there |
@mockersf here are some proposed changes to this PR: mockersf#78 I was experimenting with using a trait to remove the need for passing both If you have a camera.world_to_screen(window, global_transform, world_pos) If you have a let sized_target = camera.target.as_sized_target(windows, images);
camera.world_to_screen(sized_target, global_transform, world_pos) |
I like aevyrie's changes quite a bit here. Do you agree @mockersf? |
after playing with the changes from @aevyrie, I disagree with them as they make it possible to use invalid parameters by using a different camera for the target as the one used for the projection matrix |
Relevant to some of the general sentiment expressed here: in my "high level render targets" changes i'm experimenting with syncing render target logical and physical width/height to Camera fields, which makes methods like "world_to_screen" much nicer to use (and cleans up internals in a number of places). That wouldn't block anything here, just something to start thinking about / developing opinions on. |
The main complaint I have here is the need for |
For my use case, having a |
bors r+ |
# Objective - After #3412, `Camera::world_to_screen` got a little bit uglier to use by needing to provide both `Windows` and `Assets<Image>`, even though only one would be needed https://github.com/bevyengine/bevy/blob/b697e73c3d861c209152ccfb140ae00fbc6e9925/crates/bevy_render/src/camera/camera.rs#L117-L123 - Some time, exact coordinates are not needed but normalized device coordinates is enough ## Solution - Add a function to just get NDC
…4041) # Objective - After bevyengine#3412, `Camera::world_to_screen` got a little bit uglier to use by needing to provide both `Windows` and `Assets<Image>`, even though only one would be needed https://github.com/bevyengine/bevy/blob/b697e73c3d861c209152ccfb140ae00fbc6e9925/crates/bevy_render/src/camera/camera.rs#L117-L123 - Some time, exact coordinates are not needed but normalized device coordinates is enough ## Solution - Add a function to just get NDC
…4041) # Objective - After bevyengine#3412, `Camera::world_to_screen` got a little bit uglier to use by needing to provide both `Windows` and `Assets<Image>`, even though only one would be needed https://github.com/bevyengine/bevy/blob/b697e73c3d861c209152ccfb140ae00fbc6e9925/crates/bevy_render/src/camera/camera.rs#L117-L123 - Some time, exact coordinates are not needed but normalized device coordinates is enough ## Solution - Add a function to just get NDC
Objective
Camera::world_to_screen
got a little bit uglier to use by needing to provide bothWindows
andAssets<Image>
, even though only one would be neededbevy/crates/bevy_render/src/camera/camera.rs
Lines 117 to 123 in b697e73
Solution