1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45


use bevy::core_pipeline::core_3d::graph;
// use bevy::core_pipeline::core_3d:;
// use bevy::core_pipeline::prelude;
use bevy::prelude::*;

use bevy::render::render_graph::{Node, *};

pub fn insert_final_node<T>(
	render_app: &mut App,
	node: T,
	name: &'static str,
	in_view: &'static str,
) where
	T: Node,
{
	let mut render_graph = render_app.world.resource_mut::<RenderGraph>();

	let draw_3d_graph = render_graph.get_sub_graph_mut(graph::NAME).unwrap();
	draw_3d_graph.add_node(name, node);
	// graph_3d.add_node(name, EmptyNode);


	//what does this do?
	let input_node_id = draw_3d_graph.input_node().id;
	draw_3d_graph.add_slot_edge(
		input_node_id,
		graph::input::VIEW_ENTITY,
		name,
		in_view,
	);


	draw_3d_graph
		.add_node_edge(graph::node::END_MAIN_PASS_POST_PROCESSING, name);
	draw_3d_graph.add_node_edge(name, graph::node::UPSCALING);

	draw_3d_graph
		.remove_node_edge(
			graph::node::END_MAIN_PASS_POST_PROCESSING,
			graph::node::UPSCALING,
		)
		.unwrap();
}