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