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        #[unsafe(method(materialPropertyWithContents:))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn materialPropertyWithContents(contents: &AnyObject) -> Retained<Self>;
99
100        /// 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
101        /// <MTLTexture
102        /// > 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.
103        ///
104        /// 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.
105        /// When a cube map is expected (e.g. SCNMaterial.reflective, SCNScene.background, SCNScene.lightingEnvironment) you can use
106        /// 1. A horizontal strip image                          where `6 * image.height ==     image.width`
107        /// 2. A vertical strip image                            where `    image.height == 6 * image.width`
108        /// 3. A spherical projection image (latitude/longitude) where `2 * image.height ==     image.width`
109        /// 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).
110        #[unsafe(method(contents))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn contents(&self) -> Option<Retained<AnyObject>>;
113
114        /// Setter for [`contents`][Self::contents].
115        #[unsafe(method(setContents:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn setContents(&self, contents: Option<&AnyObject>);
118
119        #[cfg(feature = "objc2-core-foundation")]
120        /// Determines the receiver's intensity. This intensity is used to modulate the properties in several ways.
121        /// It dims the diffuse, specular and emission properties, it varies the bumpiness of the normal property and the
122        /// filter property is blended with white. Default value is 1.0. Animatable.
123        #[unsafe(method(intensity))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn intensity(&self) -> CGFloat;
126
127        #[cfg(feature = "objc2-core-foundation")]
128        /// Setter for [`intensity`][Self::intensity].
129        #[unsafe(method(setIntensity:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn setIntensity(&self, intensity: CGFloat);
132
133        /// Specifies the filter type to use when rendering the contents (specified in the `contents' property).
134        ///
135        /// The minification filter is used when to reduce the size of image data. See above the list of available modes. Defaults to SCNFilterModeLinear.
136        #[unsafe(method(minificationFilter))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn minificationFilter(&self) -> SCNFilterMode;
139
140        /// Setter for [`minificationFilter`][Self::minificationFilter].
141        #[unsafe(method(setMinificationFilter:))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn setMinificationFilter(&self, minification_filter: SCNFilterMode);
144
145        /// Specifies the filter type to use when rendering the the contents (specified in the `contents' property).
146        ///
147        /// The magnification filter is used when to increase the size of image data. See above the list of available modes. Defaults to SCNFilterModeLinear.
148        #[unsafe(method(magnificationFilter))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn magnificationFilter(&self) -> SCNFilterMode;
151
152        /// Setter for [`magnificationFilter`][Self::magnificationFilter].
153        #[unsafe(method(setMagnificationFilter:))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn setMagnificationFilter(&self, magnification_filter: SCNFilterMode);
156
157        /// Specifies the mipmap filter to use during minification.
158        ///
159        /// Defaults to SCNFilterModeNearest starting macOS 10.12, iOS 10, tvOS 10 and watchOS 3. Defaults to SCNFilterModeNone in previous versions.
160        #[unsafe(method(mipFilter))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn mipFilter(&self) -> SCNFilterMode;
163
164        /// Setter for [`mipFilter`][Self::mipFilter].
165        #[unsafe(method(setMipFilter:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn setMipFilter(&self, mip_filter: SCNFilterMode);
168
169        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-quartz-core"))]
170        #[cfg(not(target_os = "watchos"))]
171        /// Determines the receiver's contents transform. Animatable.
172        #[unsafe(method(contentsTransform))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn contentsTransform(&self) -> SCNMatrix4;
175
176        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-quartz-core"))]
177        #[cfg(not(target_os = "watchos"))]
178        /// Setter for [`contentsTransform`][Self::contentsTransform].
179        #[unsafe(method(setContentsTransform:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn setContentsTransform(&self, contents_transform: SCNMatrix4);
182
183        /// Determines the receiver's wrap mode for the s texture coordinate. Defaults to SCNWrapModeClamp.
184        #[unsafe(method(wrapS))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn wrapS(&self) -> SCNWrapMode;
187
188        /// Setter for [`wrapS`][Self::wrapS].
189        #[unsafe(method(setWrapS:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn setWrapS(&self, wrap_s: SCNWrapMode);
192
193        /// Determines the receiver's wrap mode for the t texture coordinate. Defaults to SCNWrapModeClamp.
194        #[unsafe(method(wrapT))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn wrapT(&self) -> SCNWrapMode;
197
198        /// Setter for [`wrapT`][Self::wrapT].
199        #[unsafe(method(setWrapT:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn setWrapT(&self, wrap_t: SCNWrapMode);
202
203        /// Determines the receiver's mapping channel. Defaults to 0.
204        ///
205        /// 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.
206        #[unsafe(method(mappingChannel))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn mappingChannel(&self) -> NSInteger;
209
210        /// Setter for [`mappingChannel`][Self::mappingChannel].
211        #[unsafe(method(setMappingChannel:))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn setMappingChannel(&self, mapping_channel: NSInteger);
214
215        #[cfg(feature = "SceneKitTypes")]
216        /// Specifies the texture components to sample in the shader. Defaults to SCNColorMaskRed for displacement property, and to SCNColorMaskAll for other properties.
217        ///
218        /// 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.
219        #[unsafe(method(textureComponents))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn textureComponents(&self) -> SCNColorMask;
222
223        #[cfg(feature = "SceneKitTypes")]
224        /// Setter for [`textureComponents`][Self::textureComponents].
225        #[unsafe(method(setTextureComponents:))]
226        #[unsafe(method_family = none)]
227        pub unsafe fn setTextureComponents(&self, texture_components: SCNColorMask);
228
229        #[cfg(feature = "objc2-core-foundation")]
230        /// Specifies the receiver's max anisotropy. Defaults to MAXFLOAT.
231        ///
232        /// Anisotropic filtering reduces blur and preserves detail at extreme viewing angles.
233        #[unsafe(method(maxAnisotropy))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn maxAnisotropy(&self) -> CGFloat;
236
237        #[cfg(feature = "objc2-core-foundation")]
238        /// Setter for [`maxAnisotropy`][Self::maxAnisotropy].
239        #[unsafe(method(setMaxAnisotropy:))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn setMaxAnisotropy(&self, max_anisotropy: CGFloat);
242
243        /// Returns an object suitable for a scene's `lightingEnvironment.contents` and initialized with data that was previously created by `+precomputedLightingEnvironmentDataForContents:device:error:`.
244        #[unsafe(method(precomputedLightingEnvironmentContentsWithURL:error:_))]
245        #[unsafe(method_family = none)]
246        pub unsafe fn precomputedLightingEnvironmentContentsWithURL_error(
247            url: &NSURL,
248        ) -> Result<Retained<AnyObject>, Retained<NSError>>;
249
250        /// Returns an object suitable for a scene's `lightingEnvironment.contents` and initialized with data that was previously created by `+precomputedLightingEnvironmentDataForContents:device:error:`.
251        #[unsafe(method(precomputedLightingEnvironmentContentsWithData:error:_))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn precomputedLightingEnvironmentContentsWithData_error(
254            data: &NSData,
255        ) -> Result<Retained<AnyObject>, Retained<NSError>>;
256
257        #[cfg(feature = "objc2-metal")]
258        #[cfg(not(target_os = "watchos"))]
259        /// Returns an `NSData` instance containing the result of CPU and GPU-intensive operations that is suitable for caching.
260        ///
261        /// 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.
262        #[unsafe(method(precomputedLightingEnvironmentDataForContents:device:error:_))]
263        #[unsafe(method_family = none)]
264        pub unsafe fn precomputedLightingEnvironmentDataForContents_device_error(
265            contents: &AnyObject,
266            device: Option<&ProtocolObject<dyn MTLDevice>>,
267        ) -> Result<Retained<NSData>, Retained<NSError>>;
268    );
269}
270
271/// Methods declared on superclass `NSObject`.
272impl SCNMaterialProperty {
273    extern_methods!(
274        #[unsafe(method(init))]
275        #[unsafe(method_family = init)]
276        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
277
278        #[unsafe(method(new))]
279        #[unsafe(method_family = new)]
280        pub unsafe fn new() -> Retained<Self>;
281    );
282}