[Merged by Bors] - Add ClearColor Resource to Pipelined Renderer#2631
[Merged by Bors] - Add ClearColor Resource to Pipelined Renderer#2631zicklag wants to merge 1 commit intobevyengine:pipelined-renderingfrom
Conversation
a4945ff to
08eb731
Compare
pipelined/bevy_render2/src/lib.rs
Outdated
|
|
||
| fn extract(app_world: &mut World, render_app: &mut App) { | ||
| // Update the render world clear color resource if it was added or changed in the app world | ||
| if app_world.is_resource_added::<ClearColor>() || app_world.is_resource_changed::<ClearColor>() |
There was a problem hiding this comment.
I don't think this should be updated here / hard coded in the "extract step execution logic". I think ClearColor should probably live in bevy_core_pipeline as it is behavior specific to "bevy's core render pipeline", not core renderer logic. It should just be another "extract stage system". That should also resolve the change tracking issue.
You should only need to query for Changed. "added" things also flip the "changed" flag.
There was a problem hiding this comment.
OK, cool, that makes sense. I'll update as soon as I get back to this. 👍
There was a problem hiding this comment.
Fixed it. I like that much better!
I'm really liking the extract →prepare →queue rendering model. Very nice.
bd7e8be to
b36ab35
Compare
|
bors r+ |
# Objective
- Allow the user to set the clear color when using the pipelined renderer
## Solution
- Add a `ClearColor` resource that can be added to the world to configure the clear color
## Remaining Issues
Currently the `ClearColor` resource is cloned from the app world to the render world every frame. There are two ways I can think of around this:
1. Figure out why `app_world.is_resource_changed::<ClearColor>()` always returns `true` in the `extract` step and fix it so that we are only updating the resource when it changes
2. Require the users to add the `ClearColor` resource to the render sub-app instead of the parent app. This is currently sub-optimal until we have labled sub-apps, and probably a helper funciton on `App` such as `app.with_sub_app(RenderApp, |app| { ... })`. Even if we had that, I think it would be more than we want the user to have to think about. They shouldn't have to know about the render sub-app I don't think.
I think the first option is the best, but I could really use some help figuring out the nuance of why `is_resource_changed` is always returning true in that context.
|
Pull request successfully merged into pipelined-rendering. Build succeeded: |
Objective
Solution
ClearColorresource that can be added to the world to configure the clear colorRemaining Issues
Currently the
ClearColorresource is cloned from the app world to the render world every frame. There are two ways I can think of around this:app_world.is_resource_changed::<ClearColor>()always returnstruein theextractstep and fix it so that we are only updating the resource when it changesClearColorresource to the render sub-app instead of the parent app. This is currently sub-optimal until we have labled sub-apps, and probably a helper funciton onAppsuch asapp.with_sub_app(RenderApp, |app| { ... }). Even if we had that, I think it would be more than we want the user to have to think about. They shouldn't have to know about the render sub-app I don't think.I think the first option is the best, but I could really use some help figuring out the nuance of why
is_resource_changedis always returning true in that context.