You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding `Node`s to the `RenderGraph` requires a lot of boilerplate. In this release, we tried to reduce this for most common operations. No existing APIs have been removed, these are only helpers made to simplify working with the `RenderGraph`.
480
+
481
+
We added the `RenderGraphApp` trait to the `App`. This trait contains various helper functions to reduce the boilerplate with adding nodes and edges to a graph.
482
+
483
+
Another pain point of `RenderGraph``Node`s is passing the view entity through each node and manually updating the query on that view. To fix this we added a `ViewNode` trait and `ViewNodeRunner` that will automatically take care of running the `Query` on the view entity. We also made the view entity a first-class concept of the `RenderGraph`. So you can now access the view entity the graph is currently running on from anywhere in the graph without passing it around between each `Node`.
484
+
485
+
All these new APIs assume that your Node implements `FromWorld` or `Default`.
486
+
487
+
Here's what it looks like in practice for the `BloomNode`:
488
+
489
+
```rust
490
+
// Adding the node to the 3d graph
491
+
render_app
492
+
// To run a ViewNode you need to create a ViewNodeRunner
// This can replace your `impl Node` block of any existing `Node` that operated on a view
502
+
implViewNodeforBloomNode {
503
+
// You need to define your view query as an associated type
504
+
typeViewQuery= (
505
+
&'staticExtractedCamera,
506
+
&'staticViewTarget,
507
+
&'staticBloomSettings,
508
+
);
509
+
// You don't need Node::input() or Node::update() anymore. If you still need these they are still available but they have an empty default implementation.
510
+
fnrun(
511
+
&self,
512
+
graph:&mutRenderGraphContext,
513
+
render_context:&mutRenderContext,
514
+
// This is the result of your query. If it is empty the run function will not be called
0 commit comments