Merged
Conversation
added 6 commits
December 2, 2022 15:43
- minimap with camera instead of atlas render into - camera zoom usage - camera viewport change
Member
Author
|
Btw I don't know what's failing in self hosted |
pushfoo
reviewed
Dec 8, 2022
pushfoo
reviewed
Dec 8, 2022
Co-authored-by: pushfoo <36696816+pushfoo@users.noreply.github.com>
Remove prints
4 tasks
Member
|
Let's just merge this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR changes a bit how zoom is controlled and applied to cameras.
@einarf sorry to ping but I would like you to review if this is somehow the right approach. In the end what's send to the gl context should be the same, but now the users gets correct and consistent info about the zoom applied.
A) Before, you could set a zoom that would change the projection matrix, but you could also change the ratio between the viewport and the projection effectively changing the zoom level again:
With this PR, a change in zoom will effectively change the projection (adding or removing width and height to the projection).
Getting
camera.zoomwill show the ratio between projection and viewport (not an scalar value set by the user).Setting
camera.zoomwill effectively change the projection like this:Also if the user decides to not change camera.zoom but instead change the ratio between viewport and projection the
camera.zoomproperty will return a good value, effectively showing the zoom applied.Also, as you may probably notice by now, changing the projection so it's 1/2 of the viewport or setting
camera.zoomto 0.5 will produce the same effect and reflect the same values across all camera attributes.B) I've added a
camera.scaleproperty that returns the x, y ratio between projection and viewport. And camera.zoom will return the width scale (if x, y scale is not the same, then zoom will return a result that's not completely correct).Setting camera.zoom will set camera.scale to the same value.
C) As a result of this change, zoom is now available in
SimpleCamera(asSimpleCameraallows to change viewport and projection).D) This also fixes an error in
camera.center. Later the center method was not taking into account the projection to view ratio.E) I've also added an example so you can see all this changes in action and also show how you can draw into the screen using cameras instead of using atlas render into.