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