-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
192 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use bevy_app::App; | ||
use bevy_ecs::world::FromWorld; | ||
|
||
use super::{Node, RenderGraph}; | ||
|
||
/// Utility function to add a [`Node`] to the [`RenderGraph`] | ||
/// * Create the [`Node`] using the [`FromWorld`] implementation | ||
/// * Add it to the graph | ||
/// * Automatically add the required node edges based on the given ordering | ||
pub fn add_node<T: Node + FromWorld>( | ||
render_app: &mut App, | ||
sub_graph_name: &'static str, | ||
node_name: &'static str, | ||
edges: &[&'static str], | ||
) { | ||
let node = T::from_world(&mut render_app.world); | ||
let mut render_graph = render_app.world.resource_mut::<RenderGraph>(); | ||
|
||
let graph = render_graph.get_sub_graph_mut(sub_graph_name).unwrap(); | ||
graph.add_node(node_name, node); | ||
graph.add_node_edges(edges); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.