objc2_scene_kit/generated/
SCNHitTest.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-foundation")]
6use objc2_core_foundation::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11/// hit test modes
12///
13/// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnhittestsearchmode?language=objc)
14// NS_ENUM
15#[repr(transparent)]
16#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
17pub struct SCNHitTestSearchMode(pub NSInteger);
18impl SCNHitTestSearchMode {
19    #[doc(alias = "SCNHitTestSearchModeClosest")]
20    pub const Closest: Self = Self(0);
21    #[doc(alias = "SCNHitTestSearchModeAll")]
22    pub const All: Self = Self(1);
23    #[doc(alias = "SCNHitTestSearchModeAny")]
24    pub const Any: Self = Self(2);
25}
26
27unsafe impl Encode for SCNHitTestSearchMode {
28    const ENCODING: Encoding = NSInteger::ENCODING;
29}
30
31unsafe impl RefEncode for SCNHitTestSearchMode {
32    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35/// Hit-test options
36///
37/// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnhittestoption?language=objc)
38// NS_TYPED_ENUM
39pub type SCNHitTestOption = NSString;
40
41extern "C" {
42    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnhittestcliptozrangekey?language=objc)
43    pub static SCNHitTestClipToZRangeKey: &'static SCNHitTestOption;
44}
45
46extern "C" {
47    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnhittestbackfacecullingkey?language=objc)
48    pub static SCNHitTestBackFaceCullingKey: &'static SCNHitTestOption;
49}
50
51extern "C" {
52    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnhittestboundingboxonlykey?language=objc)
53    pub static SCNHitTestBoundingBoxOnlyKey: &'static SCNHitTestOption;
54}
55
56extern "C" {
57    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnhittestignorechildnodeskey?language=objc)
58    pub static SCNHitTestIgnoreChildNodesKey: &'static SCNHitTestOption;
59}
60
61extern "C" {
62    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnhittestrootnodekey?language=objc)
63    pub static SCNHitTestRootNodeKey: &'static SCNHitTestOption;
64}
65
66extern "C" {
67    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnhittestignorehiddennodeskey?language=objc)
68    pub static SCNHitTestIgnoreHiddenNodesKey: &'static SCNHitTestOption;
69}
70
71extern "C" {
72    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnhittestoptioncategorybitmask?language=objc)
73    pub static SCNHitTestOptionCategoryBitMask: &'static SCNHitTestOption;
74}
75
76extern "C" {
77    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnhittestoptionsearchmode?language=objc)
78    pub static SCNHitTestOptionSearchMode: &'static SCNHitTestOption;
79}
80
81extern "C" {
82    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnhittestoptionignorelightarea?language=objc)
83    pub static SCNHitTestOptionIgnoreLightArea: &'static SCNHitTestOption;
84}
85
86extern "C" {
87    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnhittestfirstfoundonlykey?language=objc)
88    pub static SCNHitTestFirstFoundOnlyKey: &'static SCNHitTestOption;
89}
90
91extern "C" {
92    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnhittestsortresultskey?language=objc)
93    pub static SCNHitTestSortResultsKey: &'static SCNHitTestOption;
94}
95
96extern_class!(
97    /// Results returned by the hit-test methods.
98    ///
99    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnhittestresult?language=objc)
100    #[unsafe(super(NSObject))]
101    #[derive(Debug, PartialEq, Eq, Hash)]
102    pub struct SCNHitTestResult;
103);
104
105unsafe impl NSObjectProtocol for SCNHitTestResult {}
106
107impl SCNHitTestResult {
108    extern_methods!(
109        #[cfg(feature = "SCNNode")]
110        /// The hit node.
111        #[unsafe(method(node))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn node(&self) -> Retained<SCNNode>;
114
115        /// Index of the hit geometry element.
116        #[unsafe(method(geometryIndex))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn geometryIndex(&self) -> NSInteger;
119
120        /// Index of the hit primitive of the geometry element.
121        #[unsafe(method(faceIndex))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn faceIndex(&self) -> NSInteger;
124
125        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
126        /// Intersection point in the node's local coordinate system.
127        #[unsafe(method(localCoordinates))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn localCoordinates(&self) -> SCNVector3;
130
131        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
132        /// Intersection point in the world coordinate system.
133        #[unsafe(method(worldCoordinates))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn worldCoordinates(&self) -> SCNVector3;
136
137        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
138        /// Intersection normal in the node's local coordinate system.
139        #[unsafe(method(localNormal))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn localNormal(&self) -> SCNVector3;
142
143        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
144        /// Intersection normal in the world coordinate system.
145        #[unsafe(method(worldNormal))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn worldNormal(&self) -> SCNVector3;
148
149        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-quartz-core"))]
150        #[cfg(not(target_os = "watchos"))]
151        /// World transform of the hit node.
152        #[unsafe(method(modelTransform))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn modelTransform(&self) -> SCNMatrix4;
155
156        #[cfg(feature = "SCNNode")]
157        /// The hit bone. Only available if the node hit has a SCNSkinner attached.
158        #[unsafe(method(boneNode))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn boneNode(&self) -> Option<Retained<SCNNode>>;
161
162        #[cfg(feature = "objc2-core-foundation")]
163        /// Returns the texture coordinates at the point of intersection, for a given mapping channel.
164        ///
165        /// Parameter `channel`: The texture coordinates source index of the geometry to use. The channel must exists on the geometry otherwise {0,0} will be returned.
166        #[unsafe(method(textureCoordinatesWithMappingChannel:))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn textureCoordinatesWithMappingChannel(&self, channel: NSInteger) -> CGPoint;
169    );
170}
171
172/// Methods declared on superclass `NSObject`.
173impl SCNHitTestResult {
174    extern_methods!(
175        #[unsafe(method(init))]
176        #[unsafe(method_family = init)]
177        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
178
179        #[unsafe(method(new))]
180        #[unsafe(method_family = new)]
181        pub unsafe fn new() -> Retained<Self>;
182    );
183}
184
185/// SIMD.
186impl SCNHitTestResult {
187    extern_methods!();
188}