objc2_scene_kit/generated/
SCNMaterialProperty.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#[cfg(feature = "objc2-metal")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_metal::*;
12
13use crate::*;
14
15/// Filtering modes
16///
17/// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnfiltermode?language=objc)
18// NS_ENUM
19#[repr(transparent)]
20#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
21pub struct SCNFilterMode(pub NSInteger);
22impl SCNFilterMode {
23    #[doc(alias = "SCNFilterModeNone")]
24    pub const None: Self = Self(0);
25    #[doc(alias = "SCNFilterModeNearest")]
26    pub const Nearest: Self = Self(1);
27    #[doc(alias = "SCNFilterModeLinear")]
28    pub const Linear: Self = Self(2);
29}
30
31unsafe impl Encode for SCNFilterMode {
32    const ENCODING: Encoding = NSInteger::ENCODING;
33}
34
35unsafe impl RefEncode for SCNFilterMode {
36    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39/// Wrap modes
40///
41/// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnwrapmode?language=objc)
42// NS_ENUM
43#[repr(transparent)]
44#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
45pub struct SCNWrapMode(pub NSInteger);
46impl SCNWrapMode {
47    #[doc(alias = "SCNWrapModeClamp")]
48    pub const Clamp: Self = Self(1);
49    #[doc(alias = "SCNWrapModeRepeat")]
50    pub const Repeat: Self = Self(2);
51    #[doc(alias = "SCNWrapModeClampToBorder")]
52    pub const ClampToBorder: Self = Self(3);
53    #[doc(alias = "SCNWrapModeMirror")]
54    pub const Mirror: Self = Self(4);
55}
56
57unsafe impl Encode for SCNWrapMode {
58    const ENCODING: Encoding = NSInteger::ENCODING;
59}
60
61unsafe impl RefEncode for SCNWrapMode {
62    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
63}
64
65extern_class!(
66    /// The contents of a SCNMaterial slot
67    ///
68    /// This can be used to specify the various properties of SCNMaterial slots such as diffuse, ambient, etc.
69    ///
70    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnmaterialproperty?language=objc)
71    #[unsafe(super(NSObject))]
72    #[derive(Debug, PartialEq, Eq, Hash)]
73    pub struct SCNMaterialProperty;
74);
75
76extern_conformance!(
77    unsafe impl NSCoding for SCNMaterialProperty {}
78);
79
80extern_conformance!(
81    unsafe impl NSObjectProtocol for SCNMaterialProperty {}
82);
83
84extern_conformance!(
85    unsafe impl NSSecureCoding for SCNMaterialProperty {}
86);
87
88#[cfg(feature = "SCNAnimation")]
89extern_conformance!(
90    unsafe impl SCNAnimatable for SCNMaterialProperty {}
91);
92
93impl SCNMaterialProperty {
94    extern_methods!(
95        /// Creates and initialize a property instance with the specified contents.
96        ///
97        /// # Safety
98        ///
99        /// `contents` should be of the correct type.
100        #[unsafe(method(materialPropertyWithContents:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn materialPropertyWithContents(contents: &AnyObject) -> Retained<Self>;
103
104        /// Specifies the receiver's contents. This can be a color (NSColor, UIColor, CGColorRef), an image (NSImage, UIImage, CGImageRef), a layer (CALayer), a path (NSString or NSURL), a SpriteKit scene (SKScene), a texture (SKTexture, id
105        /// <MTLTexture
106        /// > or GLKTextureInfo), or a floating value between 0 and 1 (NSNumber) for metalness and roughness properties. AVCaptureDevice is supported on iOS 11 and AVPlayer is supported on macOS 10.13, iOS 11 and tvOS 11. Animatable when set to a color.
107        ///
108        /// Setting the contents to an instance of SKTexture will automatically update the wrapS, wrapT, contentsTransform, minification, magnification and mip filters according to the SKTexture settings.
109        /// When a cube map is expected (e.g. SCNMaterial.reflective, SCNScene.background, SCNScene.lightingEnvironment) you can use
110        /// 1. A horizontal strip image                          where `6 * image.height ==     image.width`
111        /// 2. A vertical strip image                            where `    image.height == 6 * image.width`
112        /// 3. A spherical projection image (latitude/longitude) where `2 * image.height ==     image.width`
113        /// 4. A NSArray of 6 images. This array must contain images of the exact same dimensions, in the following order, in a left-handed coordinate system: +X, -X, +Y, -Y, +Z, -Z (or Right, Left, Top, Bottom, Front, Back).
114        #[unsafe(method(contents))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn contents(&self) -> Option<Retained<AnyObject>>;
117
118        /// Setter for [`contents`][Self::contents].
119        ///
120        /// # Safety
121        ///
122        /// `contents` should be of the correct type.
123        #[unsafe(method(setContents:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn setContents(&self, contents: Option<&AnyObject>);
126
127        #[cfg(feature = "objc2-core-foundation")]
128        /// Determines the receiver's intensity. This intensity is used to modulate the properties in several ways.
129        /// It dims the diffuse, specular and emission properties, it varies the bumpiness of the normal property and the
130        /// filter property is blended with white. Default value is 1.0. Animatable.
131        #[unsafe(method(intensity))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn intensity(&self) -> CGFloat;
134
135        #[cfg(feature = "objc2-core-foundation")]
136        /// Setter for [`intensity`][Self::intensity].
137        #[unsafe(method(setIntensity:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn setIntensity(&self, intensity: CGFloat);
140
141        /// Specifies the filter type to use when rendering the contents (specified in the `contents' property).
142        ///
143        /// The minification filter is used when to reduce the size of image data. See above the list of available modes. Defaults to SCNFilterModeLinear.
144        #[unsafe(method(minificationFilter))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn minificationFilter(&self) -> SCNFilterMode;
147
148        /// Setter for [`minificationFilter`][Self::minificationFilter].
149        #[unsafe(method(setMinificationFilter:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn setMinificationFilter(&self, minification_filter: SCNFilterMode);
152
153        /// Specifies the filter type to use when rendering the the contents (specified in the `contents' property).
154        ///
155        /// The magnification filter is used when to increase the size of image data. See above the list of available modes. Defaults to SCNFilterModeLinear.
156        #[unsafe(method(magnificationFilter))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn magnificationFilter(&self) -> SCNFilterMode;
159
160        /// Setter for [`magnificationFilter`][Self::magnificationFilter].
161        #[unsafe(method(setMagnificationFilter:))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn setMagnificationFilter(&self, magnification_filter: SCNFilterMode);
164
165        /// Specifies the mipmap filter to use during minification.
166        ///
167        /// Defaults to SCNFilterModeNearest starting macOS 10.12, iOS 10, tvOS 10 and watchOS 3. Defaults to SCNFilterModeNone in previous versions.
168        #[unsafe(method(mipFilter))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn mipFilter(&self) -> SCNFilterMode;
171
172        /// Setter for [`mipFilter`][Self::mipFilter].
173        #[unsafe(method(setMipFilter:))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn setMipFilter(&self, mip_filter: SCNFilterMode);
176
177        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-quartz-core"))]
178        #[cfg(not(target_os = "watchos"))]
179        /// Determines the receiver's contents transform. Animatable.
180        #[unsafe(method(contentsTransform))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn contentsTransform(&self) -> SCNMatrix4;
183
184        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-quartz-core"))]
185        #[cfg(not(target_os = "watchos"))]
186        /// Setter for [`contentsTransform`][Self::contentsTransform].
187        #[unsafe(method(setContentsTransform:))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn setContentsTransform(&self, contents_transform: SCNMatrix4);
190
191        /// Determines the receiver's wrap mode for the s texture coordinate. Defaults to SCNWrapModeClamp.
192        #[unsafe(method(wrapS))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn wrapS(&self) -> SCNWrapMode;
195
196        /// Setter for [`wrapS`][Self::wrapS].
197        #[unsafe(method(setWrapS:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn setWrapS(&self, wrap_s: SCNWrapMode);
200
201        /// Determines the receiver's wrap mode for the t texture coordinate. Defaults to SCNWrapModeClamp.
202        #[unsafe(method(wrapT))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn wrapT(&self) -> SCNWrapMode;
205
206        /// Setter for [`wrapT`][Self::wrapT].
207        #[unsafe(method(setWrapT:))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn setWrapT(&self, wrap_t: SCNWrapMode);
210
211        /// Determines the receiver's mapping channel. Defaults to 0.
212        ///
213        /// Geometries potentially have multiple sources of texture coordinates. Every source has a unique mapping channel index. The mapping channel allows to select which source of texture coordinates is used to map the content of the receiver.
214        #[unsafe(method(mappingChannel))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn mappingChannel(&self) -> NSInteger;
217
218        /// Setter for [`mappingChannel`][Self::mappingChannel].
219        #[unsafe(method(setMappingChannel:))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn setMappingChannel(&self, mapping_channel: NSInteger);
222
223        #[cfg(feature = "SceneKitTypes")]
224        /// Specifies the texture components to sample in the shader. Defaults to SCNColorMaskRed for displacement property, and to SCNColorMaskAll for other properties.
225        ///
226        /// Use this property to when using a texture that combine multiple informations in the different texture components. For example if you pack the roughness in red and metalness in blue etc... You can specify what component to use from the texture for this given material property. This property is only supported by Metal renderers.
227        #[unsafe(method(textureComponents))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn textureComponents(&self) -> SCNColorMask;
230
231        #[cfg(feature = "SceneKitTypes")]
232        /// Setter for [`textureComponents`][Self::textureComponents].
233        #[unsafe(method(setTextureComponents:))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn setTextureComponents(&self, texture_components: SCNColorMask);
236
237        #[cfg(feature = "objc2-core-foundation")]
238        /// Specifies the receiver's max anisotropy. Defaults to MAXFLOAT.
239        ///
240        /// Anisotropic filtering reduces blur and preserves detail at extreme viewing angles.
241        #[unsafe(method(maxAnisotropy))]
242        #[unsafe(method_family = none)]
243        pub unsafe fn maxAnisotropy(&self) -> CGFloat;
244
245        #[cfg(feature = "objc2-core-foundation")]
246        /// Setter for [`maxAnisotropy`][Self::maxAnisotropy].
247        #[unsafe(method(setMaxAnisotropy:))]
248        #[unsafe(method_family = none)]
249        pub unsafe fn setMaxAnisotropy(&self, max_anisotropy: CGFloat);
250
251        /// Returns an object suitable for a scene's `lightingEnvironment.contents` and initialized with data that was previously created by `+precomputedLightingEnvironmentDataForContents:device:error:`.
252        #[unsafe(method(precomputedLightingEnvironmentContentsWithURL:error:_))]
253        #[unsafe(method_family = none)]
254        pub unsafe fn precomputedLightingEnvironmentContentsWithURL_error(
255            url: &NSURL,
256        ) -> Result<Retained<AnyObject>, Retained<NSError>>;
257
258        /// Returns an object suitable for a scene's `lightingEnvironment.contents` and initialized with data that was previously created by `+precomputedLightingEnvironmentDataForContents:device:error:`.
259        #[unsafe(method(precomputedLightingEnvironmentContentsWithData:error:_))]
260        #[unsafe(method_family = none)]
261        pub unsafe fn precomputedLightingEnvironmentContentsWithData_error(
262            data: &NSData,
263        ) -> Result<Retained<AnyObject>, Retained<NSError>>;
264
265        #[cfg(feature = "objc2-metal")]
266        #[cfg(not(target_os = "watchos"))]
267        /// Returns an `NSData` instance containing the result of CPU and GPU-intensive operations that is suitable for caching.
268        ///
269        /// This method can be leveraged in a custom offline asset pipeline, or at run time at a convenient time before the scene is presented to the user.
270        ///
271        /// # Safety
272        ///
273        /// `contents` should be of the correct type.
274        #[unsafe(method(precomputedLightingEnvironmentDataForContents:device:error:_))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn precomputedLightingEnvironmentDataForContents_device_error(
277            contents: &AnyObject,
278            device: Option<&ProtocolObject<dyn MTLDevice>>,
279        ) -> Result<Retained<NSData>, Retained<NSError>>;
280    );
281}
282
283/// Methods declared on superclass `NSObject`.
284impl SCNMaterialProperty {
285    extern_methods!(
286        #[unsafe(method(init))]
287        #[unsafe(method_family = init)]
288        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
289
290        #[unsafe(method(new))]
291        #[unsafe(method_family = new)]
292        pub unsafe fn new() -> Retained<Self>;
293    );
294}