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
27extern_conformance!(
28    unsafe impl NSObjectProtocol for SCNRenderer {}
29);
30
31#[cfg(feature = "SCNSceneRenderer")]
32extern_conformance!(
33    unsafe impl SCNSceneRenderer for SCNRenderer {}
34);
35
36#[cfg(feature = "SCNTechnique")]
37extern_conformance!(
38    unsafe impl SCNTechniqueSupport for SCNRenderer {}
39);
40
41impl SCNRenderer {
42    extern_methods!(
43        #[cfg(feature = "objc2-metal")]
44        #[cfg(not(target_os = "watchos"))]
45        /// Creates a new renderer object that renders using Metal.
46        ///
47        /// Parameter `device`: The metal device to use. Pass nil to let SceneKit choose a default device.
48        ///
49        /// Parameter `options`: An optional dictionary for future extensions.
50        #[unsafe(method(rendererWithDevice:options:))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn rendererWithDevice_options(
53            device: Option<&ProtocolObject<dyn MTLDevice>>,
54            options: Option<&NSDictionary>,
55        ) -> Retained<Self>;
56
57        #[cfg(feature = "SCNScene")]
58        /// Specifies the scene of the receiver
59        #[unsafe(method(scene))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn scene(&self) -> Option<Retained<SCNScene>>;
62
63        #[cfg(feature = "SCNScene")]
64        /// Setter for [`scene`][Self::scene].
65        #[unsafe(method(setScene:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn setScene(&self, scene: Option<&SCNScene>);
68
69        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-metal"))]
70        #[cfg(not(target_os = "watchos"))]
71        /// updates and renders the receiver's scene at the specified time (system time) viewport, Metal command buffer and pass descriptor.
72        ///
73        /// Use this method to render using Metal.
74        #[unsafe(method(renderAtTime:viewport:commandBuffer:passDescriptor:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn renderAtTime_viewport_commandBuffer_passDescriptor(
77            &self,
78            time: CFTimeInterval,
79            viewport: CGRect,
80            command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
81            render_pass_descriptor: &MTLRenderPassDescriptor,
82        );
83
84        #[cfg(feature = "objc2-core-foundation")]
85        /// updates and renders the receiver's scene at the specified time (system time).
86        ///
87        /// This method only work if the receiver was allocated with an OpenGL context. Use renderAtTime:withEncoder:pass:commandQueue: to render with Metal.
88        #[unsafe(method(renderAtTime:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn renderAtTime(&self, time: CFTimeInterval);
91
92        #[cfg(feature = "objc2-core-foundation")]
93        /// updates the receiver's scene at the specified time (system time).
94        #[unsafe(method(updateAtTime:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn updateAtTime(&self, time: CFTimeInterval);
97
98        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-metal"))]
99        #[cfg(not(target_os = "watchos"))]
100        /// renders the receiver's scene with the specified viewport, Metal command buffer and pass descriptor.
101        ///
102        /// 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.
103        #[unsafe(method(renderWithViewport:commandBuffer:passDescriptor:))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn renderWithViewport_commandBuffer_passDescriptor(
106            &self,
107            viewport: CGRect,
108            command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
109            render_pass_descriptor: &MTLRenderPassDescriptor,
110        );
111
112        #[cfg(feature = "objc2-core-foundation")]
113        /// 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.
114        #[unsafe(method(nextFrameTime))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn nextFrameTime(&self) -> CFTimeInterval;
117
118        #[cfg(all(
119            feature = "SCNSceneRenderer",
120            feature = "objc2-app-kit",
121            feature = "objc2-core-foundation"
122        ))]
123        #[cfg(target_os = "macos")]
124        /// renders the receiver's scene at the specified time (system time) into an image.
125        #[unsafe(method(snapshotAtTime:withSize:antialiasingMode:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn snapshotAtTime_withSize_antialiasingMode(
128            &self,
129            time: CFTimeInterval,
130            size: CGSize,
131            antialiasing_mode: SCNAntialiasingMode,
132        ) -> Retained<NSImage>;
133
134        #[cfg(all(feature = "SCNNode", feature = "objc2-core-foundation"))]
135        /// Update the specified probes by computing their incoming irradiance in the receiver's scene at the specified time.
136        ///
137        /// Parameter `lightProbes`: An array of nodes that must have a light probe attached.
138        ///
139        /// Parameter `time`: The time used to render the scene when computing the light probes irradiance.
140        ///
141        /// Light probes are only supported with Metal. This method is observable using NSProgress.
142        #[unsafe(method(updateProbes:atTime:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn updateProbes_atTime(
145            &self,
146            light_probes: &NSArray<SCNNode>,
147            time: CFTimeInterval,
148        );
149    );
150}
151
152/// Methods declared on superclass `NSObject`.
153impl SCNRenderer {
154    extern_methods!(
155        #[unsafe(method(init))]
156        #[unsafe(method_family = init)]
157        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
158
159        #[unsafe(method(new))]
160        #[unsafe(method_family = new)]
161        pub unsafe fn new() -> Retained<Self>;
162    );
163}