diff --git a/crates/bevy_render/src/camera/projection.rs b/crates/bevy_render/src/camera/projection.rs index 1a136c94df..27f90559d6 100644 --- a/crates/bevy_render/src/camera/projection.rs +++ b/crates/bevy_render/src/camera/projection.rs @@ -193,6 +193,19 @@ impl Default for PerspectiveProjection { } } +/// Scaling mode for [`OrthographicProjection`]. +/// +/// # Examples +/// +/// Configure the orthographic projection to two world units per window height: +/// +/// ``` +/// # use bevy_render::camera::{OrthographicProjection, Projection, ScalingMode}; +/// let projection = Projection::Orthographic(OrthographicProjection { +/// scaling_mode: ScalingMode::FixedVertical(2.0), +/// ..OrthographicProjection::default() +/// }); +/// ``` #[derive(Debug, Clone, Copy, Reflect, Serialize, Deserialize)] #[reflect(Serialize, Deserialize)] pub enum ScalingMode { @@ -278,6 +291,18 @@ impl DivAssign for ScalingMode { /// /// Note that the scale of the projection and the apparent size of objects are inversely proportional. /// As the size of the projection increases, the size of objects decreases. +/// +/// # Examples +/// +/// Configure the orthographic projection to one world unit per 100 window pixels: +/// +/// ``` +/// # use bevy_render::camera::{OrthographicProjection, Projection, ScalingMode}; +/// let projection = Projection::Orthographic(OrthographicProjection { +/// scaling_mode: ScalingMode::WindowSize(100.0), +/// ..OrthographicProjection::default() +/// }); +/// ``` #[derive(Component, Debug, Clone, Reflect)] #[reflect(Component, Default)] pub struct OrthographicProjection {