objc2_scene_kit/generated/
SCNMaterial.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-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnlightingmodel?language=objc)
13// NS_TYPED_ENUM
14pub type SCNLightingModel = NSString;
15
16extern "C" {
17    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnlightingmodelphong?language=objc)
18    pub static SCNLightingModelPhong: &'static SCNLightingModel;
19}
20
21extern "C" {
22    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnlightingmodelblinn?language=objc)
23    pub static SCNLightingModelBlinn: &'static SCNLightingModel;
24}
25
26extern "C" {
27    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnlightingmodellambert?language=objc)
28    pub static SCNLightingModelLambert: &'static SCNLightingModel;
29}
30
31extern "C" {
32    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnlightingmodelconstant?language=objc)
33    pub static SCNLightingModelConstant: &'static SCNLightingModel;
34}
35
36extern "C" {
37    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnlightingmodelphysicallybased?language=objc)
38    pub static SCNLightingModelPhysicallyBased: &'static SCNLightingModel;
39}
40
41extern "C" {
42    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnlightingmodelshadowonly?language=objc)
43    pub static SCNLightingModelShadowOnly: &'static SCNLightingModel;
44}
45
46/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnfillmode?language=objc)
47// NS_ENUM
48#[repr(transparent)]
49#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
50pub struct SCNFillMode(pub NSUInteger);
51impl SCNFillMode {
52    #[doc(alias = "SCNFillModeFill")]
53    pub const Fill: Self = Self(0);
54    #[doc(alias = "SCNFillModeLines")]
55    pub const Lines: Self = Self(1);
56}
57
58unsafe impl Encode for SCNFillMode {
59    const ENCODING: Encoding = NSUInteger::ENCODING;
60}
61
62unsafe impl RefEncode for SCNFillMode {
63    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
64}
65
66/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scncullmode?language=objc)
67// NS_ENUM
68#[repr(transparent)]
69#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
70pub struct SCNCullMode(pub NSInteger);
71impl SCNCullMode {
72    #[doc(alias = "SCNCullModeBack")]
73    pub const Back: Self = Self(0);
74    #[doc(alias = "SCNCullModeFront")]
75    pub const Front: Self = Self(1);
76}
77
78unsafe impl Encode for SCNCullMode {
79    const ENCODING: Encoding = NSInteger::ENCODING;
80}
81
82unsafe impl RefEncode for SCNCullMode {
83    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
84}
85
86/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scntransparencymode?language=objc)
87// NS_ENUM
88#[repr(transparent)]
89#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
90pub struct SCNTransparencyMode(pub NSInteger);
91impl SCNTransparencyMode {
92    #[doc(alias = "SCNTransparencyModeAOne")]
93    pub const AOne: Self = Self(0);
94    #[doc(alias = "SCNTransparencyModeRGBZero")]
95    pub const RGBZero: Self = Self(1);
96    #[doc(alias = "SCNTransparencyModeSingleLayer")]
97    pub const SingleLayer: Self = Self(2);
98    #[doc(alias = "SCNTransparencyModeDualLayer")]
99    pub const DualLayer: Self = Self(3);
100    #[doc(alias = "SCNTransparencyModeDefault")]
101    pub const Default: Self = Self(SCNTransparencyMode::AOne.0);
102}
103
104unsafe impl Encode for SCNTransparencyMode {
105    const ENCODING: Encoding = NSInteger::ENCODING;
106}
107
108unsafe impl RefEncode for SCNTransparencyMode {
109    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
110}
111
112/// Blend modes that SCNMaterial uses to compose with the framebuffer to produce blended colors.
113///
114/// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnblendmode?language=objc)
115// NS_ENUM
116#[repr(transparent)]
117#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
118pub struct SCNBlendMode(pub NSInteger);
119impl SCNBlendMode {
120    #[doc(alias = "SCNBlendModeAlpha")]
121    pub const Alpha: Self = Self(0);
122    #[doc(alias = "SCNBlendModeAdd")]
123    pub const Add: Self = Self(1);
124    #[doc(alias = "SCNBlendModeSubtract")]
125    pub const Subtract: Self = Self(2);
126    #[doc(alias = "SCNBlendModeMultiply")]
127    pub const Multiply: Self = Self(3);
128    #[doc(alias = "SCNBlendModeScreen")]
129    pub const Screen: Self = Self(4);
130    #[doc(alias = "SCNBlendModeReplace")]
131    pub const Replace: Self = Self(5);
132    #[doc(alias = "SCNBlendModeMax")]
133    pub const Max: Self = Self(6);
134}
135
136unsafe impl Encode for SCNBlendMode {
137    const ENCODING: Encoding = NSInteger::ENCODING;
138}
139
140unsafe impl RefEncode for SCNBlendMode {
141    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
142}
143
144extern_class!(
145    /// A SCNMaterial determines how a geometry is rendered. It encapsulates the colors and textures that define the appearance of 3d geometries.
146    ///
147    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnmaterial?language=objc)
148    #[unsafe(super(NSObject))]
149    #[derive(Debug, PartialEq, Eq, Hash)]
150    pub struct SCNMaterial;
151);
152
153extern_conformance!(
154    unsafe impl NSCoding for SCNMaterial {}
155);
156
157extern_conformance!(
158    unsafe impl NSCopying for SCNMaterial {}
159);
160
161unsafe impl CopyingHelper for SCNMaterial {
162    type Result = Self;
163}
164
165extern_conformance!(
166    unsafe impl NSObjectProtocol for SCNMaterial {}
167);
168
169extern_conformance!(
170    unsafe impl NSSecureCoding for SCNMaterial {}
171);
172
173#[cfg(feature = "SCNAnimation")]
174extern_conformance!(
175    unsafe impl SCNAnimatable for SCNMaterial {}
176);
177
178#[cfg(feature = "SCNShadable")]
179extern_conformance!(
180    unsafe impl SCNShadable for SCNMaterial {}
181);
182
183impl SCNMaterial {
184    extern_methods!(
185        /// Creates and initialize a material instance.
186        #[unsafe(method(material))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn material() -> Retained<Self>;
189
190        /// Determines the name of the receiver.
191        #[unsafe(method(name))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn name(&self) -> Option<Retained<NSString>>;
194
195        /// Setter for [`name`][Self::name].
196        #[unsafe(method(setName:))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn setName(&self, name: Option<&NSString>);
199
200        #[cfg(feature = "SCNMaterialProperty")]
201        /// Specifies the receiver's diffuse property.
202        ///
203        /// The diffuse property specifies the amount of light diffusely reflected from the surface. The diffuse light is reflected equally in all directions and is therefore independent of the point of view.
204        #[unsafe(method(diffuse))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn diffuse(&self) -> Retained<SCNMaterialProperty>;
207
208        #[cfg(feature = "SCNMaterialProperty")]
209        /// Specifies the receiver's ambient property.
210        ///
211        /// The ambient property specifies the amount of ambient light to reflect. This property has no visual impact on scenes that have no ambient light. Setting the ambient has no effect if locksAmbientWithDiffuse is set to YES.
212        #[unsafe(method(ambient))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn ambient(&self) -> Retained<SCNMaterialProperty>;
215
216        #[cfg(feature = "SCNMaterialProperty")]
217        /// Specifies the receiver's specular property.
218        ///
219        /// The specular property specifies the amount of light to reflect in a mirror-like manner. The specular intensity increases when the point of view lines up with the direction of the reflected light.
220        #[unsafe(method(specular))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn specular(&self) -> Retained<SCNMaterialProperty>;
223
224        #[cfg(feature = "SCNMaterialProperty")]
225        /// The emission property specifies the amount of light the material emits. This emission does not light up other surfaces in the scene.
226        #[unsafe(method(emission))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn emission(&self) -> Retained<SCNMaterialProperty>;
229
230        #[cfg(feature = "SCNMaterialProperty")]
231        /// The transparent property specifies the transparent areas of the material.
232        #[unsafe(method(transparent))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn transparent(&self) -> Retained<SCNMaterialProperty>;
235
236        #[cfg(feature = "SCNMaterialProperty")]
237        /// The reflective property specifies the reflectivity of the surface. The surface will not actually reflect other objects in the scene. This property may be used as a sphere mapping to reflect a precomputed environment.
238        #[unsafe(method(reflective))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn reflective(&self) -> Retained<SCNMaterialProperty>;
241
242        #[cfg(feature = "SCNMaterialProperty")]
243        /// The multiply property specifies a color or an image used to multiply the output fragments with. The computed fragments are multiplied with the multiply value to produce the final fragments. This property may be used for shadow maps, to fade out or tint 3d objects.
244        #[unsafe(method(multiply))]
245        #[unsafe(method_family = none)]
246        pub unsafe fn multiply(&self) -> Retained<SCNMaterialProperty>;
247
248        #[cfg(feature = "SCNMaterialProperty")]
249        /// The normal property specifies the surface orientation.
250        ///
251        /// When an image is set on the normal property the material is automatically lit per pixel. Setting a color has no effect.
252        #[unsafe(method(normal))]
253        #[unsafe(method_family = none)]
254        pub unsafe fn normal(&self) -> Retained<SCNMaterialProperty>;
255
256        #[cfg(feature = "SCNMaterialProperty")]
257        /// The displacement property specifies how vertex are translated in tangent space.
258        ///
259        /// Pass a grayscale image for a simple 'elevation' or rgb image for a vector displacement.
260        #[unsafe(method(displacement))]
261        #[unsafe(method_family = none)]
262        pub unsafe fn displacement(&self) -> Retained<SCNMaterialProperty>;
263
264        #[cfg(feature = "SCNMaterialProperty")]
265        /// The ambientOcclusion property specifies the ambient occlusion of the surface. The ambient occlusion is multiplied with the ambient light, then the result is added to the lighting contribution. This property has no visual impact on scenes that have no ambient light. When an ambient occlusion map is set, the ambient property is ignored.
266        #[unsafe(method(ambientOcclusion))]
267        #[unsafe(method_family = none)]
268        pub unsafe fn ambientOcclusion(&self) -> Retained<SCNMaterialProperty>;
269
270        #[cfg(feature = "SCNMaterialProperty")]
271        /// The selfIllumination property specifies a texture or a color that is added to the lighting contribution of the surface. When a selfIllumination is set, the emission property is ignored.
272        #[unsafe(method(selfIllumination))]
273        #[unsafe(method_family = none)]
274        pub unsafe fn selfIllumination(&self) -> Retained<SCNMaterialProperty>;
275
276        #[cfg(feature = "SCNMaterialProperty")]
277        /// The metalness property specifies how metallic the material's surface appears. Lower values (darker colors) cause the material to appear more like a dielectric surface. Higher values (brighter colors) cause the surface to appear more metallic. This property is only used when 'lightingModelName' is 'SCNLightingModelPhysicallyBased'.
278        #[unsafe(method(metalness))]
279        #[unsafe(method_family = none)]
280        pub unsafe fn metalness(&self) -> Retained<SCNMaterialProperty>;
281
282        #[cfg(feature = "SCNMaterialProperty")]
283        /// The roughness property specifies the apparent smoothness of the surface. Lower values (darker colors) cause the material to appear shiny, with well-defined specular highlights. Higher values (brighter colors) cause specular highlights to spread out and the diffuse property of the material to become more retroreflective. This property is only used when 'lightingModelName' is 'SCNLightingModelPhysicallyBased'.
284        #[unsafe(method(roughness))]
285        #[unsafe(method_family = none)]
286        pub unsafe fn roughness(&self) -> Retained<SCNMaterialProperty>;
287
288        #[cfg(feature = "SCNMaterialProperty")]
289        /// The clearCoat property specifies color and intensity of the coat layer.
290        #[unsafe(method(clearCoat))]
291        #[unsafe(method_family = none)]
292        pub unsafe fn clearCoat(&self) -> Retained<SCNMaterialProperty>;
293
294        #[cfg(feature = "SCNMaterialProperty")]
295        /// The clearCoat property specifies color and intensity of the coat roughness.
296        #[unsafe(method(clearCoatRoughness))]
297        #[unsafe(method_family = none)]
298        pub unsafe fn clearCoatRoughness(&self) -> Retained<SCNMaterialProperty>;
299
300        #[cfg(feature = "SCNMaterialProperty")]
301        /// The clearCoatNormal property specifies color and intensity of the optional coat normal map.
302        #[unsafe(method(clearCoatNormal))]
303        #[unsafe(method_family = none)]
304        pub unsafe fn clearCoatNormal(&self) -> Retained<SCNMaterialProperty>;
305
306        #[cfg(feature = "objc2-core-foundation")]
307        /// Specifies the receiver's shininess value. Defaults to 1.0. Animatable.
308        #[unsafe(method(shininess))]
309        #[unsafe(method_family = none)]
310        pub unsafe fn shininess(&self) -> CGFloat;
311
312        #[cfg(feature = "objc2-core-foundation")]
313        /// Setter for [`shininess`][Self::shininess].
314        #[unsafe(method(setShininess:))]
315        #[unsafe(method_family = none)]
316        pub unsafe fn setShininess(&self, shininess: CGFloat);
317
318        #[cfg(feature = "objc2-core-foundation")]
319        /// Specifies the receiver's transparency value. Defaults to 1.0. Animatable.
320        ///
321        /// The color of the transparent property is multiplied by this property. The result is then used to produce the final transparency according to the rule defined by the transparencyMode property.
322        #[unsafe(method(transparency))]
323        #[unsafe(method_family = none)]
324        pub unsafe fn transparency(&self) -> CGFloat;
325
326        #[cfg(feature = "objc2-core-foundation")]
327        /// Setter for [`transparency`][Self::transparency].
328        #[unsafe(method(setTransparency:))]
329        #[unsafe(method_family = none)]
330        pub unsafe fn setTransparency(&self, transparency: CGFloat);
331
332        /// Determines the receiver's lighting model. See above for the list of lighting models. Defaults to SCNLightingModelBlinn.
333        #[unsafe(method(lightingModelName))]
334        #[unsafe(method_family = none)]
335        pub unsafe fn lightingModelName(&self) -> Retained<SCNLightingModel>;
336
337        /// Setter for [`lightingModelName`][Self::lightingModelName].
338        #[unsafe(method(setLightingModelName:))]
339        #[unsafe(method_family = none)]
340        pub unsafe fn setLightingModelName(&self, lighting_model_name: &SCNLightingModel);
341
342        /// Determines whether the receiver is lit per pixel. Defaults to YES. Animatable.
343        #[unsafe(method(isLitPerPixel))]
344        #[unsafe(method_family = none)]
345        pub unsafe fn isLitPerPixel(&self) -> bool;
346
347        /// Setter for [`isLitPerPixel`][Self::isLitPerPixel].
348        #[unsafe(method(setLitPerPixel:))]
349        #[unsafe(method_family = none)]
350        pub unsafe fn setLitPerPixel(&self, lit_per_pixel: bool);
351
352        /// Determines whether the receiver is double sided. Defaults to NO. Animatable.
353        #[unsafe(method(isDoubleSided))]
354        #[unsafe(method_family = none)]
355        pub unsafe fn isDoubleSided(&self) -> bool;
356
357        /// Setter for [`isDoubleSided`][Self::isDoubleSided].
358        #[unsafe(method(setDoubleSided:))]
359        #[unsafe(method_family = none)]
360        pub unsafe fn setDoubleSided(&self, double_sided: bool);
361
362        /// Determines of to how to rasterize the receiver's primitives. Defaults to SCNFillModeFill.
363        #[unsafe(method(fillMode))]
364        #[unsafe(method_family = none)]
365        pub unsafe fn fillMode(&self) -> SCNFillMode;
366
367        /// Setter for [`fillMode`][Self::fillMode].
368        #[unsafe(method(setFillMode:))]
369        #[unsafe(method_family = none)]
370        pub unsafe fn setFillMode(&self, fill_mode: SCNFillMode);
371
372        /// Determines the culling mode of the receiver. Defaults to SCNCullModeBack. Animatable.
373        #[unsafe(method(cullMode))]
374        #[unsafe(method_family = none)]
375        pub unsafe fn cullMode(&self) -> SCNCullMode;
376
377        /// Setter for [`cullMode`][Self::cullMode].
378        #[unsafe(method(setCullMode:))]
379        #[unsafe(method_family = none)]
380        pub unsafe fn setCullMode(&self, cull_mode: SCNCullMode);
381
382        /// Determines the transparency mode of the receiver. See above for the transparency modes. Defaults to SCNTransparencyModeDefault.
383        #[unsafe(method(transparencyMode))]
384        #[unsafe(method_family = none)]
385        pub unsafe fn transparencyMode(&self) -> SCNTransparencyMode;
386
387        /// Setter for [`transparencyMode`][Self::transparencyMode].
388        #[unsafe(method(setTransparencyMode:))]
389        #[unsafe(method_family = none)]
390        pub unsafe fn setTransparencyMode(&self, transparency_mode: SCNTransparencyMode);
391
392        /// Makes the ambient property automatically match the diffuse property. Defaults to NO on 10.9 and before, defaults to YES otherwise. Animatable.
393        #[unsafe(method(locksAmbientWithDiffuse))]
394        #[unsafe(method_family = none)]
395        pub unsafe fn locksAmbientWithDiffuse(&self) -> bool;
396
397        /// Setter for [`locksAmbientWithDiffuse`][Self::locksAmbientWithDiffuse].
398        #[unsafe(method(setLocksAmbientWithDiffuse:))]
399        #[unsafe(method_family = none)]
400        pub unsafe fn setLocksAmbientWithDiffuse(&self, locks_ambient_with_diffuse: bool);
401
402        /// Determines whether the receiver writes to the depth buffer when rendered. Defaults to YES.
403        #[unsafe(method(writesToDepthBuffer))]
404        #[unsafe(method_family = none)]
405        pub unsafe fn writesToDepthBuffer(&self) -> bool;
406
407        /// Setter for [`writesToDepthBuffer`][Self::writesToDepthBuffer].
408        #[unsafe(method(setWritesToDepthBuffer:))]
409        #[unsafe(method_family = none)]
410        pub unsafe fn setWritesToDepthBuffer(&self, writes_to_depth_buffer: bool);
411
412        #[cfg(feature = "SceneKitTypes")]
413        /// Determines whether the receiver writes to the color buffer when rendered. Defaults to SCNColorMaskAll.
414        #[unsafe(method(colorBufferWriteMask))]
415        #[unsafe(method_family = none)]
416        pub unsafe fn colorBufferWriteMask(&self) -> SCNColorMask;
417
418        #[cfg(feature = "SceneKitTypes")]
419        /// Setter for [`colorBufferWriteMask`][Self::colorBufferWriteMask].
420        #[unsafe(method(setColorBufferWriteMask:))]
421        #[unsafe(method_family = none)]
422        pub unsafe fn setColorBufferWriteMask(&self, color_buffer_write_mask: SCNColorMask);
423
424        /// Determines whether the receiver reads from the depth buffer when rendered. Defaults to YES.
425        #[unsafe(method(readsFromDepthBuffer))]
426        #[unsafe(method_family = none)]
427        pub unsafe fn readsFromDepthBuffer(&self) -> bool;
428
429        /// Setter for [`readsFromDepthBuffer`][Self::readsFromDepthBuffer].
430        #[unsafe(method(setReadsFromDepthBuffer:))]
431        #[unsafe(method_family = none)]
432        pub unsafe fn setReadsFromDepthBuffer(&self, reads_from_depth_buffer: bool);
433
434        #[cfg(feature = "objc2-core-foundation")]
435        /// Specifies the receiver's fresnel exponent value. Defaults to 0.0. Animatable.
436        ///
437        /// The effect of the reflectivity property is modulated by this property. The fresnelExponent changes the exponent of the reflectance. The bigger the exponent, the more concentrated the reflection is around the edges.
438        #[unsafe(method(fresnelExponent))]
439        #[unsafe(method_family = none)]
440        pub unsafe fn fresnelExponent(&self) -> CGFloat;
441
442        #[cfg(feature = "objc2-core-foundation")]
443        /// Setter for [`fresnelExponent`][Self::fresnelExponent].
444        #[unsafe(method(setFresnelExponent:))]
445        #[unsafe(method_family = none)]
446        pub unsafe fn setFresnelExponent(&self, fresnel_exponent: CGFloat);
447
448        /// Specifies the receiver's blend mode. Defaults to SCNBlendModeAlpha.
449        #[unsafe(method(blendMode))]
450        #[unsafe(method_family = none)]
451        pub unsafe fn blendMode(&self) -> SCNBlendMode;
452
453        /// Setter for [`blendMode`][Self::blendMode].
454        #[unsafe(method(setBlendMode:))]
455        #[unsafe(method_family = none)]
456        pub unsafe fn setBlendMode(&self, blend_mode: SCNBlendMode);
457    );
458}
459
460/// Methods declared on superclass `NSObject`.
461impl SCNMaterial {
462    extern_methods!(
463        #[unsafe(method(init))]
464        #[unsafe(method_family = init)]
465        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
466
467        #[unsafe(method(new))]
468        #[unsafe(method_family = new)]
469        pub unsafe fn new() -> Retained<Self>;
470    );
471}