Skip to content

Commit

Permalink
Add explicit ordering between update_frusta and camera_system (#5757
Browse files Browse the repository at this point in the history
)

# Objective

Fix a nasty system ordering bug between `update_frusta` and `camera_system` that lead to incorrect frustum s, leading to excessive culling and extremely hard-to-debug visual glitches

## Solution

- add explicit system ordering
  • Loading branch information
TheRawMeatball committed Aug 23, 2022
1 parent 675607a commit 5e2d9b4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/bevy_render/src/view/visibility/mod.rs
Expand Up @@ -14,7 +14,10 @@ use std::cell::Cell;
use thread_local::ThreadLocal;

use crate::{
camera::{Camera, CameraProjection, OrthographicProjection, PerspectiveProjection, Projection},
camera::{
camera_system, Camera, CameraProjection, OrthographicProjection, PerspectiveProjection,
Projection,
},
mesh::Mesh,
primitives::{Aabb, Frustum, Sphere},
};
Expand Down Expand Up @@ -186,18 +189,21 @@ impl Plugin for VisibilityPlugin {
CoreStage::PostUpdate,
update_frusta::<OrthographicProjection>
.label(UpdateOrthographicFrusta)
.after(camera_system::<OrthographicProjection>)
.after(TransformSystem::TransformPropagate),
)
.add_system_to_stage(
CoreStage::PostUpdate,
update_frusta::<PerspectiveProjection>
.label(UpdatePerspectiveFrusta)
.after(camera_system::<PerspectiveProjection>)
.after(TransformSystem::TransformPropagate),
)
.add_system_to_stage(
CoreStage::PostUpdate,
update_frusta::<Projection>
.label(UpdateProjectionFrusta)
.after(camera_system::<Projection>)
.after(TransformSystem::TransformPropagate),
)
.add_system_to_stage(
Expand Down

0 comments on commit 5e2d9b4

Please sign in to comment.