objc2_scene_kit/generated/
SCNPhysicsWorld.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
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnphysicstestoption?language=objc)
13// NS_TYPED_ENUM
14pub type SCNPhysicsTestOption = NSString;
15
16extern "C" {
17    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnphysicstestcollisionbitmaskkey?language=objc)
18    pub static SCNPhysicsTestCollisionBitMaskKey: &'static SCNPhysicsTestOption;
19}
20
21extern "C" {
22    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnphysicstestsearchmodekey?language=objc)
23    pub static SCNPhysicsTestSearchModeKey: &'static SCNPhysicsTestOption;
24}
25
26extern "C" {
27    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnphysicstestbackfacecullingkey?language=objc)
28    pub static SCNPhysicsTestBackfaceCullingKey: &'static SCNPhysicsTestOption;
29}
30
31/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnphysicstestsearchmode?language=objc)
32// NS_TYPED_ENUM
33pub type SCNPhysicsTestSearchMode = NSString;
34
35extern "C" {
36    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnphysicstestsearchmodeany?language=objc)
37    pub static SCNPhysicsTestSearchModeAny: &'static SCNPhysicsTestSearchMode;
38}
39
40extern "C" {
41    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnphysicstestsearchmodeclosest?language=objc)
42    pub static SCNPhysicsTestSearchModeClosest: &'static SCNPhysicsTestSearchMode;
43}
44
45extern "C" {
46    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnphysicstestsearchmodeall?language=objc)
47    pub static SCNPhysicsTestSearchModeAll: &'static SCNPhysicsTestSearchMode;
48}
49
50extern_protocol!(
51    /// The SCNPhysicsContactDelegate protocol is to be implemented by delegates that want to be notified when a contact occured.
52    ///
53    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnphysicscontactdelegate?language=objc)
54    pub unsafe trait SCNPhysicsContactDelegate: NSObjectProtocol {
55        #[cfg(feature = "SCNPhysicsContact")]
56        #[optional]
57        #[unsafe(method(physicsWorld:didBeginContact:))]
58        #[unsafe(method_family = none)]
59        unsafe fn physicsWorld_didBeginContact(
60            &self,
61            world: &SCNPhysicsWorld,
62            contact: &SCNPhysicsContact,
63        );
64
65        #[cfg(feature = "SCNPhysicsContact")]
66        #[optional]
67        #[unsafe(method(physicsWorld:didUpdateContact:))]
68        #[unsafe(method_family = none)]
69        unsafe fn physicsWorld_didUpdateContact(
70            &self,
71            world: &SCNPhysicsWorld,
72            contact: &SCNPhysicsContact,
73        );
74
75        #[cfg(feature = "SCNPhysicsContact")]
76        #[optional]
77        #[unsafe(method(physicsWorld:didEndContact:))]
78        #[unsafe(method_family = none)]
79        unsafe fn physicsWorld_didEndContact(
80            &self,
81            world: &SCNPhysicsWorld,
82            contact: &SCNPhysicsContact,
83        );
84    }
85);
86
87extern_class!(
88    /// The SCNPhysicsWorld class describes and allows to control the physics simulation of a 3d scene.
89    ///
90    /// The SCNPhysicsWorld class should not be allocated directly but retrieved from the SCNScene class using the physicsWorld property.
91    ///
92    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnphysicsworld?language=objc)
93    #[unsafe(super(NSObject))]
94    #[derive(Debug, PartialEq, Eq, Hash)]
95    pub struct SCNPhysicsWorld;
96);
97
98extern_conformance!(
99    unsafe impl NSCoding for SCNPhysicsWorld {}
100);
101
102extern_conformance!(
103    unsafe impl NSObjectProtocol for SCNPhysicsWorld {}
104);
105
106extern_conformance!(
107    unsafe impl NSSecureCoding for SCNPhysicsWorld {}
108);
109
110impl SCNPhysicsWorld {
111    extern_methods!(
112        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
113        #[unsafe(method(gravity))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn gravity(&self) -> SCNVector3;
116
117        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
118        /// Setter for [`gravity`][Self::gravity].
119        #[unsafe(method(setGravity:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn setGravity(&self, gravity: SCNVector3);
122
123        #[cfg(feature = "objc2-core-foundation")]
124        #[unsafe(method(speed))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn speed(&self) -> CGFloat;
127
128        #[cfg(feature = "objc2-core-foundation")]
129        /// Setter for [`speed`][Self::speed].
130        #[unsafe(method(setSpeed:))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn setSpeed(&self, speed: CGFloat);
133
134        #[unsafe(method(timeStep))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn timeStep(&self) -> NSTimeInterval;
137
138        /// Setter for [`timeStep`][Self::timeStep].
139        #[unsafe(method(setTimeStep:))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn setTimeStep(&self, time_step: NSTimeInterval);
142
143        #[unsafe(method(contactDelegate))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn contactDelegate(
146            &self,
147        ) -> Option<Retained<ProtocolObject<dyn SCNPhysicsContactDelegate>>>;
148
149        /// Setter for [`contactDelegate`][Self::contactDelegate].
150        ///
151        /// This is a [weak property][objc2::topics::weak_property].
152        #[unsafe(method(setContactDelegate:))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn setContactDelegate(
155            &self,
156            contact_delegate: Option<&ProtocolObject<dyn SCNPhysicsContactDelegate>>,
157        );
158
159        #[cfg(feature = "SCNPhysicsBehavior")]
160        #[unsafe(method(addBehavior:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn addBehavior(&self, behavior: &SCNPhysicsBehavior);
163
164        #[cfg(feature = "SCNPhysicsBehavior")]
165        #[unsafe(method(removeBehavior:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn removeBehavior(&self, behavior: &SCNPhysicsBehavior);
168
169        #[unsafe(method(removeAllBehaviors))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn removeAllBehaviors(&self);
172
173        #[cfg(feature = "SCNPhysicsBehavior")]
174        #[unsafe(method(allBehaviors))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn allBehaviors(&self) -> Retained<NSArray<SCNPhysicsBehavior>>;
177
178        #[cfg(all(
179            feature = "SCNHitTest",
180            feature = "SceneKitTypes",
181            feature = "objc2-core-foundation"
182        ))]
183        /// # Safety
184        ///
185        /// `options` generic should be of the correct type.
186        #[unsafe(method(rayTestWithSegmentFromPoint:toPoint:options:))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn rayTestWithSegmentFromPoint_toPoint_options(
189            &self,
190            origin: SCNVector3,
191            dest: SCNVector3,
192            options: Option<&NSDictionary<SCNPhysicsTestOption, AnyObject>>,
193        ) -> Retained<NSArray<SCNHitTestResult>>;
194
195        #[cfg(all(feature = "SCNPhysicsBody", feature = "SCNPhysicsContact"))]
196        /// # Safety
197        ///
198        /// `options` generic should be of the correct type.
199        #[unsafe(method(contactTestBetweenBody:andBody:options:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn contactTestBetweenBody_andBody_options(
202            &self,
203            body_a: &SCNPhysicsBody,
204            body_b: &SCNPhysicsBody,
205            options: Option<&NSDictionary<SCNPhysicsTestOption, AnyObject>>,
206        ) -> Retained<NSArray<SCNPhysicsContact>>;
207
208        #[cfg(all(feature = "SCNPhysicsBody", feature = "SCNPhysicsContact"))]
209        /// # Safety
210        ///
211        /// `options` generic should be of the correct type.
212        #[unsafe(method(contactTestWithBody:options:))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn contactTestWithBody_options(
215            &self,
216            body: &SCNPhysicsBody,
217            options: Option<&NSDictionary<SCNPhysicsTestOption, AnyObject>>,
218        ) -> Retained<NSArray<SCNPhysicsContact>>;
219
220        #[cfg(all(
221            feature = "SCNPhysicsContact",
222            feature = "SCNPhysicsShape",
223            feature = "SceneKitTypes",
224            feature = "objc2-quartz-core"
225        ))]
226        #[cfg(not(target_os = "watchos"))]
227        /// # Safety
228        ///
229        /// `options` generic should be of the correct type.
230        #[unsafe(method(convexSweepTestWithShape:fromTransform:toTransform:options:))]
231        #[unsafe(method_family = none)]
232        pub unsafe fn convexSweepTestWithShape_fromTransform_toTransform_options(
233            &self,
234            shape: &SCNPhysicsShape,
235            from: SCNMatrix4,
236            to: SCNMatrix4,
237            options: Option<&NSDictionary<SCNPhysicsTestOption, AnyObject>>,
238        ) -> Retained<NSArray<SCNPhysicsContact>>;
239
240        #[unsafe(method(updateCollisionPairs))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn updateCollisionPairs(&self);
243    );
244}
245
246/// Methods declared on superclass `NSObject`.
247impl SCNPhysicsWorld {
248    extern_methods!(
249        #[unsafe(method(init))]
250        #[unsafe(method_family = init)]
251        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
252
253        #[unsafe(method(new))]
254        #[unsafe(method_family = new)]
255        pub unsafe fn new() -> Retained<Self>;
256    );
257}