Skip to content

Commit

Permalink
doc: document PerspectiveProjection (bevyengine#6310)
Browse files Browse the repository at this point in the history
# Objective

Fixes bevyengine#6279.

## Solution

Added documentation explaining the meanings and default values of `PerspectiveProjection`'s fields.


Co-authored-by: dataphract <86984145+dataphract@users.noreply.github.com>
  • Loading branch information
2 people authored and Pietrek14 committed Dec 17, 2022
1 parent c1cc9c1 commit 0f2805b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions crates/bevy_render/src/camera/projection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,35 @@ impl Default for Projection {
}
}

/// A 3D camera projection in which distant objects appear smaller than close objects.
#[derive(Component, Debug, Clone, Reflect, FromReflect)]
#[reflect(Component, Default)]
pub struct PerspectiveProjection {
/// The vertical field of view (FOV) in radians.
///
/// Defaults to a value of π/4 radians or 45 degrees.
pub fov: f32,

/// The aspect ratio (width divided by height) of the viewing frustum.
///
/// Bevy's [`camera_system`](crate::camera::camera_system) automatically
/// updates this value when the aspect ratio of the associated window changes.
///
/// Defaults to a value of `1.0`.
pub aspect_ratio: f32,

/// The distance from the camera in world units of the viewing frustum's near plane.
///
/// Objects closer to the camera than this value will not be visible.
///
/// Defaults to a value of `0.1`.
pub near: f32,

/// The distance from the camera in world units of the viewing frustum's far plane.
///
/// Objects farther from the camera than this value will not be visible.
///
/// Defaults to a value of `1000.0`.
pub far: f32,
}

Expand Down

0 comments on commit 0f2805b

Please sign in to comment.