objc2_scene_kit/generated/SCNSceneRenderer.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-avf-audio")]
7use objc2_avf_audio::*;
8#[cfg(feature = "objc2-core-foundation")]
9use objc2_core_foundation::*;
10#[cfg(feature = "objc2-core-graphics")]
11use objc2_core_graphics::*;
12use objc2_foundation::*;
13#[cfg(feature = "objc2-metal")]
14#[cfg(not(target_os = "watchos"))]
15use objc2_metal::*;
16
17use crate::*;
18
19/// antialiasing modes for scene renderers
20///
21/// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnantialiasingmode?language=objc)
22// NS_ENUM
23#[repr(transparent)]
24#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
25pub struct SCNAntialiasingMode(pub NSUInteger);
26impl SCNAntialiasingMode {
27 #[doc(alias = "SCNAntialiasingModeNone")]
28 pub const None: Self = Self(0);
29 #[doc(alias = "SCNAntialiasingModeMultisampling2X")]
30 pub const Multisampling2X: Self = Self(1);
31 #[doc(alias = "SCNAntialiasingModeMultisampling4X")]
32 pub const Multisampling4X: Self = Self(2);
33 #[doc(alias = "SCNAntialiasingModeMultisampling8X")]
34 pub const Multisampling8X: Self = Self(3);
35 #[doc(alias = "SCNAntialiasingModeMultisampling16X")]
36 pub const Multisampling16X: Self = Self(4);
37}
38
39unsafe impl Encode for SCNAntialiasingMode {
40 const ENCODING: Encoding = NSUInteger::ENCODING;
41}
42
43unsafe impl RefEncode for SCNAntialiasingMode {
44 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
45}
46
47/// rendering API used by SCNView and SCNRenderer.
48///
49/// Default preferred API is SCNRenderingAPIMetal on iOS and it depends on the configuration on macOS.
50/// If Metal is requested but not available then it fallbacks to SCNRenderingAPIOpenGLES2 on iOS and to SCNRenderingAPIOpenGLLegacy on macOS.
51///
52/// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnrenderingapi?language=objc)
53// NS_ENUM
54#[repr(transparent)]
55#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
56pub struct SCNRenderingAPI(pub NSUInteger);
57impl SCNRenderingAPI {
58 #[doc(alias = "SCNRenderingAPIMetal")]
59 pub const Metal: Self = Self(0);
60 #[doc(alias = "SCNRenderingAPIOpenGLLegacy")]
61 pub const OpenGLLegacy: Self = Self(1);
62 #[doc(alias = "SCNRenderingAPIOpenGLCore32")]
63 pub const OpenGLCore32: Self = Self(2);
64 #[doc(alias = "SCNRenderingAPIOpenGLCore41")]
65 pub const OpenGLCore41: Self = Self(3);
66}
67
68unsafe impl Encode for SCNRenderingAPI {
69 const ENCODING: Encoding = NSUInteger::ENCODING;
70}
71
72unsafe impl RefEncode for SCNRenderingAPI {
73 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
74}
75
76/// Debug options.
77///
78/// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scndebugoptions?language=objc)
79// NS_OPTIONS
80#[repr(transparent)]
81#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
82pub struct SCNDebugOptions(pub NSUInteger);
83bitflags::bitflags! {
84 impl SCNDebugOptions: NSUInteger {
85 #[doc(alias = "SCNDebugOptionNone")]
86 const None = 0;
87 #[doc(alias = "SCNDebugOptionShowPhysicsShapes")]
88 const ShowPhysicsShapes = 1<<0;
89 #[doc(alias = "SCNDebugOptionShowBoundingBoxes")]
90 const ShowBoundingBoxes = 1<<1;
91 #[doc(alias = "SCNDebugOptionShowLightInfluences")]
92 const ShowLightInfluences = 1<<2;
93 #[doc(alias = "SCNDebugOptionShowLightExtents")]
94 const ShowLightExtents = 1<<3;
95 #[doc(alias = "SCNDebugOptionShowPhysicsFields")]
96 const ShowPhysicsFields = 1<<4;
97 #[doc(alias = "SCNDebugOptionShowWireframe")]
98 const ShowWireframe = 1<<5;
99 #[doc(alias = "SCNDebugOptionRenderAsWireframe")]
100 const RenderAsWireframe = 1<<6;
101 #[doc(alias = "SCNDebugOptionShowSkeletons")]
102 const ShowSkeletons = 1<<7;
103 #[doc(alias = "SCNDebugOptionShowCreases")]
104 const ShowCreases = 1<<8;
105 #[doc(alias = "SCNDebugOptionShowConstraints")]
106 const ShowConstraints = 1<<9;
107 #[doc(alias = "SCNDebugOptionShowCameras")]
108 const ShowCameras = 1<<10;
109 }
110}
111
112unsafe impl Encode for SCNDebugOptions {
113 const ENCODING: Encoding = NSUInteger::ENCODING;
114}
115
116unsafe impl RefEncode for SCNDebugOptions {
117 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
118}
119
120extern_protocol!(
121 /// Protocol adopted by the various renderers (SCNView, SCNLayer, SCNRenderer)
122 ///
123 /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnscenerenderer?language=objc)
124 pub unsafe trait SCNSceneRenderer: NSObjectProtocol {
125 #[cfg(feature = "SCNScene")]
126 /// Specifies the scene of the receiver.
127 #[unsafe(method(scene))]
128 #[unsafe(method_family = none)]
129 unsafe fn scene(&self) -> Option<Retained<SCNScene>>;
130
131 #[cfg(feature = "SCNScene")]
132 /// Setter for [`scene`][Self::scene].
133 #[unsafe(method(setScene:))]
134 #[unsafe(method_family = none)]
135 unsafe fn setScene(&self, scene: Option<&SCNScene>);
136
137 /// Specifies the current "scene time" to display the scene.
138 ///
139 /// The scene time only affect scene time based animations (see SCNAnimation.h "usesSceneTimeBase" and SCNSceneSource.h "SCNSceneSourceAnimationImportPolicyKey" for how to create scene time based animations). Scene time based animations and this property are typically used by tools and viewer to ease seeking in time while previewing a scene.
140 #[unsafe(method(sceneTime))]
141 #[unsafe(method_family = none)]
142 unsafe fn sceneTime(&self) -> NSTimeInterval;
143
144 /// Setter for [`sceneTime`][Self::sceneTime].
145 #[unsafe(method(setSceneTime:))]
146 #[unsafe(method_family = none)]
147 unsafe fn setSceneTime(&self, scene_time: NSTimeInterval);
148
149 /// Specifies the renderer delegate.
150 #[unsafe(method(delegate))]
151 #[unsafe(method_family = none)]
152 unsafe fn delegate(&self)
153 -> Option<Retained<ProtocolObject<dyn SCNSceneRendererDelegate>>>;
154
155 /// This is a [weak property][objc2::topics::weak_property].
156 /// Setter for [`delegate`][Self::delegate].
157 #[unsafe(method(setDelegate:))]
158 #[unsafe(method_family = none)]
159 unsafe fn setDelegate(
160 &self,
161 delegate: Option<&ProtocolObject<dyn SCNSceneRendererDelegate>>,
162 );
163
164 #[cfg(all(feature = "SCNHitTest", feature = "objc2-core-foundation"))]
165 /// Returns an array of SCNHitTestResult for each node that contains a specified point.
166 ///
167 /// Parameter `point`: A point in the coordinate system of the receiver.
168 ///
169 /// Parameter `options`: Optional parameters (see the "Hit test options" group for the available options).
170 #[unsafe(method(hitTest:options:))]
171 #[unsafe(method_family = none)]
172 unsafe fn hitTest_options(
173 &self,
174 point: CGPoint,
175 options: Option<&NSDictionary<SCNHitTestOption, AnyObject>>,
176 ) -> Retained<NSArray<SCNHitTestResult>>;
177
178 #[cfg(feature = "SCNNode")]
179 /// Test whether node is visible from the specified point of view.
180 ///
181 /// Parameter `node`: The node to test the visibility of.
182 ///
183 /// Parameter `pointOfView`: The point of view used to test the visibility.
184 ///
185 /// Return YES if the node is inside or intersects the clipping planes of the point of view. This method doesn't test if 'node' is occluded by another node.
186 #[unsafe(method(isNodeInsideFrustum:withPointOfView:))]
187 #[unsafe(method_family = none)]
188 unsafe fn isNodeInsideFrustum_withPointOfView(
189 &self,
190 node: &SCNNode,
191 point_of_view: &SCNNode,
192 ) -> bool;
193
194 #[cfg(feature = "SCNNode")]
195 /// Returns an array containing the nodes visible from the specified point of view.
196 ///
197 /// Parameter `pointOfView`: The point of view used to test the visibility.
198 ///
199 /// Returns an array of all the nodes that are inside or intersects the clipping planes of the point of view. Starting in macOS10.13/iOS11 this method work with the presentation tree.
200 #[unsafe(method(nodesInsideFrustumWithPointOfView:))]
201 #[unsafe(method_family = none)]
202 unsafe fn nodesInsideFrustumWithPointOfView(
203 &self,
204 point_of_view: &SCNNode,
205 ) -> Retained<NSArray<SCNNode>>;
206
207 #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
208 /// Projects a point in the world coordinate system using the receiver's current point of view and viewport.
209 ///
210 /// Parameter `point`: The world position to be projected.
211 ///
212 /// A point projected from the near (resp. far) clip plane will have a z component of 0 (resp. 1). Starting in macOS 11.0, iOS 14, tvOS 14 and watchOS 7 the range of z component will be reversed (from 1 to 0) if the receiver uses 'reverseZ'.
213 #[unsafe(method(projectPoint:))]
214 #[unsafe(method_family = none)]
215 unsafe fn projectPoint(&self, point: SCNVector3) -> SCNVector3;
216
217 #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
218 /// Unprojects a screenspace 2D point with depth info using the receiver's current point of view and viewport.
219 ///
220 /// Parameter `point`: The screenspace position to be unprojected.
221 ///
222 /// A point whose z component is 0 (resp. 1) is unprojected on the near (resp. far) clip plane. Starting in macOS 11.0, iOS 14, tvOS 14 and watchOS 7 the range of the z component will be reversed (from 1 to 0) if the receiver uses 'reverseZ'.
223 #[unsafe(method(unprojectPoint:))]
224 #[unsafe(method_family = none)]
225 unsafe fn unprojectPoint(&self, point: SCNVector3) -> SCNVector3;
226
227 /// Returns YES if the scene is playing, NO otherwise.
228 #[unsafe(method(isPlaying))]
229 #[unsafe(method_family = none)]
230 unsafe fn isPlaying(&self) -> bool;
231
232 /// Setter for [`isPlaying`][Self::isPlaying].
233 #[unsafe(method(setPlaying:))]
234 #[unsafe(method_family = none)]
235 unsafe fn setPlaying(&self, playing: bool);
236
237 /// Indicates whether the receiver restarts playback when it reaches the end of its content. Default: YES.
238 ///
239 /// YES when the receiver restarts playback when it finishes, NO otherwise.
240 #[unsafe(method(loops))]
241 #[unsafe(method_family = none)]
242 unsafe fn loops(&self) -> bool;
243
244 /// Setter for [`loops`][Self::loops].
245 #[unsafe(method(setLoops:))]
246 #[unsafe(method_family = none)]
247 unsafe fn setLoops(&self, loops: bool);
248
249 #[cfg(feature = "SCNNode")]
250 /// Specifies the point of view used to render the scene.
251 ///
252 /// A point of view must have either a camera or a spot light attached.
253 #[unsafe(method(pointOfView))]
254 #[unsafe(method_family = none)]
255 unsafe fn pointOfView(&self) -> Option<Retained<SCNNode>>;
256
257 #[cfg(feature = "SCNNode")]
258 /// Setter for [`pointOfView`][Self::pointOfView].
259 #[unsafe(method(setPointOfView:))]
260 #[unsafe(method_family = none)]
261 unsafe fn setPointOfView(&self, point_of_view: Option<&SCNNode>);
262
263 /// Specifies whether the receiver should automatically light up scenes that have no light source. The default is NO.
264 ///
265 /// When enabled, a diffuse light is automatically added and placed while rendering scenes that have no light or only ambient lights.
266 #[unsafe(method(autoenablesDefaultLighting))]
267 #[unsafe(method_family = none)]
268 unsafe fn autoenablesDefaultLighting(&self) -> bool;
269
270 /// Setter for [`autoenablesDefaultLighting`][Self::autoenablesDefaultLighting].
271 #[unsafe(method(setAutoenablesDefaultLighting:))]
272 #[unsafe(method_family = none)]
273 unsafe fn setAutoenablesDefaultLighting(&self, autoenables_default_lighting: bool);
274
275 /// Specifies whether the receiver should jitter the rendered scene to reduce aliasing artifacts.
276 ///
277 /// When enabled, the jittering is performed asynchronously and automatically by SCNView and SCNLayer. It is done synchronously by SCNRenderer.
278 #[unsafe(method(isJitteringEnabled))]
279 #[unsafe(method_family = none)]
280 unsafe fn isJitteringEnabled(&self) -> bool;
281
282 /// Setter for [`isJitteringEnabled`][Self::isJitteringEnabled].
283 #[unsafe(method(setJitteringEnabled:))]
284 #[unsafe(method_family = none)]
285 unsafe fn setJitteringEnabled(&self, jittering_enabled: bool);
286
287 /// Specifies whether the receiver should reduce aliasing artifacts in real time based on temporal coherency. Defaults to NO.
288 #[unsafe(method(isTemporalAntialiasingEnabled))]
289 #[unsafe(method_family = none)]
290 unsafe fn isTemporalAntialiasingEnabled(&self) -> bool;
291
292 /// Setter for [`isTemporalAntialiasingEnabled`][Self::isTemporalAntialiasingEnabled].
293 #[unsafe(method(setTemporalAntialiasingEnabled:))]
294 #[unsafe(method_family = none)]
295 unsafe fn setTemporalAntialiasingEnabled(&self, temporal_antialiasing_enabled: bool);
296
297 #[cfg(feature = "block2")]
298 /// Prepare the specified object for drawing.
299 ///
300 /// Parameter `object`: The object to prepare. It can be an instance of SCNScene, SCNNode, SCNGeometry, or SCNMaterial
301 ///
302 /// Parameter `block`: This block will be called repeatedly while the object is prepared. Return YES if you want the operation to abort.
303 ///
304 /// Returns YES if the object was prepared successfully, NO if it was canceled. This method may be triggered from a secondary thread. This method is observable using NSProgress.
305 #[unsafe(method(prepareObject:shouldAbortBlock:))]
306 #[unsafe(method_family = none)]
307 unsafe fn prepareObject_shouldAbortBlock(
308 &self,
309 object: &AnyObject,
310 block: Option<&block2::Block<dyn Fn() -> Bool + '_>>,
311 ) -> bool;
312
313 #[cfg(feature = "block2")]
314 /// Prepare the specified objects for drawing on the background.
315 ///
316 /// Parameter `objects`: The objects to prepare. It can be one or more instances of SCNScene, SCNNode, SCNGeometry, or SCNMaterial
317 ///
318 /// Parameter `completionHandler`: This block will be called when all objects has been prepared, or on failure.
319 ///
320 /// This method is observable using NSProgress.
321 #[unsafe(method(prepareObjects:withCompletionHandler:))]
322 #[unsafe(method_family = none)]
323 unsafe fn prepareObjects_withCompletionHandler(
324 &self,
325 objects: &NSArray,
326 completion_handler: Option<&block2::Block<dyn Fn(Bool)>>,
327 );
328
329 /// Determines whether the receiver should display statistics info like FPS. Defaults to NO.
330 ///
331 /// When set to YES, statistics are displayed in a overlay on top of the rendered scene.
332 #[unsafe(method(showsStatistics))]
333 #[unsafe(method_family = none)]
334 unsafe fn showsStatistics(&self) -> bool;
335
336 /// Setter for [`showsStatistics`][Self::showsStatistics].
337 #[unsafe(method(setShowsStatistics:))]
338 #[unsafe(method_family = none)]
339 unsafe fn setShowsStatistics(&self, shows_statistics: bool);
340
341 /// Specifies the debug options of the receiver. Defaults to SCNDebugOptionNone.
342 #[unsafe(method(debugOptions))]
343 #[unsafe(method_family = none)]
344 unsafe fn debugOptions(&self) -> SCNDebugOptions;
345
346 /// Setter for [`debugOptions`][Self::debugOptions].
347 #[unsafe(method(setDebugOptions:))]
348 #[unsafe(method_family = none)]
349 unsafe fn setDebugOptions(&self, debug_options: SCNDebugOptions);
350
351 /// Specifies the rendering API associated to the receiver.
352 ///
353 /// This is the rendering API effectively used by the receiver. You can specify a preferred rendering API when initializing a view programmatically (see SCNPreferredRenderingAPI in SCNSceneRenderer.h) or using Interface Builder's SCNView inspector.
354 #[unsafe(method(renderingAPI))]
355 #[unsafe(method_family = none)]
356 unsafe fn renderingAPI(&self) -> SCNRenderingAPI;
357
358 #[cfg(feature = "objc2-core-graphics")]
359 /// Specifies the color space used by the receiver for shading.
360 ///
361 /// SceneKit will automatically color match image and color objects (NSImage, NSColor, CGImageRef, CGColorRef, etc.). When you directly provide color components to shaders, use this property to color match them to the working color space.
362 #[unsafe(method(workingColorSpace))]
363 #[unsafe(method_family = none)]
364 unsafe fn workingColorSpace(&self) -> Retained<CGColorSpace>;
365
366 /// A Core OpenGL render context that is used as the render target (a CGLContextObj on macOS, an EAGLContext on iOS).
367 #[unsafe(method(context))]
368 #[unsafe(method_family = none)]
369 unsafe fn context(&self) -> *mut c_void;
370
371 #[cfg(feature = "objc2-metal")]
372 #[cfg(not(target_os = "watchos"))]
373 /// The current render command encoder if any. This property is only valid within the SCNSceneRendererDelegate methods and when rendering with Metal. Otherwise it is set to nil.
374 #[unsafe(method(currentRenderCommandEncoder))]
375 #[unsafe(method_family = none)]
376 unsafe fn currentRenderCommandEncoder(
377 &self,
378 ) -> Option<Retained<ProtocolObject<dyn MTLRenderCommandEncoder>>>;
379
380 #[cfg(feature = "objc2-metal")]
381 #[cfg(not(target_os = "watchos"))]
382 /// The render pass descriptor of the receiver. This property is only valid within the SCNSceneRendererDelegate methods and when rendering with Metal. Otherwise it is set to nil.
383 #[unsafe(method(currentRenderPassDescriptor))]
384 #[unsafe(method_family = none)]
385 unsafe fn currentRenderPassDescriptor(&self) -> Retained<MTLRenderPassDescriptor>;
386
387 #[cfg(feature = "objc2-metal")]
388 #[cfg(not(target_os = "watchos"))]
389 /// The metal device of the renderer. This property is only valid on a renderer created with a Metal device. Otherwise it is set to nil.
390 #[unsafe(method(device))]
391 #[unsafe(method_family = none)]
392 unsafe fn device(&self) -> Option<Retained<ProtocolObject<dyn MTLDevice>>>;
393
394 #[cfg(feature = "objc2-metal")]
395 #[cfg(not(target_os = "watchos"))]
396 /// The pixel format of the color attachment 0 of the renderer. This property is only valid on a renderer created with a Metal device.
397 #[unsafe(method(colorPixelFormat))]
398 #[unsafe(method_family = none)]
399 unsafe fn colorPixelFormat(&self) -> MTLPixelFormat;
400
401 #[cfg(feature = "objc2-metal")]
402 #[cfg(not(target_os = "watchos"))]
403 /// The pixel format of the depth attachment of the renderer. This property is only valid on a renderer created with a Metal device.
404 #[unsafe(method(depthPixelFormat))]
405 #[unsafe(method_family = none)]
406 unsafe fn depthPixelFormat(&self) -> MTLPixelFormat;
407
408 #[cfg(feature = "objc2-metal")]
409 #[cfg(not(target_os = "watchos"))]
410 /// The pixel format of the stencil attachment of the renderer. This property is only valid on a renderer created with a Metal device.
411 #[unsafe(method(stencilPixelFormat))]
412 #[unsafe(method_family = none)]
413 unsafe fn stencilPixelFormat(&self) -> MTLPixelFormat;
414
415 #[cfg(feature = "objc2-metal")]
416 #[cfg(not(target_os = "watchos"))]
417 /// The command queue of the renderer. This property is only valid on a renderer created with a Metal device. Otherwise it is set to nil.
418 #[unsafe(method(commandQueue))]
419 #[unsafe(method_family = none)]
420 unsafe fn commandQueue(&self) -> Option<Retained<ProtocolObject<dyn MTLCommandQueue>>>;
421
422 #[cfg(feature = "objc2-avf-audio")]
423 /// Contains the instance of audio engine used by the scene.
424 ///
425 /// The audio engine can be used to add custom nodes to the audio graph.
426 #[unsafe(method(audioEngine))]
427 #[unsafe(method_family = none)]
428 unsafe fn audioEngine(&self) -> Retained<AVAudioEngine>;
429
430 #[cfg(feature = "objc2-avf-audio")]
431 /// Contains the instance of audio environment node used by the scene to spacialize sounds.
432 #[unsafe(method(audioEnvironmentNode))]
433 #[unsafe(method_family = none)]
434 unsafe fn audioEnvironmentNode(&self) -> Retained<AVAudioEnvironmentNode>;
435
436 #[cfg(feature = "SCNNode")]
437 /// Use this property to set the audio node to use as the listener position and orientation when rendering positional audio for this scene. The default is nil which means that the current point of view will be used dynamically.
438 #[unsafe(method(audioListener))]
439 #[unsafe(method_family = none)]
440 unsafe fn audioListener(&self) -> Option<Retained<SCNNode>>;
441
442 #[cfg(feature = "SCNNode")]
443 /// Setter for [`audioListener`][Self::audioListener].
444 #[unsafe(method(setAudioListener:))]
445 #[unsafe(method_family = none)]
446 unsafe fn setAudioListener(&self, audio_listener: Option<&SCNNode>);
447
448 #[cfg(feature = "objc2-core-foundation")]
449 /// Returns the current viewport for this renderer, can be used to get the actual viewport from within the delegate callback during a live resize.
450 #[unsafe(method(currentViewport))]
451 #[unsafe(method_family = none)]
452 unsafe fn currentViewport(&self) -> CGRect;
453
454 /// Specifies the current time to display the scene.
455 ///
456 /// Deprecated, use "sceneTime" instead.
457 #[deprecated]
458 #[unsafe(method(currentTime))]
459 #[unsafe(method_family = none)]
460 unsafe fn currentTime(&self) -> NSTimeInterval;
461
462 /// Setter for [`currentTime`][Self::currentTime].
463 #[deprecated]
464 #[unsafe(method(setCurrentTime:))]
465 #[unsafe(method_family = none)]
466 unsafe fn setCurrentTime(&self, current_time: NSTimeInterval);
467
468 /// Specifies if the renderer should use the reverse Z technique. Defaults to YES.
469 ///
470 /// This property is only valid on a renderer created with a Metal device.
471 #[unsafe(method(usesReverseZ))]
472 #[unsafe(method_family = none)]
473 unsafe fn usesReverseZ(&self) -> bool;
474
475 /// Setter for [`usesReverseZ`][Self::usesReverseZ].
476 #[unsafe(method(setUsesReverseZ:))]
477 #[unsafe(method_family = none)]
478 unsafe fn setUsesReverseZ(&self, uses_reverse_z: bool);
479 }
480);
481
482extern_protocol!(
483 /// Implement this protocol to perform operations at various times during the rendering
484 ///
485 /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnscenerendererdelegate?language=objc)
486 pub unsafe trait SCNSceneRendererDelegate: NSObjectProtocol {
487 /// Implement this to perform per-frame game logic. Called exactly once per frame before any animation and actions are evaluated and any physics are simulated.
488 ///
489 /// Parameter `renderer`: The renderer that will render the scene.
490 ///
491 /// Parameter `time`: The time at which to update the scene.
492 ///
493 /// All modifications done within this method don't go through the transaction model, they are directly applied on the presentation tree.
494 #[optional]
495 #[unsafe(method(renderer:updateAtTime:))]
496 #[unsafe(method_family = none)]
497 unsafe fn renderer_updateAtTime(
498 &self,
499 renderer: &ProtocolObject<dyn SCNSceneRenderer>,
500 time: NSTimeInterval,
501 );
502
503 /// Invoked on the delegate once the scene renderer did apply the animations.
504 ///
505 /// Parameter `renderer`: The renderer that did render the scene.
506 ///
507 /// Parameter `time`: The time at which the animations were applied.
508 ///
509 /// All modifications done within this method don't go through the transaction model, they are directly applied on the presentation tree.
510 #[optional]
511 #[unsafe(method(renderer:didApplyAnimationsAtTime:))]
512 #[unsafe(method_family = none)]
513 unsafe fn renderer_didApplyAnimationsAtTime(
514 &self,
515 renderer: &ProtocolObject<dyn SCNSceneRenderer>,
516 time: NSTimeInterval,
517 );
518
519 /// Invoked on the delegate once the scene renderer did simulate the physics.
520 ///
521 /// Parameter `renderer`: The renderer that did render the scene.
522 ///
523 /// Parameter `time`: The time at which the physics were simulated.
524 ///
525 /// All modifications done within this method don't go through the transaction model, they are directly applied on the presentation tree.
526 #[optional]
527 #[unsafe(method(renderer:didSimulatePhysicsAtTime:))]
528 #[unsafe(method_family = none)]
529 unsafe fn renderer_didSimulatePhysicsAtTime(
530 &self,
531 renderer: &ProtocolObject<dyn SCNSceneRenderer>,
532 time: NSTimeInterval,
533 );
534
535 /// Invoked on the delegate once the scene renderer did apply the constraints.
536 ///
537 /// Parameter `renderer`: The renderer that did render the scene.
538 ///
539 /// Parameter `time`: The time at which the constraints were simulated.
540 ///
541 /// All modifications done within this method don't go through the transaction model, they are directly applied on the presentation tree.
542 #[optional]
543 #[unsafe(method(renderer:didApplyConstraintsAtTime:))]
544 #[unsafe(method_family = none)]
545 unsafe fn renderer_didApplyConstraintsAtTime(
546 &self,
547 renderer: &ProtocolObject<dyn SCNSceneRenderer>,
548 time: NSTimeInterval,
549 );
550
551 #[cfg(feature = "SCNScene")]
552 /// Invoked on the delegate before the scene renderer renders the scene. At this point the openGL context and the destination framebuffer are bound.
553 ///
554 /// Parameter `renderer`: The renderer that will render the scene.
555 ///
556 /// Parameter `scene`: The scene to be rendered.
557 ///
558 /// Parameter `time`: The time at which the scene is to be rendered.
559 ///
560 /// Starting in 10.10 all modifications done within this method don't go through the transaction model, they are directly applied on the presentation tree.
561 #[optional]
562 #[unsafe(method(renderer:willRenderScene:atTime:))]
563 #[unsafe(method_family = none)]
564 unsafe fn renderer_willRenderScene_atTime(
565 &self,
566 renderer: &ProtocolObject<dyn SCNSceneRenderer>,
567 scene: &SCNScene,
568 time: NSTimeInterval,
569 );
570
571 #[cfg(feature = "SCNScene")]
572 /// Invoked on the delegate once the scene renderer did render the scene.
573 ///
574 /// Parameter `renderer`: The renderer that did render the scene.
575 ///
576 /// Parameter `scene`: The rendered scene.
577 ///
578 /// Parameter `time`: The time at which the scene was rendered.
579 ///
580 /// Starting in 10.10 all modifications done within this method don't go through the transaction model, they are directly applied on the presentation tree.
581 #[optional]
582 #[unsafe(method(renderer:didRenderScene:atTime:))]
583 #[unsafe(method_family = none)]
584 unsafe fn renderer_didRenderScene_atTime(
585 &self,
586 renderer: &ProtocolObject<dyn SCNSceneRenderer>,
587 scene: &SCNScene,
588 time: NSTimeInterval,
589 );
590 }
591);