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