mirror of
https://github.com/bevyengine/bevy
synced 2024-11-29 16:10:19 +00:00
Fixes minimization crash because of cluster updates. (#3369)
# Objective Fixes: #3368 Issue was caused by screen size being: `(0, 0)`. ## Solution Don't update clusters if the screen size is zero. A better solution might be to not render when minimized, but this works in the meantime. Co-authored-by: John <startoaster23@gmail.com>
This commit is contained in:
parent
c61fbcb7db
commit
3443cc77cb
1 changed files with 4 additions and 0 deletions
|
@ -359,6 +359,10 @@ pub fn update_clusters(windows: Res<Windows>, mut views: Query<(&Camera, &mut Cl
|
||||||
let inverse_projection = camera.projection_matrix.inverse();
|
let inverse_projection = camera.projection_matrix.inverse();
|
||||||
let window = windows.get(camera.window).unwrap();
|
let window = windows.get(camera.window).unwrap();
|
||||||
let screen_size_u32 = UVec2::new(window.physical_width(), window.physical_height());
|
let screen_size_u32 = UVec2::new(window.physical_width(), window.physical_height());
|
||||||
|
// Don't update clusters if screen size is 0.
|
||||||
|
if screen_size_u32.x == 0 || screen_size_u32.y == 0 {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
*clusters =
|
*clusters =
|
||||||
Clusters::from_screen_size_and_z_slices(screen_size_u32, clusters.axis_slices.z);
|
Clusters::from_screen_size_and_z_slices(screen_size_u32, clusters.axis_slices.z);
|
||||||
let screen_size = screen_size_u32.as_vec2();
|
let screen_size = screen_size_u32.as_vec2();
|
||||||
|
|
Loading…
Reference in a new issue