-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add examples for orthographic and perspective zoom #15092
Add examples for orthographic and perspective zoom #15092
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.
A few notes, but overall I really like these examples. Very actionable and relevant, with clear code.
BTW I've seen both, but do we have a standard for choosing "instructions on the screen as UI" vs "instructions in an |
Moderate preference for instructions on screen, especially if it's not going to interfere with the example otherwise. |
2bda09e
to
d8f6caa
Compare
Fantastic, thank you :) |
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.
Reviewed only one example, but the comments apply to both.
I like that these examples exist, but there are some things in here that are a bit suboptimal when using the examples as a general learning resource, which a lot of beginners do. I'd like to showcase best practices a bit more if possible.
examples/3d/perspective_zoom.rs
Outdated
@@ -0,0 +1,125 @@ | |||
//! Shows how to zoom and orbit a perspective projection camera. |
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.
Could you cross-reference this and the first person view model example? Both feature perspective zoom.
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.
I'm not entirely convinced that this should be two separate examples instead of one. Would it complicate the logic a lot if you added a toggle between the two modes when pressing space?
TBH, I did think there was an awful lot of repetition. Let's see what it looks like as a combined effort. |
41f8cf7
to
2631c71
Compare
@janhohenheim How do we feel about this? I don't know if I've just muddied the waters, but at least everything is in one place... 🤔 Will clean up last bits and pieces tomorrow, otherwise I will be pitchin' and yawin' in my sleep. |
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.
Looks pretty good now! Minor naming suggestion and we are good to go once you did your edits. Approving already :)
@@ -255,6 +255,7 @@ Example | Description | |||
--- | --- | |||
[2D top-down camera](../examples/camera/2d_top_down_camera.rs) | A 2D top-down camera smoothly following player movements | |||
[First person view model](../examples/camera/first_person_view_model.rs) | A first-person camera that uses a world model and a view model with different field of views (FOV) | |||
[Projection Zoom](../examples/camera/projection_zoom.rs) | Shows how to zoom and orbit orthographic and perspective projection cameras. |
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.
I quite like the orbit showcase. I don't think we had that before :)
Maybe rename the file to orbit_and_projection_zoom
, with the example name changing accordingly?
@richchurcher I'd also be happy if we split this into an example that showed the projection scaling on a static scene (e.g. our fox model) without any movement controls, and one example that only showed the orbit. That would probably be cleaner, but I'll leave the choice to you :) |
The merge train waits for no man 🚋 Seriously though, I think this is good enough to merge, but do feel free to tweak it in follow-ups. |
Ah, this needs revision following #15073 <3 |
The train stops for no-one! I'll revise in a sec. |
bba4dbe
to
095da01
Compare
Does some kind person want to expand a tiny bit on |
|
Thanks! I'll split the example in a separate PR. |
# Objective As previously discussed, split camera zoom and orbiting examples to keep things less cluttered. See discussion on #15092 for context.
Objective
Add examples for zooming (and orbiting) orthographic and perspective cameras.
I'm pretty green with 3D, so please treat with suspicion! I note that if/when #15075 is merged,
.scale
will go away so this example uses.scaling_mode
.Closes #2580