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