pub struct FramingOptions { /* private fields */ }Expand description
Options for fitting a camera to world-space bounds.
Implementations§
Source§impl FramingOptions
impl FramingOptions
pub const PRESET_NAMES: &'static [&'static str]
pub fn from_preset_name(name: &str) -> Option<Self>
Sourcepub const fn view_direction(self, view_direction: Vec3) -> Self
pub const fn view_direction(self, view_direction: Vec3) -> Self
Sets the world-space direction from the target toward the camera.
Sourcepub const fn look_from(self, direction: Vec3) -> Self
pub const fn look_from(self, direction: Vec3) -> Self
Alias for Self::view_direction that reads naturally at call sites.
Sourcepub fn azimuth_elevation(self, azimuth_deg: f32, elevation_deg: f32) -> Self
pub fn azimuth_elevation(self, azimuth_deg: f32, elevation_deg: f32) -> Self
Place the camera by azimuth and elevation in degrees.
Conventions:
azimuth_degis the horizontal angle from the +Z front axis. Positive rotates toward +X (right); negative toward -X (left).0 deg= front,90 deg= right,+-180 deg= back,-90 deg= left.elevation_degis the vertical angle from the horizon. Positive is above, negative is below. Values are clamped to[-90.0, 90.0].
Equivalent to calling look_from with a unit
direction derived from spherical coordinates.
§Examples
use scena::FramingOptions;
// 28 degrees to the left of front, 18 degrees above horizon.
let _options = FramingOptions::new().azimuth_elevation(-28.0, 18.0);Sourcepub fn front(self) -> Self
pub fn front(self) -> Self
Looks at the bounds from the positive Z direction.
Places the camera in front of the target, on the +Z world axis, looking toward -Z.
§Examples
use scena::FramingOptions;
let _options = FramingOptions::new().front();Sourcepub fn back(self) -> Self
pub fn back(self) -> Self
Place the camera behind the target.
Places the camera on the -Z world axis, looking toward +Z.
§Examples
use scena::FramingOptions;
let _options = FramingOptions::new().back();Sourcepub fn right(self) -> Self
pub fn right(self) -> Self
Place the camera to the right of the target.
Places the camera on the +X world axis.
§Examples
use scena::FramingOptions;
let _options = FramingOptions::new().right();Sourcepub fn left(self) -> Self
pub fn left(self) -> Self
Place the camera to the left of the target.
Places the camera on the -X world axis.
§Examples
use scena::FramingOptions;
let _options = FramingOptions::new().left();Sourcepub fn top(self) -> Self
pub fn top(self) -> Self
Place the camera above the target.
Places the camera on the +Y world axis, looking down.
§Examples
use scena::FramingOptions;
let _options = FramingOptions::new().top();Sourcepub fn bottom(self) -> Self
pub fn bottom(self) -> Self
Place the camera below the target.
Places the camera on the -Y world axis, looking up.
§Examples
use scena::FramingOptions;
let _options = FramingOptions::new().bottom();Sourcepub const fn isometric(self) -> Self
pub const fn isometric(self) -> Self
Looks at the bounds from a generic isometric-style direction.
Sourcepub fn three_quarter_front_right(self) -> Self
pub fn three_quarter_front_right(self) -> Self
Three-quarter view from the front-right, slightly elevated.
Equivalent to azimuth_elevation(45.0, 30.0).
§Examples
use scena::FramingOptions;
let _options = FramingOptions::new().three_quarter_front_right();Sourcepub fn three_quarter_front_left(self) -> Self
pub fn three_quarter_front_left(self) -> Self
Three-quarter view from the front-left, slightly elevated.
Equivalent to azimuth_elevation(-45.0, 30.0).
§Examples
use scena::FramingOptions;
let _options = FramingOptions::new().three_quarter_front_left();Sourcepub fn three_quarter_back_right(self) -> Self
pub fn three_quarter_back_right(self) -> Self
Three-quarter view from the back-right, slightly elevated.
Equivalent to azimuth_elevation(135.0, 30.0).
§Examples
use scena::FramingOptions;
let _options = FramingOptions::new().three_quarter_back_right();Sourcepub fn three_quarter_back_left(self) -> Self
pub fn three_quarter_back_left(self) -> Self
Three-quarter view from the back-left, slightly elevated.
Equivalent to azimuth_elevation(-135.0, 30.0).
§Examples
use scena::FramingOptions;
let _options = FramingOptions::new().three_quarter_back_left();Sourcepub fn orbit(self, yaw_radians: f32, pitch_radians: f32) -> Self
pub fn orbit(self, yaw_radians: f32, pitch_radians: f32) -> Self
Sets the view direction from turntable yaw and pitch radians.
Sourcepub const fn viewport(self, width: u32, height: u32) -> Self
pub const fn viewport(self, width: u32, height: u32) -> Self
Sets the viewport size in physical pixels.
Sourcepub const fn tighten_depth_range(self, enabled: bool) -> Self
pub const fn tighten_depth_range(self, enabled: bool) -> Self
Enables near/far tightening when the caller has verified it is safe.
Trait Implementations§
Source§impl Clone for FramingOptions
impl Clone for FramingOptions
Source§fn clone(&self) -> FramingOptions
fn clone(&self) -> FramingOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for FramingOptions
Source§impl Debug for FramingOptions
impl Debug for FramingOptions
Source§impl Default for FramingOptions
impl Default for FramingOptions
Source§impl PartialEq for FramingOptions
impl PartialEq for FramingOptions
Source§fn eq(&self, other: &FramingOptions) -> bool
fn eq(&self, other: &FramingOptions) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for FramingOptions
Auto Trait Implementations§
impl Freeze for FramingOptions
impl RefUnwindSafe for FramingOptions
impl Send for FramingOptions
impl Sync for FramingOptions
impl Unpin for FramingOptions
impl UnsafeUnpin for FramingOptions
impl UnwindSafe for FramingOptions
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more