pub trait ExtractComponent: Component {
    type Query: WorldQuery + ReadOnlyWorldQuery;
    type Filter: WorldQuery + ReadOnlyWorldQuery;
    type Out: Bundle;

    // Required method
    fn extract_component(
        item: <Self::Query as WorldQuery>::Item<'_>
    ) -> Option<Self::Out>;
}
Expand description

Describes how a component gets extracted for rendering.

Therefore the component is transferred from the “app world” into the “render world” in the ExtractSchedule step.

Required Associated Types§

type Query: WorldQuery + ReadOnlyWorldQuery

ECS WorldQuery to fetch the components to extract.

type Filter: WorldQuery + ReadOnlyWorldQuery

Filters the entities with additional constraints.

type Out: Bundle

The output from extraction.

Returning None based on the queried item can allow early optimization, for example if there is an enabled: bool field on Self, or by only accepting values within certain thresholds.

The output may be different from the queried component. This can be useful for example if only a subset of the fields are useful in the render world.

Out has a Bundle trait bound instead of a Component trait bound in order to allow use cases such as tuples of components as output.

Required Methods§

fn extract_component( item: <Self::Query as WorldQuery>::Item<'_> ) -> Option<Self::Out>

Defines how the component is transferred into the “render world”.

Implementors§

§

impl ExtractComponent for DebandDitherwhere DebandDither: Clone,

§

impl ExtractComponent for Tonemappingwhere Tonemapping: Clone,

§

type Query = &'static Tonemapping

§

type Filter = With<Camera>

§

type Out = Tonemapping

§

impl ExtractComponent for BloomSettings

§

type Query = (&'static BloomSettings, &'static Camera)

§

type Filter = ()

§

type Out = (BloomSettings, BloomUniforms)

§

impl ExtractComponent for Camera2dwhere Camera2d: Clone,

§

type Query = &'static Camera2d

§

type Filter = With<Camera>

§

type Out = Camera2d

§

impl ExtractComponent for Camera3dwhere Camera3d: Clone,

§

type Query = &'static Camera3d

§

type Filter = With<Camera>

§

type Out = Camera3d

§

impl ExtractComponent for Fxaawhere Fxaa: Clone,

§

type Query = &'static Fxaa

§

type Filter = With<Camera>

§

type Out = Fxaa

§

impl ExtractComponent for EnvironmentMapLight

§

impl ExtractComponent for FogSettings

§

type Query = &'static FogSettings

§

type Filter = With<Camera>

§

type Out = FogSettings

§

impl ExtractComponent for Wireframewhere Wireframe: Clone,

§

type Query = &'static Wireframe

§

type Filter = ()

§

type Out = Wireframe

§

impl ExtractComponent for UiCameraConfigwhere UiCameraConfig: Clone,

§

impl<T> ExtractComponent for Handle<T>where T: Asset,

§

type Query = &'static Handle<T>

§

type Filter = ()

§

type Out = Handle<T>