Skip to main content

openusd_rs/
usd_lux.rs

1// This file is auto-generated by genschema.rs.
2// Code added after the 'BEGIN CUSTOM CODE' marker will be preserved.
3
4use 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/// API schema that imparts the quality of being a light onto a prim.
26#[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	/// Scales the brightness of the light linearly.
35	pub fn intensity_attr(&self) -> usd::Attribute {
36		self.prim().get_attribute(&TOKENS.inputs_intensity)
37	}
38
39	/// Scales the brightness of the light exponentially as a power
40	/// of 2 (similar to an F-stop control over exposure). The result
41	/// is multiplied against the intensity.
42	pub fn exposure_attr(&self) -> usd::Attribute {
43		self.prim().get_attribute(&TOKENS.inputs_exposure)
44	}
45
46	/// A multiplier for the effect of this light on the diffuse
47	/// response of materials. This is a non-physical control.
48	pub fn diffuse_attr(&self) -> usd::Attribute {
49		self.prim().get_attribute(&TOKENS.inputs_diffuse)
50	}
51
52	/// A multiplier for the effect of this light on the specular
53	/// response of materials. This is a non-physical control.
54	pub fn specular_attr(&self) -> usd::Attribute {
55		self.prim().get_attribute(&TOKENS.inputs_specular)
56	}
57
58	/// Normalizes the emission such that the power of the light
59	/// remains constant while altering the size of the light, by dividing the
60	/// luminance by the world-space surface area of the light.
61	///
62	/// This makes it easier to independently adjust the brightness and size
63	/// of the light, by causing the total illumination provided by a light to
64	/// not vary with the area or angular size of the light.
65	pub fn normalize_attr(&self) -> usd::Attribute {
66		self.prim().get_attribute(&TOKENS.inputs_normalize)
67	}
68
69	/// The color of emitted light, in the rendering color space.
70	/// This color is just multiplied with the emission.
71	pub fn color_attr(&self) -> usd::Attribute {
72		self.prim().get_attribute(&TOKENS.inputs_color)
73	}
74
75	/// Enables using colorTemperature.
76	pub fn enable_color_temperature_attr(&self) -> usd::Attribute {
77		self.prim()
78			.get_attribute(&TOKENS.inputs_enable_color_temperature)
79	}
80
81	/// Color temperature, in degrees Kelvin, representing the
82	/// white point.  The default is a common white point, D65.  Lower
83	/// values are warmer and higher values are cooler.  The valid range
84	/// is from 1000 to 10000. Only takes effect when
85	/// enableColorTemperature is set to true.
86	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/// Base class for intrinsic lights that are boundable.
99#[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/// Base class for intrinsic lights that are not boundable.
116#[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/// Light emitted from one side of a circular disk.
133/// The disk is centered in the XY plane and emits light along the -Z axis.
134#[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	/// Radius of the disk.
143	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/// Light emitted from one side of a rectangle.
156/// The rectangle is centered in the XY plane and emits light along the -Z axis.
157/// The rectangle is 1 unit in length in the X and Y axis.  In the default
158/// position, a texture file's min coordinates should be at (+X, +Y) and
159/// max coordinates at (-X, -Y).
160#[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	/// Width of the rectangle, in the local X axis.
169	pub fn width_attr(&self) -> usd::Attribute {
170		self.prim().get_attribute(&TOKENS.inputs_width)
171	}
172
173	/// Height of the rectangle, in the local Y axis.
174	pub fn height_attr(&self) -> usd::Attribute {
175		self.prim().get_attribute(&TOKENS.inputs_height)
176	}
177
178	/// A color texture to use on the rectangle.
179	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/// Light emitted outward from a sphere.
192#[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	/// Radius of the sphere.
201	pub fn radius_attr(&self) -> usd::Attribute {
202		self.prim().get_attribute(&TOKENS.inputs_radius)
203	}
204
205	/// A hint that this light can be treated as a 'point'
206	/// light (effectively, a zero-radius sphere) by renderers that
207	/// benefit from non-area lighting. Renderers that only support
208	/// area lights can disregard this.
209	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/// Light emitted inward from a distant external environment,
222/// such as a sky or IBL light probe.
223///
224/// In this version of the dome light, the dome's default orientation is such
225/// that its top pole is aligned with the world's +Y axis. This adheres to the
226/// OpenEXR specification for latlong environment maps.
227#[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	/// A color texture to use on the dome, such as an HDR (high
236	/// dynamic range) texture intended for IBL (image based lighting).
237	pub fn texture_file_attr(&self) -> usd::Attribute {
238		self.prim().get_attribute(&TOKENS.inputs_texture_file)
239	}
240
241	/// Specifies the parameterization of the color map file.
242	/// Valid values are:
243	/// - automatic: Tries to determine the layout from the file itself.
244	/// For example, Renderman texture files embed an explicit
245	/// parameterization.
246	/// - latlong: Latitude as X, longitude as Y.
247	/// - mirroredBall: An image of the environment reflected in a
248	/// sphere, using an implicitly orthogonal projection.
249	/// - angular: Similar to mirroredBall but the radial dimension
250	/// is mapped linearly to the angle, providing better sampling
251	/// at the edges.
252	/// - cubeMapVerticalCross: A cube map with faces laid out as a
253	/// vertical cross.
254	pub fn texture_format_attr(&self) -> usd::Attribute {
255		self.prim().get_attribute(&TOKENS.inputs_texture_format)
256	}
257
258	/// Optional portals to guide light sampling.
259	pub fn portals_attr(&self) -> usd::Attribute {
260		self.prim().get_attribute(&TOKENS.portals)
261	}
262
263	/// The radius of guide geometry to use to visualize the dome light.
264	/// The default is 1 km for scenes whose metersPerUnit is the USD default of
265	/// 0.01 (i.e., 1 world unit is 1 cm).
266	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// --- (BEGIN CUSTOM CODE) ---