use bevy::{
ecs::{bundle::Bundle, component::Component},
math::Vec2,
render::{
sync_world::SyncToRenderWorld,
view::{self, InheritedVisibility, ViewVisibility, Visibility, VisibilityClass},
},
transform::components::{GlobalTransform, Transform},
};
#[derive(Default, Component)]
#[require(SyncToRenderWorld, Transform, Visibility, VisibilityClass)]
#[component(on_add = view::add_visibility_class::<LightOccluder2d>)]
pub struct LightOccluder2d {
pub shape: LightOccluder2dShape,
}
pub enum LightOccluder2dShape {
Rectangle {
half_size: Vec2,
},
}
impl Default for LightOccluder2dShape {
fn default() -> Self {
Self::Rectangle {
half_size: Vec2::splat(0.0),
}
}
}
#[derive(Bundle, Default)]
#[deprecated(
since = "0.5.0",
note = "Use the `LightOccluder2d` component instead. Inserting `LightOccluder2d` will also insert the other components required automatically."
)]
pub struct LightOccluder2dBundle {
pub light_occluder: LightOccluder2d,
pub transform: Transform,
pub global_transform: GlobalTransform,
pub visibility: Visibility,
pub inherited_visibility: InheritedVisibility,
pub view_visibility: ViewVisibility,
}