Skip to content

Commit

Permalink
fix clusters on 2dcams (14574)
Browse files Browse the repository at this point in the history
  • Loading branch information
robtfm committed Aug 15, 2024
1 parent 3c60240 commit ad4024e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
5 changes: 3 additions & 2 deletions crates/bevy_pbr/src/cluster/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

use std::num::NonZeroU64;

use bevy_core_pipeline::core_3d::Camera3d;
use bevy_ecs::{
component::Component,
entity::{Entity, EntityHashMap},
query::Without,
query::{With, Without},
reflect::ReflectComponent,
system::{Commands, Query, Res, Resource},
world::{FromWorld, World},
Expand Down Expand Up @@ -348,7 +349,7 @@ impl Clusters {

pub fn add_clusters(
mut commands: Commands,
cameras: Query<(Entity, Option<&ClusterConfig>, &Camera), Without<Clusters>>,
cameras: Query<(Entity, Option<&ClusterConfig>, &Camera), (Without<Clusters>, With<Camera3d>)>,
) {
for (entity, config, camera) in &cameras {
if !camera.is_active {
Expand Down
17 changes: 10 additions & 7 deletions crates/bevy_pbr/src/render/light.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bevy_asset::UntypedAssetId;
use bevy_color::ColorToComponents;
use bevy_core_pipeline::core_3d::CORE_3D_DEPTH_FORMAT;
use bevy_core_pipeline::core_3d::{Camera3d, CORE_3D_DEPTH_FORMAT};
use bevy_ecs::entity::EntityHashSet;
use bevy_ecs::prelude::*;
use bevy_ecs::{entity::EntityHashMap, system::lifetimeless::Read};
Expand Down Expand Up @@ -515,12 +515,15 @@ pub fn prepare_lights(
render_queue: Res<RenderQueue>,
mut global_light_meta: ResMut<GlobalClusterableObjectMeta>,
mut light_meta: ResMut<LightMeta>,
views: Query<(
Entity,
&ExtractedView,
&ExtractedClusterConfig,
Option<&RenderLayers>,
)>,
views: Query<
(
Entity,
&ExtractedView,
&ExtractedClusterConfig,
Option<&RenderLayers>,
),
With<Camera3d>,
>,
ambient_light: Res<AmbientLight>,
point_light_shadow_map: Res<PointLightShadowMap>,
directional_light_shadow_map: Res<DirectionalLightShadowMap>,
Expand Down

0 comments on commit ad4024e

Please sign in to comment.