Skip to content

Commit

Permalink
Fix post processing example to only run effect on camera with setting…
Browse files Browse the repository at this point in the history
…s component (#10560)

# Objective

- The example says it will only run on a camera with the
`PostProcessingSettings` component but the node never filters it.

## Solution

- Add the component to the `ViewQuery`

closes: #10541
  • Loading branch information
IceSentry authored Nov 14, 2023
1 parent 56d8a0e commit b1fd9ed
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions examples/shader/post_processing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ impl ViewNode for PostProcessNode {
// but it's not a normal system so we need to define it manually.
//
// This query will only run on the view entity
type ViewQuery = &'static ViewTarget;
type ViewQuery = (
&'static ViewTarget,
// This makes sure the node only runs on cameras with the PostProcessSettings component
&'static PostProcessSettings,
);

// Runs the node logic
// This is where you encode draw commands.
Expand All @@ -136,7 +140,7 @@ impl ViewNode for PostProcessNode {
&self,
_graph: &mut RenderGraphContext,
render_context: &mut RenderContext,
view_target: QueryItem<Self::ViewQuery>,
(view_target, _post_process_settings): QueryItem<Self::ViewQuery>,
world: &World,
) -> Result<(), NodeRunError> {
// Get the pipeline resource that contains the global data we need
Expand Down

0 comments on commit b1fd9ed

Please sign in to comment.