Skip to content

Commit 67b4ecd

Browse files
authored
Use bevy_light in pbr instead of bevy_pbr::light re-export + add bevy_light prelude (#20488)
# Objective - Prepare for removing re-exports ## Solution - title ## Testing - cargo check --examples
1 parent ce416c3 commit 67b4ecd

File tree

15 files changed

+41
-26
lines changed

15 files changed

+41
-26
lines changed

benches/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ bevy_picking = { path = "../crates/bevy_picking", features = [
2121
"bevy_mesh_picking_backend",
2222
] }
2323
bevy_reflect = { path = "../crates/bevy_reflect", features = ["functions"] }
24+
bevy_camera = { path = "../crates/bevy_camera" }
2425
bevy_render = { path = "../crates/bevy_render" }
2526
bevy_tasks = { path = "../crates/bevy_tasks" }
2627
bevy_platform = { path = "../crates/bevy_platform", default-features = false, features = [

benches/benches/bevy_render/render_layers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use core::hint::black_box;
22

33
use criterion::{criterion_group, Criterion};
44

5-
use bevy_render::view::RenderLayers;
5+
use bevy_camera::visibility::RenderLayers;
66

77
fn render_layers(c: &mut Criterion) {
88
c.bench_function("layers_intersect", |b| {

crates/bevy_core_pipeline/src/motion_blur/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ pub mod pipeline;
4747
/// camera.
4848
///
4949
/// ```
50-
/// # use bevy_core_pipeline::{core_3d::Camera3d, motion_blur::MotionBlur};
50+
/// # use bevy_core_pipeline::motion_blur::MotionBlur;
51+
/// # use bevy_camera::Camera3d;
5152
/// # use bevy_ecs::prelude::*;
5253
/// # fn test(mut commands: Commands) {
5354
/// commands.spawn((

crates/bevy_gizmos/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ bevy_pbr = { path = "../bevy_pbr", version = "0.17.0-dev", optional = true }
1919
bevy_sprite = { path = "../bevy_sprite", version = "0.17.0-dev", optional = true }
2020
bevy_app = { path = "../bevy_app", version = "0.17.0-dev" }
2121
bevy_camera = { path = "../bevy_camera", version = "0.17.0-dev" }
22+
bevy_light = { path = "../bevy_light", version = "0.17.0-dev" }
2223
bevy_color = { path = "../bevy_color", version = "0.17.0-dev" }
2324
bevy_ecs = { path = "../bevy_ecs", version = "0.17.0-dev" }
2425
bevy_image = { path = "../bevy_image", version = "0.17.0-dev" }

crates/bevy_gizmos/src/light.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ use bevy_ecs::{
1717
schedule::IntoScheduleConfigs,
1818
system::{Query, Res},
1919
};
20+
use bevy_light::{DirectionalLight, PointLight, SpotLight};
2021
use bevy_math::{
2122
ops,
2223
primitives::{Cone, Sphere},
2324
Isometry3d, Quat, Vec3,
2425
};
25-
use bevy_pbr::{DirectionalLight, PointLight, SpotLight};
2626
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
2727
use bevy_transform::{components::GlobalTransform, TransformSystems};
2828

crates/bevy_internal/src/prelude.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ pub use crate::image::prelude::*;
2121
#[cfg(feature = "bevy_mesh")]
2222
pub use crate::mesh::prelude::*;
2323

24+
#[doc(hidden)]
25+
#[cfg(feature = "bevy_light")]
26+
pub use crate::light::prelude::*;
27+
2428
#[doc(hidden)]
2529
#[cfg(feature = "bevy_camera")]
2630
pub use crate::camera::prelude::*;

crates/bevy_light/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ pub use directional_light::{
4848
DirectionalLightTexture,
4949
};
5050

51+
/// The light prelude.
52+
///
53+
/// This includes the most common types in this crate, re-exported for your convenience.
54+
pub mod prelude {
55+
#[doc(hidden)]
56+
pub use crate::{
57+
light_consts, AmbientLight, DirectionalLight, EnvironmentMapLight,
58+
GeneratedEnvironmentMapLight, LightProbe, PointLight, SpotLight,
59+
};
60+
}
61+
5162
use crate::directional_light::validate_shadow_map_size;
5263

5364
/// Constants for operating with the light units: lumens, and lux.

crates/bevy_pbr/src/deferred/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use crate::{
2-
graph::NodePbr, irradiance_volume::IrradianceVolume, MeshPipeline, MeshViewBindGroup,
3-
RenderViewLightProbes, ScreenSpaceAmbientOcclusion, ScreenSpaceReflectionsUniform,
4-
ViewEnvironmentMapUniformOffset, ViewLightProbesUniformOffset,
5-
ViewScreenSpaceReflectionsUniformOffset, TONEMAPPING_LUT_SAMPLER_BINDING_INDEX,
6-
TONEMAPPING_LUT_TEXTURE_BINDING_INDEX,
2+
graph::NodePbr, MeshPipeline, MeshViewBindGroup, RenderViewLightProbes,
3+
ScreenSpaceAmbientOcclusion, ScreenSpaceReflectionsUniform, ViewEnvironmentMapUniformOffset,
4+
ViewLightProbesUniformOffset, ViewScreenSpaceReflectionsUniformOffset,
5+
TONEMAPPING_LUT_SAMPLER_BINDING_INDEX, TONEMAPPING_LUT_TEXTURE_BINDING_INDEX,
76
};
87
use crate::{DistanceFog, MeshPipelineKey, ViewFogUniformOffset, ViewLightsUniformOffset};
98
use bevy_app::prelude::*;
@@ -18,7 +17,7 @@ use bevy_core_pipeline::{
1817
};
1918
use bevy_ecs::{prelude::*, query::QueryItem};
2019
use bevy_image::BevyDefault as _;
21-
use bevy_light::{EnvironmentMapLight, ShadowFilteringMethod};
20+
use bevy_light::{EnvironmentMapLight, IrradianceVolume, ShadowFilteringMethod};
2221
use bevy_render::RenderStartup;
2322
use bevy_render::{
2423
diagnostic::RecordDiagnostics,

crates/bevy_pbr/src/light_probe/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use bevy_ecs::{
1616
system::{Commands, Local, Query, Res, ResMut},
1717
};
1818
use bevy_image::Image;
19-
use bevy_light::{EnvironmentMapLight, LightProbe};
19+
use bevy_light::{EnvironmentMapLight, IrradianceVolume, LightProbe};
2020
use bevy_math::{Affine3A, FloatOrd, Mat4, Vec3A, Vec4};
2121
use bevy_platform::collections::HashMap;
2222
use bevy_render::{
@@ -40,8 +40,6 @@ use crate::{
4040
generate::EnvironmentMapGenerationPlugin, light_probe::environment_map::EnvironmentMapIds,
4141
};
4242

43-
use self::irradiance_volume::IrradianceVolume;
44-
4543
pub mod environment_map;
4644
pub mod generate;
4745
pub mod irradiance_volume;

crates/bevy_pbr/src/meshlet/instance_manager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ use super::{meshlet_mesh_manager::MeshletMeshManager, MeshletMesh, MeshletMesh3d
22
use crate::DUMMY_MESH_MATERIAL;
33
use crate::{
44
meshlet::asset::MeshletAabb, MaterialBindingId, MeshFlags, MeshTransforms, MeshUniform,
5-
NotShadowCaster, NotShadowReceiver, PreviousGlobalTransform, RenderMaterialBindings,
6-
RenderMaterialInstances,
5+
PreviousGlobalTransform, RenderMaterialBindings, RenderMaterialInstances,
76
};
87
use bevy_asset::{AssetEvent, AssetServer, Assets, UntypedAssetId};
98
use bevy_camera::visibility::RenderLayers;
@@ -14,6 +13,7 @@ use bevy_ecs::{
1413
resource::Resource,
1514
system::{Local, Query, Res, ResMut, SystemState},
1615
};
16+
use bevy_light::{NotShadowCaster, NotShadowReceiver};
1717
use bevy_platform::collections::{HashMap, HashSet};
1818
use bevy_render::{render_resource::StorageBuffer, sync_world::MainEntity, MainWorld};
1919
use bevy_transform::components::GlobalTransform;

0 commit comments

Comments
 (0)