pub struct TiledLightCulling {
pub tile_size: u32,
pub screen_width: u32,
pub screen_height: u32,
pub tiles_x: u32,
pub tiles_y: u32,
pub tiles: Vec<ScreenTile>,
pub view_projection: Mat4,
pub inv_projection: Mat4,
pub near: f32,
pub far: f32,
}Expand description
Divides the screen into tiles and assigns lights for deferred rendering.
Fields§
§tile_size: u32Tile size in pixels.
screen_width: u32Screen width.
screen_height: u32Screen height.
tiles_x: u32Number of tiles in X.
tiles_y: u32Number of tiles in Y.
tiles: Vec<ScreenTile>All tiles.
view_projection: Mat4View-projection matrix for the current frame.
inv_projection: Mat4Inverse projection for reconstructing view-space positions.
near: f32Near plane.
far: f32Far plane.
Implementations§
Source§impl TiledLightCulling
impl TiledLightCulling
pub fn new(screen_width: u32, screen_height: u32, tile_size: u32) -> Self
Sourcepub fn resize(&mut self, width: u32, height: u32)
pub fn resize(&mut self, width: u32, height: u32)
Resize the tiling when the screen resolution changes.
Sourcepub fn update_depth_ranges(&mut self, depth_buffer: &[f32])
pub fn update_depth_ranges(&mut self, depth_buffer: &[f32])
Update depth ranges for all tiles from a full-screen depth buffer.
Sourcepub fn cull_lights(&mut self, lights: &[(LightId, &Light)])
pub fn cull_lights(&mut self, lights: &[(LightId, &Light)])
Cull lights against all tiles.
Sourcepub fn tile_at_pixel(&self, x: u32, y: u32) -> Option<&ScreenTile>
pub fn tile_at_pixel(&self, x: u32, y: u32) -> Option<&ScreenTile>
Get the tile at a pixel coordinate.
Sourcepub fn stats(&self) -> TiledCullingStats
pub fn stats(&self) -> TiledCullingStats
Get statistics.
Trait Implementations§
Source§impl Clone for TiledLightCulling
impl Clone for TiledLightCulling
Auto Trait Implementations§
impl Freeze for TiledLightCulling
impl RefUnwindSafe for TiledLightCulling
impl Send for TiledLightCulling
impl Sync for TiledLightCulling
impl Unpin for TiledLightCulling
impl UnsafeUnpin for TiledLightCulling
impl UnwindSafe for TiledLightCulling
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> 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>
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.