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