This commit is contained in:
1 parent
2fa64106c8
commit
2054fa2558
21 files changed
+711
-159
No files matched your search
@@ -138,13 +138,6 @@ pub fn flush_level_object_hydration(world: &mut World) {
|
||||
}
|
||||
}
|
||||
|
||||
let lights: Vec<(Entity, crate::LightDesc)> = world
|
||||
.query_filtered::<(Entity, &crate::LightDesc, Option<&InspectorOrder>), With<LevelObject>>()
|
||||
.iter(world)
|
||||
.filter(|(_, _, order)| inspector_component_active(*order, COMPONENT_LIGHT_DESC))
|
||||
.map(|(entity, light, _)| (entity, light.clone()))
|
||||
.collect();
|
||||
|
||||
let visibility_targets: Vec<(Entity, EditorVisibility)> = world
|
||||
.query_filtered::<(Entity, &EditorVisibility), With<LevelObject>>()
|
||||
.iter(world)
|
||||
@@ -155,6 +148,22 @@ pub fn flush_level_object_hydration(world: &mut World) {
|
||||
.get_resource::<settings::ProjectSettings>()
|
||||
.map(|s| s.rendering.clone())
|
||||
.unwrap_or_default();
|
||||
let profile = world
|
||||
.get_resource::<settings::ActiveCameraRenderProfile>()
|
||||
.cloned();
|
||||
let caps = world
|
||||
.get_resource::<settings::RenderingCapabilities>()
|
||||
.cloned();
|
||||
|
||||
let lights: Vec<(Entity, crate::LightDesc)> = world
|
||||
.query_filtered::<(Entity, &crate::LightDesc, Option<&InspectorOrder>), With<LevelObject>>()
|
||||
.iter(world)
|
||||
.filter(|(_, light, order)| {
|
||||
inspector_component_active(*order, COMPONENT_LIGHT_DESC)
|
||||
&& !lights::local_light_disabled_in_solari(light, profile.as_ref(), caps.as_ref())
|
||||
})
|
||||
.map(|(entity, light, _)| (entity, light.clone()))
|
||||
.collect();
|
||||
|
||||
let mut state: SystemState<(
|
||||
Commands,
|
||||
@@ -245,6 +254,65 @@ mod tests {
|
||||
assert!(app.world().get::<PointLight>(entity).is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flush_hydration_skips_point_light_when_solari_is_active() {
|
||||
let mut app = App::new();
|
||||
app.add_plugins(MinimalPlugins);
|
||||
app.add_plugins(AssetPlugin::default());
|
||||
app.add_plugins(bevy::pbr::MaterialPlugin::<StandardMaterial>::default());
|
||||
app.init_asset::<Mesh>();
|
||||
app.world_mut()
|
||||
.insert_resource(settings::ActiveCameraRenderProfile {
|
||||
gi_path: settings::GiPath::SolariDeferred,
|
||||
..Default::default()
|
||||
});
|
||||
app.world_mut()
|
||||
.insert_resource(settings::RenderingCapabilities {
|
||||
rt_supported: true,
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
let entity = app
|
||||
.world_mut()
|
||||
.spawn((LevelObject, LightDesc::for_kind(AuthoringLightKind::Point)))
|
||||
.id();
|
||||
|
||||
flush_level_object_hydration(app.world_mut());
|
||||
|
||||
assert!(app.world().get::<PointLight>(entity).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flush_hydration_keeps_directional_light_when_solari_is_active() {
|
||||
let mut app = App::new();
|
||||
app.add_plugins(MinimalPlugins);
|
||||
app.add_plugins(AssetPlugin::default());
|
||||
app.add_plugins(bevy::pbr::MaterialPlugin::<StandardMaterial>::default());
|
||||
app.init_asset::<Mesh>();
|
||||
app.world_mut()
|
||||
.insert_resource(settings::ActiveCameraRenderProfile {
|
||||
gi_path: settings::GiPath::SolariDeferred,
|
||||
..Default::default()
|
||||
});
|
||||
app.world_mut()
|
||||
.insert_resource(settings::RenderingCapabilities {
|
||||
rt_supported: true,
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
let entity = app
|
||||
.world_mut()
|
||||
.spawn((
|
||||
LevelObject,
|
||||
LightDesc::for_kind(AuthoringLightKind::Directional),
|
||||
))
|
||||
.id();
|
||||
|
||||
flush_level_object_hydration(app.world_mut());
|
||||
|
||||
assert!(app.world().get::<DirectionalLight>(entity).is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flush_hydration_skips_inactive_light_desc() {
|
||||
let mut app = App::new();
|
||||
|
||||
Reference in new issue
Block a user