objc2_scene_kit/generated/
SCNMorpher.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/scnmorphercalculationmode?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct SCNMorpherCalculationMode(pub NSInteger);
17impl SCNMorpherCalculationMode {
18    #[doc(alias = "SCNMorpherCalculationModeNormalized")]
19    pub const Normalized: Self = Self(0);
20    #[doc(alias = "SCNMorpherCalculationModeAdditive")]
21    pub const Additive: Self = Self(1);
22}
23
24unsafe impl Encode for SCNMorpherCalculationMode {
25    const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for SCNMorpherCalculationMode {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32extern_class!(
33    /// SCNMorpher controls the deformation of morphed geometries
34    ///
35    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnmorpher?language=objc)
36    #[unsafe(super(NSObject))]
37    #[derive(Debug, PartialEq, Eq, Hash)]
38    pub struct SCNMorpher;
39);
40
41unsafe impl NSCoding for SCNMorpher {}
42
43unsafe impl NSObjectProtocol for SCNMorpher {}
44
45unsafe impl NSSecureCoding for SCNMorpher {}
46
47#[cfg(feature = "SCNAnimation")]
48unsafe impl SCNAnimatable for SCNMorpher {}
49
50impl SCNMorpher {
51    extern_methods!(
52        #[cfg(feature = "SCNGeometry")]
53        /// Specifies the morph targets as an array of SCNGeometry.
54        ///
55        /// The target geometries must have the same number of entries in their geometry sources and the same topology as the base geometry.
56        #[unsafe(method(targets))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn targets(&self) -> Retained<NSArray<SCNGeometry>>;
59
60        #[cfg(feature = "SCNGeometry")]
61        /// Setter for [`targets`][Self::targets].
62        #[unsafe(method(setTargets:))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn setTargets(&self, targets: &NSArray<SCNGeometry>);
65
66        /// Access to all the weights of all the targets.
67        #[unsafe(method(weights))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn weights(&self) -> Retained<NSArray<NSNumber>>;
70
71        /// Setter for [`weights`][Self::weights].
72        #[unsafe(method(setWeights:))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn setWeights(&self, weights: &NSArray<NSNumber>);
75
76        #[cfg(feature = "objc2-core-foundation")]
77        /// Sets the weight for the target at the specified index. Animatable implicitly or explicitly with the keyPath "weights[index]" or "weights["targetName"]" (targetName is the name of the target geometry).
78        #[unsafe(method(setWeight:forTargetAtIndex:))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn setWeight_forTargetAtIndex(&self, weight: CGFloat, target_index: NSUInteger);
81
82        #[cfg(feature = "objc2-core-foundation")]
83        /// Retrieves the weight for the target at the specified index.
84        #[unsafe(method(weightForTargetAtIndex:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn weightForTargetAtIndex(&self, target_index: NSUInteger) -> CGFloat;
87
88        #[cfg(feature = "objc2-core-foundation")]
89        /// Sets the weight for the target with the specified name (targetName is the name of the target geometry).
90        #[unsafe(method(setWeight:forTargetNamed:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn setWeight_forTargetNamed(&self, weight: CGFloat, target_name: &NSString);
93
94        #[cfg(feature = "objc2-core-foundation")]
95        /// Retrieves the weight for the target with the specified name (targetName is the name of the target geometry).
96        #[unsafe(method(weightForTargetNamed:))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn weightForTargetNamed(&self, target_name: &NSString) -> CGFloat;
99
100        /// Specifies how the morph result is calculated by the receiver. Defaults to SCNMorpherCalculationModeNormalized.
101        #[unsafe(method(calculationMode))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn calculationMode(&self) -> SCNMorpherCalculationMode;
104
105        /// Setter for [`calculationMode`][Self::calculationMode].
106        #[unsafe(method(setCalculationMode:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn setCalculationMode(&self, calculation_mode: SCNMorpherCalculationMode);
109
110        /// When set to YES the normals are not morphed but are recomputed after morphing the vertex instead. When set to NO, the morpher will morph the normals if the geometry targets have normals. Defaults to NO.
111        #[unsafe(method(unifiesNormals))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn unifiesNormals(&self) -> bool;
114
115        /// Setter for [`unifiesNormals`][Self::unifiesNormals].
116        #[unsafe(method(setUnifiesNormals:))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn setUnifiesNormals(&self, unifies_normals: bool);
119    );
120}
121
122/// Methods declared on superclass `NSObject`.
123impl SCNMorpher {
124    extern_methods!(
125        #[unsafe(method(init))]
126        #[unsafe(method_family = init)]
127        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
128
129        #[unsafe(method(new))]
130        #[unsafe(method_family = new)]
131        pub unsafe fn new() -> Retained<Self>;
132    );
133}