use bevy::{asset::AsAssetId, prelude::*, render::extract_component::ExtractComponent};
#[derive(Component, Clone, Debug, Default, Reflect, ExtractComponent)]
pub struct LightOccluder2d {
pub occluder_mask: Handle<Image>,
}
impl LightOccluder2d {
pub fn new(occluder_mask: Handle<Image>) -> Self {
Self { occluder_mask }
}
}
impl From<LightOccluder2d> for AssetId<Image> {
fn from(material: LightOccluder2d) -> Self {
material.occluder_mask.id()
}
}
impl From<&LightOccluder2d> for AssetId<Image> {
fn from(material: &LightOccluder2d) -> Self {
material.occluder_mask.id()
}
}
impl AsAssetId for LightOccluder2d {
type Asset = Image;
fn as_asset_id(&self) -> AssetId<Self::Asset> {
self.occluder_mask.id()
}
}