pub struct TiledLighting {
pub config: TiledConfig,
pub lights: Vec<TiledLight>,
pub tiles: Vec<Tile>,
pub tiles_x: u32,
pub tiles_y: u32,
}Expand description
The tiled lighting system.
Fields§
§config: TiledConfig§lights: Vec<TiledLight>§tiles: Vec<Tile>§tiles_x: u32§tiles_y: u32Implementations§
Source§impl TiledLighting
impl TiledLighting
pub fn new(config: TiledConfig) -> Self
Sourcepub fn set_lights(&mut self, lights: Vec<TiledLight>)
pub fn set_lights(&mut self, lights: Vec<TiledLight>)
Set lights for this frame.
Sourcepub fn cull(&mut self, view: &Mat4, proj: &Mat4)
pub fn cull(&mut self, view: &Mat4, proj: &Mat4)
Assign lights to tiles based on screen-space overlap.
Sourcepub fn lights_for_tile(&self, tx: u32, ty: u32) -> &[u16]
pub fn lights_for_tile(&self, tx: u32, ty: u32) -> &[u16]
Get lights affecting a specific tile.
Sourcepub fn lights_at_pixel(&self, px: u32, py: u32) -> &[u16]
pub fn lights_at_pixel(&self, px: u32, py: u32) -> &[u16]
Get lights affecting a screen pixel.
Sourcepub fn total_assignments(&self) -> usize
pub fn total_assignments(&self) -> usize
Total number of light-tile assignments (for performance stats).
Sourcepub fn avg_lights_per_tile(&self) -> f32
pub fn avg_lights_per_tile(&self) -> f32
Average lights per tile.
Sourcepub fn glsl_source() -> &'static str
pub fn glsl_source() -> &'static str
GLSL shader for tiled light evaluation.
Auto Trait Implementations§
impl Freeze for TiledLighting
impl RefUnwindSafe for TiledLighting
impl Send for TiledLighting
impl Sync for TiledLighting
impl Unpin for TiledLighting
impl UnsafeUnpin for TiledLighting
impl UnwindSafe for TiledLighting
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.