Skip to main content

wde_pbr/deferred/
cast_shadow.rs

1use bevy::prelude::*;
2use wde_renderer::prelude::*;
3
4/// Marker component that makes an entity cast shadows from the directional sun light.
5/// Add this to any entity that also has [`PbrBatchesMarker`](crate::deferred::PbrBatchesMarker).
6#[derive(Component, Default, Reflect, Clone)]
7#[reflect(Component)]
8pub struct CastShadow;
9impl SyncComponent for CastShadow {
10    type Target = Self;
11}
12impl ExtractComponent for CastShadow {
13    type QueryData = ();
14    type QueryFilter = With<CastShadow>;
15    type Out = Self;
16
17    fn extract_component(_item: bevy::ecs::query::QueryItem<'_, '_, ()>) -> Option<Self::Out> {
18        Some(CastShadow)
19    }
20}
21
22pub struct CastShadowPlugin;
23impl Plugin for CastShadowPlugin {
24    fn build(&self, app: &mut App) {
25        app.register_type::<CastShadow>()
26            .add_plugins(ExtractComponentPlugin::<CastShadow>::default());
27    }
28}