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        /// This is a [weak property][objc2::topics::weak_property].
150        /// Setter for [`contactDelegate`][Self::contactDelegate].
151        #[unsafe(method(setContactDelegate:))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn setContactDelegate(
154            &self,
155            contact_delegate: Option<&ProtocolObject<dyn SCNPhysicsContactDelegate>>,
156        );
157
158        #[cfg(feature = "SCNPhysicsBehavior")]
159        #[unsafe(method(addBehavior:))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn addBehavior(&self, behavior: &SCNPhysicsBehavior);
162
163        #[cfg(feature = "SCNPhysicsBehavior")]
164        #[unsafe(method(removeBehavior:))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn removeBehavior(&self, behavior: &SCNPhysicsBehavior);
167
168        #[unsafe(method(removeAllBehaviors))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn removeAllBehaviors(&self);
171
172        #[cfg(feature = "SCNPhysicsBehavior")]
173        #[unsafe(method(allBehaviors))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn allBehaviors(&self) -> Retained<NSArray<SCNPhysicsBehavior>>;
176
177        #[cfg(all(
178            feature = "SCNHitTest",
179            feature = "SceneKitTypes",
180            feature = "objc2-core-foundation"
181        ))]
182        #[unsafe(method(rayTestWithSegmentFromPoint:toPoint:options:))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn rayTestWithSegmentFromPoint_toPoint_options(
185            &self,
186            origin: SCNVector3,
187            dest: SCNVector3,
188            options: Option<&NSDictionary<SCNPhysicsTestOption, AnyObject>>,
189        ) -> Retained<NSArray<SCNHitTestResult>>;
190
191        #[cfg(all(feature = "SCNPhysicsBody", feature = "SCNPhysicsContact"))]
192        #[unsafe(method(contactTestBetweenBody:andBody:options:))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn contactTestBetweenBody_andBody_options(
195            &self,
196            body_a: &SCNPhysicsBody,
197            body_b: &SCNPhysicsBody,
198            options: Option<&NSDictionary<SCNPhysicsTestOption, AnyObject>>,
199        ) -> Retained<NSArray<SCNPhysicsContact>>;
200
201        #[cfg(all(feature = "SCNPhysicsBody", feature = "SCNPhysicsContact"))]
202        #[unsafe(method(contactTestWithBody:options:))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn contactTestWithBody_options(
205            &self,
206            body: &SCNPhysicsBody,
207            options: Option<&NSDictionary<SCNPhysicsTestOption, AnyObject>>,
208        ) -> Retained<NSArray<SCNPhysicsContact>>;
209
210        #[cfg(all(
211            feature = "SCNPhysicsContact",
212            feature = "SCNPhysicsShape",
213            feature = "SceneKitTypes",
214            feature = "objc2-quartz-core"
215        ))]
216        #[cfg(not(target_os = "watchos"))]
217        #[unsafe(method(convexSweepTestWithShape:fromTransform:toTransform:options:))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn convexSweepTestWithShape_fromTransform_toTransform_options(
220            &self,
221            shape: &SCNPhysicsShape,
222            from: SCNMatrix4,
223            to: SCNMatrix4,
224            options: Option<&NSDictionary<SCNPhysicsTestOption, AnyObject>>,
225        ) -> Retained<NSArray<SCNPhysicsContact>>;
226
227        #[unsafe(method(updateCollisionPairs))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn updateCollisionPairs(&self);
230    );
231}
232
233/// Methods declared on superclass `NSObject`.
234impl SCNPhysicsWorld {
235    extern_methods!(
236        #[unsafe(method(init))]
237        #[unsafe(method_family = init)]
238        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
239
240        #[unsafe(method(new))]
241        #[unsafe(method_family = new)]
242        pub unsafe fn new() -> Retained<Self>;
243    );
244}