objc2_model_io/generated/
MDLLight.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-graphics")]
7use objc2_core_graphics::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/modelio/mdllighttype?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct MDLLightType(pub NSUInteger);
17impl MDLLightType {
18    #[doc(alias = "MDLLightTypeUnknown")]
19    pub const Unknown: Self = Self(0);
20    #[doc(alias = "MDLLightTypeAmbient")]
21    pub const Ambient: Self = Self(1);
22    #[doc(alias = "MDLLightTypeDirectional")]
23    pub const Directional: Self = Self(2);
24    #[doc(alias = "MDLLightTypeSpot")]
25    pub const Spot: Self = Self(3);
26    #[doc(alias = "MDLLightTypePoint")]
27    pub const Point: Self = Self(4);
28    #[doc(alias = "MDLLightTypeLinear")]
29    pub const Linear: Self = Self(5);
30    #[doc(alias = "MDLLightTypeDiscArea")]
31    pub const DiscArea: Self = Self(6);
32    #[doc(alias = "MDLLightTypeRectangularArea")]
33    pub const RectangularArea: Self = Self(7);
34    #[doc(alias = "MDLLightTypeSuperElliptical")]
35    pub const SuperElliptical: Self = Self(8);
36    #[doc(alias = "MDLLightTypePhotometric")]
37    pub const Photometric: Self = Self(9);
38    #[doc(alias = "MDLLightTypeProbe")]
39    pub const Probe: Self = Self(10);
40    #[doc(alias = "MDLLightTypeEnvironment")]
41    pub const Environment: Self = Self(11);
42}
43
44unsafe impl Encode for MDLLightType {
45    const ENCODING: Encoding = NSUInteger::ENCODING;
46}
47
48unsafe impl RefEncode for MDLLightType {
49    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
50}
51
52extern_class!(
53    /// [Apple's documentation](https://developer.apple.com/documentation/modelio/mdllight?language=objc)
54    #[unsafe(super(MDLObject, NSObject))]
55    #[derive(Debug, PartialEq, Eq, Hash)]
56    #[cfg(feature = "MDLObject")]
57    pub struct MDLLight;
58);
59
60#[cfg(all(feature = "MDLObject", feature = "MDLTypes"))]
61unsafe impl MDLNamed for MDLLight {}
62
63#[cfg(feature = "MDLObject")]
64unsafe impl NSObjectProtocol for MDLLight {}
65
66#[cfg(feature = "MDLObject")]
67impl MDLLight {
68    extern_methods!(
69        #[unsafe(method(lightType))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn lightType(&self) -> MDLLightType;
72
73        /// Setter for [`lightType`][Self::lightType].
74        #[unsafe(method(setLightType:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn setLightType(&self, light_type: MDLLightType);
77
78        #[unsafe(method(colorSpace))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn colorSpace(&self) -> Retained<NSString>;
81
82        /// Setter for [`colorSpace`][Self::colorSpace].
83        #[unsafe(method(setColorSpace:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn setColorSpace(&self, color_space: &NSString);
86    );
87}
88
89/// Methods declared on superclass `NSObject`.
90#[cfg(feature = "MDLObject")]
91impl MDLLight {
92    extern_methods!(
93        #[unsafe(method(init))]
94        #[unsafe(method_family = init)]
95        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
96
97        #[unsafe(method(new))]
98        #[unsafe(method_family = new)]
99        pub unsafe fn new() -> Retained<Self>;
100    );
101}
102
103extern_class!(
104    /// A light with characteristics representing plausible real world lights
105    ///
106    ///
107    ///
108    ///
109    ///
110    /// quadratically attenuates to zero.
111    ///
112    /// light is maximally bright.
113    ///
114    /// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlphysicallyplausiblelight?language=objc)
115    #[unsafe(super(MDLLight, MDLObject, NSObject))]
116    #[derive(Debug, PartialEq, Eq, Hash)]
117    #[cfg(feature = "MDLObject")]
118    pub struct MDLPhysicallyPlausibleLight;
119);
120
121#[cfg(all(feature = "MDLObject", feature = "MDLTypes"))]
122unsafe impl MDLNamed for MDLPhysicallyPlausibleLight {}
123
124#[cfg(feature = "MDLObject")]
125unsafe impl NSObjectProtocol for MDLPhysicallyPlausibleLight {}
126
127#[cfg(feature = "MDLObject")]
128impl MDLPhysicallyPlausibleLight {
129    extern_methods!(
130        /// Light color specified by color temperature, in degrees Kelvin
131        ///
132        /// default color is 6500K, cool daylight.
133        #[unsafe(method(setColorByTemperature:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn setColorByTemperature(&self, temperature: c_float);
136
137        #[cfg(feature = "objc2-core-graphics")]
138        #[unsafe(method(color))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn color(&self) -> Option<Retained<CGColor>>;
141
142        #[cfg(feature = "objc2-core-graphics")]
143        /// Setter for [`color`][Self::color].
144        #[unsafe(method(setColor:))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn setColor(&self, color: Option<&CGColor>);
147
148        #[unsafe(method(lumens))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn lumens(&self) -> c_float;
151
152        /// Setter for [`lumens`][Self::lumens].
153        #[unsafe(method(setLumens:))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn setLumens(&self, lumens: c_float);
156
157        #[unsafe(method(innerConeAngle))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn innerConeAngle(&self) -> c_float;
160
161        /// Setter for [`innerConeAngle`][Self::innerConeAngle].
162        #[unsafe(method(setInnerConeAngle:))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn setInnerConeAngle(&self, inner_cone_angle: c_float);
165
166        #[unsafe(method(outerConeAngle))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn outerConeAngle(&self) -> c_float;
169
170        /// Setter for [`outerConeAngle`][Self::outerConeAngle].
171        #[unsafe(method(setOuterConeAngle:))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn setOuterConeAngle(&self, outer_cone_angle: c_float);
174
175        #[unsafe(method(attenuationStartDistance))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn attenuationStartDistance(&self) -> c_float;
178
179        /// Setter for [`attenuationStartDistance`][Self::attenuationStartDistance].
180        #[unsafe(method(setAttenuationStartDistance:))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn setAttenuationStartDistance(&self, attenuation_start_distance: c_float);
183
184        #[unsafe(method(attenuationEndDistance))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn attenuationEndDistance(&self) -> c_float;
187
188        /// Setter for [`attenuationEndDistance`][Self::attenuationEndDistance].
189        #[unsafe(method(setAttenuationEndDistance:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn setAttenuationEndDistance(&self, attenuation_end_distance: c_float);
192    );
193}
194
195/// Methods declared on superclass `NSObject`.
196#[cfg(feature = "MDLObject")]
197impl MDLPhysicallyPlausibleLight {
198    extern_methods!(
199        #[unsafe(method(init))]
200        #[unsafe(method_family = init)]
201        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
202
203        #[unsafe(method(new))]
204        #[unsafe(method_family = new)]
205        pub unsafe fn new() -> Retained<Self>;
206    );
207}
208
209extern_class!(
210    /// [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlarealight?language=objc)
211    #[unsafe(super(MDLPhysicallyPlausibleLight, MDLLight, MDLObject, NSObject))]
212    #[derive(Debug, PartialEq, Eq, Hash)]
213    #[cfg(feature = "MDLObject")]
214    pub struct MDLAreaLight;
215);
216
217#[cfg(all(feature = "MDLObject", feature = "MDLTypes"))]
218unsafe impl MDLNamed for MDLAreaLight {}
219
220#[cfg(feature = "MDLObject")]
221unsafe impl NSObjectProtocol for MDLAreaLight {}
222
223#[cfg(feature = "MDLObject")]
224impl MDLAreaLight {
225    extern_methods!(
226        #[unsafe(method(areaRadius))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn areaRadius(&self) -> c_float;
229
230        /// Setter for [`areaRadius`][Self::areaRadius].
231        #[unsafe(method(setAreaRadius:))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn setAreaRadius(&self, area_radius: c_float);
234
235        #[unsafe(method(aspect))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn aspect(&self) -> c_float;
238
239        /// Setter for [`aspect`][Self::aspect].
240        #[unsafe(method(setAspect:))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn setAspect(&self, aspect: c_float);
243    );
244}
245
246/// Methods declared on superclass `NSObject`.
247#[cfg(feature = "MDLObject")]
248impl MDLAreaLight {
249    extern_methods!(
250        #[unsafe(method(init))]
251        #[unsafe(method_family = init)]
252        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
253
254        #[unsafe(method(new))]
255        #[unsafe(method_family = new)]
256        pub unsafe fn new() -> Retained<Self>;
257    );
258}
259
260extern_class!(
261    /// A light created from measurements at various angles.
262    ///
263    ///
264    /// learn the intensity of the light in that direction.
265    ///
266    /// used to calculate the spherical harmonics coefficients
267    ///
268    /// calculated by generateSphericalHarmonicsFromLight:
269    ///
270    /// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlphotometriclight?language=objc)
271    #[unsafe(super(MDLPhysicallyPlausibleLight, MDLLight, MDLObject, NSObject))]
272    #[derive(Debug, PartialEq, Eq, Hash)]
273    #[cfg(feature = "MDLObject")]
274    pub struct MDLPhotometricLight;
275);
276
277#[cfg(all(feature = "MDLObject", feature = "MDLTypes"))]
278unsafe impl MDLNamed for MDLPhotometricLight {}
279
280#[cfg(feature = "MDLObject")]
281unsafe impl NSObjectProtocol for MDLPhotometricLight {}
282
283#[cfg(feature = "MDLObject")]
284impl MDLPhotometricLight {
285    extern_methods!(
286        #[unsafe(method(initWithIESProfile:))]
287        #[unsafe(method_family = init)]
288        pub unsafe fn initWithIESProfile(
289            this: Allocated<Self>,
290            url: &NSURL,
291        ) -> Option<Retained<Self>>;
292
293        #[unsafe(method(generateSphericalHarmonicsFromLight:))]
294        #[unsafe(method_family = none)]
295        pub unsafe fn generateSphericalHarmonicsFromLight(
296            &self,
297            spherical_harmonics_level: NSUInteger,
298        );
299
300        #[unsafe(method(generateCubemapFromLight:))]
301        #[unsafe(method_family = none)]
302        pub unsafe fn generateCubemapFromLight(&self, texture_size: NSUInteger);
303
304        #[cfg(feature = "MDLTexture")]
305        /// Generate an IES compliant MDLTexture
306        /// 1D when the number of horizontal angles is one and the innerConeAngle is
307        /// <
308        /// 180
309        /// 2D when the previous statement fails and innerConeAngle
310        /// <
311        /// 89
312        /// 3D in all other cases
313        /// the parameter textureSize is the size in pixels of the texture image. For a size of N,
314        /// 1D generates an Nx1 image, 2D generates an NxN image, 3D generates an Nx(N*6) image (i.e. cubemap).
315        #[unsafe(method(generateTexture:))]
316        #[unsafe(method_family = none)]
317        pub unsafe fn generateTexture(&self, texture_size: NSUInteger) -> Retained<MDLTexture>;
318
319        #[cfg(feature = "MDLTexture")]
320        #[unsafe(method(lightCubeMap))]
321        #[unsafe(method_family = none)]
322        pub unsafe fn lightCubeMap(&self) -> Option<Retained<MDLTexture>>;
323
324        #[unsafe(method(sphericalHarmonicsLevel))]
325        #[unsafe(method_family = none)]
326        pub unsafe fn sphericalHarmonicsLevel(&self) -> NSUInteger;
327
328        #[unsafe(method(sphericalHarmonicsCoefficients))]
329        #[unsafe(method_family = none)]
330        pub unsafe fn sphericalHarmonicsCoefficients(&self) -> Option<Retained<NSData>>;
331    );
332}
333
334/// Methods declared on superclass `NSObject`.
335#[cfg(feature = "MDLObject")]
336impl MDLPhotometricLight {
337    extern_methods!(
338        #[unsafe(method(init))]
339        #[unsafe(method_family = init)]
340        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
341
342        #[unsafe(method(new))]
343        #[unsafe(method_family = new)]
344        pub unsafe fn new() -> Retained<Self>;
345    );
346}
347
348extern_class!(
349    /// [Apple's documentation](https://developer.apple.com/documentation/modelio/mdllightprobe?language=objc)
350    #[unsafe(super(MDLLight, MDLObject, NSObject))]
351    #[derive(Debug, PartialEq, Eq, Hash)]
352    #[cfg(feature = "MDLObject")]
353    pub struct MDLLightProbe;
354);
355
356#[cfg(all(feature = "MDLObject", feature = "MDLTypes"))]
357unsafe impl MDLNamed for MDLLightProbe {}
358
359#[cfg(feature = "MDLObject")]
360unsafe impl NSObjectProtocol for MDLLightProbe {}
361
362#[cfg(feature = "MDLObject")]
363impl MDLLightProbe {
364    extern_methods!(
365        #[cfg(feature = "MDLTexture")]
366        #[unsafe(method(initWithReflectiveTexture:irradianceTexture:))]
367        #[unsafe(method_family = init)]
368        pub unsafe fn initWithReflectiveTexture_irradianceTexture(
369            this: Allocated<Self>,
370            reflective_texture: Option<&MDLTexture>,
371            irradiance_texture: Option<&MDLTexture>,
372        ) -> Retained<Self>;
373
374        #[unsafe(method(generateSphericalHarmonicsFromIrradiance:))]
375        #[unsafe(method_family = none)]
376        pub unsafe fn generateSphericalHarmonicsFromIrradiance(
377            &self,
378            spherical_harmonics_level: NSUInteger,
379        );
380
381        #[cfg(feature = "MDLTexture")]
382        #[unsafe(method(reflectiveTexture))]
383        #[unsafe(method_family = none)]
384        pub unsafe fn reflectiveTexture(&self) -> Option<Retained<MDLTexture>>;
385
386        #[cfg(feature = "MDLTexture")]
387        #[unsafe(method(irradianceTexture))]
388        #[unsafe(method_family = none)]
389        pub unsafe fn irradianceTexture(&self) -> Option<Retained<MDLTexture>>;
390
391        #[unsafe(method(sphericalHarmonicsLevel))]
392        #[unsafe(method_family = none)]
393        pub unsafe fn sphericalHarmonicsLevel(&self) -> NSUInteger;
394
395        #[unsafe(method(sphericalHarmonicsCoefficients))]
396        #[unsafe(method_family = none)]
397        pub unsafe fn sphericalHarmonicsCoefficients(&self) -> Option<Retained<NSData>>;
398    );
399}
400
401/// Methods declared on superclass `NSObject`.
402#[cfg(feature = "MDLObject")]
403impl MDLLightProbe {
404    extern_methods!(
405        #[unsafe(method(init))]
406        #[unsafe(method_family = init)]
407        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
408
409        #[unsafe(method(new))]
410        #[unsafe(method_family = new)]
411        pub unsafe fn new() -> Retained<Self>;
412    );
413}
414
415/// MDLLightBaking.
416#[cfg(feature = "MDLObject")]
417impl MDLLightProbe {
418    extern_methods!(
419        #[cfg(all(feature = "MDLTexture", feature = "MDLTransform"))]
420        #[unsafe(method(lightProbeWithTextureSize:forLocation:lightsToConsider:objectsToConsider:reflectiveCubemap:irradianceCubemap:))]
421        #[unsafe(method_family = none)]
422        pub unsafe fn lightProbeWithTextureSize_forLocation_lightsToConsider_objectsToConsider_reflectiveCubemap_irradianceCubemap(
423            texture_size: NSInteger,
424            transform: &MDLTransform,
425            lights_to_consider: &NSArray<MDLLight>,
426            objects_to_consider: &NSArray<MDLObject>,
427            reflective_cubemap: Option<&MDLTexture>,
428            irradiance_cubemap: Option<&MDLTexture>,
429        ) -> Option<Retained<MDLLightProbe>>;
430    );
431}