@@ -16,7 +16,7 @@ use bevy_render::{
1616 ComponentUniforms , DynamicUniformIndex , ExtractComponentPlugin , UniformComponentPlugin ,
1717 } ,
1818 prelude:: Color ,
19- render_graph:: { Node , NodeRunError , RenderGraph , RenderGraphContext } ,
19+ render_graph:: { Node , NodeRunError , RenderGraphContext } ,
2020 render_resource:: * ,
2121 renderer:: { RenderContext , RenderDevice } ,
2222 texture:: { CachedTexture , TextureCache } ,
@@ -80,62 +80,24 @@ impl Plugin for BloomPlugin {
8080 render_app,
8181 core_3d:: graph:: NAME ,
8282 core_3d:: graph:: node:: BLOOM ,
83- core_3d:: graph:: input:: VIEW_ENTITY ,
84- BloomNode :: IN_VIEW ,
8583 & [
8684 core_3d:: graph:: node:: MAIN_PASS ,
8785 core_3d:: graph:: node:: BLOOM ,
8886 core_3d:: graph:: node:: TONEMAPPING ,
8987 ] ,
9088 ) ;
91- {
92- let bloom_node = BloomNode :: new ( & mut render_app. world ) ;
93- let mut graph = render_app. world . resource_mut :: < RenderGraph > ( ) ;
94- let draw_3d_graph = graph
95- . get_sub_graph_mut ( crate :: core_3d:: graph:: NAME )
96- . unwrap ( ) ;
97- draw_3d_graph. add_node ( core_3d:: graph:: node:: BLOOM , bloom_node) ;
98- // MAIN_PASS -> BLOOM -> TONEMAPPING
99- draw_3d_graph. add_node_edge (
100- crate :: core_3d:: graph:: node:: MAIN_PASS ,
101- core_3d:: graph:: node:: BLOOM ,
102- ) ;
103- draw_3d_graph. add_node_edge (
104- core_3d:: graph:: node:: BLOOM ,
105- crate :: core_3d:: graph:: node:: TONEMAPPING ,
106- ) ;
107- }
10889
10990 // Add bloom to the 2d render graph
11091 add_node :: < BloomNode > (
11192 render_app,
11293 core_2d:: graph:: NAME ,
11394 core_2d:: graph:: node:: BLOOM ,
114- core_2d:: graph:: input:: VIEW_ENTITY ,
115- BloomNode :: IN_VIEW ,
11695 & [
11796 core_2d:: graph:: node:: MAIN_PASS ,
11897 core_2d:: graph:: node:: BLOOM ,
11998 core_2d:: graph:: node:: TONEMAPPING ,
12099 ] ,
121100 ) ;
122- {
123- let bloom_node = BloomNode :: new ( & mut render_app. world ) ;
124- let mut graph = render_app. world . resource_mut :: < RenderGraph > ( ) ;
125- let draw_2d_graph = graph
126- . get_sub_graph_mut ( crate :: core_2d:: graph:: NAME )
127- . unwrap ( ) ;
128- draw_2d_graph. add_node ( core_2d:: graph:: node:: BLOOM , bloom_node) ;
129- // MAIN_PASS -> BLOOM -> TONEMAPPING
130- draw_2d_graph. add_node_edge (
131- crate :: core_2d:: graph:: node:: MAIN_PASS ,
132- core_2d:: graph:: node:: BLOOM ,
133- ) ;
134- draw_2d_graph. add_node_edge (
135- core_2d:: graph:: node:: BLOOM ,
136- crate :: core_2d:: graph:: node:: TONEMAPPING ,
137- ) ;
138- }
139101 }
140102}
141103
@@ -152,8 +114,8 @@ pub struct BloomNode {
152114 ) > ,
153115}
154116
155- impl BloomNode {
156- pub fn new ( world : & mut World ) -> Self {
117+ impl FromWorld for BloomNode {
118+ fn from_world ( world : & mut World ) -> Self {
157119 Self {
158120 view_query : QueryState :: new ( world) ,
159121 }
0 commit comments