objc2_scene_kit/generated/
SCNPhysicsField.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/// Specifies the domain of influence of a physics field.
13///
14/// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnphysicsfieldscope?language=objc)
15// NS_ENUM
16#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct SCNPhysicsFieldScope(pub NSInteger);
19impl SCNPhysicsFieldScope {
20    #[doc(alias = "SCNPhysicsFieldScopeInsideExtent")]
21    pub const InsideExtent: Self = Self(0);
22    #[doc(alias = "SCNPhysicsFieldScopeOutsideExtent")]
23    pub const OutsideExtent: Self = Self(1);
24}
25
26unsafe impl Encode for SCNPhysicsFieldScope {
27    const ENCODING: Encoding = NSInteger::ENCODING;
28}
29
30unsafe impl RefEncode for SCNPhysicsFieldScope {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnfieldforceevaluator?language=objc)
35#[cfg(all(
36    feature = "SceneKitTypes",
37    feature = "block2",
38    feature = "objc2-core-foundation"
39))]
40pub type SCNFieldForceEvaluator = *mut block2::Block<
41    dyn Fn(SCNVector3, SCNVector3, c_float, c_float, NSTimeInterval) -> SCNVector3,
42>;
43
44extern_class!(
45    /// SCNPhysicsField is an abstract class that describes a force field that applies in the physics world.
46    ///
47    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnphysicsfield?language=objc)
48    #[unsafe(super(NSObject))]
49    #[derive(Debug, PartialEq, Eq, Hash)]
50    pub struct SCNPhysicsField;
51);
52
53unsafe impl NSCoding for SCNPhysicsField {}
54
55unsafe impl NSCopying for SCNPhysicsField {}
56
57unsafe impl CopyingHelper for SCNPhysicsField {
58    type Result = Self;
59}
60
61unsafe impl NSObjectProtocol for SCNPhysicsField {}
62
63unsafe impl NSSecureCoding for SCNPhysicsField {}
64
65impl SCNPhysicsField {
66    extern_methods!(
67        #[cfg(feature = "objc2-core-foundation")]
68        #[unsafe(method(strength))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn strength(&self) -> CGFloat;
71
72        #[cfg(feature = "objc2-core-foundation")]
73        /// Setter for [`strength`][Self::strength].
74        #[unsafe(method(setStrength:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn setStrength(&self, strength: CGFloat);
77
78        #[cfg(feature = "objc2-core-foundation")]
79        #[unsafe(method(falloffExponent))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn falloffExponent(&self) -> CGFloat;
82
83        #[cfg(feature = "objc2-core-foundation")]
84        /// Setter for [`falloffExponent`][Self::falloffExponent].
85        #[unsafe(method(setFalloffExponent:))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn setFalloffExponent(&self, falloff_exponent: CGFloat);
88
89        #[cfg(feature = "objc2-core-foundation")]
90        #[unsafe(method(minimumDistance))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn minimumDistance(&self) -> CGFloat;
93
94        #[cfg(feature = "objc2-core-foundation")]
95        /// Setter for [`minimumDistance`][Self::minimumDistance].
96        #[unsafe(method(setMinimumDistance:))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn setMinimumDistance(&self, minimum_distance: CGFloat);
99
100        #[unsafe(method(isActive))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn isActive(&self) -> bool;
103
104        /// Setter for [`isActive`][Self::isActive].
105        #[unsafe(method(setActive:))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn setActive(&self, active: bool);
108
109        #[unsafe(method(isExclusive))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn isExclusive(&self) -> bool;
112
113        /// Setter for [`isExclusive`][Self::isExclusive].
114        #[unsafe(method(setExclusive:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn setExclusive(&self, exclusive: bool);
117
118        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
119        #[unsafe(method(halfExtent))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn halfExtent(&self) -> SCNVector3;
122
123        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
124        /// Setter for [`halfExtent`][Self::halfExtent].
125        #[unsafe(method(setHalfExtent:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn setHalfExtent(&self, half_extent: SCNVector3);
128
129        #[unsafe(method(usesEllipsoidalExtent))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn usesEllipsoidalExtent(&self) -> bool;
132
133        /// Setter for [`usesEllipsoidalExtent`][Self::usesEllipsoidalExtent].
134        #[unsafe(method(setUsesEllipsoidalExtent:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn setUsesEllipsoidalExtent(&self, uses_ellipsoidal_extent: bool);
137
138        #[unsafe(method(scope))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn scope(&self) -> SCNPhysicsFieldScope;
141
142        /// Setter for [`scope`][Self::scope].
143        #[unsafe(method(setScope:))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn setScope(&self, scope: SCNPhysicsFieldScope);
146
147        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
148        #[unsafe(method(offset))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn offset(&self) -> SCNVector3;
151
152        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
153        /// Setter for [`offset`][Self::offset].
154        #[unsafe(method(setOffset:))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn setOffset(&self, offset: SCNVector3);
157
158        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
159        #[unsafe(method(direction))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn direction(&self) -> SCNVector3;
162
163        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
164        /// Setter for [`direction`][Self::direction].
165        #[unsafe(method(setDirection:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn setDirection(&self, direction: SCNVector3);
168
169        /// Determines the node physicsBody's categories that will be influenced by the receiver. Defaults to all bit set.
170        #[unsafe(method(categoryBitMask))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn categoryBitMask(&self) -> NSUInteger;
173
174        /// Setter for [`categoryBitMask`][Self::categoryBitMask].
175        #[unsafe(method(setCategoryBitMask:))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn setCategoryBitMask(&self, category_bit_mask: NSUInteger);
178
179        /// Slows an object proportionally to the object’s velocity.
180        /// Use this to simulate effects such as friction from motion through the air.
181        #[unsafe(method(dragField))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn dragField() -> Retained<SCNPhysicsField>;
184
185        /// Applies a force tangential to the direction from the sample point to the field's position.
186        /// The force will be CCW to the direction. Make the strength negative to apply force in the CW direction.
187        /// Amount is proportional to distance from center and the object's mass.
188        /// Use this to create effects such as tornadoes.
189        #[unsafe(method(vortexField))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn vortexField() -> Retained<SCNPhysicsField>;
192
193        /// Applies a force in the direction of the origin of the field in local space. To repel objects, use a negative strength.
194        /// The force is proportional to the distance from the field origin. Varies with the mass of the object according to F = ma
195        /// The field node's rotation property can be used to orient the gravity in a particular direction.
196        #[unsafe(method(radialGravityField))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn radialGravityField() -> Retained<SCNPhysicsField>;
199
200        /// Applies a force in the direction of the "direction" vector in the local space. To repel objects, use a negative strength.
201        /// The force is the same everywhere in the field. Varies with the mass of the object according to F = ma
202        /// The field node's rotation property can be used to orient the gravity in a particular direction.
203        #[unsafe(method(linearGravityField))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn linearGravityField() -> Retained<SCNPhysicsField>;
206
207        #[cfg(feature = "objc2-core-foundation")]
208        /// A time varying differentiable Perlin simplex noise field. A smoothness of 0 means as noisy as possible.
209        /// Use this to simulate such effects as fireflies, or snow.
210        /// To freeze the noise in place, set animationSpeed to 0.0. Mass is ignored.
211        /// You can change the "smoothness" and "animationSpeed" using KVC.
212        #[unsafe(method(noiseFieldWithSmoothness:animationSpeed:))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn noiseFieldWithSmoothness_animationSpeed(
215            smoothness: CGFloat,
216            speed: CGFloat,
217        ) -> Retained<SCNPhysicsField>;
218
219        #[cfg(feature = "objc2-core-foundation")]
220        /// Just like Noise, except the strength of the noise is proportional to the velocity of the object in the field.
221        #[unsafe(method(turbulenceFieldWithSmoothness:animationSpeed:))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn turbulenceFieldWithSmoothness_animationSpeed(
224            smoothness: CGFloat,
225            speed: CGFloat,
226        ) -> Retained<SCNPhysicsField>;
227
228        /// A Hooke’s law force - a force linearly proportional to distance from the center of the field. An object in this
229        /// field will oscillate with a period proportional to the inverse of the mass.
230        /// An example use is to keep objects confined to a particular region.
231        #[unsafe(method(springField))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn springField() -> Retained<SCNPhysicsField>;
234
235        /// A force proportional to the charge on the object. An example use of this field is to make objects behavior differently
236        /// from one another when they enter a region, or to make an object's behavior different than its mass based behavior
237        /// This field models the first part of the Lorentz equation, F = qE
238        #[unsafe(method(electricField))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn electricField() -> Retained<SCNPhysicsField>;
241
242        /// A force proportional to the charge on the object and the object’s velocity.
243        /// An example use of this field is to make objects behavior differently from one another when they enter a region, or to make an object's behavior different than its mass based behavior
244        /// This field models the second part of the Lorentz equation, F = qvB
245        #[unsafe(method(magneticField))]
246        #[unsafe(method_family = none)]
247        pub unsafe fn magneticField() -> Retained<SCNPhysicsField>;
248
249        #[cfg(all(
250            feature = "SceneKitTypes",
251            feature = "block2",
252            feature = "objc2-core-foundation"
253        ))]
254        /// A field force with a custom force evaluator.
255        #[unsafe(method(customFieldWithEvaluationBlock:))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn customFieldWithEvaluationBlock(
258            block: SCNFieldForceEvaluator,
259        ) -> Retained<SCNPhysicsField>;
260    );
261}
262
263/// Methods declared on superclass `NSObject`.
264impl SCNPhysicsField {
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}