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        ///
197        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
198        #[unsafe(method(setName:))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn setName(&self, name: Option<&NSString>);
201
202        #[cfg(feature = "SCNMaterialProperty")]
203        /// Specifies the receiver's diffuse property.
204        ///
205        /// 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.
206        #[unsafe(method(diffuse))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn diffuse(&self) -> Retained<SCNMaterialProperty>;
209
210        #[cfg(feature = "SCNMaterialProperty")]
211        /// Specifies the receiver's ambient property.
212        ///
213        /// 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.
214        #[unsafe(method(ambient))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn ambient(&self) -> Retained<SCNMaterialProperty>;
217
218        #[cfg(feature = "SCNMaterialProperty")]
219        /// Specifies the receiver's specular property.
220        ///
221        /// 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.
222        #[unsafe(method(specular))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn specular(&self) -> Retained<SCNMaterialProperty>;
225
226        #[cfg(feature = "SCNMaterialProperty")]
227        /// The emission property specifies the amount of light the material emits. This emission does not light up other surfaces in the scene.
228        #[unsafe(method(emission))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn emission(&self) -> Retained<SCNMaterialProperty>;
231
232        #[cfg(feature = "SCNMaterialProperty")]
233        /// The transparent property specifies the transparent areas of the material.
234        #[unsafe(method(transparent))]
235        #[unsafe(method_family = none)]
236        pub unsafe fn transparent(&self) -> Retained<SCNMaterialProperty>;
237
238        #[cfg(feature = "SCNMaterialProperty")]
239        /// 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.
240        #[unsafe(method(reflective))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn reflective(&self) -> Retained<SCNMaterialProperty>;
243
244        #[cfg(feature = "SCNMaterialProperty")]
245        /// 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.
246        #[unsafe(method(multiply))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn multiply(&self) -> Retained<SCNMaterialProperty>;
249
250        #[cfg(feature = "SCNMaterialProperty")]
251        /// The normal property specifies the surface orientation.
252        ///
253        /// When an image is set on the normal property the material is automatically lit per pixel. Setting a color has no effect.
254        #[unsafe(method(normal))]
255        #[unsafe(method_family = none)]
256        pub unsafe fn normal(&self) -> Retained<SCNMaterialProperty>;
257
258        #[cfg(feature = "SCNMaterialProperty")]
259        /// The displacement property specifies how vertex are translated in tangent space.
260        ///
261        /// Pass a grayscale image for a simple 'elevation' or rgb image for a vector displacement.
262        #[unsafe(method(displacement))]
263        #[unsafe(method_family = none)]
264        pub unsafe fn displacement(&self) -> Retained<SCNMaterialProperty>;
265
266        #[cfg(feature = "SCNMaterialProperty")]
267        /// 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.
268        #[unsafe(method(ambientOcclusion))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn ambientOcclusion(&self) -> Retained<SCNMaterialProperty>;
271
272        #[cfg(feature = "SCNMaterialProperty")]
273        /// 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.
274        #[unsafe(method(selfIllumination))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn selfIllumination(&self) -> Retained<SCNMaterialProperty>;
277
278        #[cfg(feature = "SCNMaterialProperty")]
279        /// 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'.
280        #[unsafe(method(metalness))]
281        #[unsafe(method_family = none)]
282        pub unsafe fn metalness(&self) -> Retained<SCNMaterialProperty>;
283
284        #[cfg(feature = "SCNMaterialProperty")]
285        /// 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'.
286        #[unsafe(method(roughness))]
287        #[unsafe(method_family = none)]
288        pub unsafe fn roughness(&self) -> Retained<SCNMaterialProperty>;
289
290        #[cfg(feature = "SCNMaterialProperty")]
291        /// The clearCoat property specifies color and intensity of the coat layer.
292        #[unsafe(method(clearCoat))]
293        #[unsafe(method_family = none)]
294        pub unsafe fn clearCoat(&self) -> Retained<SCNMaterialProperty>;
295
296        #[cfg(feature = "SCNMaterialProperty")]
297        /// The clearCoat property specifies color and intensity of the coat roughness.
298        #[unsafe(method(clearCoatRoughness))]
299        #[unsafe(method_family = none)]
300        pub unsafe fn clearCoatRoughness(&self) -> Retained<SCNMaterialProperty>;
301
302        #[cfg(feature = "SCNMaterialProperty")]
303        /// The clearCoatNormal property specifies color and intensity of the optional coat normal map.
304        #[unsafe(method(clearCoatNormal))]
305        #[unsafe(method_family = none)]
306        pub unsafe fn clearCoatNormal(&self) -> Retained<SCNMaterialProperty>;
307
308        #[cfg(feature = "objc2-core-foundation")]
309        /// Specifies the receiver's shininess value. Defaults to 1.0. Animatable.
310        #[unsafe(method(shininess))]
311        #[unsafe(method_family = none)]
312        pub unsafe fn shininess(&self) -> CGFloat;
313
314        #[cfg(feature = "objc2-core-foundation")]
315        /// Setter for [`shininess`][Self::shininess].
316        #[unsafe(method(setShininess:))]
317        #[unsafe(method_family = none)]
318        pub unsafe fn setShininess(&self, shininess: CGFloat);
319
320        #[cfg(feature = "objc2-core-foundation")]
321        /// Specifies the receiver's transparency value. Defaults to 1.0. Animatable.
322        ///
323        /// 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.
324        #[unsafe(method(transparency))]
325        #[unsafe(method_family = none)]
326        pub unsafe fn transparency(&self) -> CGFloat;
327
328        #[cfg(feature = "objc2-core-foundation")]
329        /// Setter for [`transparency`][Self::transparency].
330        #[unsafe(method(setTransparency:))]
331        #[unsafe(method_family = none)]
332        pub unsafe fn setTransparency(&self, transparency: CGFloat);
333
334        /// Determines the receiver's lighting model. See above for the list of lighting models. Defaults to SCNLightingModelBlinn.
335        #[unsafe(method(lightingModelName))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn lightingModelName(&self) -> Retained<SCNLightingModel>;
338
339        /// Setter for [`lightingModelName`][Self::lightingModelName].
340        ///
341        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
342        #[unsafe(method(setLightingModelName:))]
343        #[unsafe(method_family = none)]
344        pub unsafe fn setLightingModelName(&self, lighting_model_name: &SCNLightingModel);
345
346        /// Determines whether the receiver is lit per pixel. Defaults to YES. Animatable.
347        #[unsafe(method(isLitPerPixel))]
348        #[unsafe(method_family = none)]
349        pub unsafe fn isLitPerPixel(&self) -> bool;
350
351        /// Setter for [`isLitPerPixel`][Self::isLitPerPixel].
352        #[unsafe(method(setLitPerPixel:))]
353        #[unsafe(method_family = none)]
354        pub unsafe fn setLitPerPixel(&self, lit_per_pixel: bool);
355
356        /// Determines whether the receiver is double sided. Defaults to NO. Animatable.
357        #[unsafe(method(isDoubleSided))]
358        #[unsafe(method_family = none)]
359        pub unsafe fn isDoubleSided(&self) -> bool;
360
361        /// Setter for [`isDoubleSided`][Self::isDoubleSided].
362        #[unsafe(method(setDoubleSided:))]
363        #[unsafe(method_family = none)]
364        pub unsafe fn setDoubleSided(&self, double_sided: bool);
365
366        /// Determines of to how to rasterize the receiver's primitives. Defaults to SCNFillModeFill.
367        #[unsafe(method(fillMode))]
368        #[unsafe(method_family = none)]
369        pub unsafe fn fillMode(&self) -> SCNFillMode;
370
371        /// Setter for [`fillMode`][Self::fillMode].
372        #[unsafe(method(setFillMode:))]
373        #[unsafe(method_family = none)]
374        pub unsafe fn setFillMode(&self, fill_mode: SCNFillMode);
375
376        /// Determines the culling mode of the receiver. Defaults to SCNCullModeBack. Animatable.
377        #[unsafe(method(cullMode))]
378        #[unsafe(method_family = none)]
379        pub unsafe fn cullMode(&self) -> SCNCullMode;
380
381        /// Setter for [`cullMode`][Self::cullMode].
382        #[unsafe(method(setCullMode:))]
383        #[unsafe(method_family = none)]
384        pub unsafe fn setCullMode(&self, cull_mode: SCNCullMode);
385
386        /// Determines the transparency mode of the receiver. See above for the transparency modes. Defaults to SCNTransparencyModeDefault.
387        #[unsafe(method(transparencyMode))]
388        #[unsafe(method_family = none)]
389        pub unsafe fn transparencyMode(&self) -> SCNTransparencyMode;
390
391        /// Setter for [`transparencyMode`][Self::transparencyMode].
392        #[unsafe(method(setTransparencyMode:))]
393        #[unsafe(method_family = none)]
394        pub unsafe fn setTransparencyMode(&self, transparency_mode: SCNTransparencyMode);
395
396        /// Makes the ambient property automatically match the diffuse property. Defaults to NO on 10.9 and before, defaults to YES otherwise. Animatable.
397        #[unsafe(method(locksAmbientWithDiffuse))]
398        #[unsafe(method_family = none)]
399        pub unsafe fn locksAmbientWithDiffuse(&self) -> bool;
400
401        /// Setter for [`locksAmbientWithDiffuse`][Self::locksAmbientWithDiffuse].
402        #[unsafe(method(setLocksAmbientWithDiffuse:))]
403        #[unsafe(method_family = none)]
404        pub unsafe fn setLocksAmbientWithDiffuse(&self, locks_ambient_with_diffuse: bool);
405
406        /// Determines whether the receiver writes to the depth buffer when rendered. Defaults to YES.
407        #[unsafe(method(writesToDepthBuffer))]
408        #[unsafe(method_family = none)]
409        pub unsafe fn writesToDepthBuffer(&self) -> bool;
410
411        /// Setter for [`writesToDepthBuffer`][Self::writesToDepthBuffer].
412        #[unsafe(method(setWritesToDepthBuffer:))]
413        #[unsafe(method_family = none)]
414        pub unsafe fn setWritesToDepthBuffer(&self, writes_to_depth_buffer: bool);
415
416        #[cfg(feature = "SceneKitTypes")]
417        /// Determines whether the receiver writes to the color buffer when rendered. Defaults to SCNColorMaskAll.
418        #[unsafe(method(colorBufferWriteMask))]
419        #[unsafe(method_family = none)]
420        pub unsafe fn colorBufferWriteMask(&self) -> SCNColorMask;
421
422        #[cfg(feature = "SceneKitTypes")]
423        /// Setter for [`colorBufferWriteMask`][Self::colorBufferWriteMask].
424        #[unsafe(method(setColorBufferWriteMask:))]
425        #[unsafe(method_family = none)]
426        pub unsafe fn setColorBufferWriteMask(&self, color_buffer_write_mask: SCNColorMask);
427
428        /// Determines whether the receiver reads from the depth buffer when rendered. Defaults to YES.
429        #[unsafe(method(readsFromDepthBuffer))]
430        #[unsafe(method_family = none)]
431        pub unsafe fn readsFromDepthBuffer(&self) -> bool;
432
433        /// Setter for [`readsFromDepthBuffer`][Self::readsFromDepthBuffer].
434        #[unsafe(method(setReadsFromDepthBuffer:))]
435        #[unsafe(method_family = none)]
436        pub unsafe fn setReadsFromDepthBuffer(&self, reads_from_depth_buffer: bool);
437
438        #[cfg(feature = "objc2-core-foundation")]
439        /// Specifies the receiver's fresnel exponent value. Defaults to 0.0. Animatable.
440        ///
441        /// 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.
442        #[unsafe(method(fresnelExponent))]
443        #[unsafe(method_family = none)]
444        pub unsafe fn fresnelExponent(&self) -> CGFloat;
445
446        #[cfg(feature = "objc2-core-foundation")]
447        /// Setter for [`fresnelExponent`][Self::fresnelExponent].
448        #[unsafe(method(setFresnelExponent:))]
449        #[unsafe(method_family = none)]
450        pub unsafe fn setFresnelExponent(&self, fresnel_exponent: CGFloat);
451
452        /// Specifies the receiver's blend mode. Defaults to SCNBlendModeAlpha.
453        #[unsafe(method(blendMode))]
454        #[unsafe(method_family = none)]
455        pub unsafe fn blendMode(&self) -> SCNBlendMode;
456
457        /// Setter for [`blendMode`][Self::blendMode].
458        #[unsafe(method(setBlendMode:))]
459        #[unsafe(method_family = none)]
460        pub unsafe fn setBlendMode(&self, blend_mode: SCNBlendMode);
461    );
462}
463
464/// Methods declared on superclass `NSObject`.
465impl SCNMaterial {
466    extern_methods!(
467        #[unsafe(method(init))]
468        #[unsafe(method_family = init)]
469        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
470
471        #[unsafe(method(new))]
472        #[unsafe(method_family = new)]
473        pub unsafe fn new() -> Retained<Self>;
474    );
475}