bevy_render::camera

Function camera_system

Source
pub fn camera_system<T: CameraProjection + Component>(
    window_resized_events: EventReader<'_, '_, WindowResized>,
    window_created_events: EventReader<'_, '_, WindowCreated>,
    window_scale_factor_changed_events: EventReader<'_, '_, WindowScaleFactorChanged>,
    image_asset_events: EventReader<'_, '_, AssetEvent<Image>>,
    primary_window: Query<'_, '_, Entity, With<PrimaryWindow>>,
    windows: Query<'_, '_, (Entity, &Window)>,
    images: Res<'_, Assets<Image>>,
    manual_texture_views: Res<'_, ManualTextureViews>,
    cameras: Query<'_, '_, (&mut Camera, &mut T)>,
)
Expand description

System in charge of updating a Camera when its window or projection changes.

The system detects window creation, resize, and scale factor change events to update the camera projection if needed. It also queries any CameraProjection component associated with the same entity as the Camera one, to automatically update the camera projection matrix.

The system function is generic over the camera projection type, and only instances of OrthographicProjection and PerspectiveProjection are automatically added to the app, as well as the runtime-selected Projection. The system runs during PostUpdate.

§World Resources

Res<Assets<Image>> – For cameras that render to an image, this resource is used to inspect information about the render target. This system will not access any other image assets.