objc2_scene_kit/generated/
SCNNode.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::*;
8#[cfg(feature = "objc2-core-image")]
9#[cfg(not(target_os = "watchos"))]
10use objc2_core_image::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15extern "C" {
16    /// Rendering arguments
17    ///
18    /// These keys are used for the 'semantic' argument of -[SCNProgram setSemantic:forSymbol:options:]
19    /// Transforms are SCNMatrix4 wrapped in NSValues.
20    ///
21    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnmodeltransform?language=objc)
22    pub static SCNModelTransform: &'static NSString;
23}
24
25extern "C" {
26    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnviewtransform?language=objc)
27    pub static SCNViewTransform: &'static NSString;
28}
29
30extern "C" {
31    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnprojectiontransform?language=objc)
32    pub static SCNProjectionTransform: &'static NSString;
33}
34
35extern "C" {
36    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnnormaltransform?language=objc)
37    pub static SCNNormalTransform: &'static NSString;
38}
39
40extern "C" {
41    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnmodelviewtransform?language=objc)
42    pub static SCNModelViewTransform: &'static NSString;
43}
44
45extern "C" {
46    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnmodelviewprojectiontransform?language=objc)
47    pub static SCNModelViewProjectionTransform: &'static NSString;
48}
49
50/// The available modes of movability.
51///
52/// Movable nodes are not captured when computing light probes.
53///
54/// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnmovabilityhint?language=objc)
55// NS_ENUM
56#[repr(transparent)]
57#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
58pub struct SCNMovabilityHint(pub NSInteger);
59impl SCNMovabilityHint {
60    #[doc(alias = "SCNMovabilityHintFixed")]
61    pub const Fixed: Self = Self(0);
62    #[doc(alias = "SCNMovabilityHintMovable")]
63    pub const Movable: Self = Self(1);
64}
65
66unsafe impl Encode for SCNMovabilityHint {
67    const ENCODING: Encoding = NSInteger::ENCODING;
68}
69
70unsafe impl RefEncode for SCNMovabilityHint {
71    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
72}
73
74/// Control the focus (UIFocus) behavior.
75///
76/// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnnodefocusbehavior?language=objc)
77// NS_ENUM
78#[repr(transparent)]
79#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
80pub struct SCNNodeFocusBehavior(pub NSInteger);
81impl SCNNodeFocusBehavior {
82    #[doc(alias = "SCNNodeFocusBehaviorNone")]
83    pub const None: Self = Self(0);
84    #[doc(alias = "SCNNodeFocusBehaviorOccluding")]
85    pub const Occluding: Self = Self(1);
86    #[doc(alias = "SCNNodeFocusBehaviorFocusable")]
87    pub const Focusable: Self = Self(2);
88}
89
90unsafe impl Encode for SCNNodeFocusBehavior {
91    const ENCODING: Encoding = NSInteger::ENCODING;
92}
93
94unsafe impl RefEncode for SCNNodeFocusBehavior {
95    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
96}
97
98extern_class!(
99    /// SCNNode is the model class for node-tree objects.
100    ///
101    /// It encapsulates the position, rotations, and other transforms of a node, which define a coordinate system.
102    /// The coordinate systems of all the sub-nodes are relative to the one of their parent node.
103    ///
104    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnnode?language=objc)
105    #[unsafe(super(NSObject))]
106    #[derive(Debug, PartialEq, Eq, Hash)]
107    pub struct SCNNode;
108);
109
110unsafe impl NSCoding for SCNNode {}
111
112unsafe impl NSCopying for SCNNode {}
113
114unsafe impl CopyingHelper for SCNNode {
115    type Result = Self;
116}
117
118unsafe impl NSObjectProtocol for SCNNode {}
119
120unsafe impl NSSecureCoding for SCNNode {}
121
122#[cfg(feature = "SCNAction")]
123unsafe impl SCNActionable for SCNNode {}
124
125#[cfg(feature = "SCNAnimation")]
126unsafe impl SCNAnimatable for SCNNode {}
127
128#[cfg(feature = "SCNBoundingVolume")]
129unsafe impl SCNBoundingVolume for SCNNode {}
130
131impl SCNNode {
132    extern_methods!(
133        /// Creates and initializes a node instance.
134        #[unsafe(method(node))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn node() -> Retained<Self>;
137
138        #[cfg(feature = "SCNGeometry")]
139        /// Creates and initializes a node instance with the specified geometry attached.
140        ///
141        /// Parameter `geometry`: The geometry to attach.
142        #[unsafe(method(nodeWithGeometry:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn nodeWithGeometry(geometry: Option<&SCNGeometry>) -> Retained<SCNNode>;
145
146        /// Returns a copy of the receiver. The returned instance is autoreleased.
147        ///
148        /// The copy is recursive: every child node will be cloned, too. For a non-recursive copy, use copy instead.
149        /// The copied nodes will share their attached objects (light, geometry, camera, ...) with the original instances;
150        /// if you want, for example, to change the materials of the copy independently of the original object, you'll
151        /// have to copy the geometry of the node separately.
152        #[unsafe(method(clone))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn clone(&self) -> Retained<Self>;
155
156        #[unsafe(method(flattenedClone))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn flattenedClone(&self) -> Retained<Self>;
159
160        /// Determines the name of the receiver.
161        #[unsafe(method(name))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn name(&self) -> Option<Retained<NSString>>;
164
165        /// Setter for [`name`][Self::name].
166        #[unsafe(method(setName:))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn setName(&self, name: Option<&NSString>);
169
170        #[cfg(feature = "SCNLight")]
171        /// Determines the light attached to the receiver.
172        #[unsafe(method(light))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn light(&self) -> Option<Retained<SCNLight>>;
175
176        #[cfg(feature = "SCNLight")]
177        /// Setter for [`light`][Self::light].
178        #[unsafe(method(setLight:))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn setLight(&self, light: Option<&SCNLight>);
181
182        #[cfg(feature = "SCNCamera")]
183        /// Determines the camera attached to the receiver.
184        #[unsafe(method(camera))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn camera(&self) -> Option<Retained<SCNCamera>>;
187
188        #[cfg(feature = "SCNCamera")]
189        /// Setter for [`camera`][Self::camera].
190        #[unsafe(method(setCamera:))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn setCamera(&self, camera: Option<&SCNCamera>);
193
194        #[cfg(feature = "SCNGeometry")]
195        /// Returns the geometry attached to the receiver.
196        #[unsafe(method(geometry))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn geometry(&self) -> Option<Retained<SCNGeometry>>;
199
200        #[cfg(feature = "SCNGeometry")]
201        /// Setter for [`geometry`][Self::geometry].
202        #[unsafe(method(setGeometry:))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn setGeometry(&self, geometry: Option<&SCNGeometry>);
205
206        #[cfg(feature = "SCNSkinner")]
207        /// Returns the skinner attached to the receiver.
208        #[unsafe(method(skinner))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn skinner(&self) -> Option<Retained<SCNSkinner>>;
211
212        #[cfg(feature = "SCNSkinner")]
213        /// Setter for [`skinner`][Self::skinner].
214        #[unsafe(method(setSkinner:))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn setSkinner(&self, skinner: Option<&SCNSkinner>);
217
218        #[cfg(feature = "SCNMorpher")]
219        /// Returns the morpher attached to the receiver.
220        #[unsafe(method(morpher))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn morpher(&self) -> Option<Retained<SCNMorpher>>;
223
224        #[cfg(feature = "SCNMorpher")]
225        /// Setter for [`morpher`][Self::morpher].
226        #[unsafe(method(setMorpher:))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn setMorpher(&self, morpher: Option<&SCNMorpher>);
229
230        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-quartz-core"))]
231        #[cfg(not(target_os = "watchos"))]
232        /// Determines the receiver's transform. Animatable.
233        ///
234        /// The transform is the combination of the position, rotation and scale defined below. So when the transform is set, the receiver's position, rotation and scale are changed to match the new transform.
235        #[unsafe(method(transform))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn transform(&self) -> SCNMatrix4;
238
239        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-quartz-core"))]
240        #[cfg(not(target_os = "watchos"))]
241        /// Setter for [`transform`][Self::transform].
242        #[unsafe(method(setTransform:))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn setTransform(&self, transform: SCNMatrix4);
245
246        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-quartz-core"))]
247        #[cfg(not(target_os = "watchos"))]
248        /// Determines the receiver's transform in world space (relative to the scene's root node). Animatable.
249        #[unsafe(method(worldTransform))]
250        #[unsafe(method_family = none)]
251        pub unsafe fn worldTransform(&self) -> SCNMatrix4;
252
253        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-quartz-core"))]
254        #[cfg(not(target_os = "watchos"))]
255        #[unsafe(method(setWorldTransform:))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn setWorldTransform(&self, world_transform: SCNMatrix4);
258
259        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
260        /// Determines the receiver's position. Animatable.
261        #[unsafe(method(position))]
262        #[unsafe(method_family = none)]
263        pub unsafe fn position(&self) -> SCNVector3;
264
265        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
266        /// Setter for [`position`][Self::position].
267        #[unsafe(method(setPosition:))]
268        #[unsafe(method_family = none)]
269        pub unsafe fn setPosition(&self, position: SCNVector3);
270
271        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
272        /// Determines the receiver's position in world space (relative to the scene's root node).
273        #[unsafe(method(worldPosition))]
274        #[unsafe(method_family = none)]
275        pub unsafe fn worldPosition(&self) -> SCNVector3;
276
277        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
278        /// Setter for [`worldPosition`][Self::worldPosition].
279        #[unsafe(method(setWorldPosition:))]
280        #[unsafe(method_family = none)]
281        pub unsafe fn setWorldPosition(&self, world_position: SCNVector3);
282
283        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
284        /// Determines the receiver's rotation. Animatable.
285        ///
286        /// The rotation is axis angle rotation. The three first components are the axis, the fourth one is the rotation (in radian).
287        #[unsafe(method(rotation))]
288        #[unsafe(method_family = none)]
289        pub unsafe fn rotation(&self) -> SCNVector4;
290
291        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
292        /// Setter for [`rotation`][Self::rotation].
293        #[unsafe(method(setRotation:))]
294        #[unsafe(method_family = none)]
295        pub unsafe fn setRotation(&self, rotation: SCNVector4);
296
297        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
298        /// Determines the receiver's orientation as a unit quaternion. Animatable.
299        #[unsafe(method(orientation))]
300        #[unsafe(method_family = none)]
301        pub unsafe fn orientation(&self) -> SCNQuaternion;
302
303        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
304        /// Setter for [`orientation`][Self::orientation].
305        #[unsafe(method(setOrientation:))]
306        #[unsafe(method_family = none)]
307        pub unsafe fn setOrientation(&self, orientation: SCNQuaternion);
308
309        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
310        /// Determines the receiver's orientation in world space (relative to the scene's root node). Animatable.
311        #[unsafe(method(worldOrientation))]
312        #[unsafe(method_family = none)]
313        pub unsafe fn worldOrientation(&self) -> SCNQuaternion;
314
315        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
316        /// Setter for [`worldOrientation`][Self::worldOrientation].
317        #[unsafe(method(setWorldOrientation:))]
318        #[unsafe(method_family = none)]
319        pub unsafe fn setWorldOrientation(&self, world_orientation: SCNQuaternion);
320
321        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
322        /// Determines the receiver's euler angles. Animatable.
323        ///
324        /// The order of components in this vector matches the axes of rotation:
325        /// 1. Pitch (the x component) is the rotation about the node's x-axis (in radians)
326        /// 2. Yaw   (the y component) is the rotation about the node's y-axis (in radians)
327        /// 3. Roll  (the z component) is the rotation about the node's z-axis (in radians)
328        /// SceneKit applies these rotations in the reverse order of the components:
329        /// 1. first roll
330        /// 2. then yaw
331        /// 3. then pitch
332        #[unsafe(method(eulerAngles))]
333        #[unsafe(method_family = none)]
334        pub unsafe fn eulerAngles(&self) -> SCNVector3;
335
336        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
337        /// Setter for [`eulerAngles`][Self::eulerAngles].
338        #[unsafe(method(setEulerAngles:))]
339        #[unsafe(method_family = none)]
340        pub unsafe fn setEulerAngles(&self, euler_angles: SCNVector3);
341
342        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
343        /// Determines the receiver's scale. Animatable.
344        #[unsafe(method(scale))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn scale(&self) -> SCNVector3;
347
348        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
349        /// Setter for [`scale`][Self::scale].
350        #[unsafe(method(setScale:))]
351        #[unsafe(method_family = none)]
352        pub unsafe fn setScale(&self, scale: SCNVector3);
353
354        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-quartz-core"))]
355        #[cfg(not(target_os = "watchos"))]
356        /// Determines the receiver's pivot. Animatable.
357        #[unsafe(method(pivot))]
358        #[unsafe(method_family = none)]
359        pub unsafe fn pivot(&self) -> SCNMatrix4;
360
361        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-quartz-core"))]
362        #[cfg(not(target_os = "watchos"))]
363        /// Setter for [`pivot`][Self::pivot].
364        #[unsafe(method(setPivot:))]
365        #[unsafe(method_family = none)]
366        pub unsafe fn setPivot(&self, pivot: SCNMatrix4);
367
368        /// Determines whether the receiver is displayed. Defaults to NO. Animatable.
369        #[unsafe(method(isHidden))]
370        #[unsafe(method_family = none)]
371        pub unsafe fn isHidden(&self) -> bool;
372
373        /// Setter for [`isHidden`][Self::isHidden].
374        #[unsafe(method(setHidden:))]
375        #[unsafe(method_family = none)]
376        pub unsafe fn setHidden(&self, hidden: bool);
377
378        #[cfg(feature = "objc2-core-foundation")]
379        /// Determines the opacity of the receiver. Default is 1. Animatable.
380        #[unsafe(method(opacity))]
381        #[unsafe(method_family = none)]
382        pub unsafe fn opacity(&self) -> CGFloat;
383
384        #[cfg(feature = "objc2-core-foundation")]
385        /// Setter for [`opacity`][Self::opacity].
386        #[unsafe(method(setOpacity:))]
387        #[unsafe(method_family = none)]
388        pub unsafe fn setOpacity(&self, opacity: CGFloat);
389
390        /// Determines the rendering order of the receiver.
391        ///
392        /// Nodes with greater rendering orders are rendered last. Defaults to 0.
393        #[unsafe(method(renderingOrder))]
394        #[unsafe(method_family = none)]
395        pub unsafe fn renderingOrder(&self) -> NSInteger;
396
397        /// Setter for [`renderingOrder`][Self::renderingOrder].
398        #[unsafe(method(setRenderingOrder:))]
399        #[unsafe(method_family = none)]
400        pub unsafe fn setRenderingOrder(&self, rendering_order: NSInteger);
401
402        /// Determines if the node is rendered in shadow maps. Defaults to YES.
403        #[unsafe(method(castsShadow))]
404        #[unsafe(method_family = none)]
405        pub unsafe fn castsShadow(&self) -> bool;
406
407        /// Setter for [`castsShadow`][Self::castsShadow].
408        #[unsafe(method(setCastsShadow:))]
409        #[unsafe(method_family = none)]
410        pub unsafe fn setCastsShadow(&self, casts_shadow: bool);
411
412        /// Communicates to SceneKit’s rendering system about how you want to move content in your scene; it does not affect your ability to change the node’s position or add animations or physics to the node. Defaults to SCNMovabilityHintFixed.
413        #[unsafe(method(movabilityHint))]
414        #[unsafe(method_family = none)]
415        pub unsafe fn movabilityHint(&self) -> SCNMovabilityHint;
416
417        /// Setter for [`movabilityHint`][Self::movabilityHint].
418        #[unsafe(method(setMovabilityHint:))]
419        #[unsafe(method_family = none)]
420        pub unsafe fn setMovabilityHint(&self, movability_hint: SCNMovabilityHint);
421
422        /// Returns the parent node of the receiver.
423        #[unsafe(method(parentNode))]
424        #[unsafe(method_family = none)]
425        pub unsafe fn parentNode(&self) -> Option<Retained<SCNNode>>;
426
427        /// Returns the child node array of the receiver.
428        #[unsafe(method(childNodes))]
429        #[unsafe(method_family = none)]
430        pub unsafe fn childNodes(&self) -> Retained<NSArray<SCNNode>>;
431
432        /// Appends the node to the receiver’s childNodes array.
433        ///
434        /// Parameter `child`: The node to be added to the receiver’s childNodes array.
435        #[unsafe(method(addChildNode:))]
436        #[unsafe(method_family = none)]
437        pub unsafe fn addChildNode(&self, child: &SCNNode);
438
439        /// Insert a node in the childNodes array at the specified index.
440        ///
441        /// Parameter `child`: The node to insert.
442        ///
443        /// Parameter `index`: Index in the childNodes array to insert the node.
444        #[unsafe(method(insertChildNode:atIndex:))]
445        #[unsafe(method_family = none)]
446        pub unsafe fn insertChildNode_atIndex(&self, child: &SCNNode, index: NSUInteger);
447
448        /// Removes the node from the childNodes array of the receiver’s parentNode.
449        #[unsafe(method(removeFromParentNode))]
450        #[unsafe(method_family = none)]
451        pub unsafe fn removeFromParentNode(&self);
452
453        /// Remove `child' from the childNode array of the receiver and insert 'child2' if non-nil in its position.
454        ///
455        /// If the parentNode of `child' is not the receiver, the behavior is undefined.
456        ///
457        /// Parameter `oldChild`: The node to replace in the childNodes array.
458        ///
459        /// Parameter `newChild`: The new node that will replace the previous one.
460        #[unsafe(method(replaceChildNode:with:))]
461        #[unsafe(method_family = none)]
462        pub unsafe fn replaceChildNode_with(&self, old_child: &SCNNode, new_child: &SCNNode);
463
464        /// Returns the first node found in the node tree with the specified name.
465        ///
466        /// The search uses a pre-order tree traversal.
467        ///
468        /// Parameter `name`: The name of the node you are searching for.
469        ///
470        /// Parameter `recursively`: Set to YES if you want the search to look through the sub-nodes recursively.
471        #[unsafe(method(childNodeWithName:recursively:))]
472        #[unsafe(method_family = none)]
473        pub unsafe fn childNodeWithName_recursively(
474            &self,
475            name: &NSString,
476            recursively: bool,
477        ) -> Option<Retained<SCNNode>>;
478
479        #[cfg(feature = "block2")]
480        /// Returns the child nodes of the receiver that passes a test in a given Block.
481        ///
482        /// The search is recursive and uses a pre-order tree traversal.
483        ///
484        /// Parameter `predicate`: The block to apply to child nodes of the receiver. The block takes two arguments: "child" is a child node and "stop" is a reference to a Boolean value. The block can set the value to YES to stop further processing of the node hierarchy. The stop argument is an out-only argument. You should only ever set this Boolean to YES within the Block. The Block returns a Boolean value that indicates whether "child" passed the test.
485        #[unsafe(method(childNodesPassingTest:))]
486        #[unsafe(method_family = none)]
487        pub unsafe fn childNodesPassingTest(
488            &self,
489            predicate: &block2::Block<dyn Fn(NonNull<SCNNode>, NonNull<Bool>) -> Bool + '_>,
490        ) -> Retained<NSArray<SCNNode>>;
491
492        #[cfg(feature = "block2")]
493        /// Executes a given block on each child node under the receiver.
494        ///
495        /// The search is recursive and uses a pre-order tree traversal.
496        ///
497        /// Parameter `block`: The block to apply to child nodes of the receiver. The block takes two arguments: "child" is a child node and "stop" is a reference to a Boolean value. The block can set the value to YES to stop further processing of the node hierarchy. The stop argument is an out-only argument. You should only ever set this Boolean to YES within the Block.
498        #[unsafe(method(enumerateChildNodesUsingBlock:))]
499        #[unsafe(method_family = none)]
500        pub unsafe fn enumerateChildNodesUsingBlock(
501            &self,
502            block: &block2::Block<dyn Fn(NonNull<SCNNode>, NonNull<Bool>) + '_>,
503        );
504
505        #[cfg(feature = "block2")]
506        /// Executes a given block on the receiver and its child nodes.
507        ///
508        /// The search is recursive and uses a pre-order tree traversal.
509        ///
510        /// Parameter `block`: The block to apply to the receiver and its child nodes. The block takes two arguments: "node" is a node in the hierarchy of the receiver (including the receiver) and "stop" is a reference to a Boolean value. The block can set the value to YES to stop further processing of the node hierarchy. The stop argument is an out-only argument. You should only ever set this Boolean to YES within the Block.
511        #[unsafe(method(enumerateHierarchyUsingBlock:))]
512        #[unsafe(method_family = none)]
513        pub unsafe fn enumerateHierarchyUsingBlock(
514            &self,
515            block: &block2::Block<dyn Fn(NonNull<SCNNode>, NonNull<Bool>) + '_>,
516        );
517
518        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
519        /// Converts a position from the receiver’s coordinate system to that of the specified node.
520        ///
521        /// Parameter `position`: A position specified in the local coordinate system of the receiver.
522        ///
523        /// Parameter `node`: The node into whose coordinate system "position" is to be converted. If "node" is nil, this method instead converts to world coordinates.
524        #[unsafe(method(convertPosition:toNode:))]
525        #[unsafe(method_family = none)]
526        pub unsafe fn convertPosition_toNode(
527            &self,
528            position: SCNVector3,
529            node: Option<&SCNNode>,
530        ) -> SCNVector3;
531
532        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
533        /// Converts a position from the coordinate system of a given node to that of the receiver.
534        ///
535        /// Parameter `position`: A position specified in the local coordinate system of "node".
536        ///
537        /// Parameter `node`: The node from whose coordinate system "position" is to be converted. If "node" is nil, this method instead converts from world coordinates.
538        #[unsafe(method(convertPosition:fromNode:))]
539        #[unsafe(method_family = none)]
540        pub unsafe fn convertPosition_fromNode(
541            &self,
542            position: SCNVector3,
543            node: Option<&SCNNode>,
544        ) -> SCNVector3;
545
546        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
547        /// Converts a vector from the coordinate system of a given node to that of the receiver.
548        ///
549        ///
550        /// Parameter `vector`: A vector specified in the local coordinate system the receiver.
551        ///
552        /// Parameter `node`: The node defining the space from which the vector should be transformed. If "node" is nil, this method instead converts from world coordinates.
553        ///
554        ///
555        /// Returns: vector transformed from receiver local space to node local space.
556        #[unsafe(method(convertVector:toNode:))]
557        #[unsafe(method_family = none)]
558        pub unsafe fn convertVector_toNode(
559            &self,
560            vector: SCNVector3,
561            node: Option<&SCNNode>,
562        ) -> SCNVector3;
563
564        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
565        /// Converts a vector from the coordinate system of a given node to that of the receiver.
566        ///
567        ///
568        /// Parameter `vector`: A vector specified in the local coordinate system of "node".
569        ///
570        /// Parameter `node`: The node defining the space to which the vector should be transformed to. If "node" is nil, this method instead converts from world coordinates.
571        ///
572        ///
573        /// Returns: vector transformed from node space to reveiver local space.
574        #[unsafe(method(convertVector:fromNode:))]
575        #[unsafe(method_family = none)]
576        pub unsafe fn convertVector_fromNode(
577            &self,
578            vector: SCNVector3,
579            node: Option<&SCNNode>,
580        ) -> SCNVector3;
581
582        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-quartz-core"))]
583        #[cfg(not(target_os = "watchos"))]
584        /// Converts a transform from the receiver’s coordinate system to that of the specified node.
585        ///
586        /// Parameter `transform`: A transform specified in the local coordinate system of the receiver.
587        ///
588        /// Parameter `node`: The node into whose coordinate system "transform" is to be converted. If "node" is nil, this method instead converts to world coordinates.
589        #[unsafe(method(convertTransform:toNode:))]
590        #[unsafe(method_family = none)]
591        pub unsafe fn convertTransform_toNode(
592            &self,
593            transform: SCNMatrix4,
594            node: Option<&SCNNode>,
595        ) -> SCNMatrix4;
596
597        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-quartz-core"))]
598        #[cfg(not(target_os = "watchos"))]
599        /// Converts a transform from the coordinate system of a given node to that of the receiver.
600        ///
601        /// Parameter `transform`: A transform specified in the local coordinate system of "node".
602        ///
603        /// Parameter `node`: The node from whose coordinate system "transform" is to be converted. If "node" is nil, this method instead converts from world coordinates.
604        #[unsafe(method(convertTransform:fromNode:))]
605        #[unsafe(method_family = none)]
606        pub unsafe fn convertTransform_fromNode(
607            &self,
608            transform: SCNMatrix4,
609            node: Option<&SCNNode>,
610        ) -> SCNMatrix4;
611
612        #[cfg(feature = "SCNPhysicsBody")]
613        /// The description of the physics body of the receiver.
614        ///
615        /// Default is nil.
616        #[unsafe(method(physicsBody))]
617        #[unsafe(method_family = none)]
618        pub unsafe fn physicsBody(&self) -> Option<Retained<SCNPhysicsBody>>;
619
620        #[cfg(feature = "SCNPhysicsBody")]
621        /// Setter for [`physicsBody`][Self::physicsBody].
622        #[unsafe(method(setPhysicsBody:))]
623        #[unsafe(method_family = none)]
624        pub unsafe fn setPhysicsBody(&self, physics_body: Option<&SCNPhysicsBody>);
625
626        #[cfg(feature = "SCNPhysicsField")]
627        /// The description of the physics field of the receiver.
628        ///
629        /// Default is nil.
630        #[unsafe(method(physicsField))]
631        #[unsafe(method_family = none)]
632        pub unsafe fn physicsField(&self) -> Option<Retained<SCNPhysicsField>>;
633
634        #[cfg(feature = "SCNPhysicsField")]
635        /// Setter for [`physicsField`][Self::physicsField].
636        #[unsafe(method(setPhysicsField:))]
637        #[unsafe(method_family = none)]
638        pub unsafe fn setPhysicsField(&self, physics_field: Option<&SCNPhysicsField>);
639
640        #[cfg(feature = "SCNConstraint")]
641        /// An array of SCNConstraint that are applied to the receiver.
642        ///
643        /// Adding or removing a constraint can be implicitly animated based on the current transaction.
644        #[unsafe(method(constraints))]
645        #[unsafe(method_family = none)]
646        pub unsafe fn constraints(&self) -> Option<Retained<NSArray<SCNConstraint>>>;
647
648        #[cfg(feature = "SCNConstraint")]
649        /// Setter for [`constraints`][Self::constraints].
650        #[unsafe(method(setConstraints:))]
651        #[unsafe(method_family = none)]
652        pub unsafe fn setConstraints(&self, constraints: Option<&NSArray<SCNConstraint>>);
653
654        #[cfg(feature = "objc2-core-image")]
655        #[cfg(not(target_os = "watchos"))]
656        /// An array of Core Image filters that are applied to the rendering of the receiver and its child nodes. Animatable.
657        ///
658        /// Defaults to nil. Filter properties should be modified by calling setValue:forKeyPath: on each node that the filter is attached to. If the inputs of the filter are modified directly after the filter is attached to a node, the behavior is undefined.
659        #[unsafe(method(filters))]
660        #[unsafe(method_family = none)]
661        pub unsafe fn filters(&self) -> Option<Retained<NSArray<CIFilter>>>;
662
663        #[cfg(feature = "objc2-core-image")]
664        #[cfg(not(target_os = "watchos"))]
665        /// Setter for [`filters`][Self::filters].
666        #[unsafe(method(setFilters:))]
667        #[unsafe(method_family = none)]
668        pub unsafe fn setFilters(&self, filters: Option<&NSArray<CIFilter>>);
669
670        /// Returns the presentation node.
671        ///
672        /// Returns a copy of the node containing all the properties as they were at the start of the current transaction, with any active animations applied.
673        /// This gives a close approximation to the version of the node that is currently displayed.
674        /// The effect of attempting to modify the returned node in any way is undefined. The returned node has no parent and no child nodes.
675        #[unsafe(method(presentationNode))]
676        #[unsafe(method_family = none)]
677        pub unsafe fn presentationNode(&self) -> Retained<SCNNode>;
678
679        /// Controls whether or not the node's actions and animations are updated or paused. Defaults to NO.
680        #[unsafe(method(isPaused))]
681        #[unsafe(method_family = none)]
682        pub unsafe fn isPaused(&self) -> bool;
683
684        /// Setter for [`isPaused`][Self::isPaused].
685        #[unsafe(method(setPaused:))]
686        #[unsafe(method_family = none)]
687        pub unsafe fn setPaused(&self, paused: bool);
688
689        /// Specifies the receiver's renderer delegate object.
690        ///
691        /// Setting a renderer delegate prevents the SceneKit renderer from drawing the node and lets you use custom OpenGL code instead.
692        /// The preferred way to customize the rendering is to tweak the material properties of the different materials of the node's geometry. SCNMaterial conforms to the SCNShadable protocol and allows for more advanced rendering using GLSL.
693        /// You would typically use a renderer delegate with a node that has no geometry and only serves as a location in space. An example would be attaching a particle system to that node and render it with custom OpenGL code.
694        #[unsafe(method(rendererDelegate))]
695        #[unsafe(method_family = none)]
696        pub unsafe fn rendererDelegate(
697            &self,
698        ) -> Option<Retained<ProtocolObject<dyn SCNNodeRendererDelegate>>>;
699
700        /// Setter for [`rendererDelegate`][Self::rendererDelegate].
701        #[unsafe(method(setRendererDelegate:))]
702        #[unsafe(method_family = none)]
703        pub unsafe fn setRendererDelegate(
704            &self,
705            renderer_delegate: Option<&ProtocolObject<dyn SCNNodeRendererDelegate>>,
706        );
707
708        #[cfg(all(
709            feature = "SCNHitTest",
710            feature = "SceneKitTypes",
711            feature = "objc2-core-foundation"
712        ))]
713        /// Returns an array of SCNHitTestResult for each node in the receiver's sub tree that intersects the specified segment.
714        ///
715        /// Parameter `pointA`: The first point of the segment relative to the receiver.
716        ///
717        /// Parameter `pointB`: The second point of the segment relative to the receiver.
718        ///
719        /// Parameter `options`: Optional parameters (see the "Hit test options" section in SCNSceneRenderer.h for the available options).
720        ///
721        /// See SCNSceneRenderer.h for a screen-space hit testing method.
722        #[unsafe(method(hitTestWithSegmentFromPoint:toPoint:options:))]
723        #[unsafe(method_family = none)]
724        pub unsafe fn hitTestWithSegmentFromPoint_toPoint_options(
725            &self,
726            point_a: SCNVector3,
727            point_b: SCNVector3,
728            options: Option<&NSDictionary<NSString, AnyObject>>,
729        ) -> Retained<NSArray<SCNHitTestResult>>;
730
731        /// Defines what logical 'categories' the receiver belongs too. Defaults to 1.
732        ///
733        /// Categories can be used to
734        /// 1. exclude nodes from the influence of a given light (see SCNLight.categoryBitMask)
735        /// 2. include/exclude nodes from render passes (see SCNTechnique.h)
736        /// 3. specify which nodes to use when hit-testing (see SCNHitTestOptionCategoryBitMask)
737        #[unsafe(method(categoryBitMask))]
738        #[unsafe(method_family = none)]
739        pub unsafe fn categoryBitMask(&self) -> NSUInteger;
740
741        /// Setter for [`categoryBitMask`][Self::categoryBitMask].
742        #[unsafe(method(setCategoryBitMask:))]
743        #[unsafe(method_family = none)]
744        pub unsafe fn setCategoryBitMask(&self, category_bit_mask: NSUInteger);
745    );
746}
747
748/// Methods declared on superclass `NSObject`.
749impl SCNNode {
750    extern_methods!(
751        #[unsafe(method(init))]
752        #[unsafe(method_family = init)]
753        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
754
755        #[unsafe(method(new))]
756        #[unsafe(method_family = new)]
757        pub unsafe fn new() -> Retained<Self>;
758    );
759}
760
761/// Transforms.
762impl SCNNode {
763    extern_methods!(
764        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
765        /// The local unit Y axis (0, 1, 0).
766        #[unsafe(method(localUp))]
767        #[unsafe(method_family = none)]
768        pub unsafe fn localUp() -> SCNVector3;
769
770        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
771        /// The local unit X axis (1, 0, 0).
772        #[unsafe(method(localRight))]
773        #[unsafe(method_family = none)]
774        pub unsafe fn localRight() -> SCNVector3;
775
776        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
777        /// The local unit -Z axis (0, 0, -1).
778        #[unsafe(method(localFront))]
779        #[unsafe(method_family = none)]
780        pub unsafe fn localFront() -> SCNVector3;
781
782        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
783        /// The local unit Y axis (0, 1, 0) in world space.
784        #[unsafe(method(worldUp))]
785        #[unsafe(method_family = none)]
786        pub unsafe fn worldUp(&self) -> SCNVector3;
787
788        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
789        /// The local unit X axis (1, 0, 0) in world space.
790        #[unsafe(method(worldRight))]
791        #[unsafe(method_family = none)]
792        pub unsafe fn worldRight(&self) -> SCNVector3;
793
794        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
795        /// The local unit -Z axis (0, 0, -1) in world space.
796        #[unsafe(method(worldFront))]
797        #[unsafe(method_family = none)]
798        pub unsafe fn worldFront(&self) -> SCNVector3;
799
800        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
801        /// Convenience for calling lookAt:up:localFront: with worldUp set to `self.worldUp`
802        /// and localFront [SCNNode localFront].
803        ///
804        /// Parameter `worldTarget`: target position in world space.
805        #[unsafe(method(lookAt:))]
806        #[unsafe(method_family = none)]
807        pub unsafe fn lookAt(&self, world_target: SCNVector3);
808
809        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
810        /// Set the orientation of the node so its front vector is pointing toward a given
811        /// target. Using a reference up vector in world space and a front vector in
812        /// local space.
813        ///
814        ///
815        /// Parameter `worldTarget`: position in world space.
816        ///
817        /// Parameter `worldUp`: the up vector in world space.
818        ///
819        /// Parameter `localFront`: the front vector in local space.
820        #[unsafe(method(lookAt:up:localFront:))]
821        #[unsafe(method_family = none)]
822        pub unsafe fn lookAt_up_localFront(
823            &self,
824            world_target: SCNVector3,
825            world_up: SCNVector3,
826            local_front: SCNVector3,
827        );
828
829        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
830        /// Translate the current node position along the given vector in local space.
831        ///
832        ///
833        /// Parameter `translation`: the translation in local space.
834        #[unsafe(method(localTranslateBy:))]
835        #[unsafe(method_family = none)]
836        pub unsafe fn localTranslateBy(&self, translation: SCNVector3);
837
838        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
839        /// Apply a the given rotation to the current one.
840        ///
841        ///
842        /// Parameter `rotation`: rotation in local space.
843        #[unsafe(method(localRotateBy:))]
844        #[unsafe(method_family = none)]
845        pub unsafe fn localRotateBy(&self, rotation: SCNQuaternion);
846
847        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
848        /// Apply a rotation relative to a target point in parent space.
849        ///
850        ///
851        /// Parameter `worldRotation`: rotation to apply in world space.
852        ///
853        /// Parameter `worldTarget`: position of the target in world space.
854        #[unsafe(method(rotateBy:aroundTarget:))]
855        #[unsafe(method_family = none)]
856        pub unsafe fn rotateBy_aroundTarget(
857            &self,
858            world_rotation: SCNQuaternion,
859            world_target: SCNVector3,
860        );
861    );
862}
863
864extern_protocol!(
865    /// The SCNNodeRendererDelegate protocol declares the methods that an instance of SCNNode invokes to let a delegate customize its rendering.
866    ///
867    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnnoderendererdelegate?language=objc)
868    pub unsafe trait SCNNodeRendererDelegate: NSObjectProtocol {
869        #[cfg(feature = "SCNRenderer")]
870        /// Invoked when a node is rendered.
871        ///
872        /// The preferred way to customize the rendering is to tweak the material properties of the different materials of the node's geometry. SCNMaterial conforms to the SCNShadable protocol and allows for more advanced rendering using GLSL.
873        /// You would typically use a renderer delegate with a node that has no geometry and only serves as a location in space. An example would be attaching a particle system to that node and render it with custom OpenGL code.
874        /// Only drawing calls and the means to achieve them are supposed to be performed during the renderer delegate callback, any changes in the model (nodes, geometry...) would involve unexpected results.
875        ///
876        /// Parameter `node`: The node to render.
877        ///
878        /// Parameter `renderer`: The scene renderer to render into.
879        ///
880        /// Parameter `arguments`: A dictionary whose values are SCNMatrix4 matrices wrapped in NSValue objects.
881        #[optional]
882        #[unsafe(method(renderNode:renderer:arguments:))]
883        #[unsafe(method_family = none)]
884        unsafe fn renderNode_renderer_arguments(
885            &self,
886            node: &SCNNode,
887            renderer: &SCNRenderer,
888            arguments: &NSDictionary<NSString, AnyObject>,
889        );
890    }
891);
892
893/// SIMD.
894impl SCNNode {
895    extern_methods!();
896}
897
898/// Focus.
899impl SCNNode {
900    extern_methods!(
901        /// Controls the behavior of the receiver regarding the UIFocus system. Defaults to SCNNodeFocusBehaviorNone.
902        #[unsafe(method(focusBehavior))]
903        #[unsafe(method_family = none)]
904        pub unsafe fn focusBehavior(&self) -> SCNNodeFocusBehavior;
905
906        /// Setter for [`focusBehavior`][Self::focusBehavior].
907        #[unsafe(method(setFocusBehavior:))]
908        #[unsafe(method_family = none)]
909        pub unsafe fn setFocusBehavior(&self, focus_behavior: SCNNodeFocusBehavior);
910    );
911}