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        #[unsafe(method(setTargets:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn setTargets(&self, targets: &NSArray<SCNGeometry>);
73
74        /// Access to all the weights of all the targets.
75        #[unsafe(method(weights))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn weights(&self) -> Retained<NSArray<NSNumber>>;
78
79        /// Setter for [`weights`][Self::weights].
80        #[unsafe(method(setWeights:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn setWeights(&self, weights: &NSArray<NSNumber>);
83
84        #[cfg(feature = "objc2-core-foundation")]
85        /// 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).
86        #[unsafe(method(setWeight:forTargetAtIndex:))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn setWeight_forTargetAtIndex(&self, weight: CGFloat, target_index: NSUInteger);
89
90        #[cfg(feature = "objc2-core-foundation")]
91        /// Retrieves the weight for the target at the specified index.
92        #[unsafe(method(weightForTargetAtIndex:))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn weightForTargetAtIndex(&self, target_index: NSUInteger) -> CGFloat;
95
96        #[cfg(feature = "objc2-core-foundation")]
97        /// Sets the weight for the target with the specified name (targetName is the name of the target geometry).
98        #[unsafe(method(setWeight:forTargetNamed:))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn setWeight_forTargetNamed(&self, weight: CGFloat, target_name: &NSString);
101
102        #[cfg(feature = "objc2-core-foundation")]
103        /// Retrieves the weight for the target with the specified name (targetName is the name of the target geometry).
104        #[unsafe(method(weightForTargetNamed:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn weightForTargetNamed(&self, target_name: &NSString) -> CGFloat;
107
108        /// Specifies how the morph result is calculated by the receiver. Defaults to SCNMorpherCalculationModeNormalized.
109        #[unsafe(method(calculationMode))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn calculationMode(&self) -> SCNMorpherCalculationMode;
112
113        /// Setter for [`calculationMode`][Self::calculationMode].
114        #[unsafe(method(setCalculationMode:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn setCalculationMode(&self, calculation_mode: SCNMorpherCalculationMode);
117
118        /// 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.
119        #[unsafe(method(unifiesNormals))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn unifiesNormals(&self) -> bool;
122
123        /// Setter for [`unifiesNormals`][Self::unifiesNormals].
124        #[unsafe(method(setUnifiesNormals:))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn setUnifiesNormals(&self, unifies_normals: bool);
127    );
128}
129
130/// Methods declared on superclass `NSObject`.
131impl SCNMorpher {
132    extern_methods!(
133        #[unsafe(method(init))]
134        #[unsafe(method_family = init)]
135        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
136
137        #[unsafe(method(new))]
138        #[unsafe(method_family = new)]
139        pub unsafe fn new() -> Retained<Self>;
140    );
141}