objc2_scene_kit/generated/
SCNRenderer.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-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9#[cfg(feature = "objc2-core-foundation")]
10use objc2_core_foundation::*;
11use objc2_foundation::*;
12#[cfg(feature = "objc2-metal")]
13#[cfg(not(target_os = "watchos"))]
14use objc2_metal::*;
15
16use crate::*;
17
18extern_class!(
19    /// SCNRenderer lets you use the SceneKit renderer in an OpenGL context or Metal render pass descriptor of your own.
20    ///
21    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnrenderer?language=objc)
22    #[unsafe(super(NSObject))]
23    #[derive(Debug, PartialEq, Eq, Hash)]
24    pub struct SCNRenderer;
25);
26
27unsafe impl NSObjectProtocol for SCNRenderer {}
28
29#[cfg(feature = "SCNSceneRenderer")]
30unsafe impl SCNSceneRenderer for SCNRenderer {}
31
32#[cfg(feature = "SCNTechnique")]
33unsafe impl SCNTechniqueSupport for SCNRenderer {}
34
35impl SCNRenderer {
36    extern_methods!(
37        #[cfg(feature = "objc2-metal")]
38        #[cfg(not(target_os = "watchos"))]
39        /// Creates a new renderer object that renders using Metal.
40        ///
41        /// Parameter `device`: The metal device to use. Pass nil to let SceneKit choose a default device.
42        ///
43        /// Parameter `options`: An optional dictionary for future extensions.
44        #[unsafe(method(rendererWithDevice:options:))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn rendererWithDevice_options(
47            device: Option<&ProtocolObject<dyn MTLDevice>>,
48            options: Option<&NSDictionary>,
49        ) -> Retained<Self>;
50
51        #[cfg(feature = "SCNScene")]
52        /// Specifies the scene of the receiver
53        #[unsafe(method(scene))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn scene(&self) -> Option<Retained<SCNScene>>;
56
57        #[cfg(feature = "SCNScene")]
58        /// Setter for [`scene`][Self::scene].
59        #[unsafe(method(setScene:))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn setScene(&self, scene: Option<&SCNScene>);
62
63        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-metal"))]
64        #[cfg(not(target_os = "watchos"))]
65        /// updates and renders the receiver's scene at the specified time (system time) viewport, Metal command buffer and pass descriptor.
66        ///
67        /// Use this method to render using Metal.
68        #[unsafe(method(renderAtTime:viewport:commandBuffer:passDescriptor:))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn renderAtTime_viewport_commandBuffer_passDescriptor(
71            &self,
72            time: CFTimeInterval,
73            viewport: CGRect,
74            command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
75            render_pass_descriptor: &MTLRenderPassDescriptor,
76        );
77
78        #[cfg(feature = "objc2-core-foundation")]
79        /// updates and renders the receiver's scene at the specified time (system time).
80        ///
81        /// This method only work if the receiver was allocated with an OpenGL context. Use renderAtTime:withEncoder:pass:commandQueue: to render with Metal.
82        #[unsafe(method(renderAtTime:))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn renderAtTime(&self, time: CFTimeInterval);
85
86        #[cfg(feature = "objc2-core-foundation")]
87        /// updates the receiver's scene at the specified time (system time).
88        #[unsafe(method(updateAtTime:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn updateAtTime(&self, time: CFTimeInterval);
91
92        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-metal"))]
93        #[cfg(not(target_os = "watchos"))]
94        /// renders the receiver's scene with the specified viewport, Metal command buffer and pass descriptor.
95        ///
96        /// Use this method to render using Metal. This method doesn't update the scene's animations, physics, particles etc... It's up to you to call "updateAtTime:" to update the scene.
97        #[unsafe(method(renderWithViewport:commandBuffer:passDescriptor:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn renderWithViewport_commandBuffer_passDescriptor(
100            &self,
101            viewport: CGRect,
102            command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
103            render_pass_descriptor: &MTLRenderPassDescriptor,
104        );
105
106        #[cfg(feature = "objc2-core-foundation")]
107        /// Returns the time at which the next update should happen. If infinite no update needs to be scheduled yet. If the current frame time, a continuous animation is running and an update should be scheduled after a "natural" delay.
108        #[unsafe(method(nextFrameTime))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn nextFrameTime(&self) -> CFTimeInterval;
111
112        #[cfg(all(
113            feature = "SCNSceneRenderer",
114            feature = "objc2-app-kit",
115            feature = "objc2-core-foundation"
116        ))]
117        #[cfg(target_os = "macos")]
118        /// renders the receiver's scene at the specified time (system time) into an image.
119        #[unsafe(method(snapshotAtTime:withSize:antialiasingMode:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn snapshotAtTime_withSize_antialiasingMode(
122            &self,
123            time: CFTimeInterval,
124            size: CGSize,
125            antialiasing_mode: SCNAntialiasingMode,
126        ) -> Retained<NSImage>;
127
128        #[cfg(all(feature = "SCNNode", feature = "objc2-core-foundation"))]
129        /// Update the specified probes by computing their incoming irradiance in the receiver's scene at the specified time.
130        ///
131        /// Parameter `lightProbes`: An array of nodes that must have a light probe attached.
132        ///
133        /// Parameter `time`: The time used to render the scene when computing the light probes irradiance.
134        ///
135        /// Light probes are only supported with Metal. This method is observable using NSProgress.
136        #[unsafe(method(updateProbes:atTime:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn updateProbes_atTime(
139            &self,
140            light_probes: &NSArray<SCNNode>,
141            time: CFTimeInterval,
142        );
143    );
144}
145
146/// Methods declared on superclass `NSObject`.
147impl SCNRenderer {
148    extern_methods!(
149        #[unsafe(method(init))]
150        #[unsafe(method_family = init)]
151        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
152
153        #[unsafe(method(new))]
154        #[unsafe(method_family = new)]
155        pub unsafe fn new() -> Retained<Self>;
156    );
157}