use crate::{declare_public_tokens, sdf, tf, usd};
declare_public_tokens!(Tokens, TOKENS, [
guide_radius: "guideRadius",
inputs_color: "inputs:color",
inputs_color_temperature: "inputs:colorTemperature",
inputs_diffuse: "inputs:diffuse",
inputs_enable_color_temperature: "inputs:enableColorTemperature",
inputs_exposure: "inputs:exposure",
inputs_height: "inputs:height",
inputs_intensity: "inputs:intensity",
inputs_normalize: "inputs:normalize",
inputs_radius: "inputs:radius",
inputs_specular: "inputs:specular",
inputs_texture_file: "inputs:texture:file",
inputs_texture_format: "inputs:texture:format",
inputs_width: "inputs:width",
portals: "portals",
treat_as_point: "treatAsPoint"
]);
#[repr(transparent)]
pub struct LightAPI<'a>(usd::SchemaBase<'a>);
impl LightAPI<'_> {
pub fn define(stage: &usd::Stage, path: impl Into<sdf::Path>) -> LightAPI {
LightAPI(usd::SchemaBase::new(stage.prim_at_path(path)))
}
pub fn intensity_attr(&self) -> usd::Attribute {
self.prim().get_attribute(&TOKENS.inputs_intensity)
}
pub fn exposure_attr(&self) -> usd::Attribute {
self.prim().get_attribute(&TOKENS.inputs_exposure)
}
pub fn diffuse_attr(&self) -> usd::Attribute {
self.prim().get_attribute(&TOKENS.inputs_diffuse)
}
pub fn specular_attr(&self) -> usd::Attribute {
self.prim().get_attribute(&TOKENS.inputs_specular)
}
pub fn normalize_attr(&self) -> usd::Attribute {
self.prim().get_attribute(&TOKENS.inputs_normalize)
}
pub fn color_attr(&self) -> usd::Attribute {
self.prim().get_attribute(&TOKENS.inputs_color)
}
pub fn enable_color_temperature_attr(&self) -> usd::Attribute {
self.prim()
.get_attribute(&TOKENS.inputs_enable_color_temperature)
}
pub fn color_temperature_attr(&self) -> usd::Attribute {
self.prim().get_attribute(&TOKENS.inputs_color_temperature)
}
}
impl<'a> std::ops::Deref for LightAPI<'a> {
type Target = usd::SchemaBase<'a>;
fn deref(&self) -> &Self::Target {
unsafe { std::mem::transmute(self) }
}
}
#[repr(transparent)]
pub struct BoundableLightBase<'a>(usd::SchemaBase<'a>);
impl BoundableLightBase<'_> {
pub fn define(stage: &usd::Stage, path: impl Into<sdf::Path>) -> BoundableLightBase {
BoundableLightBase(usd::SchemaBase::new(stage.prim_at_path(path)))
}
}
impl<'a> std::ops::Deref for BoundableLightBase<'a> {
type Target = LightAPI<'a>;
fn deref(&self) -> &Self::Target {
unsafe { std::mem::transmute(self) }
}
}
#[repr(transparent)]
pub struct NonboundableLightBase<'a>(usd::SchemaBase<'a>);
impl NonboundableLightBase<'_> {
pub fn define(stage: &usd::Stage, path: impl Into<sdf::Path>) -> NonboundableLightBase {
NonboundableLightBase(usd::SchemaBase::new(stage.prim_at_path(path)))
}
}
impl<'a> std::ops::Deref for NonboundableLightBase<'a> {
type Target = LightAPI<'a>;
fn deref(&self) -> &Self::Target {
unsafe { std::mem::transmute(self) }
}
}
#[repr(transparent)]
pub struct DiskLight<'a>(usd::SchemaBase<'a>);
impl DiskLight<'_> {
pub fn define(stage: &usd::Stage, path: impl Into<sdf::Path>) -> DiskLight {
DiskLight(usd::SchemaBase::new(stage.prim_at_path(path)))
}
pub fn radius_attr(&self) -> usd::Attribute {
self.prim().get_attribute(&TOKENS.inputs_radius)
}
}
impl<'a> std::ops::Deref for DiskLight<'a> {
type Target = BoundableLightBase<'a>;
fn deref(&self) -> &Self::Target {
unsafe { std::mem::transmute(self) }
}
}
#[repr(transparent)]
pub struct RectLight<'a>(usd::SchemaBase<'a>);
impl RectLight<'_> {
pub fn define(stage: &usd::Stage, path: impl Into<sdf::Path>) -> RectLight {
RectLight(usd::SchemaBase::new(stage.prim_at_path(path)))
}
pub fn width_attr(&self) -> usd::Attribute {
self.prim().get_attribute(&TOKENS.inputs_width)
}
pub fn height_attr(&self) -> usd::Attribute {
self.prim().get_attribute(&TOKENS.inputs_height)
}
pub fn texture_file_attr(&self) -> usd::Attribute {
self.prim().get_attribute(&TOKENS.inputs_texture_file)
}
}
impl<'a> std::ops::Deref for RectLight<'a> {
type Target = BoundableLightBase<'a>;
fn deref(&self) -> &Self::Target {
unsafe { std::mem::transmute(self) }
}
}
#[repr(transparent)]
pub struct SphereLight<'a>(usd::SchemaBase<'a>);
impl SphereLight<'_> {
pub fn define(stage: &usd::Stage, path: impl Into<sdf::Path>) -> SphereLight {
SphereLight(usd::SchemaBase::new(stage.prim_at_path(path)))
}
pub fn radius_attr(&self) -> usd::Attribute {
self.prim().get_attribute(&TOKENS.inputs_radius)
}
pub fn treat_as_point_attr(&self) -> usd::Attribute {
self.prim().get_attribute(&TOKENS.treat_as_point)
}
}
impl<'a> std::ops::Deref for SphereLight<'a> {
type Target = BoundableLightBase<'a>;
fn deref(&self) -> &Self::Target {
unsafe { std::mem::transmute(self) }
}
}
#[repr(transparent)]
pub struct DomeLight<'a>(usd::SchemaBase<'a>);
impl DomeLight<'_> {
pub fn define(stage: &usd::Stage, path: impl Into<sdf::Path>) -> DomeLight {
DomeLight(usd::SchemaBase::new(stage.prim_at_path(path)))
}
pub fn texture_file_attr(&self) -> usd::Attribute {
self.prim().get_attribute(&TOKENS.inputs_texture_file)
}
pub fn texture_format_attr(&self) -> usd::Attribute {
self.prim().get_attribute(&TOKENS.inputs_texture_format)
}
pub fn portals_attr(&self) -> usd::Attribute {
self.prim().get_attribute(&TOKENS.portals)
}
pub fn guide_radius_attr(&self) -> usd::Attribute {
self.prim().get_attribute(&TOKENS.guide_radius)
}
}
impl<'a> std::ops::Deref for DomeLight<'a> {
type Target = NonboundableLightBase<'a>;
fn deref(&self) -> &Self::Target {
unsafe { std::mem::transmute(self) }
}
}