[][src]Struct web_glitz::pipeline::graphics::DepthRange

pub struct DepthRange { /* fields omitted */ }

Defines how a fragment's depth output will be mapped onto the range 0.0..1.0 from the near plane at 0.0 to the far plane at 1.0.

  • Values smaller than the lower bound will be mapped to 0.0.
  • Values greater than the upper bound will be mapped to 1.0.
  • Values contained on the range will be mapped to the range 0.0..1.0.

Can be constructed from a RangeInclusive via TryFrom:

use std::convert::TryFrom;
use web_glitz::pipeline::graphics::DepthRange;

let depth_range = DepthRange::try_from(0.2..=0.8).unwrap();

The lower bound of the range must not be smaller than 0.0, the upper bound of the range must not be greater than 1.0, and the lower bound must be strictly smaller than the upper bound; otherwise, an [InvalidDepthRange] error is returned.

A default depth range may be obtained through Default:

use std::convert::TryFrom;
use web_glitz::pipeline::graphics::DepthRange;

assert_eq!(DepthRange::default(), DepthRange::try_from(0.0..=1.0).unwrap());

Implementations

impl DepthRange[src]

pub fn near(&self) -> f32[src]

The lower bound of this range that will be mapped onto the near plane at 0.0.

pub fn far(&self) -> f32[src]

The upper bound of this range that will be mapped onto the far plane at 1.0.

Trait Implementations

impl Clone for DepthRange[src]

impl Debug for DepthRange[src]

impl Default for DepthRange[src]

impl PartialEq<DepthRange> for DepthRange[src]

impl StructuralPartialEq for DepthRange[src]

impl TryFrom<RangeInclusive<f32>> for DepthRange[src]

type Error = InvalidDepthRange

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<D, T> IntoBuffer<T> for D where
    D: Borrow<T> + 'static,
    T: Copy + 'static, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.