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

[Merged by Bors] - update camera projection if viewport changed #5945

Conversation

jakobhellermann
Copy link
Contributor

fixes #5944

Uses the second solution:

  1. keep track of the old viewport in the computed_state, and if camera.viewport != camera.computed_state.old_viewport, then update the projection. This is more reliable, but needs to store two UVec2s more in the camera (probably not a big deal).

@jakobhellermann jakobhellermann added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen labels Sep 11, 2022
Copy link
Contributor

@irate-devil irate-devil left a comment

Choose a reason for hiding this comment

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

The computation here only cares about the size of the viewport, not the position. Then it's only one extra Uvec2 :)

crates/bevy_render/src/camera/camera.rs Outdated Show resolved Hide resolved
@jakobhellermann
Copy link
Contributor Author

rebased an addressed review comments

@cart
Copy link
Member

cart commented Oct 28, 2022

bors r+

bors bot pushed a commit that referenced this pull request Oct 28, 2022
fixes #5944

Uses the second solution:
> 2. keep track of the old viewport in the computed_state, and if camera.viewport != camera.computed_state.old_viewport, then update the projection. This is more reliable, but needs to store two UVec2s more in the camera (probably not a big deal).
@bors bors bot changed the title update camera projection if viewport changed [Merged by Bors] - update camera projection if viewport changed Oct 28, 2022
@bors bors bot closed this Oct 28, 2022
@jakobhellermann jakobhellermann deleted the fix-camera-viewport-projection branch October 29, 2022 08:50
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
fixes bevyengine#5944

Uses the second solution:
> 2. keep track of the old viewport in the computed_state, and if camera.viewport != camera.computed_state.old_viewport, then update the projection. This is more reliable, but needs to store two UVec2s more in the camera (probably not a big deal).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing the Viewport of a camera doesn't update its projection
4 participants