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
105extern_conformance!(
106    unsafe impl NSObjectProtocol for SCNHitTestResult {}
107);
108
109impl SCNHitTestResult {
110    extern_methods!(
111        #[cfg(feature = "SCNNode")]
112        /// The hit node.
113        #[unsafe(method(node))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn node(&self) -> Retained<SCNNode>;
116
117        /// Index of the hit geometry element.
118        #[unsafe(method(geometryIndex))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn geometryIndex(&self) -> NSInteger;
121
122        /// Index of the hit primitive of the geometry element.
123        #[unsafe(method(faceIndex))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn faceIndex(&self) -> NSInteger;
126
127        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
128        /// Intersection point in the node's local coordinate system.
129        #[unsafe(method(localCoordinates))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn localCoordinates(&self) -> SCNVector3;
132
133        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
134        /// Intersection point in the world coordinate system.
135        #[unsafe(method(worldCoordinates))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn worldCoordinates(&self) -> SCNVector3;
138
139        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
140        /// Intersection normal in the node's local coordinate system.
141        #[unsafe(method(localNormal))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn localNormal(&self) -> SCNVector3;
144
145        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
146        /// Intersection normal in the world coordinate system.
147        #[unsafe(method(worldNormal))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn worldNormal(&self) -> SCNVector3;
150
151        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-quartz-core"))]
152        #[cfg(not(target_os = "watchos"))]
153        /// World transform of the hit node.
154        #[unsafe(method(modelTransform))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn modelTransform(&self) -> SCNMatrix4;
157
158        #[cfg(feature = "SCNNode")]
159        /// The hit bone. Only available if the node hit has a SCNSkinner attached.
160        #[unsafe(method(boneNode))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn boneNode(&self) -> Option<Retained<SCNNode>>;
163
164        #[cfg(feature = "objc2-core-foundation")]
165        /// Returns the texture coordinates at the point of intersection, for a given mapping channel.
166        ///
167        /// 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.
168        #[unsafe(method(textureCoordinatesWithMappingChannel:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn textureCoordinatesWithMappingChannel(&self, channel: NSInteger) -> CGPoint;
171    );
172}
173
174/// Methods declared on superclass `NSObject`.
175impl SCNHitTestResult {
176    extern_methods!(
177        #[unsafe(method(init))]
178        #[unsafe(method_family = init)]
179        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
180
181        #[unsafe(method(new))]
182        #[unsafe(method_family = new)]
183        pub unsafe fn new() -> Retained<Self>;
184    );
185}
186
187/// SIMD.
188impl SCNHitTestResult {
189    extern_methods!();
190}