pub struct LightMap { /* private fields */ }Expand description
The lights that reach a visual, each with the transform from the space of the visual to the space of the light.
Implementations§
Source§impl LightMap
impl LightMap
Sourcepub fn add(&mut self, source: LightSource, to_light_space: Matrix)
pub fn add(&mut self, source: LightSource, to_light_space: Matrix)
Adds a light; to_light_space maps the coordinates of the lit visual
to those of the coordinate space of the light.
Sourcepub fn lit_at(&self, point: Point, material: &LightingMaterial) -> LightColor
pub fn lit_at(&self, point: Point, material: &LightingMaterial) -> LightColor
The sum of the lights at point of the lit visual reflected by
material, not clamped.
Sourcepub fn light_at(&self, point: Point) -> LightColor
pub fn light_at(&self, point: Point) -> LightColor
The sum of the lights at point of the lit visual, clamped to 0..1.
Sourcepub fn size_for(rect: Rect) -> PixelSize
pub fn size_for(rect: Rect) -> PixelSize
The size of the light map of rect on the grid of 0.4: a cell per
LIGHT_MAP_CELL units, at least 2 and at most LIGHT_MAP_MAX_CELLS.
The render walk uses size_for_scale.
Sourcepub fn size_for_scale(rect: Rect, device_scale: f64) -> PixelSize
pub fn size_for_scale(rect: Rect, device_scale: f64) -> PixelSize
The number of samples of the light map of rect along each side,
for a visual drawn device_scale device pixels per unit: a sample
every LIGHT_MAP_SAMPLE_SPACING device pixels, at least 2 and at
most LIGHT_MAP_MAX_SAMPLES.
Sourcepub fn factors(
&self,
rect: Rect,
size: PixelSize,
material: &LightingMaterial,
) -> Option<MultiplyLayerFactors>
pub fn factors( &self, rect: Rect, size: PixelSize, material: &LightingMaterial, ) -> Option<MultiplyLayerFactors>
The factors of the multiply layer that lights the content of rect:
the light at each sample (reflected by material), over a scale of
the brightest channel (at least 1, at most
LIGHT_MAP_MAX_SCALE). None when the light is exactly full
everywhere, so the layer would change nothing.
Sourcepub fn pixels(&self, rect: Rect, size: PixelSize) -> Option<Vec<u8>>
pub fn pixels(&self, rect: Rect, size: PixelSize) -> Option<Vec<u8>>
The RGBA pixels (premultiplied, row by row from the top) of the
source-atop light map of rect at size (for a drawing context
without layer effects): each pixel the LightColor::atop_pixel of
the light at the centre of its sample. None when the light is full
everywhere, so the map would change nothing.
Source§impl LightMap
impl LightMap
Sourcepub fn scene_pixels(
&self,
rect: Rect,
size: PixelSize,
material: &LightingMaterial,
) -> Vec<u8> ⓘ
pub fn scene_pixels( &self, rect: Rect, size: PixelSize, material: &LightingMaterial, ) -> Vec<u8> ⓘ
The opaque RGBA pixels (row by row from the top) of the lighting of
a scene lighting effect over rect at size: the lights reflected
by material, clamped to 1, at the centre of each sample.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LightMap
impl RefUnwindSafe for LightMap
impl Send for LightMap
impl Sync for LightMap
impl Unpin for LightMap
impl UnsafeUnpin for LightMap
impl UnwindSafe for LightMap
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more