1use crate::{declare_public_tokens, sdf, tf, usd};
5
6declare_public_tokens!(Tokens, TOKENS, [
7 guide_radius: "guideRadius",
8 inputs_color: "inputs:color",
9 inputs_color_temperature: "inputs:colorTemperature",
10 inputs_diffuse: "inputs:diffuse",
11 inputs_enable_color_temperature: "inputs:enableColorTemperature",
12 inputs_exposure: "inputs:exposure",
13 inputs_height: "inputs:height",
14 inputs_intensity: "inputs:intensity",
15 inputs_normalize: "inputs:normalize",
16 inputs_radius: "inputs:radius",
17 inputs_specular: "inputs:specular",
18 inputs_texture_file: "inputs:texture:file",
19 inputs_texture_format: "inputs:texture:format",
20 inputs_width: "inputs:width",
21 portals: "portals",
22 treat_as_point: "treatAsPoint"
23]);
24
25#[repr(transparent)]
27pub struct LightAPI<'a>(usd::SchemaBase<'a>);
28
29impl LightAPI<'_> {
30 pub fn define(stage: &usd::Stage, path: impl Into<sdf::Path>) -> LightAPI {
31 LightAPI(usd::SchemaBase::new(stage.prim_at_path(path)))
32 }
33
34 pub fn intensity_attr(&self) -> usd::Attribute {
36 self.prim().get_attribute(&TOKENS.inputs_intensity)
37 }
38
39 pub fn exposure_attr(&self) -> usd::Attribute {
43 self.prim().get_attribute(&TOKENS.inputs_exposure)
44 }
45
46 pub fn diffuse_attr(&self) -> usd::Attribute {
49 self.prim().get_attribute(&TOKENS.inputs_diffuse)
50 }
51
52 pub fn specular_attr(&self) -> usd::Attribute {
55 self.prim().get_attribute(&TOKENS.inputs_specular)
56 }
57
58 pub fn normalize_attr(&self) -> usd::Attribute {
66 self.prim().get_attribute(&TOKENS.inputs_normalize)
67 }
68
69 pub fn color_attr(&self) -> usd::Attribute {
72 self.prim().get_attribute(&TOKENS.inputs_color)
73 }
74
75 pub fn enable_color_temperature_attr(&self) -> usd::Attribute {
77 self.prim()
78 .get_attribute(&TOKENS.inputs_enable_color_temperature)
79 }
80
81 pub fn color_temperature_attr(&self) -> usd::Attribute {
87 self.prim().get_attribute(&TOKENS.inputs_color_temperature)
88 }
89}
90
91impl<'a> std::ops::Deref for LightAPI<'a> {
92 type Target = usd::SchemaBase<'a>;
93 fn deref(&self) -> &Self::Target {
94 unsafe { std::mem::transmute(self) }
95 }
96}
97
98#[repr(transparent)]
100pub struct BoundableLightBase<'a>(usd::SchemaBase<'a>);
101
102impl BoundableLightBase<'_> {
103 pub fn define(stage: &usd::Stage, path: impl Into<sdf::Path>) -> BoundableLightBase {
104 BoundableLightBase(usd::SchemaBase::new(stage.prim_at_path(path)))
105 }
106}
107
108impl<'a> std::ops::Deref for BoundableLightBase<'a> {
109 type Target = LightAPI<'a>;
110 fn deref(&self) -> &Self::Target {
111 unsafe { std::mem::transmute(self) }
112 }
113}
114
115#[repr(transparent)]
117pub struct NonboundableLightBase<'a>(usd::SchemaBase<'a>);
118
119impl NonboundableLightBase<'_> {
120 pub fn define(stage: &usd::Stage, path: impl Into<sdf::Path>) -> NonboundableLightBase {
121 NonboundableLightBase(usd::SchemaBase::new(stage.prim_at_path(path)))
122 }
123}
124
125impl<'a> std::ops::Deref for NonboundableLightBase<'a> {
126 type Target = LightAPI<'a>;
127 fn deref(&self) -> &Self::Target {
128 unsafe { std::mem::transmute(self) }
129 }
130}
131
132#[repr(transparent)]
135pub struct DiskLight<'a>(usd::SchemaBase<'a>);
136
137impl DiskLight<'_> {
138 pub fn define(stage: &usd::Stage, path: impl Into<sdf::Path>) -> DiskLight {
139 DiskLight(usd::SchemaBase::new(stage.prim_at_path(path)))
140 }
141
142 pub fn radius_attr(&self) -> usd::Attribute {
144 self.prim().get_attribute(&TOKENS.inputs_radius)
145 }
146}
147
148impl<'a> std::ops::Deref for DiskLight<'a> {
149 type Target = BoundableLightBase<'a>;
150 fn deref(&self) -> &Self::Target {
151 unsafe { std::mem::transmute(self) }
152 }
153}
154
155#[repr(transparent)]
161pub struct RectLight<'a>(usd::SchemaBase<'a>);
162
163impl RectLight<'_> {
164 pub fn define(stage: &usd::Stage, path: impl Into<sdf::Path>) -> RectLight {
165 RectLight(usd::SchemaBase::new(stage.prim_at_path(path)))
166 }
167
168 pub fn width_attr(&self) -> usd::Attribute {
170 self.prim().get_attribute(&TOKENS.inputs_width)
171 }
172
173 pub fn height_attr(&self) -> usd::Attribute {
175 self.prim().get_attribute(&TOKENS.inputs_height)
176 }
177
178 pub fn texture_file_attr(&self) -> usd::Attribute {
180 self.prim().get_attribute(&TOKENS.inputs_texture_file)
181 }
182}
183
184impl<'a> std::ops::Deref for RectLight<'a> {
185 type Target = BoundableLightBase<'a>;
186 fn deref(&self) -> &Self::Target {
187 unsafe { std::mem::transmute(self) }
188 }
189}
190
191#[repr(transparent)]
193pub struct SphereLight<'a>(usd::SchemaBase<'a>);
194
195impl SphereLight<'_> {
196 pub fn define(stage: &usd::Stage, path: impl Into<sdf::Path>) -> SphereLight {
197 SphereLight(usd::SchemaBase::new(stage.prim_at_path(path)))
198 }
199
200 pub fn radius_attr(&self) -> usd::Attribute {
202 self.prim().get_attribute(&TOKENS.inputs_radius)
203 }
204
205 pub fn treat_as_point_attr(&self) -> usd::Attribute {
210 self.prim().get_attribute(&TOKENS.treat_as_point)
211 }
212}
213
214impl<'a> std::ops::Deref for SphereLight<'a> {
215 type Target = BoundableLightBase<'a>;
216 fn deref(&self) -> &Self::Target {
217 unsafe { std::mem::transmute(self) }
218 }
219}
220
221#[repr(transparent)]
228pub struct DomeLight<'a>(usd::SchemaBase<'a>);
229
230impl DomeLight<'_> {
231 pub fn define(stage: &usd::Stage, path: impl Into<sdf::Path>) -> DomeLight {
232 DomeLight(usd::SchemaBase::new(stage.prim_at_path(path)))
233 }
234
235 pub fn texture_file_attr(&self) -> usd::Attribute {
238 self.prim().get_attribute(&TOKENS.inputs_texture_file)
239 }
240
241 pub fn texture_format_attr(&self) -> usd::Attribute {
255 self.prim().get_attribute(&TOKENS.inputs_texture_format)
256 }
257
258 pub fn portals_attr(&self) -> usd::Attribute {
260 self.prim().get_attribute(&TOKENS.portals)
261 }
262
263 pub fn guide_radius_attr(&self) -> usd::Attribute {
267 self.prim().get_attribute(&TOKENS.guide_radius)
268 }
269}
270
271impl<'a> std::ops::Deref for DomeLight<'a> {
272 type Target = NonboundableLightBase<'a>;
273 fn deref(&self) -> &Self::Target {
274 unsafe { std::mem::transmute(self) }
275 }
276}
277
278