use anyhow::Result;
use crate::schemas::geom;
use crate::usd::{Attribute, Relationship, SchemaBase};
use super::tokens as tok;
pub trait Light: SchemaBase {
fn intensity_attr(&self) -> Attribute {
self.prim().attribute(tok::A_INTENSITY)
}
fn create_intensity_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_INTENSITY, "float")?
.set_custom(false)?)
}
fn exposure_attr(&self) -> Attribute {
self.prim().attribute(tok::A_EXPOSURE)
}
fn create_exposure_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_EXPOSURE, "float")?
.set_custom(false)?)
}
fn diffuse_attr(&self) -> Attribute {
self.prim().attribute(tok::A_DIFFUSE)
}
fn create_diffuse_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_DIFFUSE, "float")?
.set_custom(false)?)
}
fn specular_attr(&self) -> Attribute {
self.prim().attribute(tok::A_SPECULAR)
}
fn create_specular_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_SPECULAR, "float")?
.set_custom(false)?)
}
fn normalize_attr(&self) -> Attribute {
self.prim().attribute(tok::A_NORMALIZE)
}
fn create_normalize_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_NORMALIZE, "bool")?
.set_custom(false)?)
}
fn color_attr(&self) -> Attribute {
self.prim().attribute(tok::A_COLOR)
}
fn create_color_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_COLOR, "color3f")?
.set_custom(false)?)
}
fn enable_color_temperature_attr(&self) -> Attribute {
self.prim().attribute(tok::A_ENABLE_COLOR_TEMPERATURE)
}
fn create_enable_color_temperature_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_ENABLE_COLOR_TEMPERATURE, "bool")?
.set_custom(false)?)
}
fn color_temperature_attr(&self) -> Attribute {
self.prim().attribute(tok::A_COLOR_TEMPERATURE)
}
fn create_color_temperature_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_COLOR_TEMPERATURE, "float")?
.set_custom(false)?)
}
fn filters_rel(&self) -> Relationship {
self.prim().relationship(tok::REL_FILTERS)
}
fn create_filters_rel(&self) -> Result<Relationship> {
Ok(self.prim().create_relationship(tok::REL_FILTERS)?.set_custom(false)?)
}
}
pub trait BoundableLight: geom::Boundable + Light {}
pub trait NonboundableLight: geom::Xformable + Light {}