1- use crate :: {
2- environment_map:: RenderViewEnvironmentMaps , MeshPipeline , MeshViewBindGroup ,
3- ScreenSpaceAmbientOcclusionSettings , ViewLightProbesUniformOffset ,
4- } ;
1+ use crate :: { MeshPipeline , MeshViewBindGroup , ScreenSpaceAmbientOcclusionSettings } ;
52use bevy_app:: prelude:: * ;
63use bevy_asset:: { load_internal_asset, Handle } ;
74use bevy_core_pipeline:: {
@@ -17,17 +14,25 @@ use bevy_render::{
1714 extract_component:: {
1815 ComponentUniforms , ExtractComponent , ExtractComponentPlugin , UniformComponentPlugin ,
1916 } ,
20- render_graph:: { NodeRunError , RenderGraphApp , RenderGraphContext , ViewNode , ViewNodeRunner } ,
21- render_resource:: binding_types:: uniform_buffer,
22- render_resource:: * ,
17+ render_asset:: RenderAssets ,
18+ render_graph:: { NodeRunError , RenderGraphContext , ViewNode , ViewNodeRunner } ,
19+ render_resource:: {
20+ binding_types:: uniform_buffer, Operations , PipelineCache , RenderPassDescriptor ,
21+ } ,
2322 renderer:: { RenderContext , RenderDevice } ,
24- texture:: BevyDefault ,
25- view:: { ExtractedView , ViewTarget , ViewUniformOffset } ,
26- Render , RenderApp , RenderSet ,
23+ texture:: Image ,
24+ view:: { ViewTarget , ViewUniformOffset } ,
25+ Render , RenderSet ,
26+ } ;
27+
28+ use bevy_render:: {
29+ render_graph:: RenderGraphApp , render_resource:: * , texture:: BevyDefault , view:: ExtractedView ,
30+ RenderApp ,
2731} ;
2832
2933use crate :: {
30- MeshPipelineKey , ShadowFilteringMethod , ViewFogUniformOffset , ViewLightsUniformOffset ,
34+ EnvironmentMapLight , MeshPipelineKey , ShadowFilteringMethod , ViewFogUniformOffset ,
35+ ViewLightsUniformOffset ,
3136} ;
3237
3338pub struct DeferredPbrLightingPlugin ;
@@ -146,7 +151,6 @@ impl ViewNode for DeferredOpaquePass3dPbrLightingNode {
146151 & ' static ViewUniformOffset ,
147152 & ' static ViewLightsUniformOffset ,
148153 & ' static ViewFogUniformOffset ,
149- & ' static ViewLightProbesUniformOffset ,
150154 & ' static MeshViewBindGroup ,
151155 & ' static ViewTarget ,
152156 & ' static DeferredLightingIdDepthTexture ,
@@ -161,7 +165,6 @@ impl ViewNode for DeferredOpaquePass3dPbrLightingNode {
161165 view_uniform_offset,
162166 view_lights_offset,
163167 view_fog_offset,
164- view_light_probes_offset,
165168 mesh_view_bind_group,
166169 target,
167170 deferred_lighting_id_depth_texture,
@@ -215,7 +218,6 @@ impl ViewNode for DeferredOpaquePass3dPbrLightingNode {
215218 view_uniform_offset. offset ,
216219 view_lights_offset. offset ,
217220 view_fog_offset. offset ,
218- * * view_light_probes_offset,
219221 ] ,
220222 ) ;
221223 render_pass. set_bind_group ( 1 , & bind_group_1, & [ ] ) ;
@@ -401,27 +403,28 @@ pub fn prepare_deferred_lighting_pipelines(
401403 & ExtractedView ,
402404 Option < & Tonemapping > ,
403405 Option < & DebandDither > ,
406+ Option < & EnvironmentMapLight > ,
404407 Option < & ShadowFilteringMethod > ,
405408 Has < ScreenSpaceAmbientOcclusionSettings > ,
406409 (
407410 Has < NormalPrepass > ,
408411 Has < DepthPrepass > ,
409412 Has < MotionVectorPrepass > ,
410413 ) ,
411- Has < RenderViewEnvironmentMaps > ,
412414 ) ,
413415 With < DeferredPrepass > ,
414416 > ,
417+ images : Res < RenderAssets < Image > > ,
415418) {
416419 for (
417420 entity,
418421 view,
419422 tonemapping,
420423 dither,
424+ environment_map,
421425 shadow_filter_method,
422426 ssao,
423427 ( normal_prepass, depth_prepass, motion_vector_prepass) ,
424- has_environment_maps,
425428 ) in & views
426429 {
427430 let mut view_key = MeshPipelineKey :: from_hdr ( view. hdr ) ;
@@ -468,10 +471,11 @@ pub fn prepare_deferred_lighting_pipelines(
468471 view_key |= MeshPipelineKey :: SCREEN_SPACE_AMBIENT_OCCLUSION ;
469472 }
470473
471- // We don't need to check to see whether the environment map is loaded
472- // because [`gather_light_probes`] already checked that for us before
473- // adding the [`RenderViewEnvironmentMaps`] component.
474- if has_environment_maps {
474+ let environment_map_loaded = match environment_map {
475+ Some ( environment_map) => environment_map. is_loaded ( & images) ,
476+ None => false ,
477+ } ;
478+ if environment_map_loaded {
475479 view_key |= MeshPipelineKey :: ENVIRONMENT_MAP ;
476480 }
477481
0 commit comments