Skip to main content

ExtractComponent

Trait ExtractComponent 

Source
pub trait ExtractComponent<F = ()>: SyncComponent<F> {
    type QueryData: ReadOnlyQueryData;
    type QueryFilter: QueryFilter;
    type Out: Bundle
       where <Self::Out as DynamicBundle>::Effect: NoBundleEffect;

    // Required method
    fn extract_component(
        item: <Self::QueryData as QueryData>::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. This functionality is enabled by adding ExtractComponentPlugin with the component type.

The Out type is defined in SyncComponent.

The marker type F is only used as a way to bypass the orphan rules. To implement the trait for a foreign type you can use a local type as the marker, e.g. the type of the plugin that calls ExtractComponentPlugin.

Required Associated Types§

Source

type QueryData: ReadOnlyQueryData

ECS ReadOnlyQueryData to fetch the components to extract.

Source

type QueryFilter: QueryFilter

Filters the entities with additional constraints.

Source

type Out: Bundle where <Self::Out as DynamicBundle>::Effect: NoBundleEffect

The output from extraction, i.e. ExtractComponent::extract_component.

The output components won’t be removed automatically from the render world if the implementing component is removed, unless you set them in the SyncComponent::Target.

Required Methods§

Source

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

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

Returning None based on the queried item will remove the SyncComponent::Target from the entity in the render world.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl ExtractComponent for AutoExposure

Source§

impl ExtractComponent for Bloom

Source§

type QueryData = (&'static Bloom, &'static Camera)

Source§

type QueryFilter = With<Hdr>

Source§

type Out = (Bloom, BloomUniforms)

Source§

impl ExtractComponent for Camera2d

Source§

impl ExtractComponent for Camera3d

Source§

impl ExtractComponent for CameraMainTextureUsages

Source§

impl ExtractComponent for ChromaticAberration

Source§

impl ExtractComponent for ContactShadows

Source§

impl ExtractComponent for DebandDither

Source§

impl ExtractComponent for DistanceFog

Source§

impl ExtractComponent for LensDistortion

Source§

impl ExtractComponent for MotionBlur

Source§

type QueryData = &'static MotionBlur

Source§

type QueryFilter = With<Camera>

Source§

type Out = MotionBlurUniform

Source§

impl ExtractComponent for Msaa
where Msaa: Clone,

Source§

impl ExtractComponent for NoBackgroundMotionVectors

Source§

impl ExtractComponent for OcclusionCulling

Source§

impl ExtractComponent for OrderIndependentTransparencySettings

Source§

impl ExtractComponent for PbrDeferredLightingDepthId

Source§

impl ExtractComponent for Readback
where Readback: Clone,

Source§

impl ExtractComponent for ScreenSpaceAmbientOcclusion

Source§

impl ExtractComponent for ScreenSpaceReflections

Source§

impl ExtractComponent for ScreenSpaceTransmission

Source§

impl ExtractComponent for Tonemapping

Source§

impl ExtractComponent for Vignette