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