objc2_scene_kit/generated/
SceneKitTypes.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-gl-kit")]
10#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
11use objc2_gl_kit::*;
12#[cfg(feature = "objc2-quartz-core")]
13#[cfg(not(target_os = "watchos"))]
14use objc2_quartz_core::*;
15
16use crate::*;
17
18/// The modes that an action can use to adjust the apparent timing of the action.
19///
20/// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnactiontimingmode?language=objc)
21// NS_ENUM
22#[repr(transparent)]
23#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
24pub struct SCNActionTimingMode(pub NSInteger);
25impl SCNActionTimingMode {
26    #[doc(alias = "SCNActionTimingModeLinear")]
27    pub const Linear: Self = Self(0);
28    #[doc(alias = "SCNActionTimingModeEaseIn")]
29    pub const EaseIn: Self = Self(1);
30    #[doc(alias = "SCNActionTimingModeEaseOut")]
31    pub const EaseOut: Self = Self(2);
32    #[doc(alias = "SCNActionTimingModeEaseInEaseOut")]
33    pub const EaseInEaseOut: Self = Self(3);
34}
35
36unsafe impl Encode for SCNActionTimingMode {
37    const ENCODING: Encoding = NSInteger::ENCODING;
38}
39
40unsafe impl RefEncode for SCNActionTimingMode {
41    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
42}
43
44/// Color components
45///
46/// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scncolormask?language=objc)
47// NS_OPTIONS
48#[repr(transparent)]
49#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
50pub struct SCNColorMask(pub NSInteger);
51bitflags::bitflags! {
52    impl SCNColorMask: NSInteger {
53        #[doc(alias = "SCNColorMaskNone")]
54        const None = 0;
55        #[doc(alias = "SCNColorMaskRed")]
56        const Red = 0x1<<3;
57        #[doc(alias = "SCNColorMaskGreen")]
58        const Green = 0x1<<2;
59        #[doc(alias = "SCNColorMaskBlue")]
60        const Blue = 0x1<<1;
61        #[doc(alias = "SCNColorMaskAlpha")]
62        const Alpha = 0x1<<0;
63        #[doc(alias = "SCNColorMaskAll")]
64        const All = 0xf;
65    }
66}
67
68unsafe impl Encode for SCNColorMask {
69    const ENCODING: Encoding = NSInteger::ENCODING;
70}
71
72unsafe impl RefEncode for SCNColorMask {
73    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
74}
75
76/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnvector3?language=objc)
77#[cfg(feature = "objc2-core-foundation")]
78#[repr(C)]
79#[derive(Clone, Copy, Debug, PartialEq)]
80pub struct SCNVector3 {
81    pub x: CGFloat,
82    pub y: CGFloat,
83    pub z: CGFloat,
84}
85
86#[cfg(feature = "objc2-core-foundation")]
87unsafe impl Encode for SCNVector3 {
88    const ENCODING: Encoding = Encoding::Struct(
89        "SCNVector3",
90        &[
91            <CGFloat>::ENCODING,
92            <CGFloat>::ENCODING,
93            <CGFloat>::ENCODING,
94        ],
95    );
96}
97
98#[cfg(feature = "objc2-core-foundation")]
99unsafe impl RefEncode for SCNVector3 {
100    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
101}
102
103/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnvector4?language=objc)
104#[cfg(feature = "objc2-core-foundation")]
105#[repr(C)]
106#[derive(Clone, Copy, Debug, PartialEq)]
107pub struct SCNVector4 {
108    pub x: CGFloat,
109    pub y: CGFloat,
110    pub z: CGFloat,
111    pub w: CGFloat,
112}
113
114#[cfg(feature = "objc2-core-foundation")]
115unsafe impl Encode for SCNVector4 {
116    const ENCODING: Encoding = Encoding::Struct(
117        "SCNVector4",
118        &[
119            <CGFloat>::ENCODING,
120            <CGFloat>::ENCODING,
121            <CGFloat>::ENCODING,
122            <CGFloat>::ENCODING,
123        ],
124    );
125}
126
127#[cfg(feature = "objc2-core-foundation")]
128unsafe impl RefEncode for SCNVector4 {
129    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
130}
131
132extern "C" {
133    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnvector3zero?language=objc)
134    #[cfg(feature = "objc2-core-foundation")]
135    pub static SCNVector3Zero: SCNVector3;
136}
137
138extern "C" {
139    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnvector4zero?language=objc)
140    #[cfg(feature = "objc2-core-foundation")]
141    pub static SCNVector4Zero: SCNVector4;
142}
143
144#[cfg(feature = "objc2-core-foundation")]
145impl SCNVector3 {
146    #[doc(alias = "SCNVector3EqualToVector3")]
147    #[cfg(feature = "objc2-core-foundation")]
148    #[inline]
149    pub unsafe fn equal_to_vector3(self, b: SCNVector3) -> bool {
150        extern "C-unwind" {
151            fn SCNVector3EqualToVector3(a: SCNVector3, b: SCNVector3) -> bool;
152        }
153        unsafe { SCNVector3EqualToVector3(self, b) }
154    }
155}
156
157#[cfg(feature = "objc2-core-foundation")]
158impl SCNVector4 {
159    #[doc(alias = "SCNVector4EqualToVector4")]
160    #[cfg(feature = "objc2-core-foundation")]
161    #[inline]
162    pub unsafe fn equal_to_vector4(self, b: SCNVector4) -> bool {
163        extern "C-unwind" {
164            fn SCNVector4EqualToVector4(a: SCNVector4, b: SCNVector4) -> bool;
165        }
166        unsafe { SCNVector4EqualToVector4(self, b) }
167    }
168}
169
170#[cfg(feature = "objc2-core-foundation")]
171impl SCNVector3 {
172    // TODO: pub fn SCNVector3Make(x: CGFloat,y: CGFloat,z: CGFloat,) -> SCNVector3;
173}
174
175#[cfg(feature = "objc2-core-foundation")]
176impl SCNVector4 {
177    // TODO: pub fn SCNVector4Make(x: CGFloat,y: CGFloat,z: CGFloat,w: CGFloat,) -> SCNVector4;
178}
179
180/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnquaternion?language=objc)
181#[cfg(feature = "objc2-core-foundation")]
182pub type SCNQuaternion = SCNVector4;
183
184/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnmatrix4?language=objc)
185#[cfg(feature = "objc2-quartz-core")]
186#[cfg(not(target_os = "watchos"))]
187pub type SCNMatrix4 = CATransform3D;
188
189extern "C" {
190    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnmatrix4identity?language=objc)
191    #[cfg(feature = "objc2-quartz-core")]
192    #[cfg(not(target_os = "watchos"))]
193    pub static SCNMatrix4Identity: SCNMatrix4;
194}
195
196extern "C-unwind" {
197    #[cfg(feature = "objc2-quartz-core")]
198    #[cfg(not(target_os = "watchos"))]
199    pub fn SCNMatrix4IsIdentity(m: SCNMatrix4) -> bool;
200}
201
202extern "C-unwind" {
203    #[cfg(feature = "objc2-quartz-core")]
204    #[cfg(not(target_os = "watchos"))]
205    pub fn SCNMatrix4EqualToMatrix4(a: SCNMatrix4, b: SCNMatrix4) -> bool;
206}
207
208// TODO: pub fn SCNMatrix4MakeTranslation(tx: CGFloat,ty: CGFloat,tz: CGFloat,) -> SCNMatrix4;
209
210// TODO: pub fn SCNMatrix4MakeScale(sx: CGFloat,sy: CGFloat,sz: CGFloat,) -> SCNMatrix4;
211
212extern "C-unwind" {
213    #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-quartz-core"))]
214    #[cfg(not(target_os = "watchos"))]
215    pub fn SCNMatrix4MakeRotation(angle: CGFloat, x: CGFloat, y: CGFloat, z: CGFloat)
216        -> SCNMatrix4;
217}
218
219// TODO: pub fn SCNMatrix4Translate(m: SCNMatrix4,tx: CGFloat,ty: CGFloat,tz: CGFloat,) -> SCNMatrix4;
220
221extern "C-unwind" {
222    #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-quartz-core"))]
223    #[cfg(not(target_os = "watchos"))]
224    pub fn SCNMatrix4Scale(m: SCNMatrix4, sx: CGFloat, sy: CGFloat, sz: CGFloat) -> SCNMatrix4;
225}
226
227extern "C-unwind" {
228    #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-quartz-core"))]
229    #[cfg(not(target_os = "watchos"))]
230    pub fn SCNMatrix4Rotate(
231        m: SCNMatrix4,
232        angle: CGFloat,
233        x: CGFloat,
234        y: CGFloat,
235        z: CGFloat,
236    ) -> SCNMatrix4;
237}
238
239extern "C-unwind" {
240    #[cfg(feature = "objc2-quartz-core")]
241    #[cfg(not(target_os = "watchos"))]
242    pub fn SCNMatrix4Invert(m: SCNMatrix4) -> SCNMatrix4;
243}
244
245extern "C-unwind" {
246    #[cfg(feature = "objc2-quartz-core")]
247    #[cfg(not(target_os = "watchos"))]
248    pub fn SCNMatrix4Mult(a: SCNMatrix4, b: SCNMatrix4) -> SCNMatrix4;
249}
250
251#[cfg(feature = "objc2-core-foundation")]
252impl SCNVector3 {
253    // TODO: pub fn SCNVector3FromGLKVector3(vector: GLKVector3,) -> SCNVector3;
254
255    // TODO: pub fn SCNVector3ToGLKVector3(vector: SCNVector3,) -> GLKVector3;
256}
257
258#[cfg(feature = "objc2-core-foundation")]
259impl SCNVector4 {
260    // TODO: pub fn SCNVector4FromGLKVector4(vector: GLKVector4,) -> SCNVector4;
261
262    // TODO: pub fn SCNVector4ToGLKVector4(vector: SCNVector4,) -> GLKVector4;
263}
264
265extern "C-unwind" {
266    /// # Safety
267    ///
268    /// The returned must be correctly initialized.
269    #[cfg(all(feature = "objc2-gl-kit", feature = "objc2-quartz-core"))]
270    #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
271    pub fn SCNMatrix4ToGLKMatrix4(mat: SCNMatrix4) -> GLKMatrix4;
272}
273
274extern "C-unwind" {
275    /// # Safety
276    ///
277    /// `mat` must be correctly initialized.
278    #[cfg(all(feature = "objc2-gl-kit", feature = "objc2-quartz-core"))]
279    #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
280    pub fn SCNMatrix4FromGLKMatrix4(mat: GLKMatrix4) -> SCNMatrix4;
281}
282
283mod private_NSValueSceneKitAdditions {
284    pub trait Sealed {}
285}
286
287/// Category "SceneKitAdditions" on [`NSValue`].
288///
289/// Adds methods to wrap vectors in NSValue objects.
290#[doc(alias = "SceneKitAdditions")]
291pub unsafe trait NSValueSceneKitAdditions:
292    ClassType + Sized + private_NSValueSceneKitAdditions::Sealed
293{
294    extern_methods!(
295        #[cfg(feature = "objc2-core-foundation")]
296        #[unsafe(method(valueWithSCNVector3:))]
297        #[unsafe(method_family = none)]
298        unsafe fn valueWithSCNVector3(v: SCNVector3) -> Retained<NSValue>;
299
300        #[cfg(feature = "objc2-core-foundation")]
301        #[unsafe(method(valueWithSCNVector4:))]
302        #[unsafe(method_family = none)]
303        unsafe fn valueWithSCNVector4(v: SCNVector4) -> Retained<NSValue>;
304
305        #[cfg(feature = "objc2-quartz-core")]
306        #[cfg(not(target_os = "watchos"))]
307        #[unsafe(method(valueWithSCNMatrix4:))]
308        #[unsafe(method_family = none)]
309        unsafe fn valueWithSCNMatrix4(v: SCNMatrix4) -> Retained<NSValue>;
310
311        #[cfg(feature = "objc2-core-foundation")]
312        #[unsafe(method(SCNVector3Value))]
313        #[unsafe(method_family = none)]
314        unsafe fn SCNVector3Value(&self) -> SCNVector3;
315
316        #[cfg(feature = "objc2-core-foundation")]
317        #[unsafe(method(SCNVector4Value))]
318        #[unsafe(method_family = none)]
319        unsafe fn SCNVector4Value(&self) -> SCNVector4;
320
321        #[cfg(feature = "objc2-quartz-core")]
322        #[cfg(not(target_os = "watchos"))]
323        #[unsafe(method(SCNMatrix4Value))]
324        #[unsafe(method_family = none)]
325        unsafe fn SCNMatrix4Value(&self) -> SCNMatrix4;
326    );
327}
328
329impl private_NSValueSceneKitAdditions::Sealed for NSValue {}
330unsafe impl NSValueSceneKitAdditions for NSValue {}
331
332extern "C" {
333    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnerrordomain?language=objc)
334    pub static SCNErrorDomain: &'static NSString;
335}
336
337/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnprogramcompilationerror?language=objc)
338pub const SCNProgramCompilationError: c_uint = 1;
339
340extern "C-unwind" {
341    #[cfg(feature = "objc2-core-foundation")]
342    #[deprecated = "renamed to `SCNVector3::equal_to_vector3`"]
343    pub fn SCNVector3EqualToVector3(a: SCNVector3, b: SCNVector3) -> bool;
344}
345
346extern "C-unwind" {
347    #[cfg(feature = "objc2-core-foundation")]
348    #[deprecated = "renamed to `SCNVector4::equal_to_vector4`"]
349    pub fn SCNVector4EqualToVector4(a: SCNVector4, b: SCNVector4) -> bool;
350}