objc2_scene_kit/generated/
SCNConstraint.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
12extern_class!(
13    /// A SCNConstraint is an abstract class that represents a single constraint that can be applied to a node.
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnconstraint?language=objc)
16    #[unsafe(super(NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    pub struct SCNConstraint;
19);
20
21unsafe impl NSCoding for SCNConstraint {}
22
23unsafe impl NSCopying for SCNConstraint {}
24
25unsafe impl CopyingHelper for SCNConstraint {
26    type Result = Self;
27}
28
29unsafe impl NSObjectProtocol for SCNConstraint {}
30
31unsafe impl NSSecureCoding for SCNConstraint {}
32
33#[cfg(feature = "SCNAnimation")]
34unsafe impl SCNAnimatable for SCNConstraint {}
35
36impl SCNConstraint {
37    extern_methods!(
38        /// Determines whether the constraint is enabled or not. Defaults to YES.
39        #[unsafe(method(isEnabled))]
40        #[unsafe(method_family = none)]
41        pub unsafe fn isEnabled(&self) -> bool;
42
43        /// Setter for [`isEnabled`][Self::isEnabled].
44        #[unsafe(method(setEnabled:))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn setEnabled(&self, enabled: bool);
47
48        #[cfg(feature = "objc2-core-foundation")]
49        /// Specifies the inflence factor of the receiver. Defaults to 1. Animatable
50        #[unsafe(method(influenceFactor))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn influenceFactor(&self) -> CGFloat;
53
54        #[cfg(feature = "objc2-core-foundation")]
55        /// Setter for [`influenceFactor`][Self::influenceFactor].
56        #[unsafe(method(setInfluenceFactor:))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn setInfluenceFactor(&self, influence_factor: CGFloat);
59
60        /// Specifies whether or not the contraint should applies incrementally and have it's effect being cumulated over the rendered frames. Defaults to YES starting macOS 10.13, iOS 11, tvOS 11 and watchOS 4. Defaults to NO in previous versions.
61        #[unsafe(method(isIncremental))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn isIncremental(&self) -> bool;
64
65        /// Setter for [`isIncremental`][Self::isIncremental].
66        #[unsafe(method(setIncremental:))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn setIncremental(&self, incremental: bool);
69    );
70}
71
72/// Methods declared on superclass `NSObject`.
73impl SCNConstraint {
74    extern_methods!(
75        #[unsafe(method(init))]
76        #[unsafe(method_family = init)]
77        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
78
79        #[unsafe(method(new))]
80        #[unsafe(method_family = new)]
81        pub unsafe fn new() -> Retained<Self>;
82    );
83}
84
85extern_class!(
86    /// A SCNLookAtConstraint applies on a node's orientation so that it always look at another node.
87    ///
88    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnlookatconstraint?language=objc)
89    #[unsafe(super(SCNConstraint, NSObject))]
90    #[derive(Debug, PartialEq, Eq, Hash)]
91    pub struct SCNLookAtConstraint;
92);
93
94unsafe impl NSCoding for SCNLookAtConstraint {}
95
96unsafe impl NSCopying for SCNLookAtConstraint {}
97
98unsafe impl CopyingHelper for SCNLookAtConstraint {
99    type Result = Self;
100}
101
102unsafe impl NSObjectProtocol for SCNLookAtConstraint {}
103
104unsafe impl NSSecureCoding for SCNLookAtConstraint {}
105
106#[cfg(feature = "SCNAnimation")]
107unsafe impl SCNAnimatable for SCNLookAtConstraint {}
108
109impl SCNLookAtConstraint {
110    extern_methods!(
111        #[cfg(feature = "SCNNode")]
112        /// Creates and returns a SCNLookAtConstraint object with the specified target.
113        ///
114        /// Parameter `target`: The target node to look at.
115        #[unsafe(method(lookAtConstraintWithTarget:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn lookAtConstraintWithTarget(target: Option<&SCNNode>) -> Retained<Self>;
118
119        #[cfg(feature = "SCNNode")]
120        /// Defines the target node to look at.
121        #[unsafe(method(target))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn target(&self) -> Option<Retained<SCNNode>>;
124
125        #[cfg(feature = "SCNNode")]
126        /// Setter for [`target`][Self::target].
127        #[unsafe(method(setTarget:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn setTarget(&self, target: Option<&SCNNode>);
130
131        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
132        /// Offset look at position in target space. Defaults to zero. Animatable
133        #[unsafe(method(targetOffset))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn targetOffset(&self) -> SCNVector3;
136
137        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
138        /// Setter for [`targetOffset`][Self::targetOffset].
139        #[unsafe(method(setTargetOffset:))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn setTargetOffset(&self, target_offset: SCNVector3);
142
143        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
144        /// Front direction in the constraint owner local space. Defaults to -[SCNNode localFront]. Animatable
145        #[unsafe(method(localFront))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn localFront(&self) -> SCNVector3;
148
149        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
150        /// Setter for [`localFront`][Self::localFront].
151        #[unsafe(method(setLocalFront:))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn setLocalFront(&self, local_front: SCNVector3);
154
155        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
156        /// Up reference direction in world space. Defaults to -[SCNNode localUp]. Animatable
157        #[unsafe(method(worldUp))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn worldUp(&self) -> SCNVector3;
160
161        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
162        /// Setter for [`worldUp`][Self::worldUp].
163        #[unsafe(method(setWorldUp:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn setWorldUp(&self, world_up: SCNVector3);
166
167        /// Specifies whether the receiver enables the gimbal lock. Defaults to NO.
168        ///
169        /// Enabling the gimbal lock prevents the receiver from rotating the constrained node around to roll axis.
170        #[unsafe(method(gimbalLockEnabled))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn gimbalLockEnabled(&self) -> bool;
173
174        /// Setter for [`gimbalLockEnabled`][Self::gimbalLockEnabled].
175        #[unsafe(method(setGimbalLockEnabled:))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn setGimbalLockEnabled(&self, gimbal_lock_enabled: bool);
178    );
179}
180
181/// Methods declared on superclass `NSObject`.
182impl SCNLookAtConstraint {
183    extern_methods!(
184        #[unsafe(method(init))]
185        #[unsafe(method_family = init)]
186        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
187
188        #[unsafe(method(new))]
189        #[unsafe(method_family = new)]
190        pub unsafe fn new() -> Retained<Self>;
191    );
192}
193
194/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnbillboardaxis?language=objc)
195// NS_OPTIONS
196#[repr(transparent)]
197#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
198pub struct SCNBillboardAxis(pub NSUInteger);
199bitflags::bitflags! {
200    impl SCNBillboardAxis: NSUInteger {
201        #[doc(alias = "SCNBillboardAxisX")]
202        const X = 0x1<<0;
203        #[doc(alias = "SCNBillboardAxisY")]
204        const Y = 0x1<<1;
205        #[doc(alias = "SCNBillboardAxisZ")]
206        const Z = 0x1<<2;
207        #[doc(alias = "SCNBillboardAxisAll")]
208        const All = SCNBillboardAxis::X.0|SCNBillboardAxis::Y.0|SCNBillboardAxis::Z.0;
209    }
210}
211
212unsafe impl Encode for SCNBillboardAxis {
213    const ENCODING: Encoding = NSUInteger::ENCODING;
214}
215
216unsafe impl RefEncode for SCNBillboardAxis {
217    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
218}
219
220extern_class!(
221    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnbillboardconstraint?language=objc)
222    #[unsafe(super(SCNConstraint, NSObject))]
223    #[derive(Debug, PartialEq, Eq, Hash)]
224    pub struct SCNBillboardConstraint;
225);
226
227unsafe impl NSCoding for SCNBillboardConstraint {}
228
229unsafe impl NSCopying for SCNBillboardConstraint {}
230
231unsafe impl CopyingHelper for SCNBillboardConstraint {
232    type Result = Self;
233}
234
235unsafe impl NSObjectProtocol for SCNBillboardConstraint {}
236
237unsafe impl NSSecureCoding for SCNBillboardConstraint {}
238
239#[cfg(feature = "SCNAnimation")]
240unsafe impl SCNAnimatable for SCNBillboardConstraint {}
241
242impl SCNBillboardConstraint {
243    extern_methods!(
244        /// Creates and returns a SCNBillboardConstraint constraint.
245        ///
246        /// A billboard constraint forces the receiver to look into the direction of the current point of view.
247        #[unsafe(method(billboardConstraint))]
248        #[unsafe(method_family = none)]
249        pub unsafe fn billboardConstraint() -> Retained<Self>;
250
251        /// Specifies the axes on which the billboarding orientation operates. Defaults to SCNBillboardAxisAll.
252        #[unsafe(method(freeAxes))]
253        #[unsafe(method_family = none)]
254        pub unsafe fn freeAxes(&self) -> SCNBillboardAxis;
255
256        /// Setter for [`freeAxes`][Self::freeAxes].
257        #[unsafe(method(setFreeAxes:))]
258        #[unsafe(method_family = none)]
259        pub unsafe fn setFreeAxes(&self, free_axes: SCNBillboardAxis);
260    );
261}
262
263/// Methods declared on superclass `NSObject`.
264impl SCNBillboardConstraint {
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}
275
276extern_class!(
277    /// A SCNTransformConstraint applies on the transform of a node via a custom block.
278    ///
279    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scntransformconstraint?language=objc)
280    #[unsafe(super(SCNConstraint, NSObject))]
281    #[derive(Debug, PartialEq, Eq, Hash)]
282    pub struct SCNTransformConstraint;
283);
284
285unsafe impl NSCoding for SCNTransformConstraint {}
286
287unsafe impl NSCopying for SCNTransformConstraint {}
288
289unsafe impl CopyingHelper for SCNTransformConstraint {
290    type Result = Self;
291}
292
293unsafe impl NSObjectProtocol for SCNTransformConstraint {}
294
295unsafe impl NSSecureCoding for SCNTransformConstraint {}
296
297#[cfg(feature = "SCNAnimation")]
298unsafe impl SCNAnimatable for SCNTransformConstraint {}
299
300impl SCNTransformConstraint {
301    extern_methods!(
302        #[cfg(all(
303            feature = "SCNNode",
304            feature = "SceneKitTypes",
305            feature = "block2",
306            feature = "objc2-quartz-core"
307        ))]
308        #[cfg(not(target_os = "watchos"))]
309        /// Creates and returns a SCNTransformConstraint object with the specified parameters.
310        ///
311        /// Parameter `world`: Determines whether the constraint is evaluated in world or local space.
312        ///
313        /// Parameter `block`: The custom block to call to evaluate the constraint.
314        ///
315        /// The node and its transform are passed to the block. The transform returned by the block will be used to render the node.
316        #[unsafe(method(transformConstraintInWorldSpace:withBlock:))]
317        #[unsafe(method_family = none)]
318        pub unsafe fn transformConstraintInWorldSpace_withBlock(
319            world: bool,
320            block: &block2::Block<dyn Fn(NonNull<SCNNode>, SCNMatrix4) -> SCNMatrix4>,
321        ) -> Retained<Self>;
322
323        #[cfg(all(
324            feature = "SCNNode",
325            feature = "SceneKitTypes",
326            feature = "block2",
327            feature = "objc2-core-foundation"
328        ))]
329        /// Creates and returns a SCNTransformConstraint object with the specified parameters.
330        ///
331        /// Parameter `world`: Determines whether the constraint is evaluated in world or local space.
332        ///
333        /// Parameter `block`: The custom block to call to evaluate the constraint.
334        ///
335        /// The node and its position are passed to the block. The position returned by the block will be used to render the node.
336        #[unsafe(method(positionConstraintInWorldSpace:withBlock:))]
337        #[unsafe(method_family = none)]
338        pub unsafe fn positionConstraintInWorldSpace_withBlock(
339            world: bool,
340            block: &block2::Block<dyn Fn(NonNull<SCNNode>, SCNVector3) -> SCNVector3>,
341        ) -> Retained<Self>;
342
343        #[cfg(all(
344            feature = "SCNNode",
345            feature = "SceneKitTypes",
346            feature = "block2",
347            feature = "objc2-core-foundation"
348        ))]
349        /// Creates and returns a SCNTransformConstraint object with the specified parameters.
350        ///
351        /// Parameter `world`: Determines whether the constraint is evaluated in world or local space.
352        ///
353        /// Parameter `block`: The custom block to call to evaluate the constraint.
354        ///
355        /// The node and its quaternion are passed to the block. The quaternion returned by the block will be used to render the node.
356        #[unsafe(method(orientationConstraintInWorldSpace:withBlock:))]
357        #[unsafe(method_family = none)]
358        pub unsafe fn orientationConstraintInWorldSpace_withBlock(
359            world: bool,
360            block: &block2::Block<dyn Fn(NonNull<SCNNode>, SCNQuaternion) -> SCNQuaternion>,
361        ) -> Retained<Self>;
362    );
363}
364
365/// Methods declared on superclass `NSObject`.
366impl SCNTransformConstraint {
367    extern_methods!(
368        #[unsafe(method(init))]
369        #[unsafe(method_family = init)]
370        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
371
372        #[unsafe(method(new))]
373        #[unsafe(method_family = new)]
374        pub unsafe fn new() -> Retained<Self>;
375    );
376}
377
378extern_class!(
379    /// A SCNIKConstraint applies an inverse kinematics constraint
380    ///
381    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnikconstraint?language=objc)
382    #[unsafe(super(SCNConstraint, NSObject))]
383    #[derive(Debug, PartialEq, Eq, Hash)]
384    pub struct SCNIKConstraint;
385);
386
387unsafe impl NSCoding for SCNIKConstraint {}
388
389unsafe impl NSCopying for SCNIKConstraint {}
390
391unsafe impl CopyingHelper for SCNIKConstraint {
392    type Result = Self;
393}
394
395unsafe impl NSObjectProtocol for SCNIKConstraint {}
396
397unsafe impl NSSecureCoding for SCNIKConstraint {}
398
399#[cfg(feature = "SCNAnimation")]
400unsafe impl SCNAnimatable for SCNIKConstraint {}
401
402impl SCNIKConstraint {
403    extern_methods!(
404        #[cfg(feature = "SCNNode")]
405        /// Creates and returns a SCNIKConstraint object with the specified parameter.
406        ///
407        /// Parameter `chainRootNode`: The root node of the kinematic chain.
408        ///
409        /// "chainRootNode" must be an ancestor of the node on which the constraint is applied.
410        #[unsafe(method(initWithChainRootNode:))]
411        #[unsafe(method_family = init)]
412        pub unsafe fn initWithChainRootNode(
413            this: Allocated<Self>,
414            chain_root_node: &SCNNode,
415        ) -> Retained<Self>;
416
417        #[cfg(feature = "SCNNode")]
418        /// Creates and returns a SCNIKConstraint object with the specified parameter.
419        ///
420        /// Parameter `chainRootNode`: The root node of the kinematic chain.
421        ///
422        /// "chainRootNode" must be an ancestor of the node on which the constraint is applied.
423        #[unsafe(method(inverseKinematicsConstraintWithChainRootNode:))]
424        #[unsafe(method_family = none)]
425        pub unsafe fn inverseKinematicsConstraintWithChainRootNode(
426            chain_root_node: &SCNNode,
427        ) -> Retained<Self>;
428
429        #[cfg(feature = "SCNNode")]
430        /// Specifies the root node of the kinematic chain.
431        #[unsafe(method(chainRootNode))]
432        #[unsafe(method_family = none)]
433        pub unsafe fn chainRootNode(&self) -> Retained<SCNNode>;
434
435        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
436        /// Specifies the target position (in world space coordinates) of the end joint (i.e the node that owns the IK constraint). Defaults to (0,0,0). Animatable.
437        #[unsafe(method(targetPosition))]
438        #[unsafe(method_family = none)]
439        pub unsafe fn targetPosition(&self) -> SCNVector3;
440
441        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
442        /// Setter for [`targetPosition`][Self::targetPosition].
443        #[unsafe(method(setTargetPosition:))]
444        #[unsafe(method_family = none)]
445        pub unsafe fn setTargetPosition(&self, target_position: SCNVector3);
446
447        #[cfg(all(feature = "SCNNode", feature = "objc2-core-foundation"))]
448        /// Specifies the maximum rotation allowed (in degrees) for the specified joint from its initial orientation. Defaults to 180.
449        #[unsafe(method(setMaxAllowedRotationAngle:forJoint:))]
450        #[unsafe(method_family = none)]
451        pub unsafe fn setMaxAllowedRotationAngle_forJoint(&self, angle: CGFloat, node: &SCNNode);
452
453        #[cfg(all(feature = "SCNNode", feature = "objc2-core-foundation"))]
454        #[unsafe(method(maxAllowedRotationAngleForJoint:))]
455        #[unsafe(method_family = none)]
456        pub unsafe fn maxAllowedRotationAngleForJoint(&self, node: &SCNNode) -> CGFloat;
457    );
458}
459
460/// Methods declared on superclass `NSObject`.
461impl SCNIKConstraint {
462    extern_methods!(
463        #[unsafe(method(init))]
464        #[unsafe(method_family = init)]
465        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
466
467        #[unsafe(method(new))]
468        #[unsafe(method_family = new)]
469        pub unsafe fn new() -> Retained<Self>;
470    );
471}
472
473extern_class!(
474    /// A SCNDistanceConstraint ensure a minimum/maximum distance with a target node.
475    ///
476    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scndistanceconstraint?language=objc)
477    #[unsafe(super(SCNConstraint, NSObject))]
478    #[derive(Debug, PartialEq, Eq, Hash)]
479    pub struct SCNDistanceConstraint;
480);
481
482unsafe impl NSCoding for SCNDistanceConstraint {}
483
484unsafe impl NSCopying for SCNDistanceConstraint {}
485
486unsafe impl CopyingHelper for SCNDistanceConstraint {
487    type Result = Self;
488}
489
490unsafe impl NSObjectProtocol for SCNDistanceConstraint {}
491
492unsafe impl NSSecureCoding for SCNDistanceConstraint {}
493
494#[cfg(feature = "SCNAnimation")]
495unsafe impl SCNAnimatable for SCNDistanceConstraint {}
496
497impl SCNDistanceConstraint {
498    extern_methods!(
499        #[cfg(feature = "SCNNode")]
500        /// Creates and returns a SCNDistanceConstraint constraint.
501        #[unsafe(method(distanceConstraintWithTarget:))]
502        #[unsafe(method_family = none)]
503        pub unsafe fn distanceConstraintWithTarget(target: Option<&SCNNode>) -> Retained<Self>;
504
505        #[cfg(feature = "SCNNode")]
506        /// Defines the target node to keep distance with.
507        #[unsafe(method(target))]
508        #[unsafe(method_family = none)]
509        pub unsafe fn target(&self) -> Option<Retained<SCNNode>>;
510
511        #[cfg(feature = "SCNNode")]
512        /// Setter for [`target`][Self::target].
513        #[unsafe(method(setTarget:))]
514        #[unsafe(method_family = none)]
515        pub unsafe fn setTarget(&self, target: Option<&SCNNode>);
516
517        #[cfg(feature = "objc2-core-foundation")]
518        /// The minimum distance. Defaults to 0. Animatable.
519        #[unsafe(method(minimumDistance))]
520        #[unsafe(method_family = none)]
521        pub unsafe fn minimumDistance(&self) -> CGFloat;
522
523        #[cfg(feature = "objc2-core-foundation")]
524        /// Setter for [`minimumDistance`][Self::minimumDistance].
525        #[unsafe(method(setMinimumDistance:))]
526        #[unsafe(method_family = none)]
527        pub unsafe fn setMinimumDistance(&self, minimum_distance: CGFloat);
528
529        #[cfg(feature = "objc2-core-foundation")]
530        /// The minimum distance. Defaults to MAXFLOAT. Animatable.
531        #[unsafe(method(maximumDistance))]
532        #[unsafe(method_family = none)]
533        pub unsafe fn maximumDistance(&self) -> CGFloat;
534
535        #[cfg(feature = "objc2-core-foundation")]
536        /// Setter for [`maximumDistance`][Self::maximumDistance].
537        #[unsafe(method(setMaximumDistance:))]
538        #[unsafe(method_family = none)]
539        pub unsafe fn setMaximumDistance(&self, maximum_distance: CGFloat);
540    );
541}
542
543/// Methods declared on superclass `NSObject`.
544impl SCNDistanceConstraint {
545    extern_methods!(
546        #[unsafe(method(init))]
547        #[unsafe(method_family = init)]
548        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
549
550        #[unsafe(method(new))]
551        #[unsafe(method_family = new)]
552        pub unsafe fn new() -> Retained<Self>;
553    );
554}
555
556extern_class!(
557    /// A SCNReplicatorConstraint replicates the position/orientation/scale of a target node
558    ///
559    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnreplicatorconstraint?language=objc)
560    #[unsafe(super(SCNConstraint, NSObject))]
561    #[derive(Debug, PartialEq, Eq, Hash)]
562    pub struct SCNReplicatorConstraint;
563);
564
565unsafe impl NSCoding for SCNReplicatorConstraint {}
566
567unsafe impl NSCopying for SCNReplicatorConstraint {}
568
569unsafe impl CopyingHelper for SCNReplicatorConstraint {
570    type Result = Self;
571}
572
573unsafe impl NSObjectProtocol for SCNReplicatorConstraint {}
574
575unsafe impl NSSecureCoding for SCNReplicatorConstraint {}
576
577#[cfg(feature = "SCNAnimation")]
578unsafe impl SCNAnimatable for SCNReplicatorConstraint {}
579
580impl SCNReplicatorConstraint {
581    extern_methods!(
582        #[cfg(feature = "SCNNode")]
583        /// Creates and returns a SCNReplicatorConstraint constraint.
584        #[unsafe(method(replicatorConstraintWithTarget:))]
585        #[unsafe(method_family = none)]
586        pub unsafe fn replicatorConstraintWithTarget(target: Option<&SCNNode>) -> Retained<Self>;
587
588        #[cfg(feature = "SCNNode")]
589        /// Defines the target node to replicate
590        #[unsafe(method(target))]
591        #[unsafe(method_family = none)]
592        pub unsafe fn target(&self) -> Option<Retained<SCNNode>>;
593
594        #[cfg(feature = "SCNNode")]
595        /// Setter for [`target`][Self::target].
596        #[unsafe(method(setTarget:))]
597        #[unsafe(method_family = none)]
598        pub unsafe fn setTarget(&self, target: Option<&SCNNode>);
599
600        /// Defines whether or not the constraint should replicate the target orientation. Defaults to YES.
601        #[unsafe(method(replicatesOrientation))]
602        #[unsafe(method_family = none)]
603        pub unsafe fn replicatesOrientation(&self) -> bool;
604
605        /// Setter for [`replicatesOrientation`][Self::replicatesOrientation].
606        #[unsafe(method(setReplicatesOrientation:))]
607        #[unsafe(method_family = none)]
608        pub unsafe fn setReplicatesOrientation(&self, replicates_orientation: bool);
609
610        /// Defines whether or not the constraint should replicate the target position. Defaults to YES.
611        #[unsafe(method(replicatesPosition))]
612        #[unsafe(method_family = none)]
613        pub unsafe fn replicatesPosition(&self) -> bool;
614
615        /// Setter for [`replicatesPosition`][Self::replicatesPosition].
616        #[unsafe(method(setReplicatesPosition:))]
617        #[unsafe(method_family = none)]
618        pub unsafe fn setReplicatesPosition(&self, replicates_position: bool);
619
620        /// Defines whether or not the constraint should replicate the target scale. Defaults to YES.
621        #[unsafe(method(replicatesScale))]
622        #[unsafe(method_family = none)]
623        pub unsafe fn replicatesScale(&self) -> bool;
624
625        /// Setter for [`replicatesScale`][Self::replicatesScale].
626        #[unsafe(method(setReplicatesScale:))]
627        #[unsafe(method_family = none)]
628        pub unsafe fn setReplicatesScale(&self, replicates_scale: bool);
629
630        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
631        /// Defines an addition orientation offset. Defaults to no offset. Animatable.
632        #[unsafe(method(orientationOffset))]
633        #[unsafe(method_family = none)]
634        pub unsafe fn orientationOffset(&self) -> SCNQuaternion;
635
636        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
637        /// Setter for [`orientationOffset`][Self::orientationOffset].
638        #[unsafe(method(setOrientationOffset:))]
639        #[unsafe(method_family = none)]
640        pub unsafe fn setOrientationOffset(&self, orientation_offset: SCNQuaternion);
641
642        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
643        /// Defines an addition orientation offset. Defaults to no offset. Animatable.
644        #[unsafe(method(positionOffset))]
645        #[unsafe(method_family = none)]
646        pub unsafe fn positionOffset(&self) -> SCNVector3;
647
648        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
649        /// Setter for [`positionOffset`][Self::positionOffset].
650        #[unsafe(method(setPositionOffset:))]
651        #[unsafe(method_family = none)]
652        pub unsafe fn setPositionOffset(&self, position_offset: SCNVector3);
653
654        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
655        /// Defines an addition scale offset. Defaults to no offset. Animatable.
656        #[unsafe(method(scaleOffset))]
657        #[unsafe(method_family = none)]
658        pub unsafe fn scaleOffset(&self) -> SCNVector3;
659
660        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
661        /// Setter for [`scaleOffset`][Self::scaleOffset].
662        #[unsafe(method(setScaleOffset:))]
663        #[unsafe(method_family = none)]
664        pub unsafe fn setScaleOffset(&self, scale_offset: SCNVector3);
665    );
666}
667
668/// Methods declared on superclass `NSObject`.
669impl SCNReplicatorConstraint {
670    extern_methods!(
671        #[unsafe(method(init))]
672        #[unsafe(method_family = init)]
673        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
674
675        #[unsafe(method(new))]
676        #[unsafe(method_family = new)]
677        pub unsafe fn new() -> Retained<Self>;
678    );
679}
680
681extern_class!(
682    /// A SCNAccelerationConstraint caps the acceleration and velocity of a node
683    ///
684    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnaccelerationconstraint?language=objc)
685    #[unsafe(super(SCNConstraint, NSObject))]
686    #[derive(Debug, PartialEq, Eq, Hash)]
687    pub struct SCNAccelerationConstraint;
688);
689
690unsafe impl NSCoding for SCNAccelerationConstraint {}
691
692unsafe impl NSCopying for SCNAccelerationConstraint {}
693
694unsafe impl CopyingHelper for SCNAccelerationConstraint {
695    type Result = Self;
696}
697
698unsafe impl NSObjectProtocol for SCNAccelerationConstraint {}
699
700unsafe impl NSSecureCoding for SCNAccelerationConstraint {}
701
702#[cfg(feature = "SCNAnimation")]
703unsafe impl SCNAnimatable for SCNAccelerationConstraint {}
704
705impl SCNAccelerationConstraint {
706    extern_methods!(
707        /// Creates and returns a SCNAccelerationConstraint object.
708        #[unsafe(method(accelerationConstraint))]
709        #[unsafe(method_family = none)]
710        pub unsafe fn accelerationConstraint() -> Retained<Self>;
711
712        #[cfg(feature = "objc2-core-foundation")]
713        /// Controls the maximum linear acceleration. Defaults to MAXFLOAT. Animatable.
714        ///
715        /// The maximum linear acceleration is in m.s^-2
716        #[unsafe(method(maximumLinearAcceleration))]
717        #[unsafe(method_family = none)]
718        pub unsafe fn maximumLinearAcceleration(&self) -> CGFloat;
719
720        #[cfg(feature = "objc2-core-foundation")]
721        /// Setter for [`maximumLinearAcceleration`][Self::maximumLinearAcceleration].
722        #[unsafe(method(setMaximumLinearAcceleration:))]
723        #[unsafe(method_family = none)]
724        pub unsafe fn setMaximumLinearAcceleration(&self, maximum_linear_acceleration: CGFloat);
725
726        #[cfg(feature = "objc2-core-foundation")]
727        /// Controls the maximum linear velocity. Defaults to MAXFLOAT. Animatable.
728        ///
729        /// The maximum linear velocity is in m.s
730        #[unsafe(method(maximumLinearVelocity))]
731        #[unsafe(method_family = none)]
732        pub unsafe fn maximumLinearVelocity(&self) -> CGFloat;
733
734        #[cfg(feature = "objc2-core-foundation")]
735        /// Setter for [`maximumLinearVelocity`][Self::maximumLinearVelocity].
736        #[unsafe(method(setMaximumLinearVelocity:))]
737        #[unsafe(method_family = none)]
738        pub unsafe fn setMaximumLinearVelocity(&self, maximum_linear_velocity: CGFloat);
739
740        #[cfg(feature = "objc2-core-foundation")]
741        /// Controls the distance at which the node should start decelerating. Defaults to 0. Animatable.
742        #[unsafe(method(decelerationDistance))]
743        #[unsafe(method_family = none)]
744        pub unsafe fn decelerationDistance(&self) -> CGFloat;
745
746        #[cfg(feature = "objc2-core-foundation")]
747        /// Setter for [`decelerationDistance`][Self::decelerationDistance].
748        #[unsafe(method(setDecelerationDistance:))]
749        #[unsafe(method_family = none)]
750        pub unsafe fn setDecelerationDistance(&self, deceleration_distance: CGFloat);
751
752        #[cfg(feature = "objc2-core-foundation")]
753        /// Specifies the damping factor of the receiver. Optionally reduce the body's linear velocity each frame to simulate fluid/air friction. Value should be zero or greater. Defaults to 0.1. Animatable.
754        #[unsafe(method(damping))]
755        #[unsafe(method_family = none)]
756        pub unsafe fn damping(&self) -> CGFloat;
757
758        #[cfg(feature = "objc2-core-foundation")]
759        /// Setter for [`damping`][Self::damping].
760        #[unsafe(method(setDamping:))]
761        #[unsafe(method_family = none)]
762        pub unsafe fn setDamping(&self, damping: CGFloat);
763    );
764}
765
766/// Methods declared on superclass `NSObject`.
767impl SCNAccelerationConstraint {
768    extern_methods!(
769        #[unsafe(method(init))]
770        #[unsafe(method_family = init)]
771        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
772
773        #[unsafe(method(new))]
774        #[unsafe(method_family = new)]
775        pub unsafe fn new() -> Retained<Self>;
776    );
777}
778
779extern_class!(
780    /// A SCNSliderConstraint constraint makes a node to collide and slide against a category of nodes
781    ///
782    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnsliderconstraint?language=objc)
783    #[unsafe(super(SCNConstraint, NSObject))]
784    #[derive(Debug, PartialEq, Eq, Hash)]
785    pub struct SCNSliderConstraint;
786);
787
788unsafe impl NSCoding for SCNSliderConstraint {}
789
790unsafe impl NSCopying for SCNSliderConstraint {}
791
792unsafe impl CopyingHelper for SCNSliderConstraint {
793    type Result = Self;
794}
795
796unsafe impl NSObjectProtocol for SCNSliderConstraint {}
797
798unsafe impl NSSecureCoding for SCNSliderConstraint {}
799
800#[cfg(feature = "SCNAnimation")]
801unsafe impl SCNAnimatable for SCNSliderConstraint {}
802
803impl SCNSliderConstraint {
804    extern_methods!(
805        /// Creates and returns a SCNSliderConstraint object.
806        #[unsafe(method(sliderConstraint))]
807        #[unsafe(method_family = none)]
808        pub unsafe fn sliderConstraint() -> Retained<Self>;
809
810        /// Defines the category of node to collide against. Defaults to 0.
811        #[unsafe(method(collisionCategoryBitMask))]
812        #[unsafe(method_family = none)]
813        pub unsafe fn collisionCategoryBitMask(&self) -> NSUInteger;
814
815        /// Setter for [`collisionCategoryBitMask`][Self::collisionCategoryBitMask].
816        #[unsafe(method(setCollisionCategoryBitMask:))]
817        #[unsafe(method_family = none)]
818        pub unsafe fn setCollisionCategoryBitMask(&self, collision_category_bit_mask: NSUInteger);
819
820        #[cfg(feature = "objc2-core-foundation")]
821        /// Defines the radius of the slider. Defaults to 1.
822        #[unsafe(method(radius))]
823        #[unsafe(method_family = none)]
824        pub unsafe fn radius(&self) -> CGFloat;
825
826        #[cfg(feature = "objc2-core-foundation")]
827        /// Setter for [`radius`][Self::radius].
828        #[unsafe(method(setRadius:))]
829        #[unsafe(method_family = none)]
830        pub unsafe fn setRadius(&self, radius: CGFloat);
831
832        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
833        /// Defines the offset of the slider. Defaults to (0,0,0).
834        #[unsafe(method(offset))]
835        #[unsafe(method_family = none)]
836        pub unsafe fn offset(&self) -> SCNVector3;
837
838        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
839        /// Setter for [`offset`][Self::offset].
840        #[unsafe(method(setOffset:))]
841        #[unsafe(method_family = none)]
842        pub unsafe fn setOffset(&self, offset: SCNVector3);
843    );
844}
845
846/// Methods declared on superclass `NSObject`.
847impl SCNSliderConstraint {
848    extern_methods!(
849        #[unsafe(method(init))]
850        #[unsafe(method_family = init)]
851        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
852
853        #[unsafe(method(new))]
854        #[unsafe(method_family = new)]
855        pub unsafe fn new() -> Retained<Self>;
856    );
857}
858
859extern_protocol!(
860    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnavoidoccluderconstraintdelegate?language=objc)
861    pub unsafe trait SCNAvoidOccluderConstraintDelegate: NSObjectProtocol {
862        #[cfg(feature = "SCNNode")]
863        #[optional]
864        #[unsafe(method(avoidOccluderConstraint:shouldAvoidOccluder:forNode:))]
865        #[unsafe(method_family = none)]
866        unsafe fn avoidOccluderConstraint_shouldAvoidOccluder_forNode(
867            &self,
868            constraint: &SCNAvoidOccluderConstraint,
869            occluder: &SCNNode,
870            node: &SCNNode,
871        ) -> bool;
872
873        #[cfg(feature = "SCNNode")]
874        #[optional]
875        #[unsafe(method(avoidOccluderConstraint:didAvoidOccluder:forNode:))]
876        #[unsafe(method_family = none)]
877        unsafe fn avoidOccluderConstraint_didAvoidOccluder_forNode(
878            &self,
879            constraint: &SCNAvoidOccluderConstraint,
880            occluder: &SCNNode,
881            node: &SCNNode,
882        );
883    }
884);
885
886extern_class!(
887    /// A SCNAvoidOccluderConstraint constraints place the receiver at a position that prevent nodes with the specified category to occlude the target.
888    ///
889    /// The target node and it's children are ignored as potential occluders.
890    ///
891    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnavoidoccluderconstraint?language=objc)
892    #[unsafe(super(SCNConstraint, NSObject))]
893    #[derive(Debug, PartialEq, Eq, Hash)]
894    pub struct SCNAvoidOccluderConstraint;
895);
896
897unsafe impl NSCoding for SCNAvoidOccluderConstraint {}
898
899unsafe impl NSCopying for SCNAvoidOccluderConstraint {}
900
901unsafe impl CopyingHelper for SCNAvoidOccluderConstraint {
902    type Result = Self;
903}
904
905unsafe impl NSObjectProtocol for SCNAvoidOccluderConstraint {}
906
907unsafe impl NSSecureCoding for SCNAvoidOccluderConstraint {}
908
909#[cfg(feature = "SCNAnimation")]
910unsafe impl SCNAnimatable for SCNAvoidOccluderConstraint {}
911
912impl SCNAvoidOccluderConstraint {
913    extern_methods!(
914        #[cfg(feature = "SCNNode")]
915        /// Creates and returns a SCNAvoidOccluderConstraint object.
916        #[unsafe(method(avoidOccluderConstraintWithTarget:))]
917        #[unsafe(method_family = none)]
918        pub unsafe fn avoidOccluderConstraintWithTarget(target: Option<&SCNNode>)
919            -> Retained<Self>;
920
921        /// The receiver's delegate
922        #[unsafe(method(delegate))]
923        #[unsafe(method_family = none)]
924        pub unsafe fn delegate(
925            &self,
926        ) -> Retained<ProtocolObject<dyn SCNAvoidOccluderConstraintDelegate>>;
927
928        /// Setter for [`delegate`][Self::delegate].
929        #[unsafe(method(setDelegate:))]
930        #[unsafe(method_family = none)]
931        pub unsafe fn setDelegate(
932            &self,
933            delegate: &ProtocolObject<dyn SCNAvoidOccluderConstraintDelegate>,
934        );
935
936        #[cfg(feature = "SCNNode")]
937        /// Defines the target node
938        #[unsafe(method(target))]
939        #[unsafe(method_family = none)]
940        pub unsafe fn target(&self) -> Option<Retained<SCNNode>>;
941
942        #[cfg(feature = "SCNNode")]
943        /// Setter for [`target`][Self::target].
944        #[unsafe(method(setTarget:))]
945        #[unsafe(method_family = none)]
946        pub unsafe fn setTarget(&self, target: Option<&SCNNode>);
947
948        /// Defines the category of node to consider as occluder. Defaults to 1.
949        #[unsafe(method(occluderCategoryBitMask))]
950        #[unsafe(method_family = none)]
951        pub unsafe fn occluderCategoryBitMask(&self) -> NSUInteger;
952
953        /// Setter for [`occluderCategoryBitMask`][Self::occluderCategoryBitMask].
954        #[unsafe(method(setOccluderCategoryBitMask:))]
955        #[unsafe(method_family = none)]
956        pub unsafe fn setOccluderCategoryBitMask(&self, occluder_category_bit_mask: NSUInteger);
957
958        #[cfg(feature = "objc2-core-foundation")]
959        /// Defines the bias the apply after moving the receiver to avoid occluders. Defaults to 10e-5.
960        ///
961        /// A positive bias will move the receiver closer to the target.
962        #[unsafe(method(bias))]
963        #[unsafe(method_family = none)]
964        pub unsafe fn bias(&self) -> CGFloat;
965
966        #[cfg(feature = "objc2-core-foundation")]
967        /// Setter for [`bias`][Self::bias].
968        #[unsafe(method(setBias:))]
969        #[unsafe(method_family = none)]
970        pub unsafe fn setBias(&self, bias: CGFloat);
971    );
972}
973
974/// Methods declared on superclass `NSObject`.
975impl SCNAvoidOccluderConstraint {
976    extern_methods!(
977        #[unsafe(method(init))]
978        #[unsafe(method_family = init)]
979        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
980
981        #[unsafe(method(new))]
982        #[unsafe(method_family = new)]
983        pub unsafe fn new() -> Retained<Self>;
984    );
985}