use crate::light::Light;
use crate::property::table::{Properties, PropertyInfo, PropertyTable, PropertyVisitor};
pub(crate) static PROPERTIES: PropertyTable = PropertyTable::new(
&[
PropertyInfo::paint("anchor"),
PropertyInfo::paint("position"),
PropertyInfo::paint("color"),
PropertyInfo::paint("intensity"),
],
&[0, 2, 3, 1],
);
impl Properties for Light {
const TABLE: &'static PropertyTable = &PROPERTIES;
fn visit<V: PropertyVisitor<Self>>(slot: usize, visitor: V) -> Option<V::Output> {
Some(match slot {
0 => visitor.paint(|s| &s.properties.light_anchor, |s| &mut s.properties.light_anchor),
1 => visitor.paint(|s| &s.properties.light_position, |s| &mut s.properties.light_position),
2 => visitor.paint(|s| &s.properties.light_color, |s| &mut s.properties.light_color),
3 => visitor.paint(|s| &s.properties.light_intensity, |s| &mut s.properties.light_intensity),
_ => return None,
})
}
}