bevy/crates/bevy_render/src/camera
Rafał Harabień fe7f98f7f0
Fix deactivated camera still being used in render world (#15946)
# Objective

Switch to retained render world causes the extracted cameras in render
world to not be removed until camera in main world is despawned. When
extracting data from main world inactive cameras are skipped. Therefore
camera that was active and became inactive has a retained
`ExtractedCamera` component from previous frames (when it was active)
and is processed the same way as if it were active (there is no `active`
field on `ExtractedCamera`). This breakes switching between cameras in
`render_primitives` example.
Fixes #15822

## Solution

Fix it by removing `ExtractedCamera` and related components from
inactive cameras.
Note that despawning inactive camera seems to be bad option because they
are spawned using `SyncToRenderWorld` component.

## Testing

Switching camera in `render_primitives` example now works correctly.

---------

Co-authored-by: akimakinai <105044389+akimakinai@users.noreply.github.com>
2024-10-19 15:13:14 +00:00
..
camera_driver_node.rs fix: Skip some rendering logics when the viewport width or height is zero (#15654) 2024-10-08 22:52:19 +00:00
camera.rs Fix deactivated camera still being used in render world (#15946) 2024-10-19 15:13:14 +00:00
clear_color.rs Remove thiserror from bevy_render (#15765) 2024-10-09 14:26:28 +00:00
manual_texture_view.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
mod.rs Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
projection.rs Improve API for scaling orthographic cameras (#15969) 2024-10-17 17:50:06 +00:00