Skip to content

struct

SpotLight

pub struct SpotLight {
    pub position: Vec3,
    pub target: Vec3,
    pub color: Color,
    pub intensity: f32,
    pub distance: f32,
    pub angle: f32,
    pub penumbra: f32,
    pub shadow: Option<Shadow>,
}

A cone of light from a point towards target, fading out over distance (0 = no falloff).

Fields

position

pub position: Vec3

Where it is.

target

pub target: Vec3

The point it shines at.

color

pub color: Color

Its colour.

intensity

pub intensity: f32

Its strength.

distance

pub distance: f32

How far it reaches (0: no falloff).

angle

pub angle: f32

Half-angle of the cone, in degrees.

penumbra

pub penumbra: f32

How much of the cone's edge fades (0: hard edge, 1: all of it).

shadow

pub shadow: Option<Shadow>

Its shadows, if it casts them.

Methods

direction

pub fn direction(&self) -> Vec3

The unit direction it shines in.

cone

pub fn cone(&self) -> (f32, f32)

Cosines of the cone's outer and inner (fully lit) edges.

Trait implementations