bevy/crates/bevy_core_pipeline/src
Torstein Grindvik 67aa2953d0 Extract component derive (#7399)
# Objective

In simple cases we might want to derive the `ExtractComponent` trait.
This adds symmetry to the existing `ExtractResource` derive.

## Solution

Add an implementation of `#[derive(ExtractComponent)]`.
The implementation is adapted from the existing `ExtractResource` derive macro.

Additionally, there is an attribute called `extract_component_filter`. This allows specifying a query filter type used when extracting.
If not specified, no filter (equal to `()`) is used.

So:

```rust
#[derive(Component, Clone, ExtractComponent)]
#[extract_component_filter(With<Fuel>)]
pub struct Car {
    pub wheels: usize,
}
```

would expand to (a bit cleaned up here):

```rust
impl ExtractComponent for Car
{
    type Query = &'static Self;
    type Filter = With<Fuel>;
    type Out = Self;
    fn extract_component(item: QueryItem<'_, Self::Query>) -> Option<Self::Out> {
        Some(item.clone())
    }
}
```

---

## Changelog

- Added the ability to `#[derive(ExtractComponent)]` with an optional filter.
2023-01-30 18:12:16 +00:00
..
bloom Wgpu 0.15 (#7356) 2023-01-29 20:27:30 +00:00
core_2d Extract component derive (#7399) 2023-01-30 18:12:16 +00:00
core_3d Extract component derive (#7399) 2023-01-30 18:12:16 +00:00
fullscreen_vertex_shader separate tonemapping and upscaling passes (#3425) 2022-10-26 20:13:59 +00:00
fxaa Extract component derive (#7399) 2023-01-30 18:12:16 +00:00
prepass Move prepass functions to prepass_utils (#7354) 2023-01-24 20:36:40 +00:00
tonemapping Extract component derive (#7399) 2023-01-30 18:12:16 +00:00
upscaling Support recording multiple CommandBuffers in RenderContext (#7248) 2023-01-22 00:21:55 +00:00
clear_color.rs Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00
lib.rs Add depth and normal prepass (#6284) 2023-01-19 22:11:13 +00:00