@@ -122,6 +122,7 @@ pub mod graph {
122
122
}
123
123
}
124
124
125
+ pub use crate :: cascade:: { CascadeShadowConfig , CascadeShadowConfigBuilder , Cascades } ;
125
126
use crate :: { deferred:: DeferredPbrLightingPlugin , graph:: NodePbr } ;
126
127
use bevy_app:: prelude:: * ;
127
128
use bevy_asset:: { AssetApp , AssetPath , Assets , Handle } ;
@@ -130,19 +131,16 @@ use bevy_ecs::prelude::*;
130
131
use bevy_image:: Image ;
131
132
use bevy_render:: {
132
133
alpha:: AlphaMode ,
133
- camera:: { sort_cameras, CameraUpdateSystems , Projection } ,
134
+ camera:: { sort_cameras, Projection } ,
134
135
extract_component:: ExtractComponentPlugin ,
135
136
extract_resource:: ExtractResourcePlugin ,
136
137
load_shader_library,
137
138
render_graph:: RenderGraph ,
138
139
render_resource:: ShaderRef ,
139
140
sync_component:: SyncComponentPlugin ,
140
- view:: VisibilitySystems ,
141
141
ExtractSchedule , Render , RenderApp , RenderDebugFlags , RenderSystems ,
142
142
} ;
143
143
144
- use bevy_transform:: TransformSystems ;
145
-
146
144
use std:: path:: PathBuf ;
147
145
148
146
fn shader_ref ( path : PathBuf ) -> ShaderRef {
@@ -205,22 +203,8 @@ impl Plugin for PbrPlugin {
205
203
load_shader_library ! ( app, "meshlet/dummy_visibility_buffer_resolve.wgsl" ) ;
206
204
207
205
app. register_asset_reflect :: < StandardMaterial > ( )
208
- . register_type :: < AmbientLight > ( )
209
- . register_type :: < CascadeShadowConfig > ( )
210
- . register_type :: < Cascades > ( )
211
206
. register_type :: < ClusterConfig > ( )
212
- . register_type :: < DirectionalLight > ( )
213
- . register_type :: < DirectionalLightShadowMap > ( )
214
- . register_type :: < NotShadowCaster > ( )
215
- . register_type :: < NotShadowReceiver > ( )
216
- . register_type :: < PointLight > ( )
217
- . register_type :: < PointLightShadowMap > ( )
218
- . register_type :: < SpotLight > ( )
219
- . register_type :: < ShadowFilteringMethod > ( )
220
- . init_resource :: < AmbientLight > ( )
221
207
. init_resource :: < GlobalVisibleClusterableObjects > ( )
222
- . init_resource :: < DirectionalLightShadowMap > ( )
223
- . init_resource :: < PointLightShadowMap > ( )
224
208
. register_type :: < DefaultOpaqueRendererMethod > ( )
225
209
. init_resource :: < DefaultOpaqueRendererMethod > ( )
226
210
. add_plugins ( (
@@ -243,7 +227,7 @@ impl Plugin for PbrPlugin {
243
227
ExtractComponentPlugin :: < ShadowFilteringMethod > :: default ( ) ,
244
228
LightmapPlugin ,
245
229
LightProbePlugin ,
246
- PbrProjectionPlugin ,
230
+ LightPlugin ,
247
231
GpuMeshPreprocessPlugin {
248
232
use_gpu_instance_buffer_builder : self . use_gpu_instance_buffer_builder ,
249
233
} ,
@@ -266,64 +250,6 @@ impl Plugin for PbrPlugin {
266
250
SimulationLightSystems :: AssignLightsToClusters ,
267
251
)
268
252
. chain ( ) ,
269
- )
270
- . configure_sets (
271
- PostUpdate ,
272
- SimulationLightSystems :: UpdateDirectionalLightCascades
273
- . ambiguous_with ( SimulationLightSystems :: UpdateDirectionalLightCascades ) ,
274
- )
275
- . configure_sets (
276
- PostUpdate ,
277
- SimulationLightSystems :: CheckLightVisibility
278
- . ambiguous_with ( SimulationLightSystems :: CheckLightVisibility ) ,
279
- )
280
- . add_systems (
281
- PostUpdate ,
282
- (
283
- add_clusters
284
- . in_set ( SimulationLightSystems :: AddClusters )
285
- . after ( CameraUpdateSystems ) ,
286
- assign_objects_to_clusters
287
- . in_set ( SimulationLightSystems :: AssignLightsToClusters )
288
- . after ( TransformSystems :: Propagate )
289
- . after ( VisibilitySystems :: CheckVisibility )
290
- . after ( CameraUpdateSystems ) ,
291
- clear_directional_light_cascades
292
- . in_set ( SimulationLightSystems :: UpdateDirectionalLightCascades )
293
- . after ( TransformSystems :: Propagate )
294
- . after ( CameraUpdateSystems ) ,
295
- update_directional_light_frusta
296
- . in_set ( SimulationLightSystems :: UpdateLightFrusta )
297
- // This must run after CheckVisibility because it relies on `ViewVisibility`
298
- . after ( VisibilitySystems :: CheckVisibility )
299
- . after ( TransformSystems :: Propagate )
300
- . after ( SimulationLightSystems :: UpdateDirectionalLightCascades )
301
- // We assume that no entity will be both a directional light and a spot light,
302
- // so these systems will run independently of one another.
303
- // FIXME: Add an archetype invariant for this https://github.com/bevyengine/bevy/issues/1481.
304
- . ambiguous_with ( update_spot_light_frusta) ,
305
- update_point_light_frusta
306
- . in_set ( SimulationLightSystems :: UpdateLightFrusta )
307
- . after ( TransformSystems :: Propagate )
308
- . after ( SimulationLightSystems :: AssignLightsToClusters ) ,
309
- update_spot_light_frusta
310
- . in_set ( SimulationLightSystems :: UpdateLightFrusta )
311
- . after ( TransformSystems :: Propagate )
312
- . after ( SimulationLightSystems :: AssignLightsToClusters ) ,
313
- (
314
- check_dir_light_mesh_visibility,
315
- check_point_light_mesh_visibility,
316
- )
317
- . in_set ( SimulationLightSystems :: CheckLightVisibility )
318
- . after ( VisibilitySystems :: CalculateBounds )
319
- . after ( TransformSystems :: Propagate )
320
- . after ( SimulationLightSystems :: UpdateLightFrusta )
321
- // NOTE: This MUST be scheduled AFTER the core renderer visibility check
322
- // because that resets entity `ViewVisibility` for the first view
323
- // which would override any results from this otherwise
324
- . after ( VisibilitySystems :: CheckVisibility )
325
- . before ( VisibilitySystems :: MarkNewlyHiddenEntitiesInvisible ) ,
326
- ) ,
327
253
) ;
328
254
329
255
if self . add_default_deferred_lighting_plugin {
@@ -401,17 +327,3 @@ impl Plugin for PbrPlugin {
401
327
app. insert_resource ( global_cluster_settings) ;
402
328
}
403
329
}
404
-
405
- /// Camera projection PBR functionality.
406
- #[ derive( Default ) ]
407
- pub struct PbrProjectionPlugin ;
408
- impl Plugin for PbrProjectionPlugin {
409
- fn build ( & self , app : & mut App ) {
410
- app. add_systems (
411
- PostUpdate ,
412
- build_directional_light_cascades
413
- . in_set ( SimulationLightSystems :: UpdateDirectionalLightCascades )
414
- . after ( clear_directional_light_cascades) ,
415
- ) ;
416
- }
417
- }
0 commit comments