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
41extern_conformance!(
42    unsafe impl NSCoding for SCNMorpher {}
43);
44
45extern_conformance!(
46    unsafe impl NSObjectProtocol for SCNMorpher {}
47);
48
49extern_conformance!(
50    unsafe impl NSSecureCoding for SCNMorpher {}
51);
52
53#[cfg(feature = "SCNAnimation")]
54extern_conformance!(
55    unsafe impl SCNAnimatable for SCNMorpher {}
56);
57
58impl SCNMorpher {
59    extern_methods!(
60        #[cfg(feature = "SCNGeometry")]
61        /// Specifies the morph targets as an array of SCNGeometry.
62        ///
63        /// The target geometries must have the same number of entries in their geometry sources and the same topology as the base geometry.
64        #[unsafe(method(targets))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn targets(&self) -> Retained<NSArray<SCNGeometry>>;
67
68        #[cfg(feature = "SCNGeometry")]
69        /// Setter for [`targets`][Self::targets].
70        ///
71        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
72        #[unsafe(method(setTargets:))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn setTargets(&self, targets: &NSArray<SCNGeometry>);
75
76        /// Access to all the weights of all the targets.
77        #[unsafe(method(weights))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn weights(&self) -> Retained<NSArray<NSNumber>>;
80
81        /// Setter for [`weights`][Self::weights].
82        #[unsafe(method(setWeights:))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn setWeights(&self, weights: &NSArray<NSNumber>);
85
86        #[cfg(feature = "objc2-core-foundation")]
87        /// 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).
88        #[unsafe(method(setWeight:forTargetAtIndex:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn setWeight_forTargetAtIndex(&self, weight: CGFloat, target_index: NSUInteger);
91
92        #[cfg(feature = "objc2-core-foundation")]
93        /// Retrieves the weight for the target at the specified index.
94        #[unsafe(method(weightForTargetAtIndex:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn weightForTargetAtIndex(&self, target_index: NSUInteger) -> CGFloat;
97
98        #[cfg(feature = "objc2-core-foundation")]
99        /// Sets the weight for the target with the specified name (targetName is the name of the target geometry).
100        #[unsafe(method(setWeight:forTargetNamed:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn setWeight_forTargetNamed(&self, weight: CGFloat, target_name: &NSString);
103
104        #[cfg(feature = "objc2-core-foundation")]
105        /// Retrieves the weight for the target with the specified name (targetName is the name of the target geometry).
106        #[unsafe(method(weightForTargetNamed:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn weightForTargetNamed(&self, target_name: &NSString) -> CGFloat;
109
110        /// Specifies how the morph result is calculated by the receiver. Defaults to SCNMorpherCalculationModeNormalized.
111        #[unsafe(method(calculationMode))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn calculationMode(&self) -> SCNMorpherCalculationMode;
114
115        /// Setter for [`calculationMode`][Self::calculationMode].
116        #[unsafe(method(setCalculationMode:))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn setCalculationMode(&self, calculation_mode: SCNMorpherCalculationMode);
119
120        /// 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.
121        #[unsafe(method(unifiesNormals))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn unifiesNormals(&self) -> bool;
124
125        /// Setter for [`unifiesNormals`][Self::unifiesNormals].
126        #[unsafe(method(setUnifiesNormals:))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn setUnifiesNormals(&self, unifies_normals: bool);
129    );
130}
131
132/// Methods declared on superclass `NSObject`.
133impl SCNMorpher {
134    extern_methods!(
135        #[unsafe(method(init))]
136        #[unsafe(method_family = init)]
137        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
138
139        #[unsafe(method(new))]
140        #[unsafe(method_family = new)]
141        pub unsafe fn new() -> Retained<Self>;
142    );
143}