Light

Enum Light 

Source
pub enum Light {
    Directional {
        direction: Vector3<f32>,
        color: Vector3<f32>,
        intensity: f32,
    },
    Point {
        position: Vector3<f32>,
        color: Vector3<f32>,
        intensity: f32,
    },
    Spot {
        position: Vector3<f32>,
        direction: Vector3<f32>,
        color: Vector3<f32>,
        intensity: f32,
        inner_cone_angle: f32,
        outer_cone_angle: f32,
    },
}
Expand description

Represents a light.

Variants§

§

Directional

Directional lights are light sources that act as though they are infinitely far away and emit light in the direction. Because it is at an infinite distance, the light is not attenuated. Its intensity is defined in lumens per metre squared, or lux (lm/m2).

Fields

§direction: Vector3<f32>

Direction of the directional light

§color: Vector3<f32>

Color of the directional light

§intensity: f32

Intensity of the directional light

§

Point

Point lights emit light in all directions from their position in space; The brightness of the light attenuates in a physically correct manner as distance increases from the light’s position (i.e. brightness goes like the inverse square of the distance). Point light intensity is defined in candela, which is lumens per square radian (lm/sr).

Fields

§position: Vector3<f32>

Position of the point light

§color: Vector3<f32>

Color of the point light

§intensity: f32

Intensity of the point light

§

Spot

Spot lights emit light in a cone in direction. The angle and falloff of the cone is defined using two numbers, the inner_cone_angle and outer_cone_angle. As with point lights, the brightness also attenuates in a physically correct manner as distance increases from the light’s position (i.e. brightness goes like the inverse square of the distance). Spot light intensity refers to the brightness inside the inner_cone_angle (and at the location of the light) and is defined in candela, which is lumens per square radian (lm/sr). Engines that don’t support two angles for spotlights should use outer_cone_angle as the spotlight angle (leaving inner_cone_angle to implicitly be 0).

Fields

§position: Vector3<f32>

Position of the spot light

§direction: Vector3<f32>

Direction of the spot light

§color: Vector3<f32>

Color of the spot light

§intensity: f32

Intensity of the spot light

§inner_cone_angle: f32

Inner cone angle of the spot light

§outer_cone_angle: f32

Outer cone angle of the spot light

Trait Implementations§

Source§

impl Clone for Light

Source§

fn clone(&self) -> Light

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Light

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Light

§

impl RefUnwindSafe for Light

§

impl Send for Light

§

impl Sync for Light

§

impl Unpin for Light

§

impl UnwindSafe for Light

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.