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

Document when Camera::viewport_to_world and related methods return None #8841

Merged
Prev Previous commit
Next Next commit
fixup?: clarify render target comment
  • Loading branch information
tormeh committed Aug 1, 2023
commit 8fd32f324ecd6dd455480750b0eb9a6d93d43ba4
16 changes: 12 additions & 4 deletions crates/bevy_render/src/camera/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ impl Camera {
///
/// Returns `None` if both:
/// - The viewport is not set
/// - The render target is not set
/// - Bevy has not set the render target. This can happen if:
/// - The function is called just after the `Camera` is created, before `camera_system` is executed
/// - The target isn't correctly set (for example it points to an image that doesn't exist)
#[inline]
pub fn logical_viewport_size(&self) -> Option<Vec2> {
self.viewport
Expand Down Expand Up @@ -226,7 +228,9 @@ impl Camera {
/// Returns `None` if any of these conditions occur:
/// - The logical viewport size cannot be computed. This can happen if both:
/// - The viewport is not set
/// - The render target is not set
/// - Bevy has not set the render target. This can happen if:
/// - The function is called just after the `Camera` is created, before `camera_system` is executed
/// - The target isn't correctly set (for example it points to an image that doesn't exist)
/// - The projection matrix is invalid
/// - The camera transform is invalid or cannot be inverted
/// - The world position is invalid
Expand Down Expand Up @@ -263,7 +267,9 @@ impl Camera {
/// Returns `None` if any of these conditions occur:
/// - The logical viewport size cannot be computed. This can happen if both:
/// - The viewport is not set
/// - The render target is not set
/// - Bevy has not set the render target. This can happen if:
/// - The function is called just after the `Camera` is created, before `camera_system` is executed
/// - The target isn't correctly set (for example it points to an image that doesn't exist)
/// - The near or far plane cannot be computed. This can happen if:
/// - The projection matrix is invalid or cannot be inverted
/// - The camera transform is invalid
Expand Down Expand Up @@ -300,7 +306,9 @@ impl Camera {
/// Returns `None` if any of these conditions occur:
/// - The logical viewport size cannot be computed. This can happen if both:
/// - The viewport is not set
/// - The render target is not set
/// - Bevy has not set the render target. This can happen if:
/// - The function is called just after the `Camera` is created, before `camera_system` is executed
/// - The target isn't correctly set (for example it points to an image that doesn't exist)
/// - The viewport position cannot be mapped to the world. This can happen if:
/// - The projection matrix is invalid or cannot be inverted
/// - The camera transform is invalid
Expand Down