Skip to main content

drive_surfaces

Function drive_surfaces 

Source
pub fn drive_surfaces(
    commands: Commands<'_, '_>,
    surfaces: ResMut<'_, Surfaces>,
    cameras: Query<'_, '_, (Entity, &SurfaceCamera, &mut Camera)>,
)
Expand description

Toggle each surface camera’s activity: always on for RenderMode::Live; on for one frame after a dirty RenderMode::Snapshot, then off. Mirrors the portal crate’s drive_render_targets. Also despawns the camera of a surface that has been removed, so a torn-down surface (e.g. on a scene switch) leaves no orphan camera rendering into a freed texture.