pub enum LightFalloff {
Stops(Vec<LightStop>),
Texture {
slot: u32,
half_extent: Vec2,
offset: Vec2,
},
}Expand description
How a light’s value varies over its footprint.
Variants§
Stops(Vec<LightStop>)
A radial ramp over 0..=1 of the light’s radius, interpolated
linearly between ascending stops (at strictly ascending, all in
0..=1). t below the first stop is the first colour, t above the
last is the last colour. If the last stop is not zero the light still
ends at the rim: fragments past radius are discarded.
Texture
A falloff texture (Godot PointLight2D.texture) sampled in
light-local uv: the texture covers position + offset +- half_extent,
rgb scales the light colour and a scales the ramp, and fragments
outside the texture footprint are discarded. slot selects an upload
queued on the pass (LightTextureUpload);
a slot with no texture paints nothing.
Implementations§
Source§impl LightFalloff
impl LightFalloff
Sourcepub fn stops(stops: impl Into<Vec<LightStop>>) -> Self
pub fn stops(stops: impl Into<Vec<LightStop>>) -> Self
The deleted light2d.rs default ramp: white at the centre, half at
0.5, black at the rim.
Sourcepub fn half_extent(&self, radius: f32) -> Vec2
pub fn half_extent(&self, radius: f32) -> Vec2
Footprint half extent in world units: radius for stops, the
texture’s own half extent for a texture.
Trait Implementations§
Source§impl Clone for LightFalloff
impl Clone for LightFalloff
Source§impl Debug for LightFalloff
impl Debug for LightFalloff
Source§impl Default for LightFalloff
impl Default for LightFalloff
Source§impl PartialEq for LightFalloff
impl PartialEq for LightFalloff
impl StructuralPartialEq for LightFalloff
Auto Trait Implementations§
impl Freeze for LightFalloff
impl RefUnwindSafe for LightFalloff
impl Send for LightFalloff
impl Sync for LightFalloff
impl Unpin for LightFalloff
impl UnsafeUnpin for LightFalloff
impl UnwindSafe for LightFalloff
Blanket Implementations§
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
impl<T> Brush for T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.