objc2_scene_kit/generated/SCNParametricGeometry.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
13use crate::*;
14
15extern_class!(
16 /// SCNPlane represents a rectangle with controllable width and height. The plane has one visible side.
17 ///
18 /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnplane?language=objc)
19 #[unsafe(super(SCNGeometry, NSObject))]
20 #[derive(Debug, PartialEq, Eq, Hash)]
21 #[cfg(feature = "SCNGeometry")]
22 pub struct SCNPlane;
23);
24
25#[cfg(feature = "SCNGeometry")]
26extern_conformance!(
27 unsafe impl NSCoding for SCNPlane {}
28);
29
30#[cfg(feature = "SCNGeometry")]
31extern_conformance!(
32 unsafe impl NSCopying for SCNPlane {}
33);
34
35#[cfg(feature = "SCNGeometry")]
36unsafe impl CopyingHelper for SCNPlane {
37 type Result = Self;
38}
39
40#[cfg(feature = "SCNGeometry")]
41extern_conformance!(
42 unsafe impl NSObjectProtocol for SCNPlane {}
43);
44
45#[cfg(feature = "SCNGeometry")]
46extern_conformance!(
47 unsafe impl NSSecureCoding for SCNPlane {}
48);
49
50#[cfg(all(feature = "SCNAnimation", feature = "SCNGeometry"))]
51extern_conformance!(
52 unsafe impl SCNAnimatable for SCNPlane {}
53);
54
55#[cfg(all(feature = "SCNBoundingVolume", feature = "SCNGeometry"))]
56extern_conformance!(
57 unsafe impl SCNBoundingVolume for SCNPlane {}
58);
59
60#[cfg(all(feature = "SCNGeometry", feature = "SCNShadable"))]
61extern_conformance!(
62 unsafe impl SCNShadable for SCNPlane {}
63);
64
65#[cfg(feature = "SCNGeometry")]
66impl SCNPlane {
67 extern_methods!(
68 #[cfg(feature = "objc2-core-foundation")]
69 /// Creates and returns a plane with given width and height.
70 ///
71 /// Parameter `width`: The width of the plane.
72 ///
73 /// Parameter `height`: The height of the plane.
74 #[unsafe(method(planeWithWidth:height:))]
75 #[unsafe(method_family = none)]
76 pub unsafe fn planeWithWidth_height(width: CGFloat, height: CGFloat) -> Retained<Self>;
77
78 #[cfg(feature = "objc2-core-foundation")]
79 /// The plane extent along the X axis. Animatable.
80 ///
81 /// If the value is less than or equal to 0, the geometry is empty. The default value is 1.
82 #[unsafe(method(width))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn width(&self) -> CGFloat;
85
86 #[cfg(feature = "objc2-core-foundation")]
87 /// Setter for [`width`][Self::width].
88 #[unsafe(method(setWidth:))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn setWidth(&self, width: CGFloat);
91
92 #[cfg(feature = "objc2-core-foundation")]
93 /// The plane extent along the Y axis. Animatable.
94 ///
95 /// If the value is less than or equal to 0, the geometry is empty. The default value is 1.
96 #[unsafe(method(height))]
97 #[unsafe(method_family = none)]
98 pub unsafe fn height(&self) -> CGFloat;
99
100 #[cfg(feature = "objc2-core-foundation")]
101 /// Setter for [`height`][Self::height].
102 #[unsafe(method(setHeight:))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn setHeight(&self, height: CGFloat);
105
106 /// The number of subdivisions along the X axis. Animatable.
107 ///
108 /// If the value is less than 1, the behavior is undefined. The default value is 1.
109 #[unsafe(method(widthSegmentCount))]
110 #[unsafe(method_family = none)]
111 pub unsafe fn widthSegmentCount(&self) -> NSInteger;
112
113 /// Setter for [`widthSegmentCount`][Self::widthSegmentCount].
114 #[unsafe(method(setWidthSegmentCount:))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn setWidthSegmentCount(&self, width_segment_count: NSInteger);
117
118 /// The number of subdivisions along the Y axis. The default value is 1. Animatable.
119 ///
120 /// If the value is less than 1, the behavior is undefined. The default value is 1.
121 #[unsafe(method(heightSegmentCount))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn heightSegmentCount(&self) -> NSInteger;
124
125 /// Setter for [`heightSegmentCount`][Self::heightSegmentCount].
126 #[unsafe(method(setHeightSegmentCount:))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn setHeightSegmentCount(&self, height_segment_count: NSInteger);
129
130 #[cfg(feature = "objc2-core-foundation")]
131 /// The corner radius. Animatable.
132 ///
133 /// If the value is strictly less than 0, the geometry is empty. The default value is 0.
134 #[unsafe(method(cornerRadius))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn cornerRadius(&self) -> CGFloat;
137
138 #[cfg(feature = "objc2-core-foundation")]
139 /// Setter for [`cornerRadius`][Self::cornerRadius].
140 #[unsafe(method(setCornerRadius:))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn setCornerRadius(&self, corner_radius: CGFloat);
143
144 /// The number of subdivisions for the rounded corners. Animatable.
145 ///
146 /// If the value is less than 1, the behavior is undefined. The default value is 10.
147 #[unsafe(method(cornerSegmentCount))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn cornerSegmentCount(&self) -> NSInteger;
150
151 /// Setter for [`cornerSegmentCount`][Self::cornerSegmentCount].
152 #[unsafe(method(setCornerSegmentCount:))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn setCornerSegmentCount(&self, corner_segment_count: NSInteger);
155 );
156}
157
158/// Methods declared on superclass `SCNGeometry`.
159#[cfg(feature = "SCNGeometry")]
160impl SCNPlane {
161 extern_methods!(
162 /// Creates and returns an empty geometry object.
163 ///
164 /// An empty geometry may be used as the lowest level of detail of a geometry.
165 #[unsafe(method(geometry))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn geometry() -> Retained<Self>;
168
169 /// Creates and returns a new geometry built from geometry sources and geometry elements.
170 ///
171 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
172 ///
173 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
174 ///
175 /// A geometry is made of geometry sources (at least `SCNGeometrySourceSemanticVertex`) and at least one geometry element. Multiple sources for texture coordinates are accepted. In that case the `mappingChannel` is implicitly set based on the order of the texture sources, starting at index 0.
176 #[unsafe(method(geometryWithSources:elements:))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn geometryWithSources_elements(
179 sources: &NSArray<SCNGeometrySource>,
180 elements: Option<&NSArray<SCNGeometryElement>>,
181 ) -> Retained<Self>;
182
183 /// Creates and returns a new geometry built from geometry sources and geometry elements, with per-source indexed geometry data.
184 ///
185 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
186 ///
187 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
188 ///
189 /// Parameter `sourceChannels`: An array of indices that describes, for each geometry source, which channel of the geometry elements to use.
190 ///
191 /// ```text
192 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using different indices to reference position and UV data (2 channels)
193 ///
194 /// Positions ┆ POS0 POS3 POS4 ┆ quad quad pentagon quad quad pentagon ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
195 /// 0 │ (0.0, 0.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌─────┐ ┌─────┐ ┌───────┐ ┌─────┐ ┌─────┐ ┌───────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
196 /// 1 │ (0.0, 1.0, 0.0) ┆ │UV0 UV3│UV0 UV3│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 0 1 2 3 2 3 0 1 1 2 3 4 0 ┆ primitiveCount:3
197 /// 2 │ (1.0, 0.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────┘ └───────────────────────┘ ┆ indicesChannelCount:2
198 /// 3 │ (1.0, 1.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 channel 1 ┆ interleavedIndicesChannels:…
199 /// 4 │ (2.0, 0.0, 0.0) ┆ │ │ │ ┆ (positions) (UVs) ┆ bytesPerIndex:…];
200 /// 5 │ (2.0, 1.0, 0.0) ┆ │UV1 UV2│UV1 UV2│ ┆ ┆
201 /// 6 │ (2.0, 2.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
202 /// @
203 /// [positionSource, texcoordsSource]
204 /// 7 │ (0.0, 2.0, 0.0) ┆ │UVO UV4 UV3│ ┆ ┆ elements:
205 /// @
206 /// [element]
207 /// ┆ │ POS2 │ ┆ quad A quad B pentagon C ┆ sourceChannels:
208 /// @
209 /// [0, 1]];
210 /// UVs ┆ │ │ ┆ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ ┆
211 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ 4 4 5 0 0 1 1 2 2 3 3 5 2 4 3 3 0 2 1 7 1 6 2 5 3 2 4 1 0 ┆
212 /// 1 │ (0.0, 1.0) ┆ │ │ ┆ └───┘└──────────────────────────────────────────────────┘ ┆
213 /// 2 │ (1.0, 1.0) ┆ │UV1 UV2│ ┆ polygons interleaved channels ┆
214 /// 3 │ (1.0, 0.0) ┆ └───────────────────────┘ ┆ (positions and UVs) ┆
215 /// 4 │ (0.5, 0.0) ┆ POS7 POS6 ┆ ┆
216 ///
217 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using the same indices to reference position and UV data (1 channel)
218 ///
219 /// Positions ┆ POS0 POS3 POS4 ┆ quad A quad B pentagon C ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
220 /// 0 │ (0.0, 4.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌────────┐ ┌────────┐ ┌───────────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
221 /// 1 │ (0.0, 2.0, 0.0) ┆ │UV0 UV3│UV3 UV4│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 ┆ primitiveCount:3
222 /// 2 │ (2.0, 2.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────────────────┘ ┆ bytesPerIndex:…];
223 /// 3 │ (2.0, 4.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 ┆
224 /// 4 │ (4.0, 4.0, 0.0) ┆ │ │ │ ┆ (positions and UVs) ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
225 /// @
226 /// [positionSource, texcoordsSource]
227 /// 5 │ (4.0, 2.0, 0.0) ┆ │UV1 UV2│UV2 UV5│ ┆ ┆ elements:
228 /// @
229 /// [element]];
230 /// 6 │ (4.0, 0.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆
231 /// 7 │ (0.0, 0.0, 0.0) ┆ │UV1 UV2 UV5│ ┆ ┆ === or equivalently ===
232 /// ┆ │ POS2 │ ┆ ┆
233 /// UVs ┆ │ │ ┆ ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
234 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
235 /// 1 │ (0.0, 0.5) ┆ │ │ ┆ ┆ primitiveCount:3
236 /// 2 │ (0.5, 0.5) ┆ │UV7 UV6│ ┆ ┆ indicesChannelCount:1
237 /// 3 │ (0.5, 0.0) ┆ └───────────────────────┘ ┆ ┆ interleavedIndicesChannels:…
238 /// 4 │ (1.0, 0.0) ┆ POS7 POS6 ┆ ┆ bytesPerIndex:…];
239 /// 5 │ (1.0, 0.5) ┆ ┆ ┆
240 /// 6 │ (1.0, 1.0) ┆ ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
241 /// @
242 /// [positionSource, texcoordsSource]
243 /// 7 │ (0.0, 1.0) ┆ ┆ ┆ elements:
244 /// @
245 /// [element]
246 /// ┆ ┆ ┆ sourceChannels:
247 /// @
248 /// [0, 0]]; ┆
249 /// ```
250 #[unsafe(method(geometryWithSources:elements:sourceChannels:))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn geometryWithSources_elements_sourceChannels(
253 sources: &NSArray<SCNGeometrySource>,
254 elements: Option<&NSArray<SCNGeometryElement>>,
255 source_channels: Option<&NSArray<NSNumber>>,
256 ) -> Retained<Self>;
257 );
258}
259
260/// Methods declared on superclass `NSObject`.
261#[cfg(feature = "SCNGeometry")]
262impl SCNPlane {
263 extern_methods!(
264 #[unsafe(method(init))]
265 #[unsafe(method_family = init)]
266 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
267
268 #[unsafe(method(new))]
269 #[unsafe(method_family = new)]
270 pub unsafe fn new() -> Retained<Self>;
271 );
272}
273
274extern_class!(
275 /// SCNBox represents a box with rectangular sides and optional chamfers.
276 ///
277 /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnbox?language=objc)
278 #[unsafe(super(SCNGeometry, NSObject))]
279 #[derive(Debug, PartialEq, Eq, Hash)]
280 #[cfg(feature = "SCNGeometry")]
281 pub struct SCNBox;
282);
283
284#[cfg(feature = "SCNGeometry")]
285extern_conformance!(
286 unsafe impl NSCoding for SCNBox {}
287);
288
289#[cfg(feature = "SCNGeometry")]
290extern_conformance!(
291 unsafe impl NSCopying for SCNBox {}
292);
293
294#[cfg(feature = "SCNGeometry")]
295unsafe impl CopyingHelper for SCNBox {
296 type Result = Self;
297}
298
299#[cfg(feature = "SCNGeometry")]
300extern_conformance!(
301 unsafe impl NSObjectProtocol for SCNBox {}
302);
303
304#[cfg(feature = "SCNGeometry")]
305extern_conformance!(
306 unsafe impl NSSecureCoding for SCNBox {}
307);
308
309#[cfg(all(feature = "SCNAnimation", feature = "SCNGeometry"))]
310extern_conformance!(
311 unsafe impl SCNAnimatable for SCNBox {}
312);
313
314#[cfg(all(feature = "SCNBoundingVolume", feature = "SCNGeometry"))]
315extern_conformance!(
316 unsafe impl SCNBoundingVolume for SCNBox {}
317);
318
319#[cfg(all(feature = "SCNGeometry", feature = "SCNShadable"))]
320extern_conformance!(
321 unsafe impl SCNShadable for SCNBox {}
322);
323
324#[cfg(feature = "SCNGeometry")]
325impl SCNBox {
326 extern_methods!(
327 #[cfg(feature = "objc2-core-foundation")]
328 /// Creates and returns a box with given width, height, length and chamfer radius.
329 ///
330 /// Parameter `width`: The width of the box.
331 ///
332 /// Parameter `height`: The height of the box.
333 ///
334 /// Parameter `length`: The length of the box.
335 ///
336 /// Parameter `chamferRadius`: The chamfer radius of the box.
337 #[unsafe(method(boxWithWidth:height:length:chamferRadius:))]
338 #[unsafe(method_family = none)]
339 pub unsafe fn boxWithWidth_height_length_chamferRadius(
340 width: CGFloat,
341 height: CGFloat,
342 length: CGFloat,
343 chamfer_radius: CGFloat,
344 ) -> Retained<Self>;
345
346 #[cfg(feature = "objc2-core-foundation")]
347 /// The width of the box. Animatable.
348 ///
349 /// If the value is less than or equal to 0, the geometry is empty. The default value is 1.
350 #[unsafe(method(width))]
351 #[unsafe(method_family = none)]
352 pub unsafe fn width(&self) -> CGFloat;
353
354 #[cfg(feature = "objc2-core-foundation")]
355 /// Setter for [`width`][Self::width].
356 #[unsafe(method(setWidth:))]
357 #[unsafe(method_family = none)]
358 pub unsafe fn setWidth(&self, width: CGFloat);
359
360 #[cfg(feature = "objc2-core-foundation")]
361 /// The height of the box. Animatable.
362 ///
363 /// If the value is less than or equal to 0, the geometry is empty. The default value is 1.
364 #[unsafe(method(height))]
365 #[unsafe(method_family = none)]
366 pub unsafe fn height(&self) -> CGFloat;
367
368 #[cfg(feature = "objc2-core-foundation")]
369 /// Setter for [`height`][Self::height].
370 #[unsafe(method(setHeight:))]
371 #[unsafe(method_family = none)]
372 pub unsafe fn setHeight(&self, height: CGFloat);
373
374 #[cfg(feature = "objc2-core-foundation")]
375 /// The length of the box. Animatable.
376 ///
377 /// If the value is less than or equal to 0, the geometry is empty. The default value is 1.
378 #[unsafe(method(length))]
379 #[unsafe(method_family = none)]
380 pub unsafe fn length(&self) -> CGFloat;
381
382 #[cfg(feature = "objc2-core-foundation")]
383 /// Setter for [`length`][Self::length].
384 #[unsafe(method(setLength:))]
385 #[unsafe(method_family = none)]
386 pub unsafe fn setLength(&self, length: CGFloat);
387
388 #[cfg(feature = "objc2-core-foundation")]
389 /// The chamfer radius. Animatable.
390 ///
391 /// If the value is strictly less than 0, the geometry is empty. The default value is 0.
392 #[unsafe(method(chamferRadius))]
393 #[unsafe(method_family = none)]
394 pub unsafe fn chamferRadius(&self) -> CGFloat;
395
396 #[cfg(feature = "objc2-core-foundation")]
397 /// Setter for [`chamferRadius`][Self::chamferRadius].
398 #[unsafe(method(setChamferRadius:))]
399 #[unsafe(method_family = none)]
400 pub unsafe fn setChamferRadius(&self, chamfer_radius: CGFloat);
401
402 /// The number of subdivisions along the X axis. Animatable.
403 ///
404 /// If the value is less than 1, the behavior is undefined. The default value is 1.
405 #[unsafe(method(widthSegmentCount))]
406 #[unsafe(method_family = none)]
407 pub unsafe fn widthSegmentCount(&self) -> NSInteger;
408
409 /// Setter for [`widthSegmentCount`][Self::widthSegmentCount].
410 #[unsafe(method(setWidthSegmentCount:))]
411 #[unsafe(method_family = none)]
412 pub unsafe fn setWidthSegmentCount(&self, width_segment_count: NSInteger);
413
414 /// The number of subdivisions along the Y axis. Animatable.
415 ///
416 /// If the value is less than 1, the behavior is undefined. The default value is 1.
417 #[unsafe(method(heightSegmentCount))]
418 #[unsafe(method_family = none)]
419 pub unsafe fn heightSegmentCount(&self) -> NSInteger;
420
421 /// Setter for [`heightSegmentCount`][Self::heightSegmentCount].
422 #[unsafe(method(setHeightSegmentCount:))]
423 #[unsafe(method_family = none)]
424 pub unsafe fn setHeightSegmentCount(&self, height_segment_count: NSInteger);
425
426 /// The number of subdivisions along the Z axis. Animatable.
427 ///
428 /// If the value is less than 1, the behavior is undefined. The default value is 1.
429 #[unsafe(method(lengthSegmentCount))]
430 #[unsafe(method_family = none)]
431 pub unsafe fn lengthSegmentCount(&self) -> NSInteger;
432
433 /// Setter for [`lengthSegmentCount`][Self::lengthSegmentCount].
434 #[unsafe(method(setLengthSegmentCount:))]
435 #[unsafe(method_family = none)]
436 pub unsafe fn setLengthSegmentCount(&self, length_segment_count: NSInteger);
437
438 /// The number of chamfer subdivisions. Animatable.
439 ///
440 /// If the value is less than 1, the behavior is undefined. The default value is 10.
441 #[unsafe(method(chamferSegmentCount))]
442 #[unsafe(method_family = none)]
443 pub unsafe fn chamferSegmentCount(&self) -> NSInteger;
444
445 /// Setter for [`chamferSegmentCount`][Self::chamferSegmentCount].
446 #[unsafe(method(setChamferSegmentCount:))]
447 #[unsafe(method_family = none)]
448 pub unsafe fn setChamferSegmentCount(&self, chamfer_segment_count: NSInteger);
449 );
450}
451
452/// Methods declared on superclass `SCNGeometry`.
453#[cfg(feature = "SCNGeometry")]
454impl SCNBox {
455 extern_methods!(
456 /// Creates and returns an empty geometry object.
457 ///
458 /// An empty geometry may be used as the lowest level of detail of a geometry.
459 #[unsafe(method(geometry))]
460 #[unsafe(method_family = none)]
461 pub unsafe fn geometry() -> Retained<Self>;
462
463 /// Creates and returns a new geometry built from geometry sources and geometry elements.
464 ///
465 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
466 ///
467 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
468 ///
469 /// A geometry is made of geometry sources (at least `SCNGeometrySourceSemanticVertex`) and at least one geometry element. Multiple sources for texture coordinates are accepted. In that case the `mappingChannel` is implicitly set based on the order of the texture sources, starting at index 0.
470 #[unsafe(method(geometryWithSources:elements:))]
471 #[unsafe(method_family = none)]
472 pub unsafe fn geometryWithSources_elements(
473 sources: &NSArray<SCNGeometrySource>,
474 elements: Option<&NSArray<SCNGeometryElement>>,
475 ) -> Retained<Self>;
476
477 /// Creates and returns a new geometry built from geometry sources and geometry elements, with per-source indexed geometry data.
478 ///
479 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
480 ///
481 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
482 ///
483 /// Parameter `sourceChannels`: An array of indices that describes, for each geometry source, which channel of the geometry elements to use.
484 ///
485 /// ```text
486 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using different indices to reference position and UV data (2 channels)
487 ///
488 /// Positions ┆ POS0 POS3 POS4 ┆ quad quad pentagon quad quad pentagon ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
489 /// 0 │ (0.0, 0.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌─────┐ ┌─────┐ ┌───────┐ ┌─────┐ ┌─────┐ ┌───────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
490 /// 1 │ (0.0, 1.0, 0.0) ┆ │UV0 UV3│UV0 UV3│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 0 1 2 3 2 3 0 1 1 2 3 4 0 ┆ primitiveCount:3
491 /// 2 │ (1.0, 0.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────┘ └───────────────────────┘ ┆ indicesChannelCount:2
492 /// 3 │ (1.0, 1.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 channel 1 ┆ interleavedIndicesChannels:…
493 /// 4 │ (2.0, 0.0, 0.0) ┆ │ │ │ ┆ (positions) (UVs) ┆ bytesPerIndex:…];
494 /// 5 │ (2.0, 1.0, 0.0) ┆ │UV1 UV2│UV1 UV2│ ┆ ┆
495 /// 6 │ (2.0, 2.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
496 /// @
497 /// [positionSource, texcoordsSource]
498 /// 7 │ (0.0, 2.0, 0.0) ┆ │UVO UV4 UV3│ ┆ ┆ elements:
499 /// @
500 /// [element]
501 /// ┆ │ POS2 │ ┆ quad A quad B pentagon C ┆ sourceChannels:
502 /// @
503 /// [0, 1]];
504 /// UVs ┆ │ │ ┆ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ ┆
505 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ 4 4 5 0 0 1 1 2 2 3 3 5 2 4 3 3 0 2 1 7 1 6 2 5 3 2 4 1 0 ┆
506 /// 1 │ (0.0, 1.0) ┆ │ │ ┆ └───┘└──────────────────────────────────────────────────┘ ┆
507 /// 2 │ (1.0, 1.0) ┆ │UV1 UV2│ ┆ polygons interleaved channels ┆
508 /// 3 │ (1.0, 0.0) ┆ └───────────────────────┘ ┆ (positions and UVs) ┆
509 /// 4 │ (0.5, 0.0) ┆ POS7 POS6 ┆ ┆
510 ///
511 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using the same indices to reference position and UV data (1 channel)
512 ///
513 /// Positions ┆ POS0 POS3 POS4 ┆ quad A quad B pentagon C ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
514 /// 0 │ (0.0, 4.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌────────┐ ┌────────┐ ┌───────────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
515 /// 1 │ (0.0, 2.0, 0.0) ┆ │UV0 UV3│UV3 UV4│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 ┆ primitiveCount:3
516 /// 2 │ (2.0, 2.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────────────────┘ ┆ bytesPerIndex:…];
517 /// 3 │ (2.0, 4.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 ┆
518 /// 4 │ (4.0, 4.0, 0.0) ┆ │ │ │ ┆ (positions and UVs) ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
519 /// @
520 /// [positionSource, texcoordsSource]
521 /// 5 │ (4.0, 2.0, 0.0) ┆ │UV1 UV2│UV2 UV5│ ┆ ┆ elements:
522 /// @
523 /// [element]];
524 /// 6 │ (4.0, 0.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆
525 /// 7 │ (0.0, 0.0, 0.0) ┆ │UV1 UV2 UV5│ ┆ ┆ === or equivalently ===
526 /// ┆ │ POS2 │ ┆ ┆
527 /// UVs ┆ │ │ ┆ ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
528 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
529 /// 1 │ (0.0, 0.5) ┆ │ │ ┆ ┆ primitiveCount:3
530 /// 2 │ (0.5, 0.5) ┆ │UV7 UV6│ ┆ ┆ indicesChannelCount:1
531 /// 3 │ (0.5, 0.0) ┆ └───────────────────────┘ ┆ ┆ interleavedIndicesChannels:…
532 /// 4 │ (1.0, 0.0) ┆ POS7 POS6 ┆ ┆ bytesPerIndex:…];
533 /// 5 │ (1.0, 0.5) ┆ ┆ ┆
534 /// 6 │ (1.0, 1.0) ┆ ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
535 /// @
536 /// [positionSource, texcoordsSource]
537 /// 7 │ (0.0, 1.0) ┆ ┆ ┆ elements:
538 /// @
539 /// [element]
540 /// ┆ ┆ ┆ sourceChannels:
541 /// @
542 /// [0, 0]]; ┆
543 /// ```
544 #[unsafe(method(geometryWithSources:elements:sourceChannels:))]
545 #[unsafe(method_family = none)]
546 pub unsafe fn geometryWithSources_elements_sourceChannels(
547 sources: &NSArray<SCNGeometrySource>,
548 elements: Option<&NSArray<SCNGeometryElement>>,
549 source_channels: Option<&NSArray<NSNumber>>,
550 ) -> Retained<Self>;
551 );
552}
553
554/// Methods declared on superclass `NSObject`.
555#[cfg(feature = "SCNGeometry")]
556impl SCNBox {
557 extern_methods!(
558 #[unsafe(method(init))]
559 #[unsafe(method_family = init)]
560 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
561
562 #[unsafe(method(new))]
563 #[unsafe(method_family = new)]
564 pub unsafe fn new() -> Retained<Self>;
565 );
566}
567
568extern_class!(
569 /// SCNPyramid represents a right pyramid with a rectangular base.
570 ///
571 /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnpyramid?language=objc)
572 #[unsafe(super(SCNGeometry, NSObject))]
573 #[derive(Debug, PartialEq, Eq, Hash)]
574 #[cfg(feature = "SCNGeometry")]
575 pub struct SCNPyramid;
576);
577
578#[cfg(feature = "SCNGeometry")]
579extern_conformance!(
580 unsafe impl NSCoding for SCNPyramid {}
581);
582
583#[cfg(feature = "SCNGeometry")]
584extern_conformance!(
585 unsafe impl NSCopying for SCNPyramid {}
586);
587
588#[cfg(feature = "SCNGeometry")]
589unsafe impl CopyingHelper for SCNPyramid {
590 type Result = Self;
591}
592
593#[cfg(feature = "SCNGeometry")]
594extern_conformance!(
595 unsafe impl NSObjectProtocol for SCNPyramid {}
596);
597
598#[cfg(feature = "SCNGeometry")]
599extern_conformance!(
600 unsafe impl NSSecureCoding for SCNPyramid {}
601);
602
603#[cfg(all(feature = "SCNAnimation", feature = "SCNGeometry"))]
604extern_conformance!(
605 unsafe impl SCNAnimatable for SCNPyramid {}
606);
607
608#[cfg(all(feature = "SCNBoundingVolume", feature = "SCNGeometry"))]
609extern_conformance!(
610 unsafe impl SCNBoundingVolume for SCNPyramid {}
611);
612
613#[cfg(all(feature = "SCNGeometry", feature = "SCNShadable"))]
614extern_conformance!(
615 unsafe impl SCNShadable for SCNPyramid {}
616);
617
618#[cfg(feature = "SCNGeometry")]
619impl SCNPyramid {
620 extern_methods!(
621 #[cfg(feature = "objc2-core-foundation")]
622 /// Creates and returns a pyramid with given width, height, and length.
623 ///
624 /// Parameter `width`: The width of the pyramid.
625 ///
626 /// Parameter `height`: The height of the pyramid.
627 ///
628 /// Parameter `length`: The length of the pyramid.
629 #[unsafe(method(pyramidWithWidth:height:length:))]
630 #[unsafe(method_family = none)]
631 pub unsafe fn pyramidWithWidth_height_length(
632 width: CGFloat,
633 height: CGFloat,
634 length: CGFloat,
635 ) -> Retained<Self>;
636
637 #[cfg(feature = "objc2-core-foundation")]
638 /// The width of the pyramid base. Animatable.
639 ///
640 /// If the value is less than or equal to 0, the geometry is empty. The default value is 1.
641 #[unsafe(method(width))]
642 #[unsafe(method_family = none)]
643 pub unsafe fn width(&self) -> CGFloat;
644
645 #[cfg(feature = "objc2-core-foundation")]
646 /// Setter for [`width`][Self::width].
647 #[unsafe(method(setWidth:))]
648 #[unsafe(method_family = none)]
649 pub unsafe fn setWidth(&self, width: CGFloat);
650
651 #[cfg(feature = "objc2-core-foundation")]
652 /// The height of the pyramid. Animatable.
653 ///
654 /// If the value is less than or equal to 0, the geometry is empty. The default value is 1.
655 #[unsafe(method(height))]
656 #[unsafe(method_family = none)]
657 pub unsafe fn height(&self) -> CGFloat;
658
659 #[cfg(feature = "objc2-core-foundation")]
660 /// Setter for [`height`][Self::height].
661 #[unsafe(method(setHeight:))]
662 #[unsafe(method_family = none)]
663 pub unsafe fn setHeight(&self, height: CGFloat);
664
665 #[cfg(feature = "objc2-core-foundation")]
666 /// The length of the pyramid base. Animatable.
667 ///
668 /// If the value is less than or equal to 0, the geometry is empty. The default value is 1.
669 #[unsafe(method(length))]
670 #[unsafe(method_family = none)]
671 pub unsafe fn length(&self) -> CGFloat;
672
673 #[cfg(feature = "objc2-core-foundation")]
674 /// Setter for [`length`][Self::length].
675 #[unsafe(method(setLength:))]
676 #[unsafe(method_family = none)]
677 pub unsafe fn setLength(&self, length: CGFloat);
678
679 /// The number of subdivisions along the X axis. Animatable.
680 ///
681 /// If the value is less than 1, the behavior is undefined. The default value is 1.
682 #[unsafe(method(widthSegmentCount))]
683 #[unsafe(method_family = none)]
684 pub unsafe fn widthSegmentCount(&self) -> NSInteger;
685
686 /// Setter for [`widthSegmentCount`][Self::widthSegmentCount].
687 #[unsafe(method(setWidthSegmentCount:))]
688 #[unsafe(method_family = none)]
689 pub unsafe fn setWidthSegmentCount(&self, width_segment_count: NSInteger);
690
691 /// The number of subdivisions along the Y axis. Animatable.
692 ///
693 /// If the value is less than 1, the behavior is undefined. The default value is 1.
694 #[unsafe(method(heightSegmentCount))]
695 #[unsafe(method_family = none)]
696 pub unsafe fn heightSegmentCount(&self) -> NSInteger;
697
698 /// Setter for [`heightSegmentCount`][Self::heightSegmentCount].
699 #[unsafe(method(setHeightSegmentCount:))]
700 #[unsafe(method_family = none)]
701 pub unsafe fn setHeightSegmentCount(&self, height_segment_count: NSInteger);
702
703 /// The number of subdivisions along the Z axis. Animatable.
704 ///
705 /// If the value is less than 1, the behavior is undefined. The default value is 1.
706 #[unsafe(method(lengthSegmentCount))]
707 #[unsafe(method_family = none)]
708 pub unsafe fn lengthSegmentCount(&self) -> NSInteger;
709
710 /// Setter for [`lengthSegmentCount`][Self::lengthSegmentCount].
711 #[unsafe(method(setLengthSegmentCount:))]
712 #[unsafe(method_family = none)]
713 pub unsafe fn setLengthSegmentCount(&self, length_segment_count: NSInteger);
714 );
715}
716
717/// Methods declared on superclass `SCNGeometry`.
718#[cfg(feature = "SCNGeometry")]
719impl SCNPyramid {
720 extern_methods!(
721 /// Creates and returns an empty geometry object.
722 ///
723 /// An empty geometry may be used as the lowest level of detail of a geometry.
724 #[unsafe(method(geometry))]
725 #[unsafe(method_family = none)]
726 pub unsafe fn geometry() -> Retained<Self>;
727
728 /// Creates and returns a new geometry built from geometry sources and geometry elements.
729 ///
730 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
731 ///
732 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
733 ///
734 /// A geometry is made of geometry sources (at least `SCNGeometrySourceSemanticVertex`) and at least one geometry element. Multiple sources for texture coordinates are accepted. In that case the `mappingChannel` is implicitly set based on the order of the texture sources, starting at index 0.
735 #[unsafe(method(geometryWithSources:elements:))]
736 #[unsafe(method_family = none)]
737 pub unsafe fn geometryWithSources_elements(
738 sources: &NSArray<SCNGeometrySource>,
739 elements: Option<&NSArray<SCNGeometryElement>>,
740 ) -> Retained<Self>;
741
742 /// Creates and returns a new geometry built from geometry sources and geometry elements, with per-source indexed geometry data.
743 ///
744 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
745 ///
746 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
747 ///
748 /// Parameter `sourceChannels`: An array of indices that describes, for each geometry source, which channel of the geometry elements to use.
749 ///
750 /// ```text
751 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using different indices to reference position and UV data (2 channels)
752 ///
753 /// Positions ┆ POS0 POS3 POS4 ┆ quad quad pentagon quad quad pentagon ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
754 /// 0 │ (0.0, 0.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌─────┐ ┌─────┐ ┌───────┐ ┌─────┐ ┌─────┐ ┌───────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
755 /// 1 │ (0.0, 1.0, 0.0) ┆ │UV0 UV3│UV0 UV3│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 0 1 2 3 2 3 0 1 1 2 3 4 0 ┆ primitiveCount:3
756 /// 2 │ (1.0, 0.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────┘ └───────────────────────┘ ┆ indicesChannelCount:2
757 /// 3 │ (1.0, 1.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 channel 1 ┆ interleavedIndicesChannels:…
758 /// 4 │ (2.0, 0.0, 0.0) ┆ │ │ │ ┆ (positions) (UVs) ┆ bytesPerIndex:…];
759 /// 5 │ (2.0, 1.0, 0.0) ┆ │UV1 UV2│UV1 UV2│ ┆ ┆
760 /// 6 │ (2.0, 2.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
761 /// @
762 /// [positionSource, texcoordsSource]
763 /// 7 │ (0.0, 2.0, 0.0) ┆ │UVO UV4 UV3│ ┆ ┆ elements:
764 /// @
765 /// [element]
766 /// ┆ │ POS2 │ ┆ quad A quad B pentagon C ┆ sourceChannels:
767 /// @
768 /// [0, 1]];
769 /// UVs ┆ │ │ ┆ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ ┆
770 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ 4 4 5 0 0 1 1 2 2 3 3 5 2 4 3 3 0 2 1 7 1 6 2 5 3 2 4 1 0 ┆
771 /// 1 │ (0.0, 1.0) ┆ │ │ ┆ └───┘└──────────────────────────────────────────────────┘ ┆
772 /// 2 │ (1.0, 1.0) ┆ │UV1 UV2│ ┆ polygons interleaved channels ┆
773 /// 3 │ (1.0, 0.0) ┆ └───────────────────────┘ ┆ (positions and UVs) ┆
774 /// 4 │ (0.5, 0.0) ┆ POS7 POS6 ┆ ┆
775 ///
776 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using the same indices to reference position and UV data (1 channel)
777 ///
778 /// Positions ┆ POS0 POS3 POS4 ┆ quad A quad B pentagon C ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
779 /// 0 │ (0.0, 4.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌────────┐ ┌────────┐ ┌───────────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
780 /// 1 │ (0.0, 2.0, 0.0) ┆ │UV0 UV3│UV3 UV4│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 ┆ primitiveCount:3
781 /// 2 │ (2.0, 2.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────────────────┘ ┆ bytesPerIndex:…];
782 /// 3 │ (2.0, 4.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 ┆
783 /// 4 │ (4.0, 4.0, 0.0) ┆ │ │ │ ┆ (positions and UVs) ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
784 /// @
785 /// [positionSource, texcoordsSource]
786 /// 5 │ (4.0, 2.0, 0.0) ┆ │UV1 UV2│UV2 UV5│ ┆ ┆ elements:
787 /// @
788 /// [element]];
789 /// 6 │ (4.0, 0.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆
790 /// 7 │ (0.0, 0.0, 0.0) ┆ │UV1 UV2 UV5│ ┆ ┆ === or equivalently ===
791 /// ┆ │ POS2 │ ┆ ┆
792 /// UVs ┆ │ │ ┆ ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
793 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
794 /// 1 │ (0.0, 0.5) ┆ │ │ ┆ ┆ primitiveCount:3
795 /// 2 │ (0.5, 0.5) ┆ │UV7 UV6│ ┆ ┆ indicesChannelCount:1
796 /// 3 │ (0.5, 0.0) ┆ └───────────────────────┘ ┆ ┆ interleavedIndicesChannels:…
797 /// 4 │ (1.0, 0.0) ┆ POS7 POS6 ┆ ┆ bytesPerIndex:…];
798 /// 5 │ (1.0, 0.5) ┆ ┆ ┆
799 /// 6 │ (1.0, 1.0) ┆ ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
800 /// @
801 /// [positionSource, texcoordsSource]
802 /// 7 │ (0.0, 1.0) ┆ ┆ ┆ elements:
803 /// @
804 /// [element]
805 /// ┆ ┆ ┆ sourceChannels:
806 /// @
807 /// [0, 0]]; ┆
808 /// ```
809 #[unsafe(method(geometryWithSources:elements:sourceChannels:))]
810 #[unsafe(method_family = none)]
811 pub unsafe fn geometryWithSources_elements_sourceChannels(
812 sources: &NSArray<SCNGeometrySource>,
813 elements: Option<&NSArray<SCNGeometryElement>>,
814 source_channels: Option<&NSArray<NSNumber>>,
815 ) -> Retained<Self>;
816 );
817}
818
819/// Methods declared on superclass `NSObject`.
820#[cfg(feature = "SCNGeometry")]
821impl SCNPyramid {
822 extern_methods!(
823 #[unsafe(method(init))]
824 #[unsafe(method_family = init)]
825 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
826
827 #[unsafe(method(new))]
828 #[unsafe(method_family = new)]
829 pub unsafe fn new() -> Retained<Self>;
830 );
831}
832
833extern_class!(
834 /// SCNSphere represents a sphere with controllable radius
835 ///
836 /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnsphere?language=objc)
837 #[unsafe(super(SCNGeometry, NSObject))]
838 #[derive(Debug, PartialEq, Eq, Hash)]
839 #[cfg(feature = "SCNGeometry")]
840 pub struct SCNSphere;
841);
842
843#[cfg(feature = "SCNGeometry")]
844extern_conformance!(
845 unsafe impl NSCoding for SCNSphere {}
846);
847
848#[cfg(feature = "SCNGeometry")]
849extern_conformance!(
850 unsafe impl NSCopying for SCNSphere {}
851);
852
853#[cfg(feature = "SCNGeometry")]
854unsafe impl CopyingHelper for SCNSphere {
855 type Result = Self;
856}
857
858#[cfg(feature = "SCNGeometry")]
859extern_conformance!(
860 unsafe impl NSObjectProtocol for SCNSphere {}
861);
862
863#[cfg(feature = "SCNGeometry")]
864extern_conformance!(
865 unsafe impl NSSecureCoding for SCNSphere {}
866);
867
868#[cfg(all(feature = "SCNAnimation", feature = "SCNGeometry"))]
869extern_conformance!(
870 unsafe impl SCNAnimatable for SCNSphere {}
871);
872
873#[cfg(all(feature = "SCNBoundingVolume", feature = "SCNGeometry"))]
874extern_conformance!(
875 unsafe impl SCNBoundingVolume for SCNSphere {}
876);
877
878#[cfg(all(feature = "SCNGeometry", feature = "SCNShadable"))]
879extern_conformance!(
880 unsafe impl SCNShadable for SCNSphere {}
881);
882
883#[cfg(feature = "SCNGeometry")]
884impl SCNSphere {
885 extern_methods!(
886 #[cfg(feature = "objc2-core-foundation")]
887 /// Creates and returns a sphere with given radius.
888 ///
889 /// Parameter `radius`: The radius of the sphere.
890 #[unsafe(method(sphereWithRadius:))]
891 #[unsafe(method_family = none)]
892 pub unsafe fn sphereWithRadius(radius: CGFloat) -> Retained<Self>;
893
894 #[cfg(feature = "objc2-core-foundation")]
895 /// The sphere radius. Animatable.
896 ///
897 /// If the value is less than or equal to 0, the geometry is empty. The default value is 0.5.
898 #[unsafe(method(radius))]
899 #[unsafe(method_family = none)]
900 pub unsafe fn radius(&self) -> CGFloat;
901
902 #[cfg(feature = "objc2-core-foundation")]
903 /// Setter for [`radius`][Self::radius].
904 #[unsafe(method(setRadius:))]
905 #[unsafe(method_family = none)]
906 pub unsafe fn setRadius(&self, radius: CGFloat);
907
908 /// Indicate if the geometry is a geosphere.
909 ///
910 /// The default value is NO.
911 #[unsafe(method(isGeodesic))]
912 #[unsafe(method_family = none)]
913 pub unsafe fn isGeodesic(&self) -> bool;
914
915 /// Setter for [`isGeodesic`][Self::isGeodesic].
916 #[unsafe(method(setGeodesic:))]
917 #[unsafe(method_family = none)]
918 pub unsafe fn setGeodesic(&self, geodesic: bool);
919
920 /// The number of segments along both spherical coordinates. Animatable.
921 ///
922 /// If the value is less than 3, the behavior is undefined. The default value is 48.
923 #[unsafe(method(segmentCount))]
924 #[unsafe(method_family = none)]
925 pub unsafe fn segmentCount(&self) -> NSInteger;
926
927 /// Setter for [`segmentCount`][Self::segmentCount].
928 #[unsafe(method(setSegmentCount:))]
929 #[unsafe(method_family = none)]
930 pub unsafe fn setSegmentCount(&self, segment_count: NSInteger);
931 );
932}
933
934/// Methods declared on superclass `SCNGeometry`.
935#[cfg(feature = "SCNGeometry")]
936impl SCNSphere {
937 extern_methods!(
938 /// Creates and returns an empty geometry object.
939 ///
940 /// An empty geometry may be used as the lowest level of detail of a geometry.
941 #[unsafe(method(geometry))]
942 #[unsafe(method_family = none)]
943 pub unsafe fn geometry() -> Retained<Self>;
944
945 /// Creates and returns a new geometry built from geometry sources and geometry elements.
946 ///
947 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
948 ///
949 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
950 ///
951 /// A geometry is made of geometry sources (at least `SCNGeometrySourceSemanticVertex`) and at least one geometry element. Multiple sources for texture coordinates are accepted. In that case the `mappingChannel` is implicitly set based on the order of the texture sources, starting at index 0.
952 #[unsafe(method(geometryWithSources:elements:))]
953 #[unsafe(method_family = none)]
954 pub unsafe fn geometryWithSources_elements(
955 sources: &NSArray<SCNGeometrySource>,
956 elements: Option<&NSArray<SCNGeometryElement>>,
957 ) -> Retained<Self>;
958
959 /// Creates and returns a new geometry built from geometry sources and geometry elements, with per-source indexed geometry data.
960 ///
961 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
962 ///
963 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
964 ///
965 /// Parameter `sourceChannels`: An array of indices that describes, for each geometry source, which channel of the geometry elements to use.
966 ///
967 /// ```text
968 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using different indices to reference position and UV data (2 channels)
969 ///
970 /// Positions ┆ POS0 POS3 POS4 ┆ quad quad pentagon quad quad pentagon ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
971 /// 0 │ (0.0, 0.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌─────┐ ┌─────┐ ┌───────┐ ┌─────┐ ┌─────┐ ┌───────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
972 /// 1 │ (0.0, 1.0, 0.0) ┆ │UV0 UV3│UV0 UV3│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 0 1 2 3 2 3 0 1 1 2 3 4 0 ┆ primitiveCount:3
973 /// 2 │ (1.0, 0.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────┘ └───────────────────────┘ ┆ indicesChannelCount:2
974 /// 3 │ (1.0, 1.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 channel 1 ┆ interleavedIndicesChannels:…
975 /// 4 │ (2.0, 0.0, 0.0) ┆ │ │ │ ┆ (positions) (UVs) ┆ bytesPerIndex:…];
976 /// 5 │ (2.0, 1.0, 0.0) ┆ │UV1 UV2│UV1 UV2│ ┆ ┆
977 /// 6 │ (2.0, 2.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
978 /// @
979 /// [positionSource, texcoordsSource]
980 /// 7 │ (0.0, 2.0, 0.0) ┆ │UVO UV4 UV3│ ┆ ┆ elements:
981 /// @
982 /// [element]
983 /// ┆ │ POS2 │ ┆ quad A quad B pentagon C ┆ sourceChannels:
984 /// @
985 /// [0, 1]];
986 /// UVs ┆ │ │ ┆ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ ┆
987 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ 4 4 5 0 0 1 1 2 2 3 3 5 2 4 3 3 0 2 1 7 1 6 2 5 3 2 4 1 0 ┆
988 /// 1 │ (0.0, 1.0) ┆ │ │ ┆ └───┘└──────────────────────────────────────────────────┘ ┆
989 /// 2 │ (1.0, 1.0) ┆ │UV1 UV2│ ┆ polygons interleaved channels ┆
990 /// 3 │ (1.0, 0.0) ┆ └───────────────────────┘ ┆ (positions and UVs) ┆
991 /// 4 │ (0.5, 0.0) ┆ POS7 POS6 ┆ ┆
992 ///
993 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using the same indices to reference position and UV data (1 channel)
994 ///
995 /// Positions ┆ POS0 POS3 POS4 ┆ quad A quad B pentagon C ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
996 /// 0 │ (0.0, 4.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌────────┐ ┌────────┐ ┌───────────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
997 /// 1 │ (0.0, 2.0, 0.0) ┆ │UV0 UV3│UV3 UV4│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 ┆ primitiveCount:3
998 /// 2 │ (2.0, 2.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────────────────┘ ┆ bytesPerIndex:…];
999 /// 3 │ (2.0, 4.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 ┆
1000 /// 4 │ (4.0, 4.0, 0.0) ┆ │ │ │ ┆ (positions and UVs) ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
1001 /// @
1002 /// [positionSource, texcoordsSource]
1003 /// 5 │ (4.0, 2.0, 0.0) ┆ │UV1 UV2│UV2 UV5│ ┆ ┆ elements:
1004 /// @
1005 /// [element]];
1006 /// 6 │ (4.0, 0.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆
1007 /// 7 │ (0.0, 0.0, 0.0) ┆ │UV1 UV2 UV5│ ┆ ┆ === or equivalently ===
1008 /// ┆ │ POS2 │ ┆ ┆
1009 /// UVs ┆ │ │ ┆ ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
1010 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
1011 /// 1 │ (0.0, 0.5) ┆ │ │ ┆ ┆ primitiveCount:3
1012 /// 2 │ (0.5, 0.5) ┆ │UV7 UV6│ ┆ ┆ indicesChannelCount:1
1013 /// 3 │ (0.5, 0.0) ┆ └───────────────────────┘ ┆ ┆ interleavedIndicesChannels:…
1014 /// 4 │ (1.0, 0.0) ┆ POS7 POS6 ┆ ┆ bytesPerIndex:…];
1015 /// 5 │ (1.0, 0.5) ┆ ┆ ┆
1016 /// 6 │ (1.0, 1.0) ┆ ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
1017 /// @
1018 /// [positionSource, texcoordsSource]
1019 /// 7 │ (0.0, 1.0) ┆ ┆ ┆ elements:
1020 /// @
1021 /// [element]
1022 /// ┆ ┆ ┆ sourceChannels:
1023 /// @
1024 /// [0, 0]]; ┆
1025 /// ```
1026 #[unsafe(method(geometryWithSources:elements:sourceChannels:))]
1027 #[unsafe(method_family = none)]
1028 pub unsafe fn geometryWithSources_elements_sourceChannels(
1029 sources: &NSArray<SCNGeometrySource>,
1030 elements: Option<&NSArray<SCNGeometryElement>>,
1031 source_channels: Option<&NSArray<NSNumber>>,
1032 ) -> Retained<Self>;
1033 );
1034}
1035
1036/// Methods declared on superclass `NSObject`.
1037#[cfg(feature = "SCNGeometry")]
1038impl SCNSphere {
1039 extern_methods!(
1040 #[unsafe(method(init))]
1041 #[unsafe(method_family = init)]
1042 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1043
1044 #[unsafe(method(new))]
1045 #[unsafe(method_family = new)]
1046 pub unsafe fn new() -> Retained<Self>;
1047 );
1048}
1049
1050extern_class!(
1051 /// SCNCylinder represents a cylinder with controllable height and radius.
1052 ///
1053 /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scncylinder?language=objc)
1054 #[unsafe(super(SCNGeometry, NSObject))]
1055 #[derive(Debug, PartialEq, Eq, Hash)]
1056 #[cfg(feature = "SCNGeometry")]
1057 pub struct SCNCylinder;
1058);
1059
1060#[cfg(feature = "SCNGeometry")]
1061extern_conformance!(
1062 unsafe impl NSCoding for SCNCylinder {}
1063);
1064
1065#[cfg(feature = "SCNGeometry")]
1066extern_conformance!(
1067 unsafe impl NSCopying for SCNCylinder {}
1068);
1069
1070#[cfg(feature = "SCNGeometry")]
1071unsafe impl CopyingHelper for SCNCylinder {
1072 type Result = Self;
1073}
1074
1075#[cfg(feature = "SCNGeometry")]
1076extern_conformance!(
1077 unsafe impl NSObjectProtocol for SCNCylinder {}
1078);
1079
1080#[cfg(feature = "SCNGeometry")]
1081extern_conformance!(
1082 unsafe impl NSSecureCoding for SCNCylinder {}
1083);
1084
1085#[cfg(all(feature = "SCNAnimation", feature = "SCNGeometry"))]
1086extern_conformance!(
1087 unsafe impl SCNAnimatable for SCNCylinder {}
1088);
1089
1090#[cfg(all(feature = "SCNBoundingVolume", feature = "SCNGeometry"))]
1091extern_conformance!(
1092 unsafe impl SCNBoundingVolume for SCNCylinder {}
1093);
1094
1095#[cfg(all(feature = "SCNGeometry", feature = "SCNShadable"))]
1096extern_conformance!(
1097 unsafe impl SCNShadable for SCNCylinder {}
1098);
1099
1100#[cfg(feature = "SCNGeometry")]
1101impl SCNCylinder {
1102 extern_methods!(
1103 #[cfg(feature = "objc2-core-foundation")]
1104 /// Creates and returns a cylinder with given radius and height.
1105 ///
1106 /// Parameter `radius`: The radius of the cylinder.
1107 ///
1108 /// Parameter `height`: The height of the cylinder.
1109 #[unsafe(method(cylinderWithRadius:height:))]
1110 #[unsafe(method_family = none)]
1111 pub unsafe fn cylinderWithRadius_height(radius: CGFloat, height: CGFloat)
1112 -> Retained<Self>;
1113
1114 #[cfg(feature = "objc2-core-foundation")]
1115 /// The radius of the cylinder. Animatable.
1116 ///
1117 /// If the value is less than or equal to 0, the geometry is empty. The default value is 0.5.
1118 #[unsafe(method(radius))]
1119 #[unsafe(method_family = none)]
1120 pub unsafe fn radius(&self) -> CGFloat;
1121
1122 #[cfg(feature = "objc2-core-foundation")]
1123 /// Setter for [`radius`][Self::radius].
1124 #[unsafe(method(setRadius:))]
1125 #[unsafe(method_family = none)]
1126 pub unsafe fn setRadius(&self, radius: CGFloat);
1127
1128 #[cfg(feature = "objc2-core-foundation")]
1129 /// The height of the cylinder. Animatable.
1130 ///
1131 /// If the value is less than or equal to 0, the geometry is empty. The default value is 1.
1132 #[unsafe(method(height))]
1133 #[unsafe(method_family = none)]
1134 pub unsafe fn height(&self) -> CGFloat;
1135
1136 #[cfg(feature = "objc2-core-foundation")]
1137 /// Setter for [`height`][Self::height].
1138 #[unsafe(method(setHeight:))]
1139 #[unsafe(method_family = none)]
1140 pub unsafe fn setHeight(&self, height: CGFloat);
1141
1142 /// The number of subdivisions along the radial coordinate. Animatable.
1143 ///
1144 /// If the value is less than 3, the behavior is undefined. The default value is 48.
1145 #[unsafe(method(radialSegmentCount))]
1146 #[unsafe(method_family = none)]
1147 pub unsafe fn radialSegmentCount(&self) -> NSInteger;
1148
1149 /// Setter for [`radialSegmentCount`][Self::radialSegmentCount].
1150 #[unsafe(method(setRadialSegmentCount:))]
1151 #[unsafe(method_family = none)]
1152 pub unsafe fn setRadialSegmentCount(&self, radial_segment_count: NSInteger);
1153
1154 /// The number of subdivisions along the Y axis. Animatable.
1155 ///
1156 /// If the value is less than 1, the behavior is undefined. The default value is 1.
1157 #[unsafe(method(heightSegmentCount))]
1158 #[unsafe(method_family = none)]
1159 pub unsafe fn heightSegmentCount(&self) -> NSInteger;
1160
1161 /// Setter for [`heightSegmentCount`][Self::heightSegmentCount].
1162 #[unsafe(method(setHeightSegmentCount:))]
1163 #[unsafe(method_family = none)]
1164 pub unsafe fn setHeightSegmentCount(&self, height_segment_count: NSInteger);
1165 );
1166}
1167
1168/// Methods declared on superclass `SCNGeometry`.
1169#[cfg(feature = "SCNGeometry")]
1170impl SCNCylinder {
1171 extern_methods!(
1172 /// Creates and returns an empty geometry object.
1173 ///
1174 /// An empty geometry may be used as the lowest level of detail of a geometry.
1175 #[unsafe(method(geometry))]
1176 #[unsafe(method_family = none)]
1177 pub unsafe fn geometry() -> Retained<Self>;
1178
1179 /// Creates and returns a new geometry built from geometry sources and geometry elements.
1180 ///
1181 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
1182 ///
1183 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
1184 ///
1185 /// A geometry is made of geometry sources (at least `SCNGeometrySourceSemanticVertex`) and at least one geometry element. Multiple sources for texture coordinates are accepted. In that case the `mappingChannel` is implicitly set based on the order of the texture sources, starting at index 0.
1186 #[unsafe(method(geometryWithSources:elements:))]
1187 #[unsafe(method_family = none)]
1188 pub unsafe fn geometryWithSources_elements(
1189 sources: &NSArray<SCNGeometrySource>,
1190 elements: Option<&NSArray<SCNGeometryElement>>,
1191 ) -> Retained<Self>;
1192
1193 /// Creates and returns a new geometry built from geometry sources and geometry elements, with per-source indexed geometry data.
1194 ///
1195 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
1196 ///
1197 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
1198 ///
1199 /// Parameter `sourceChannels`: An array of indices that describes, for each geometry source, which channel of the geometry elements to use.
1200 ///
1201 /// ```text
1202 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using different indices to reference position and UV data (2 channels)
1203 ///
1204 /// Positions ┆ POS0 POS3 POS4 ┆ quad quad pentagon quad quad pentagon ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
1205 /// 0 │ (0.0, 0.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌─────┐ ┌─────┐ ┌───────┐ ┌─────┐ ┌─────┐ ┌───────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
1206 /// 1 │ (0.0, 1.0, 0.0) ┆ │UV0 UV3│UV0 UV3│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 0 1 2 3 2 3 0 1 1 2 3 4 0 ┆ primitiveCount:3
1207 /// 2 │ (1.0, 0.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────┘ └───────────────────────┘ ┆ indicesChannelCount:2
1208 /// 3 │ (1.0, 1.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 channel 1 ┆ interleavedIndicesChannels:…
1209 /// 4 │ (2.0, 0.0, 0.0) ┆ │ │ │ ┆ (positions) (UVs) ┆ bytesPerIndex:…];
1210 /// 5 │ (2.0, 1.0, 0.0) ┆ │UV1 UV2│UV1 UV2│ ┆ ┆
1211 /// 6 │ (2.0, 2.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
1212 /// @
1213 /// [positionSource, texcoordsSource]
1214 /// 7 │ (0.0, 2.0, 0.0) ┆ │UVO UV4 UV3│ ┆ ┆ elements:
1215 /// @
1216 /// [element]
1217 /// ┆ │ POS2 │ ┆ quad A quad B pentagon C ┆ sourceChannels:
1218 /// @
1219 /// [0, 1]];
1220 /// UVs ┆ │ │ ┆ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ ┆
1221 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ 4 4 5 0 0 1 1 2 2 3 3 5 2 4 3 3 0 2 1 7 1 6 2 5 3 2 4 1 0 ┆
1222 /// 1 │ (0.0, 1.0) ┆ │ │ ┆ └───┘└──────────────────────────────────────────────────┘ ┆
1223 /// 2 │ (1.0, 1.0) ┆ │UV1 UV2│ ┆ polygons interleaved channels ┆
1224 /// 3 │ (1.0, 0.0) ┆ └───────────────────────┘ ┆ (positions and UVs) ┆
1225 /// 4 │ (0.5, 0.0) ┆ POS7 POS6 ┆ ┆
1226 ///
1227 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using the same indices to reference position and UV data (1 channel)
1228 ///
1229 /// Positions ┆ POS0 POS3 POS4 ┆ quad A quad B pentagon C ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
1230 /// 0 │ (0.0, 4.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌────────┐ ┌────────┐ ┌───────────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
1231 /// 1 │ (0.0, 2.0, 0.0) ┆ │UV0 UV3│UV3 UV4│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 ┆ primitiveCount:3
1232 /// 2 │ (2.0, 2.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────────────────┘ ┆ bytesPerIndex:…];
1233 /// 3 │ (2.0, 4.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 ┆
1234 /// 4 │ (4.0, 4.0, 0.0) ┆ │ │ │ ┆ (positions and UVs) ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
1235 /// @
1236 /// [positionSource, texcoordsSource]
1237 /// 5 │ (4.0, 2.0, 0.0) ┆ │UV1 UV2│UV2 UV5│ ┆ ┆ elements:
1238 /// @
1239 /// [element]];
1240 /// 6 │ (4.0, 0.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆
1241 /// 7 │ (0.0, 0.0, 0.0) ┆ │UV1 UV2 UV5│ ┆ ┆ === or equivalently ===
1242 /// ┆ │ POS2 │ ┆ ┆
1243 /// UVs ┆ │ │ ┆ ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
1244 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
1245 /// 1 │ (0.0, 0.5) ┆ │ │ ┆ ┆ primitiveCount:3
1246 /// 2 │ (0.5, 0.5) ┆ │UV7 UV6│ ┆ ┆ indicesChannelCount:1
1247 /// 3 │ (0.5, 0.0) ┆ └───────────────────────┘ ┆ ┆ interleavedIndicesChannels:…
1248 /// 4 │ (1.0, 0.0) ┆ POS7 POS6 ┆ ┆ bytesPerIndex:…];
1249 /// 5 │ (1.0, 0.5) ┆ ┆ ┆
1250 /// 6 │ (1.0, 1.0) ┆ ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
1251 /// @
1252 /// [positionSource, texcoordsSource]
1253 /// 7 │ (0.0, 1.0) ┆ ┆ ┆ elements:
1254 /// @
1255 /// [element]
1256 /// ┆ ┆ ┆ sourceChannels:
1257 /// @
1258 /// [0, 0]]; ┆
1259 /// ```
1260 #[unsafe(method(geometryWithSources:elements:sourceChannels:))]
1261 #[unsafe(method_family = none)]
1262 pub unsafe fn geometryWithSources_elements_sourceChannels(
1263 sources: &NSArray<SCNGeometrySource>,
1264 elements: Option<&NSArray<SCNGeometryElement>>,
1265 source_channels: Option<&NSArray<NSNumber>>,
1266 ) -> Retained<Self>;
1267 );
1268}
1269
1270/// Methods declared on superclass `NSObject`.
1271#[cfg(feature = "SCNGeometry")]
1272impl SCNCylinder {
1273 extern_methods!(
1274 #[unsafe(method(init))]
1275 #[unsafe(method_family = init)]
1276 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1277
1278 #[unsafe(method(new))]
1279 #[unsafe(method_family = new)]
1280 pub unsafe fn new() -> Retained<Self>;
1281 );
1282}
1283
1284extern_class!(
1285 /// SCNCone represents a cone with controllable height, top radius and bottom radius.
1286 ///
1287 /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scncone?language=objc)
1288 #[unsafe(super(SCNGeometry, NSObject))]
1289 #[derive(Debug, PartialEq, Eq, Hash)]
1290 #[cfg(feature = "SCNGeometry")]
1291 pub struct SCNCone;
1292);
1293
1294#[cfg(feature = "SCNGeometry")]
1295extern_conformance!(
1296 unsafe impl NSCoding for SCNCone {}
1297);
1298
1299#[cfg(feature = "SCNGeometry")]
1300extern_conformance!(
1301 unsafe impl NSCopying for SCNCone {}
1302);
1303
1304#[cfg(feature = "SCNGeometry")]
1305unsafe impl CopyingHelper for SCNCone {
1306 type Result = Self;
1307}
1308
1309#[cfg(feature = "SCNGeometry")]
1310extern_conformance!(
1311 unsafe impl NSObjectProtocol for SCNCone {}
1312);
1313
1314#[cfg(feature = "SCNGeometry")]
1315extern_conformance!(
1316 unsafe impl NSSecureCoding for SCNCone {}
1317);
1318
1319#[cfg(all(feature = "SCNAnimation", feature = "SCNGeometry"))]
1320extern_conformance!(
1321 unsafe impl SCNAnimatable for SCNCone {}
1322);
1323
1324#[cfg(all(feature = "SCNBoundingVolume", feature = "SCNGeometry"))]
1325extern_conformance!(
1326 unsafe impl SCNBoundingVolume for SCNCone {}
1327);
1328
1329#[cfg(all(feature = "SCNGeometry", feature = "SCNShadable"))]
1330extern_conformance!(
1331 unsafe impl SCNShadable for SCNCone {}
1332);
1333
1334#[cfg(feature = "SCNGeometry")]
1335impl SCNCone {
1336 extern_methods!(
1337 #[cfg(feature = "objc2-core-foundation")]
1338 /// Creates and returns a cone with given top radius, bottom radius and height.
1339 ///
1340 /// Parameter `topRadius`: The radius at the top of the cone.
1341 ///
1342 /// Parameter `bottomRadius`: The radius at the bottom of the cone.
1343 ///
1344 /// Parameter `height`: The height of the cone.
1345 #[unsafe(method(coneWithTopRadius:bottomRadius:height:))]
1346 #[unsafe(method_family = none)]
1347 pub unsafe fn coneWithTopRadius_bottomRadius_height(
1348 top_radius: CGFloat,
1349 bottom_radius: CGFloat,
1350 height: CGFloat,
1351 ) -> Retained<Self>;
1352
1353 #[cfg(feature = "objc2-core-foundation")]
1354 /// The radius at the top of the cone. Animatable.
1355 ///
1356 /// If the value is less than 0, the geometry is empty. The default value is 0.
1357 #[unsafe(method(topRadius))]
1358 #[unsafe(method_family = none)]
1359 pub unsafe fn topRadius(&self) -> CGFloat;
1360
1361 #[cfg(feature = "objc2-core-foundation")]
1362 /// Setter for [`topRadius`][Self::topRadius].
1363 #[unsafe(method(setTopRadius:))]
1364 #[unsafe(method_family = none)]
1365 pub unsafe fn setTopRadius(&self, top_radius: CGFloat);
1366
1367 #[cfg(feature = "objc2-core-foundation")]
1368 /// The radius at the bottom of the cone. Animatable.
1369 ///
1370 /// If the value is less than 0, the geometry is empty. The default value is 0.5.
1371 #[unsafe(method(bottomRadius))]
1372 #[unsafe(method_family = none)]
1373 pub unsafe fn bottomRadius(&self) -> CGFloat;
1374
1375 #[cfg(feature = "objc2-core-foundation")]
1376 /// Setter for [`bottomRadius`][Self::bottomRadius].
1377 #[unsafe(method(setBottomRadius:))]
1378 #[unsafe(method_family = none)]
1379 pub unsafe fn setBottomRadius(&self, bottom_radius: CGFloat);
1380
1381 #[cfg(feature = "objc2-core-foundation")]
1382 /// The height of the cone. Animatable.
1383 ///
1384 /// If the value is less than or equal to 0, the geometry is empty. The default value is 1.
1385 #[unsafe(method(height))]
1386 #[unsafe(method_family = none)]
1387 pub unsafe fn height(&self) -> CGFloat;
1388
1389 #[cfg(feature = "objc2-core-foundation")]
1390 /// Setter for [`height`][Self::height].
1391 #[unsafe(method(setHeight:))]
1392 #[unsafe(method_family = none)]
1393 pub unsafe fn setHeight(&self, height: CGFloat);
1394
1395 /// The number of subdivisions along the radial coordinate. Animatable.
1396 ///
1397 /// If the value is less than 3, the behavior is undefined. The default value is 48.
1398 #[unsafe(method(radialSegmentCount))]
1399 #[unsafe(method_family = none)]
1400 pub unsafe fn radialSegmentCount(&self) -> NSInteger;
1401
1402 /// Setter for [`radialSegmentCount`][Self::radialSegmentCount].
1403 #[unsafe(method(setRadialSegmentCount:))]
1404 #[unsafe(method_family = none)]
1405 pub unsafe fn setRadialSegmentCount(&self, radial_segment_count: NSInteger);
1406
1407 /// The number of subdivisions along the Y axis. Animatable.
1408 ///
1409 /// If the value is less than 1, the behavior is undefined. The default value is 1.
1410 #[unsafe(method(heightSegmentCount))]
1411 #[unsafe(method_family = none)]
1412 pub unsafe fn heightSegmentCount(&self) -> NSInteger;
1413
1414 /// Setter for [`heightSegmentCount`][Self::heightSegmentCount].
1415 #[unsafe(method(setHeightSegmentCount:))]
1416 #[unsafe(method_family = none)]
1417 pub unsafe fn setHeightSegmentCount(&self, height_segment_count: NSInteger);
1418 );
1419}
1420
1421/// Methods declared on superclass `SCNGeometry`.
1422#[cfg(feature = "SCNGeometry")]
1423impl SCNCone {
1424 extern_methods!(
1425 /// Creates and returns an empty geometry object.
1426 ///
1427 /// An empty geometry may be used as the lowest level of detail of a geometry.
1428 #[unsafe(method(geometry))]
1429 #[unsafe(method_family = none)]
1430 pub unsafe fn geometry() -> Retained<Self>;
1431
1432 /// Creates and returns a new geometry built from geometry sources and geometry elements.
1433 ///
1434 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
1435 ///
1436 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
1437 ///
1438 /// A geometry is made of geometry sources (at least `SCNGeometrySourceSemanticVertex`) and at least one geometry element. Multiple sources for texture coordinates are accepted. In that case the `mappingChannel` is implicitly set based on the order of the texture sources, starting at index 0.
1439 #[unsafe(method(geometryWithSources:elements:))]
1440 #[unsafe(method_family = none)]
1441 pub unsafe fn geometryWithSources_elements(
1442 sources: &NSArray<SCNGeometrySource>,
1443 elements: Option<&NSArray<SCNGeometryElement>>,
1444 ) -> Retained<Self>;
1445
1446 /// Creates and returns a new geometry built from geometry sources and geometry elements, with per-source indexed geometry data.
1447 ///
1448 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
1449 ///
1450 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
1451 ///
1452 /// Parameter `sourceChannels`: An array of indices that describes, for each geometry source, which channel of the geometry elements to use.
1453 ///
1454 /// ```text
1455 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using different indices to reference position and UV data (2 channels)
1456 ///
1457 /// Positions ┆ POS0 POS3 POS4 ┆ quad quad pentagon quad quad pentagon ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
1458 /// 0 │ (0.0, 0.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌─────┐ ┌─────┐ ┌───────┐ ┌─────┐ ┌─────┐ ┌───────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
1459 /// 1 │ (0.0, 1.0, 0.0) ┆ │UV0 UV3│UV0 UV3│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 0 1 2 3 2 3 0 1 1 2 3 4 0 ┆ primitiveCount:3
1460 /// 2 │ (1.0, 0.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────┘ └───────────────────────┘ ┆ indicesChannelCount:2
1461 /// 3 │ (1.0, 1.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 channel 1 ┆ interleavedIndicesChannels:…
1462 /// 4 │ (2.0, 0.0, 0.0) ┆ │ │ │ ┆ (positions) (UVs) ┆ bytesPerIndex:…];
1463 /// 5 │ (2.0, 1.0, 0.0) ┆ │UV1 UV2│UV1 UV2│ ┆ ┆
1464 /// 6 │ (2.0, 2.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
1465 /// @
1466 /// [positionSource, texcoordsSource]
1467 /// 7 │ (0.0, 2.0, 0.0) ┆ │UVO UV4 UV3│ ┆ ┆ elements:
1468 /// @
1469 /// [element]
1470 /// ┆ │ POS2 │ ┆ quad A quad B pentagon C ┆ sourceChannels:
1471 /// @
1472 /// [0, 1]];
1473 /// UVs ┆ │ │ ┆ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ ┆
1474 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ 4 4 5 0 0 1 1 2 2 3 3 5 2 4 3 3 0 2 1 7 1 6 2 5 3 2 4 1 0 ┆
1475 /// 1 │ (0.0, 1.0) ┆ │ │ ┆ └───┘└──────────────────────────────────────────────────┘ ┆
1476 /// 2 │ (1.0, 1.0) ┆ │UV1 UV2│ ┆ polygons interleaved channels ┆
1477 /// 3 │ (1.0, 0.0) ┆ └───────────────────────┘ ┆ (positions and UVs) ┆
1478 /// 4 │ (0.5, 0.0) ┆ POS7 POS6 ┆ ┆
1479 ///
1480 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using the same indices to reference position and UV data (1 channel)
1481 ///
1482 /// Positions ┆ POS0 POS3 POS4 ┆ quad A quad B pentagon C ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
1483 /// 0 │ (0.0, 4.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌────────┐ ┌────────┐ ┌───────────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
1484 /// 1 │ (0.0, 2.0, 0.0) ┆ │UV0 UV3│UV3 UV4│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 ┆ primitiveCount:3
1485 /// 2 │ (2.0, 2.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────────────────┘ ┆ bytesPerIndex:…];
1486 /// 3 │ (2.0, 4.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 ┆
1487 /// 4 │ (4.0, 4.0, 0.0) ┆ │ │ │ ┆ (positions and UVs) ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
1488 /// @
1489 /// [positionSource, texcoordsSource]
1490 /// 5 │ (4.0, 2.0, 0.0) ┆ │UV1 UV2│UV2 UV5│ ┆ ┆ elements:
1491 /// @
1492 /// [element]];
1493 /// 6 │ (4.0, 0.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆
1494 /// 7 │ (0.0, 0.0, 0.0) ┆ │UV1 UV2 UV5│ ┆ ┆ === or equivalently ===
1495 /// ┆ │ POS2 │ ┆ ┆
1496 /// UVs ┆ │ │ ┆ ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
1497 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
1498 /// 1 │ (0.0, 0.5) ┆ │ │ ┆ ┆ primitiveCount:3
1499 /// 2 │ (0.5, 0.5) ┆ │UV7 UV6│ ┆ ┆ indicesChannelCount:1
1500 /// 3 │ (0.5, 0.0) ┆ └───────────────────────┘ ┆ ┆ interleavedIndicesChannels:…
1501 /// 4 │ (1.0, 0.0) ┆ POS7 POS6 ┆ ┆ bytesPerIndex:…];
1502 /// 5 │ (1.0, 0.5) ┆ ┆ ┆
1503 /// 6 │ (1.0, 1.0) ┆ ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
1504 /// @
1505 /// [positionSource, texcoordsSource]
1506 /// 7 │ (0.0, 1.0) ┆ ┆ ┆ elements:
1507 /// @
1508 /// [element]
1509 /// ┆ ┆ ┆ sourceChannels:
1510 /// @
1511 /// [0, 0]]; ┆
1512 /// ```
1513 #[unsafe(method(geometryWithSources:elements:sourceChannels:))]
1514 #[unsafe(method_family = none)]
1515 pub unsafe fn geometryWithSources_elements_sourceChannels(
1516 sources: &NSArray<SCNGeometrySource>,
1517 elements: Option<&NSArray<SCNGeometryElement>>,
1518 source_channels: Option<&NSArray<NSNumber>>,
1519 ) -> Retained<Self>;
1520 );
1521}
1522
1523/// Methods declared on superclass `NSObject`.
1524#[cfg(feature = "SCNGeometry")]
1525impl SCNCone {
1526 extern_methods!(
1527 #[unsafe(method(init))]
1528 #[unsafe(method_family = init)]
1529 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1530
1531 #[unsafe(method(new))]
1532 #[unsafe(method_family = new)]
1533 pub unsafe fn new() -> Retained<Self>;
1534 );
1535}
1536
1537extern_class!(
1538 /// SCNTube represents a tube with controllable height, inner radius and outer radius.
1539 ///
1540 /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scntube?language=objc)
1541 #[unsafe(super(SCNGeometry, NSObject))]
1542 #[derive(Debug, PartialEq, Eq, Hash)]
1543 #[cfg(feature = "SCNGeometry")]
1544 pub struct SCNTube;
1545);
1546
1547#[cfg(feature = "SCNGeometry")]
1548extern_conformance!(
1549 unsafe impl NSCoding for SCNTube {}
1550);
1551
1552#[cfg(feature = "SCNGeometry")]
1553extern_conformance!(
1554 unsafe impl NSCopying for SCNTube {}
1555);
1556
1557#[cfg(feature = "SCNGeometry")]
1558unsafe impl CopyingHelper for SCNTube {
1559 type Result = Self;
1560}
1561
1562#[cfg(feature = "SCNGeometry")]
1563extern_conformance!(
1564 unsafe impl NSObjectProtocol for SCNTube {}
1565);
1566
1567#[cfg(feature = "SCNGeometry")]
1568extern_conformance!(
1569 unsafe impl NSSecureCoding for SCNTube {}
1570);
1571
1572#[cfg(all(feature = "SCNAnimation", feature = "SCNGeometry"))]
1573extern_conformance!(
1574 unsafe impl SCNAnimatable for SCNTube {}
1575);
1576
1577#[cfg(all(feature = "SCNBoundingVolume", feature = "SCNGeometry"))]
1578extern_conformance!(
1579 unsafe impl SCNBoundingVolume for SCNTube {}
1580);
1581
1582#[cfg(all(feature = "SCNGeometry", feature = "SCNShadable"))]
1583extern_conformance!(
1584 unsafe impl SCNShadable for SCNTube {}
1585);
1586
1587#[cfg(feature = "SCNGeometry")]
1588impl SCNTube {
1589 extern_methods!(
1590 #[cfg(feature = "objc2-core-foundation")]
1591 /// Creates and returns a tube with given inner radius, outer radius and height.
1592 ///
1593 /// Parameter `innerRadius`: The inner radius of the tube.
1594 ///
1595 /// Parameter `outerRadius`: The outer radius of the tube.
1596 ///
1597 /// Parameter `height`: The height of the tube.
1598 #[unsafe(method(tubeWithInnerRadius:outerRadius:height:))]
1599 #[unsafe(method_family = none)]
1600 pub unsafe fn tubeWithInnerRadius_outerRadius_height(
1601 inner_radius: CGFloat,
1602 outer_radius: CGFloat,
1603 height: CGFloat,
1604 ) -> Retained<Self>;
1605
1606 #[cfg(feature = "objc2-core-foundation")]
1607 /// The inner radius of the tube. Animatable.
1608 ///
1609 /// If the value is less than or equal to 0, or if it is greater than or equal to the outer radius, then the geometry is empty. The default value is 0.25.
1610 #[unsafe(method(innerRadius))]
1611 #[unsafe(method_family = none)]
1612 pub unsafe fn innerRadius(&self) -> CGFloat;
1613
1614 #[cfg(feature = "objc2-core-foundation")]
1615 /// Setter for [`innerRadius`][Self::innerRadius].
1616 #[unsafe(method(setInnerRadius:))]
1617 #[unsafe(method_family = none)]
1618 pub unsafe fn setInnerRadius(&self, inner_radius: CGFloat);
1619
1620 #[cfg(feature = "objc2-core-foundation")]
1621 /// The outer radius of the tube. Animatable.
1622 ///
1623 /// If the value is less than or equal to 0, or if it is less than or equal to the inner radius, then the geometry is empty. The default value is 0.5.
1624 #[unsafe(method(outerRadius))]
1625 #[unsafe(method_family = none)]
1626 pub unsafe fn outerRadius(&self) -> CGFloat;
1627
1628 #[cfg(feature = "objc2-core-foundation")]
1629 /// Setter for [`outerRadius`][Self::outerRadius].
1630 #[unsafe(method(setOuterRadius:))]
1631 #[unsafe(method_family = none)]
1632 pub unsafe fn setOuterRadius(&self, outer_radius: CGFloat);
1633
1634 #[cfg(feature = "objc2-core-foundation")]
1635 /// The height of the tube. Animatable.
1636 ///
1637 /// If the value is less than or equal to 0, the geometry is empty. The default value is 1.
1638 #[unsafe(method(height))]
1639 #[unsafe(method_family = none)]
1640 pub unsafe fn height(&self) -> CGFloat;
1641
1642 #[cfg(feature = "objc2-core-foundation")]
1643 /// Setter for [`height`][Self::height].
1644 #[unsafe(method(setHeight:))]
1645 #[unsafe(method_family = none)]
1646 pub unsafe fn setHeight(&self, height: CGFloat);
1647
1648 /// The number of subdivisions along the radial coordinate. Animatable.
1649 ///
1650 /// If the value is less than 3, the behavior is undefined. The default value is 48.
1651 #[unsafe(method(radialSegmentCount))]
1652 #[unsafe(method_family = none)]
1653 pub unsafe fn radialSegmentCount(&self) -> NSInteger;
1654
1655 /// Setter for [`radialSegmentCount`][Self::radialSegmentCount].
1656 #[unsafe(method(setRadialSegmentCount:))]
1657 #[unsafe(method_family = none)]
1658 pub unsafe fn setRadialSegmentCount(&self, radial_segment_count: NSInteger);
1659
1660 /// The number of subdivisions along the Y axis. Animatable.
1661 ///
1662 /// If the value is less than 1, the behavior is undefined. The default value is 1.
1663 #[unsafe(method(heightSegmentCount))]
1664 #[unsafe(method_family = none)]
1665 pub unsafe fn heightSegmentCount(&self) -> NSInteger;
1666
1667 /// Setter for [`heightSegmentCount`][Self::heightSegmentCount].
1668 #[unsafe(method(setHeightSegmentCount:))]
1669 #[unsafe(method_family = none)]
1670 pub unsafe fn setHeightSegmentCount(&self, height_segment_count: NSInteger);
1671 );
1672}
1673
1674/// Methods declared on superclass `SCNGeometry`.
1675#[cfg(feature = "SCNGeometry")]
1676impl SCNTube {
1677 extern_methods!(
1678 /// Creates and returns an empty geometry object.
1679 ///
1680 /// An empty geometry may be used as the lowest level of detail of a geometry.
1681 #[unsafe(method(geometry))]
1682 #[unsafe(method_family = none)]
1683 pub unsafe fn geometry() -> Retained<Self>;
1684
1685 /// Creates and returns a new geometry built from geometry sources and geometry elements.
1686 ///
1687 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
1688 ///
1689 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
1690 ///
1691 /// A geometry is made of geometry sources (at least `SCNGeometrySourceSemanticVertex`) and at least one geometry element. Multiple sources for texture coordinates are accepted. In that case the `mappingChannel` is implicitly set based on the order of the texture sources, starting at index 0.
1692 #[unsafe(method(geometryWithSources:elements:))]
1693 #[unsafe(method_family = none)]
1694 pub unsafe fn geometryWithSources_elements(
1695 sources: &NSArray<SCNGeometrySource>,
1696 elements: Option<&NSArray<SCNGeometryElement>>,
1697 ) -> Retained<Self>;
1698
1699 /// Creates and returns a new geometry built from geometry sources and geometry elements, with per-source indexed geometry data.
1700 ///
1701 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
1702 ///
1703 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
1704 ///
1705 /// Parameter `sourceChannels`: An array of indices that describes, for each geometry source, which channel of the geometry elements to use.
1706 ///
1707 /// ```text
1708 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using different indices to reference position and UV data (2 channels)
1709 ///
1710 /// Positions ┆ POS0 POS3 POS4 ┆ quad quad pentagon quad quad pentagon ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
1711 /// 0 │ (0.0, 0.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌─────┐ ┌─────┐ ┌───────┐ ┌─────┐ ┌─────┐ ┌───────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
1712 /// 1 │ (0.0, 1.0, 0.0) ┆ │UV0 UV3│UV0 UV3│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 0 1 2 3 2 3 0 1 1 2 3 4 0 ┆ primitiveCount:3
1713 /// 2 │ (1.0, 0.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────┘ └───────────────────────┘ ┆ indicesChannelCount:2
1714 /// 3 │ (1.0, 1.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 channel 1 ┆ interleavedIndicesChannels:…
1715 /// 4 │ (2.0, 0.0, 0.0) ┆ │ │ │ ┆ (positions) (UVs) ┆ bytesPerIndex:…];
1716 /// 5 │ (2.0, 1.0, 0.0) ┆ │UV1 UV2│UV1 UV2│ ┆ ┆
1717 /// 6 │ (2.0, 2.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
1718 /// @
1719 /// [positionSource, texcoordsSource]
1720 /// 7 │ (0.0, 2.0, 0.0) ┆ │UVO UV4 UV3│ ┆ ┆ elements:
1721 /// @
1722 /// [element]
1723 /// ┆ │ POS2 │ ┆ quad A quad B pentagon C ┆ sourceChannels:
1724 /// @
1725 /// [0, 1]];
1726 /// UVs ┆ │ │ ┆ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ ┆
1727 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ 4 4 5 0 0 1 1 2 2 3 3 5 2 4 3 3 0 2 1 7 1 6 2 5 3 2 4 1 0 ┆
1728 /// 1 │ (0.0, 1.0) ┆ │ │ ┆ └───┘└──────────────────────────────────────────────────┘ ┆
1729 /// 2 │ (1.0, 1.0) ┆ │UV1 UV2│ ┆ polygons interleaved channels ┆
1730 /// 3 │ (1.0, 0.0) ┆ └───────────────────────┘ ┆ (positions and UVs) ┆
1731 /// 4 │ (0.5, 0.0) ┆ POS7 POS6 ┆ ┆
1732 ///
1733 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using the same indices to reference position and UV data (1 channel)
1734 ///
1735 /// Positions ┆ POS0 POS3 POS4 ┆ quad A quad B pentagon C ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
1736 /// 0 │ (0.0, 4.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌────────┐ ┌────────┐ ┌───────────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
1737 /// 1 │ (0.0, 2.0, 0.0) ┆ │UV0 UV3│UV3 UV4│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 ┆ primitiveCount:3
1738 /// 2 │ (2.0, 2.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────────────────┘ ┆ bytesPerIndex:…];
1739 /// 3 │ (2.0, 4.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 ┆
1740 /// 4 │ (4.0, 4.0, 0.0) ┆ │ │ │ ┆ (positions and UVs) ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
1741 /// @
1742 /// [positionSource, texcoordsSource]
1743 /// 5 │ (4.0, 2.0, 0.0) ┆ │UV1 UV2│UV2 UV5│ ┆ ┆ elements:
1744 /// @
1745 /// [element]];
1746 /// 6 │ (4.0, 0.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆
1747 /// 7 │ (0.0, 0.0, 0.0) ┆ │UV1 UV2 UV5│ ┆ ┆ === or equivalently ===
1748 /// ┆ │ POS2 │ ┆ ┆
1749 /// UVs ┆ │ │ ┆ ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
1750 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
1751 /// 1 │ (0.0, 0.5) ┆ │ │ ┆ ┆ primitiveCount:3
1752 /// 2 │ (0.5, 0.5) ┆ │UV7 UV6│ ┆ ┆ indicesChannelCount:1
1753 /// 3 │ (0.5, 0.0) ┆ └───────────────────────┘ ┆ ┆ interleavedIndicesChannels:…
1754 /// 4 │ (1.0, 0.0) ┆ POS7 POS6 ┆ ┆ bytesPerIndex:…];
1755 /// 5 │ (1.0, 0.5) ┆ ┆ ┆
1756 /// 6 │ (1.0, 1.0) ┆ ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
1757 /// @
1758 /// [positionSource, texcoordsSource]
1759 /// 7 │ (0.0, 1.0) ┆ ┆ ┆ elements:
1760 /// @
1761 /// [element]
1762 /// ┆ ┆ ┆ sourceChannels:
1763 /// @
1764 /// [0, 0]]; ┆
1765 /// ```
1766 #[unsafe(method(geometryWithSources:elements:sourceChannels:))]
1767 #[unsafe(method_family = none)]
1768 pub unsafe fn geometryWithSources_elements_sourceChannels(
1769 sources: &NSArray<SCNGeometrySource>,
1770 elements: Option<&NSArray<SCNGeometryElement>>,
1771 source_channels: Option<&NSArray<NSNumber>>,
1772 ) -> Retained<Self>;
1773 );
1774}
1775
1776/// Methods declared on superclass `NSObject`.
1777#[cfg(feature = "SCNGeometry")]
1778impl SCNTube {
1779 extern_methods!(
1780 #[unsafe(method(init))]
1781 #[unsafe(method_family = init)]
1782 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1783
1784 #[unsafe(method(new))]
1785 #[unsafe(method_family = new)]
1786 pub unsafe fn new() -> Retained<Self>;
1787 );
1788}
1789
1790extern_class!(
1791 /// SCNCapsule represents a capsule with controllable height and cap radius.
1792 ///
1793 /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scncapsule?language=objc)
1794 #[unsafe(super(SCNGeometry, NSObject))]
1795 #[derive(Debug, PartialEq, Eq, Hash)]
1796 #[cfg(feature = "SCNGeometry")]
1797 pub struct SCNCapsule;
1798);
1799
1800#[cfg(feature = "SCNGeometry")]
1801extern_conformance!(
1802 unsafe impl NSCoding for SCNCapsule {}
1803);
1804
1805#[cfg(feature = "SCNGeometry")]
1806extern_conformance!(
1807 unsafe impl NSCopying for SCNCapsule {}
1808);
1809
1810#[cfg(feature = "SCNGeometry")]
1811unsafe impl CopyingHelper for SCNCapsule {
1812 type Result = Self;
1813}
1814
1815#[cfg(feature = "SCNGeometry")]
1816extern_conformance!(
1817 unsafe impl NSObjectProtocol for SCNCapsule {}
1818);
1819
1820#[cfg(feature = "SCNGeometry")]
1821extern_conformance!(
1822 unsafe impl NSSecureCoding for SCNCapsule {}
1823);
1824
1825#[cfg(all(feature = "SCNAnimation", feature = "SCNGeometry"))]
1826extern_conformance!(
1827 unsafe impl SCNAnimatable for SCNCapsule {}
1828);
1829
1830#[cfg(all(feature = "SCNBoundingVolume", feature = "SCNGeometry"))]
1831extern_conformance!(
1832 unsafe impl SCNBoundingVolume for SCNCapsule {}
1833);
1834
1835#[cfg(all(feature = "SCNGeometry", feature = "SCNShadable"))]
1836extern_conformance!(
1837 unsafe impl SCNShadable for SCNCapsule {}
1838);
1839
1840#[cfg(feature = "SCNGeometry")]
1841impl SCNCapsule {
1842 extern_methods!(
1843 #[cfg(feature = "objc2-core-foundation")]
1844 /// Creates and returns a capsule with given radius and height.
1845 ///
1846 /// Parameter `capRadius`: The radius of the capsule.
1847 ///
1848 /// Parameter `height`: The height of the capsule.
1849 #[unsafe(method(capsuleWithCapRadius:height:))]
1850 #[unsafe(method_family = none)]
1851 pub unsafe fn capsuleWithCapRadius_height(
1852 cap_radius: CGFloat,
1853 height: CGFloat,
1854 ) -> Retained<Self>;
1855
1856 #[cfg(feature = "objc2-core-foundation")]
1857 /// The cap radius of the capsule. Animatable.
1858 ///
1859 /// If the value is less than or equal to 0, the geometry is empty. The default value is 0.5.
1860 #[unsafe(method(capRadius))]
1861 #[unsafe(method_family = none)]
1862 pub unsafe fn capRadius(&self) -> CGFloat;
1863
1864 #[cfg(feature = "objc2-core-foundation")]
1865 /// Setter for [`capRadius`][Self::capRadius].
1866 #[unsafe(method(setCapRadius:))]
1867 #[unsafe(method_family = none)]
1868 pub unsafe fn setCapRadius(&self, cap_radius: CGFloat);
1869
1870 #[cfg(feature = "objc2-core-foundation")]
1871 /// The height of the capsule. Animatable.
1872 ///
1873 /// If the value is less than or equal to 0, the geometry is empty. The default value is 2.
1874 #[unsafe(method(height))]
1875 #[unsafe(method_family = none)]
1876 pub unsafe fn height(&self) -> CGFloat;
1877
1878 #[cfg(feature = "objc2-core-foundation")]
1879 /// Setter for [`height`][Self::height].
1880 #[unsafe(method(setHeight:))]
1881 #[unsafe(method_family = none)]
1882 pub unsafe fn setHeight(&self, height: CGFloat);
1883
1884 /// The number of subdivisions along the radial coordinate. Animatable.
1885 ///
1886 /// If the value is less than 3, the behavior is undefined. The default value is 48.
1887 #[unsafe(method(radialSegmentCount))]
1888 #[unsafe(method_family = none)]
1889 pub unsafe fn radialSegmentCount(&self) -> NSInteger;
1890
1891 /// Setter for [`radialSegmentCount`][Self::radialSegmentCount].
1892 #[unsafe(method(setRadialSegmentCount:))]
1893 #[unsafe(method_family = none)]
1894 pub unsafe fn setRadialSegmentCount(&self, radial_segment_count: NSInteger);
1895
1896 /// The number of subdivisions along the Y axis. Animatable.
1897 ///
1898 /// If the value is less than 1, the behavior is undefined. The default value is 1.
1899 #[unsafe(method(heightSegmentCount))]
1900 #[unsafe(method_family = none)]
1901 pub unsafe fn heightSegmentCount(&self) -> NSInteger;
1902
1903 /// Setter for [`heightSegmentCount`][Self::heightSegmentCount].
1904 #[unsafe(method(setHeightSegmentCount:))]
1905 #[unsafe(method_family = none)]
1906 pub unsafe fn setHeightSegmentCount(&self, height_segment_count: NSInteger);
1907
1908 /// The number of subdivisions in the cap. Animatable.
1909 ///
1910 /// If the value is less than 2, the behavior is undefined. The default value is 24.
1911 #[unsafe(method(capSegmentCount))]
1912 #[unsafe(method_family = none)]
1913 pub unsafe fn capSegmentCount(&self) -> NSInteger;
1914
1915 /// Setter for [`capSegmentCount`][Self::capSegmentCount].
1916 #[unsafe(method(setCapSegmentCount:))]
1917 #[unsafe(method_family = none)]
1918 pub unsafe fn setCapSegmentCount(&self, cap_segment_count: NSInteger);
1919 );
1920}
1921
1922/// Methods declared on superclass `SCNGeometry`.
1923#[cfg(feature = "SCNGeometry")]
1924impl SCNCapsule {
1925 extern_methods!(
1926 /// Creates and returns an empty geometry object.
1927 ///
1928 /// An empty geometry may be used as the lowest level of detail of a geometry.
1929 #[unsafe(method(geometry))]
1930 #[unsafe(method_family = none)]
1931 pub unsafe fn geometry() -> Retained<Self>;
1932
1933 /// Creates and returns a new geometry built from geometry sources and geometry elements.
1934 ///
1935 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
1936 ///
1937 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
1938 ///
1939 /// A geometry is made of geometry sources (at least `SCNGeometrySourceSemanticVertex`) and at least one geometry element. Multiple sources for texture coordinates are accepted. In that case the `mappingChannel` is implicitly set based on the order of the texture sources, starting at index 0.
1940 #[unsafe(method(geometryWithSources:elements:))]
1941 #[unsafe(method_family = none)]
1942 pub unsafe fn geometryWithSources_elements(
1943 sources: &NSArray<SCNGeometrySource>,
1944 elements: Option<&NSArray<SCNGeometryElement>>,
1945 ) -> Retained<Self>;
1946
1947 /// Creates and returns a new geometry built from geometry sources and geometry elements, with per-source indexed geometry data.
1948 ///
1949 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
1950 ///
1951 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
1952 ///
1953 /// Parameter `sourceChannels`: An array of indices that describes, for each geometry source, which channel of the geometry elements to use.
1954 ///
1955 /// ```text
1956 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using different indices to reference position and UV data (2 channels)
1957 ///
1958 /// Positions ┆ POS0 POS3 POS4 ┆ quad quad pentagon quad quad pentagon ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
1959 /// 0 │ (0.0, 0.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌─────┐ ┌─────┐ ┌───────┐ ┌─────┐ ┌─────┐ ┌───────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
1960 /// 1 │ (0.0, 1.0, 0.0) ┆ │UV0 UV3│UV0 UV3│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 0 1 2 3 2 3 0 1 1 2 3 4 0 ┆ primitiveCount:3
1961 /// 2 │ (1.0, 0.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────┘ └───────────────────────┘ ┆ indicesChannelCount:2
1962 /// 3 │ (1.0, 1.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 channel 1 ┆ interleavedIndicesChannels:…
1963 /// 4 │ (2.0, 0.0, 0.0) ┆ │ │ │ ┆ (positions) (UVs) ┆ bytesPerIndex:…];
1964 /// 5 │ (2.0, 1.0, 0.0) ┆ │UV1 UV2│UV1 UV2│ ┆ ┆
1965 /// 6 │ (2.0, 2.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
1966 /// @
1967 /// [positionSource, texcoordsSource]
1968 /// 7 │ (0.0, 2.0, 0.0) ┆ │UVO UV4 UV3│ ┆ ┆ elements:
1969 /// @
1970 /// [element]
1971 /// ┆ │ POS2 │ ┆ quad A quad B pentagon C ┆ sourceChannels:
1972 /// @
1973 /// [0, 1]];
1974 /// UVs ┆ │ │ ┆ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ ┆
1975 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ 4 4 5 0 0 1 1 2 2 3 3 5 2 4 3 3 0 2 1 7 1 6 2 5 3 2 4 1 0 ┆
1976 /// 1 │ (0.0, 1.0) ┆ │ │ ┆ └───┘└──────────────────────────────────────────────────┘ ┆
1977 /// 2 │ (1.0, 1.0) ┆ │UV1 UV2│ ┆ polygons interleaved channels ┆
1978 /// 3 │ (1.0, 0.0) ┆ └───────────────────────┘ ┆ (positions and UVs) ┆
1979 /// 4 │ (0.5, 0.0) ┆ POS7 POS6 ┆ ┆
1980 ///
1981 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using the same indices to reference position and UV data (1 channel)
1982 ///
1983 /// Positions ┆ POS0 POS3 POS4 ┆ quad A quad B pentagon C ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
1984 /// 0 │ (0.0, 4.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌────────┐ ┌────────┐ ┌───────────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
1985 /// 1 │ (0.0, 2.0, 0.0) ┆ │UV0 UV3│UV3 UV4│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 ┆ primitiveCount:3
1986 /// 2 │ (2.0, 2.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────────────────┘ ┆ bytesPerIndex:…];
1987 /// 3 │ (2.0, 4.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 ┆
1988 /// 4 │ (4.0, 4.0, 0.0) ┆ │ │ │ ┆ (positions and UVs) ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
1989 /// @
1990 /// [positionSource, texcoordsSource]
1991 /// 5 │ (4.0, 2.0, 0.0) ┆ │UV1 UV2│UV2 UV5│ ┆ ┆ elements:
1992 /// @
1993 /// [element]];
1994 /// 6 │ (4.0, 0.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆
1995 /// 7 │ (0.0, 0.0, 0.0) ┆ │UV1 UV2 UV5│ ┆ ┆ === or equivalently ===
1996 /// ┆ │ POS2 │ ┆ ┆
1997 /// UVs ┆ │ │ ┆ ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
1998 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
1999 /// 1 │ (0.0, 0.5) ┆ │ │ ┆ ┆ primitiveCount:3
2000 /// 2 │ (0.5, 0.5) ┆ │UV7 UV6│ ┆ ┆ indicesChannelCount:1
2001 /// 3 │ (0.5, 0.0) ┆ └───────────────────────┘ ┆ ┆ interleavedIndicesChannels:…
2002 /// 4 │ (1.0, 0.0) ┆ POS7 POS6 ┆ ┆ bytesPerIndex:…];
2003 /// 5 │ (1.0, 0.5) ┆ ┆ ┆
2004 /// 6 │ (1.0, 1.0) ┆ ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
2005 /// @
2006 /// [positionSource, texcoordsSource]
2007 /// 7 │ (0.0, 1.0) ┆ ┆ ┆ elements:
2008 /// @
2009 /// [element]
2010 /// ┆ ┆ ┆ sourceChannels:
2011 /// @
2012 /// [0, 0]]; ┆
2013 /// ```
2014 #[unsafe(method(geometryWithSources:elements:sourceChannels:))]
2015 #[unsafe(method_family = none)]
2016 pub unsafe fn geometryWithSources_elements_sourceChannels(
2017 sources: &NSArray<SCNGeometrySource>,
2018 elements: Option<&NSArray<SCNGeometryElement>>,
2019 source_channels: Option<&NSArray<NSNumber>>,
2020 ) -> Retained<Self>;
2021 );
2022}
2023
2024/// Methods declared on superclass `NSObject`.
2025#[cfg(feature = "SCNGeometry")]
2026impl SCNCapsule {
2027 extern_methods!(
2028 #[unsafe(method(init))]
2029 #[unsafe(method_family = init)]
2030 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2031
2032 #[unsafe(method(new))]
2033 #[unsafe(method_family = new)]
2034 pub unsafe fn new() -> Retained<Self>;
2035 );
2036}
2037
2038extern_class!(
2039 /// SCNTorus represents a torus with controllable ring radius and pipe radius.
2040 ///
2041 /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scntorus?language=objc)
2042 #[unsafe(super(SCNGeometry, NSObject))]
2043 #[derive(Debug, PartialEq, Eq, Hash)]
2044 #[cfg(feature = "SCNGeometry")]
2045 pub struct SCNTorus;
2046);
2047
2048#[cfg(feature = "SCNGeometry")]
2049extern_conformance!(
2050 unsafe impl NSCoding for SCNTorus {}
2051);
2052
2053#[cfg(feature = "SCNGeometry")]
2054extern_conformance!(
2055 unsafe impl NSCopying for SCNTorus {}
2056);
2057
2058#[cfg(feature = "SCNGeometry")]
2059unsafe impl CopyingHelper for SCNTorus {
2060 type Result = Self;
2061}
2062
2063#[cfg(feature = "SCNGeometry")]
2064extern_conformance!(
2065 unsafe impl NSObjectProtocol for SCNTorus {}
2066);
2067
2068#[cfg(feature = "SCNGeometry")]
2069extern_conformance!(
2070 unsafe impl NSSecureCoding for SCNTorus {}
2071);
2072
2073#[cfg(all(feature = "SCNAnimation", feature = "SCNGeometry"))]
2074extern_conformance!(
2075 unsafe impl SCNAnimatable for SCNTorus {}
2076);
2077
2078#[cfg(all(feature = "SCNBoundingVolume", feature = "SCNGeometry"))]
2079extern_conformance!(
2080 unsafe impl SCNBoundingVolume for SCNTorus {}
2081);
2082
2083#[cfg(all(feature = "SCNGeometry", feature = "SCNShadable"))]
2084extern_conformance!(
2085 unsafe impl SCNShadable for SCNTorus {}
2086);
2087
2088#[cfg(feature = "SCNGeometry")]
2089impl SCNTorus {
2090 extern_methods!(
2091 #[cfg(feature = "objc2-core-foundation")]
2092 /// Creates and returns a torus with given ring radius and pipe radius.
2093 ///
2094 /// Parameter `ringRadius`: The radius of the ring.
2095 ///
2096 /// Parameter `pipeRadius`: The radius of the pipe.
2097 #[unsafe(method(torusWithRingRadius:pipeRadius:))]
2098 #[unsafe(method_family = none)]
2099 pub unsafe fn torusWithRingRadius_pipeRadius(
2100 ring_radius: CGFloat,
2101 pipe_radius: CGFloat,
2102 ) -> Retained<Self>;
2103
2104 #[cfg(feature = "objc2-core-foundation")]
2105 /// The radius of the torus ring. Animatable.
2106 ///
2107 /// If the value is less than or equal to 0, the geometry is empty. The default value is 0.5.
2108 #[unsafe(method(ringRadius))]
2109 #[unsafe(method_family = none)]
2110 pub unsafe fn ringRadius(&self) -> CGFloat;
2111
2112 #[cfg(feature = "objc2-core-foundation")]
2113 /// Setter for [`ringRadius`][Self::ringRadius].
2114 #[unsafe(method(setRingRadius:))]
2115 #[unsafe(method_family = none)]
2116 pub unsafe fn setRingRadius(&self, ring_radius: CGFloat);
2117
2118 #[cfg(feature = "objc2-core-foundation")]
2119 /// The radius of the torus pipe. Animatable.
2120 ///
2121 /// If the value is less than or equal to 0, the geometry is empty. The default value is 0.25.
2122 #[unsafe(method(pipeRadius))]
2123 #[unsafe(method_family = none)]
2124 pub unsafe fn pipeRadius(&self) -> CGFloat;
2125
2126 #[cfg(feature = "objc2-core-foundation")]
2127 /// Setter for [`pipeRadius`][Self::pipeRadius].
2128 #[unsafe(method(setPipeRadius:))]
2129 #[unsafe(method_family = none)]
2130 pub unsafe fn setPipeRadius(&self, pipe_radius: CGFloat);
2131
2132 /// The number of subdivisions of the ring. Animatable.
2133 ///
2134 /// If the value is less than 3, the behavior is undefined. The default value is 48.
2135 #[unsafe(method(ringSegmentCount))]
2136 #[unsafe(method_family = none)]
2137 pub unsafe fn ringSegmentCount(&self) -> NSInteger;
2138
2139 /// Setter for [`ringSegmentCount`][Self::ringSegmentCount].
2140 #[unsafe(method(setRingSegmentCount:))]
2141 #[unsafe(method_family = none)]
2142 pub unsafe fn setRingSegmentCount(&self, ring_segment_count: NSInteger);
2143
2144 /// The number of subdivisions of the pipe. Animatable.
2145 ///
2146 /// If the value is less than 3, the behavior is undefined. The default value is 24.
2147 #[unsafe(method(pipeSegmentCount))]
2148 #[unsafe(method_family = none)]
2149 pub unsafe fn pipeSegmentCount(&self) -> NSInteger;
2150
2151 /// Setter for [`pipeSegmentCount`][Self::pipeSegmentCount].
2152 #[unsafe(method(setPipeSegmentCount:))]
2153 #[unsafe(method_family = none)]
2154 pub unsafe fn setPipeSegmentCount(&self, pipe_segment_count: NSInteger);
2155 );
2156}
2157
2158/// Methods declared on superclass `SCNGeometry`.
2159#[cfg(feature = "SCNGeometry")]
2160impl SCNTorus {
2161 extern_methods!(
2162 /// Creates and returns an empty geometry object.
2163 ///
2164 /// An empty geometry may be used as the lowest level of detail of a geometry.
2165 #[unsafe(method(geometry))]
2166 #[unsafe(method_family = none)]
2167 pub unsafe fn geometry() -> Retained<Self>;
2168
2169 /// Creates and returns a new geometry built from geometry sources and geometry elements.
2170 ///
2171 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
2172 ///
2173 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
2174 ///
2175 /// A geometry is made of geometry sources (at least `SCNGeometrySourceSemanticVertex`) and at least one geometry element. Multiple sources for texture coordinates are accepted. In that case the `mappingChannel` is implicitly set based on the order of the texture sources, starting at index 0.
2176 #[unsafe(method(geometryWithSources:elements:))]
2177 #[unsafe(method_family = none)]
2178 pub unsafe fn geometryWithSources_elements(
2179 sources: &NSArray<SCNGeometrySource>,
2180 elements: Option<&NSArray<SCNGeometryElement>>,
2181 ) -> Retained<Self>;
2182
2183 /// Creates and returns a new geometry built from geometry sources and geometry elements, with per-source indexed geometry data.
2184 ///
2185 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
2186 ///
2187 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
2188 ///
2189 /// Parameter `sourceChannels`: An array of indices that describes, for each geometry source, which channel of the geometry elements to use.
2190 ///
2191 /// ```text
2192 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using different indices to reference position and UV data (2 channels)
2193 ///
2194 /// Positions ┆ POS0 POS3 POS4 ┆ quad quad pentagon quad quad pentagon ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
2195 /// 0 │ (0.0, 0.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌─────┐ ┌─────┐ ┌───────┐ ┌─────┐ ┌─────┐ ┌───────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
2196 /// 1 │ (0.0, 1.0, 0.0) ┆ │UV0 UV3│UV0 UV3│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 0 1 2 3 2 3 0 1 1 2 3 4 0 ┆ primitiveCount:3
2197 /// 2 │ (1.0, 0.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────┘ └───────────────────────┘ ┆ indicesChannelCount:2
2198 /// 3 │ (1.0, 1.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 channel 1 ┆ interleavedIndicesChannels:…
2199 /// 4 │ (2.0, 0.0, 0.0) ┆ │ │ │ ┆ (positions) (UVs) ┆ bytesPerIndex:…];
2200 /// 5 │ (2.0, 1.0, 0.0) ┆ │UV1 UV2│UV1 UV2│ ┆ ┆
2201 /// 6 │ (2.0, 2.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
2202 /// @
2203 /// [positionSource, texcoordsSource]
2204 /// 7 │ (0.0, 2.0, 0.0) ┆ │UVO UV4 UV3│ ┆ ┆ elements:
2205 /// @
2206 /// [element]
2207 /// ┆ │ POS2 │ ┆ quad A quad B pentagon C ┆ sourceChannels:
2208 /// @
2209 /// [0, 1]];
2210 /// UVs ┆ │ │ ┆ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ ┆
2211 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ 4 4 5 0 0 1 1 2 2 3 3 5 2 4 3 3 0 2 1 7 1 6 2 5 3 2 4 1 0 ┆
2212 /// 1 │ (0.0, 1.0) ┆ │ │ ┆ └───┘└──────────────────────────────────────────────────┘ ┆
2213 /// 2 │ (1.0, 1.0) ┆ │UV1 UV2│ ┆ polygons interleaved channels ┆
2214 /// 3 │ (1.0, 0.0) ┆ └───────────────────────┘ ┆ (positions and UVs) ┆
2215 /// 4 │ (0.5, 0.0) ┆ POS7 POS6 ┆ ┆
2216 ///
2217 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using the same indices to reference position and UV data (1 channel)
2218 ///
2219 /// Positions ┆ POS0 POS3 POS4 ┆ quad A quad B pentagon C ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
2220 /// 0 │ (0.0, 4.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌────────┐ ┌────────┐ ┌───────────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
2221 /// 1 │ (0.0, 2.0, 0.0) ┆ │UV0 UV3│UV3 UV4│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 ┆ primitiveCount:3
2222 /// 2 │ (2.0, 2.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────────────────┘ ┆ bytesPerIndex:…];
2223 /// 3 │ (2.0, 4.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 ┆
2224 /// 4 │ (4.0, 4.0, 0.0) ┆ │ │ │ ┆ (positions and UVs) ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
2225 /// @
2226 /// [positionSource, texcoordsSource]
2227 /// 5 │ (4.0, 2.0, 0.0) ┆ │UV1 UV2│UV2 UV5│ ┆ ┆ elements:
2228 /// @
2229 /// [element]];
2230 /// 6 │ (4.0, 0.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆
2231 /// 7 │ (0.0, 0.0, 0.0) ┆ │UV1 UV2 UV5│ ┆ ┆ === or equivalently ===
2232 /// ┆ │ POS2 │ ┆ ┆
2233 /// UVs ┆ │ │ ┆ ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
2234 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
2235 /// 1 │ (0.0, 0.5) ┆ │ │ ┆ ┆ primitiveCount:3
2236 /// 2 │ (0.5, 0.5) ┆ │UV7 UV6│ ┆ ┆ indicesChannelCount:1
2237 /// 3 │ (0.5, 0.0) ┆ └───────────────────────┘ ┆ ┆ interleavedIndicesChannels:…
2238 /// 4 │ (1.0, 0.0) ┆ POS7 POS6 ┆ ┆ bytesPerIndex:…];
2239 /// 5 │ (1.0, 0.5) ┆ ┆ ┆
2240 /// 6 │ (1.0, 1.0) ┆ ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
2241 /// @
2242 /// [positionSource, texcoordsSource]
2243 /// 7 │ (0.0, 1.0) ┆ ┆ ┆ elements:
2244 /// @
2245 /// [element]
2246 /// ┆ ┆ ┆ sourceChannels:
2247 /// @
2248 /// [0, 0]]; ┆
2249 /// ```
2250 #[unsafe(method(geometryWithSources:elements:sourceChannels:))]
2251 #[unsafe(method_family = none)]
2252 pub unsafe fn geometryWithSources_elements_sourceChannels(
2253 sources: &NSArray<SCNGeometrySource>,
2254 elements: Option<&NSArray<SCNGeometryElement>>,
2255 source_channels: Option<&NSArray<NSNumber>>,
2256 ) -> Retained<Self>;
2257 );
2258}
2259
2260/// Methods declared on superclass `NSObject`.
2261#[cfg(feature = "SCNGeometry")]
2262impl SCNTorus {
2263 extern_methods!(
2264 #[unsafe(method(init))]
2265 #[unsafe(method_family = init)]
2266 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2267
2268 #[unsafe(method(new))]
2269 #[unsafe(method_family = new)]
2270 pub unsafe fn new() -> Retained<Self>;
2271 );
2272}
2273
2274extern_class!(
2275 /// SCNFloor represents an infinite plane geometry.
2276 ///
2277 /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnfloor?language=objc)
2278 #[unsafe(super(SCNGeometry, NSObject))]
2279 #[derive(Debug, PartialEq, Eq, Hash)]
2280 #[cfg(feature = "SCNGeometry")]
2281 pub struct SCNFloor;
2282);
2283
2284#[cfg(feature = "SCNGeometry")]
2285extern_conformance!(
2286 unsafe impl NSCoding for SCNFloor {}
2287);
2288
2289#[cfg(feature = "SCNGeometry")]
2290extern_conformance!(
2291 unsafe impl NSCopying for SCNFloor {}
2292);
2293
2294#[cfg(feature = "SCNGeometry")]
2295unsafe impl CopyingHelper for SCNFloor {
2296 type Result = Self;
2297}
2298
2299#[cfg(feature = "SCNGeometry")]
2300extern_conformance!(
2301 unsafe impl NSObjectProtocol for SCNFloor {}
2302);
2303
2304#[cfg(feature = "SCNGeometry")]
2305extern_conformance!(
2306 unsafe impl NSSecureCoding for SCNFloor {}
2307);
2308
2309#[cfg(all(feature = "SCNAnimation", feature = "SCNGeometry"))]
2310extern_conformance!(
2311 unsafe impl SCNAnimatable for SCNFloor {}
2312);
2313
2314#[cfg(all(feature = "SCNBoundingVolume", feature = "SCNGeometry"))]
2315extern_conformance!(
2316 unsafe impl SCNBoundingVolume for SCNFloor {}
2317);
2318
2319#[cfg(all(feature = "SCNGeometry", feature = "SCNShadable"))]
2320extern_conformance!(
2321 unsafe impl SCNShadable for SCNFloor {}
2322);
2323
2324#[cfg(feature = "SCNGeometry")]
2325impl SCNFloor {
2326 extern_methods!(
2327 /// Creates and returns a floor.
2328 ///
2329 /// A floor is an infinite plane.
2330 #[unsafe(method(floor))]
2331 #[unsafe(method_family = none)]
2332 pub unsafe fn floor() -> Retained<Self>;
2333
2334 #[cfg(feature = "objc2-core-foundation")]
2335 /// Specifies the reflectivity of the floor. Animatable.
2336 ///
2337 /// If the value is greater than zero then the surface will reflect other objects in the scene. The default value is 0.25.
2338 #[unsafe(method(reflectivity))]
2339 #[unsafe(method_family = none)]
2340 pub unsafe fn reflectivity(&self) -> CGFloat;
2341
2342 #[cfg(feature = "objc2-core-foundation")]
2343 /// Setter for [`reflectivity`][Self::reflectivity].
2344 #[unsafe(method(setReflectivity:))]
2345 #[unsafe(method_family = none)]
2346 pub unsafe fn setReflectivity(&self, reflectivity: CGFloat);
2347
2348 #[cfg(feature = "objc2-core-foundation")]
2349 /// Specifies the distance from the floor where the falloff begins. Animatable.
2350 ///
2351 /// The default value is 0.
2352 #[unsafe(method(reflectionFalloffStart))]
2353 #[unsafe(method_family = none)]
2354 pub unsafe fn reflectionFalloffStart(&self) -> CGFloat;
2355
2356 #[cfg(feature = "objc2-core-foundation")]
2357 /// Setter for [`reflectionFalloffStart`][Self::reflectionFalloffStart].
2358 #[unsafe(method(setReflectionFalloffStart:))]
2359 #[unsafe(method_family = none)]
2360 pub unsafe fn setReflectionFalloffStart(&self, reflection_falloff_start: CGFloat);
2361
2362 #[cfg(feature = "objc2-core-foundation")]
2363 /// Specifies the distance from the floor where the falloff finishes. Animatable.
2364 ///
2365 /// If the value is 0 then there is no falloff. The default value is 0.
2366 #[unsafe(method(reflectionFalloffEnd))]
2367 #[unsafe(method_family = none)]
2368 pub unsafe fn reflectionFalloffEnd(&self) -> CGFloat;
2369
2370 #[cfg(feature = "objc2-core-foundation")]
2371 /// Setter for [`reflectionFalloffEnd`][Self::reflectionFalloffEnd].
2372 #[unsafe(method(setReflectionFalloffEnd:))]
2373 #[unsafe(method_family = none)]
2374 pub unsafe fn setReflectionFalloffEnd(&self, reflection_falloff_end: CGFloat);
2375
2376 /// Determines the node categories to reflect. Defaults to all bits set.
2377 #[unsafe(method(reflectionCategoryBitMask))]
2378 #[unsafe(method_family = none)]
2379 pub unsafe fn reflectionCategoryBitMask(&self) -> NSUInteger;
2380
2381 /// Setter for [`reflectionCategoryBitMask`][Self::reflectionCategoryBitMask].
2382 #[unsafe(method(setReflectionCategoryBitMask:))]
2383 #[unsafe(method_family = none)]
2384 pub unsafe fn setReflectionCategoryBitMask(&self, reflection_category_bit_mask: NSUInteger);
2385
2386 #[cfg(feature = "objc2-core-foundation")]
2387 /// The floor extent along the X axis. Animatable.
2388 ///
2389 /// If the value is equal to 0, the floor is infinite on the X axis. The default value is 0.
2390 #[unsafe(method(width))]
2391 #[unsafe(method_family = none)]
2392 pub unsafe fn width(&self) -> CGFloat;
2393
2394 #[cfg(feature = "objc2-core-foundation")]
2395 /// Setter for [`width`][Self::width].
2396 #[unsafe(method(setWidth:))]
2397 #[unsafe(method_family = none)]
2398 pub unsafe fn setWidth(&self, width: CGFloat);
2399
2400 #[cfg(feature = "objc2-core-foundation")]
2401 /// The floor extent along the Z axis. Animatable.
2402 ///
2403 /// If the value is equal to 0, the floor is infinite on the Z axis. The default value is 0.
2404 #[unsafe(method(length))]
2405 #[unsafe(method_family = none)]
2406 pub unsafe fn length(&self) -> CGFloat;
2407
2408 #[cfg(feature = "objc2-core-foundation")]
2409 /// Setter for [`length`][Self::length].
2410 #[unsafe(method(setLength:))]
2411 #[unsafe(method_family = none)]
2412 pub unsafe fn setLength(&self, length: CGFloat);
2413
2414 #[cfg(feature = "objc2-core-foundation")]
2415 /// Specifies the resolution scale factor of the buffer used to render the reflection.
2416 ///
2417 /// Defaults to 1.0.
2418 #[unsafe(method(reflectionResolutionScaleFactor))]
2419 #[unsafe(method_family = none)]
2420 pub unsafe fn reflectionResolutionScaleFactor(&self) -> CGFloat;
2421
2422 #[cfg(feature = "objc2-core-foundation")]
2423 /// Setter for [`reflectionResolutionScaleFactor`][Self::reflectionResolutionScaleFactor].
2424 #[unsafe(method(setReflectionResolutionScaleFactor:))]
2425 #[unsafe(method_family = none)]
2426 pub unsafe fn setReflectionResolutionScaleFactor(
2427 &self,
2428 reflection_resolution_scale_factor: CGFloat,
2429 );
2430 );
2431}
2432
2433/// Methods declared on superclass `SCNGeometry`.
2434#[cfg(feature = "SCNGeometry")]
2435impl SCNFloor {
2436 extern_methods!(
2437 /// Creates and returns an empty geometry object.
2438 ///
2439 /// An empty geometry may be used as the lowest level of detail of a geometry.
2440 #[unsafe(method(geometry))]
2441 #[unsafe(method_family = none)]
2442 pub unsafe fn geometry() -> Retained<Self>;
2443
2444 /// Creates and returns a new geometry built from geometry sources and geometry elements.
2445 ///
2446 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
2447 ///
2448 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
2449 ///
2450 /// A geometry is made of geometry sources (at least `SCNGeometrySourceSemanticVertex`) and at least one geometry element. Multiple sources for texture coordinates are accepted. In that case the `mappingChannel` is implicitly set based on the order of the texture sources, starting at index 0.
2451 #[unsafe(method(geometryWithSources:elements:))]
2452 #[unsafe(method_family = none)]
2453 pub unsafe fn geometryWithSources_elements(
2454 sources: &NSArray<SCNGeometrySource>,
2455 elements: Option<&NSArray<SCNGeometryElement>>,
2456 ) -> Retained<Self>;
2457
2458 /// Creates and returns a new geometry built from geometry sources and geometry elements, with per-source indexed geometry data.
2459 ///
2460 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
2461 ///
2462 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
2463 ///
2464 /// Parameter `sourceChannels`: An array of indices that describes, for each geometry source, which channel of the geometry elements to use.
2465 ///
2466 /// ```text
2467 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using different indices to reference position and UV data (2 channels)
2468 ///
2469 /// Positions ┆ POS0 POS3 POS4 ┆ quad quad pentagon quad quad pentagon ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
2470 /// 0 │ (0.0, 0.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌─────┐ ┌─────┐ ┌───────┐ ┌─────┐ ┌─────┐ ┌───────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
2471 /// 1 │ (0.0, 1.0, 0.0) ┆ │UV0 UV3│UV0 UV3│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 0 1 2 3 2 3 0 1 1 2 3 4 0 ┆ primitiveCount:3
2472 /// 2 │ (1.0, 0.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────┘ └───────────────────────┘ ┆ indicesChannelCount:2
2473 /// 3 │ (1.0, 1.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 channel 1 ┆ interleavedIndicesChannels:…
2474 /// 4 │ (2.0, 0.0, 0.0) ┆ │ │ │ ┆ (positions) (UVs) ┆ bytesPerIndex:…];
2475 /// 5 │ (2.0, 1.0, 0.0) ┆ │UV1 UV2│UV1 UV2│ ┆ ┆
2476 /// 6 │ (2.0, 2.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
2477 /// @
2478 /// [positionSource, texcoordsSource]
2479 /// 7 │ (0.0, 2.0, 0.0) ┆ │UVO UV4 UV3│ ┆ ┆ elements:
2480 /// @
2481 /// [element]
2482 /// ┆ │ POS2 │ ┆ quad A quad B pentagon C ┆ sourceChannels:
2483 /// @
2484 /// [0, 1]];
2485 /// UVs ┆ │ │ ┆ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ ┆
2486 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ 4 4 5 0 0 1 1 2 2 3 3 5 2 4 3 3 0 2 1 7 1 6 2 5 3 2 4 1 0 ┆
2487 /// 1 │ (0.0, 1.0) ┆ │ │ ┆ └───┘└──────────────────────────────────────────────────┘ ┆
2488 /// 2 │ (1.0, 1.0) ┆ │UV1 UV2│ ┆ polygons interleaved channels ┆
2489 /// 3 │ (1.0, 0.0) ┆ └───────────────────────┘ ┆ (positions and UVs) ┆
2490 /// 4 │ (0.5, 0.0) ┆ POS7 POS6 ┆ ┆
2491 ///
2492 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using the same indices to reference position and UV data (1 channel)
2493 ///
2494 /// Positions ┆ POS0 POS3 POS4 ┆ quad A quad B pentagon C ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
2495 /// 0 │ (0.0, 4.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌────────┐ ┌────────┐ ┌───────────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
2496 /// 1 │ (0.0, 2.0, 0.0) ┆ │UV0 UV3│UV3 UV4│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 ┆ primitiveCount:3
2497 /// 2 │ (2.0, 2.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────────────────┘ ┆ bytesPerIndex:…];
2498 /// 3 │ (2.0, 4.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 ┆
2499 /// 4 │ (4.0, 4.0, 0.0) ┆ │ │ │ ┆ (positions and UVs) ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
2500 /// @
2501 /// [positionSource, texcoordsSource]
2502 /// 5 │ (4.0, 2.0, 0.0) ┆ │UV1 UV2│UV2 UV5│ ┆ ┆ elements:
2503 /// @
2504 /// [element]];
2505 /// 6 │ (4.0, 0.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆
2506 /// 7 │ (0.0, 0.0, 0.0) ┆ │UV1 UV2 UV5│ ┆ ┆ === or equivalently ===
2507 /// ┆ │ POS2 │ ┆ ┆
2508 /// UVs ┆ │ │ ┆ ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
2509 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
2510 /// 1 │ (0.0, 0.5) ┆ │ │ ┆ ┆ primitiveCount:3
2511 /// 2 │ (0.5, 0.5) ┆ │UV7 UV6│ ┆ ┆ indicesChannelCount:1
2512 /// 3 │ (0.5, 0.0) ┆ └───────────────────────┘ ┆ ┆ interleavedIndicesChannels:…
2513 /// 4 │ (1.0, 0.0) ┆ POS7 POS6 ┆ ┆ bytesPerIndex:…];
2514 /// 5 │ (1.0, 0.5) ┆ ┆ ┆
2515 /// 6 │ (1.0, 1.0) ┆ ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
2516 /// @
2517 /// [positionSource, texcoordsSource]
2518 /// 7 │ (0.0, 1.0) ┆ ┆ ┆ elements:
2519 /// @
2520 /// [element]
2521 /// ┆ ┆ ┆ sourceChannels:
2522 /// @
2523 /// [0, 0]]; ┆
2524 /// ```
2525 #[unsafe(method(geometryWithSources:elements:sourceChannels:))]
2526 #[unsafe(method_family = none)]
2527 pub unsafe fn geometryWithSources_elements_sourceChannels(
2528 sources: &NSArray<SCNGeometrySource>,
2529 elements: Option<&NSArray<SCNGeometryElement>>,
2530 source_channels: Option<&NSArray<NSNumber>>,
2531 ) -> Retained<Self>;
2532 );
2533}
2534
2535/// Methods declared on superclass `NSObject`.
2536#[cfg(feature = "SCNGeometry")]
2537impl SCNFloor {
2538 extern_methods!(
2539 #[unsafe(method(init))]
2540 #[unsafe(method_family = init)]
2541 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2542
2543 #[unsafe(method(new))]
2544 #[unsafe(method_family = new)]
2545 pub unsafe fn new() -> Retained<Self>;
2546 );
2547}
2548
2549extern_class!(
2550 /// SCNText represents a block of text that has been extruded
2551 ///
2552 /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scntext?language=objc)
2553 #[unsafe(super(SCNGeometry, NSObject))]
2554 #[derive(Debug, PartialEq, Eq, Hash)]
2555 #[cfg(feature = "SCNGeometry")]
2556 pub struct SCNText;
2557);
2558
2559#[cfg(feature = "SCNGeometry")]
2560extern_conformance!(
2561 unsafe impl NSCoding for SCNText {}
2562);
2563
2564#[cfg(feature = "SCNGeometry")]
2565extern_conformance!(
2566 unsafe impl NSCopying for SCNText {}
2567);
2568
2569#[cfg(feature = "SCNGeometry")]
2570unsafe impl CopyingHelper for SCNText {
2571 type Result = Self;
2572}
2573
2574#[cfg(feature = "SCNGeometry")]
2575extern_conformance!(
2576 unsafe impl NSObjectProtocol for SCNText {}
2577);
2578
2579#[cfg(feature = "SCNGeometry")]
2580extern_conformance!(
2581 unsafe impl NSSecureCoding for SCNText {}
2582);
2583
2584#[cfg(all(feature = "SCNAnimation", feature = "SCNGeometry"))]
2585extern_conformance!(
2586 unsafe impl SCNAnimatable for SCNText {}
2587);
2588
2589#[cfg(all(feature = "SCNBoundingVolume", feature = "SCNGeometry"))]
2590extern_conformance!(
2591 unsafe impl SCNBoundingVolume for SCNText {}
2592);
2593
2594#[cfg(all(feature = "SCNGeometry", feature = "SCNShadable"))]
2595extern_conformance!(
2596 unsafe impl SCNShadable for SCNText {}
2597);
2598
2599#[cfg(feature = "SCNGeometry")]
2600impl SCNText {
2601 extern_methods!(
2602 #[cfg(feature = "objc2-core-foundation")]
2603 /// Creates and returns a 3D representation of given text with given extrusion depth.
2604 ///
2605 /// Parameter `string`: The text to be represented.
2606 ///
2607 /// Parameter `extrusionDepth`: The extrusion depth.
2608 #[unsafe(method(textWithString:extrusionDepth:))]
2609 #[unsafe(method_family = none)]
2610 pub unsafe fn textWithString_extrusionDepth(
2611 string: Option<&AnyObject>,
2612 extrusion_depth: CGFloat,
2613 ) -> Retained<Self>;
2614
2615 #[cfg(feature = "objc2-core-foundation")]
2616 /// The extrusion depth. Animatable.
2617 ///
2618 /// If the value is 0, we get a mono-sided, 2D version of the text.
2619 #[unsafe(method(extrusionDepth))]
2620 #[unsafe(method_family = none)]
2621 pub unsafe fn extrusionDepth(&self) -> CGFloat;
2622
2623 #[cfg(feature = "objc2-core-foundation")]
2624 /// Setter for [`extrusionDepth`][Self::extrusionDepth].
2625 #[unsafe(method(setExtrusionDepth:))]
2626 #[unsafe(method_family = none)]
2627 pub unsafe fn setExtrusionDepth(&self, extrusion_depth: CGFloat);
2628
2629 /// The text to be represented. The text must be an instance of NSString or NSAttributedString.
2630 ///
2631 /// The default value is nil.
2632 #[unsafe(method(string))]
2633 #[unsafe(method_family = none)]
2634 pub unsafe fn string(&self) -> Option<Retained<AnyObject>>;
2635
2636 /// Setter for [`string`][Self::string].
2637 #[unsafe(method(setString:))]
2638 #[unsafe(method_family = none)]
2639 pub unsafe fn setString(&self, string: Option<&AnyObject>);
2640
2641 #[cfg(feature = "objc2-app-kit")]
2642 #[cfg(target_os = "macos")]
2643 /// The font used to represent the text.
2644 ///
2645 /// The font property is only used when the string property is not an NSAttributedString. Defaults to the system font (12 point).
2646 #[unsafe(method(font))]
2647 #[unsafe(method_family = none)]
2648 pub unsafe fn font(&self) -> Option<Retained<NSFont>>;
2649
2650 #[cfg(feature = "objc2-app-kit")]
2651 #[cfg(target_os = "macos")]
2652 /// Setter for [`font`][Self::font].
2653 #[unsafe(method(setFont:))]
2654 #[unsafe(method_family = none)]
2655 pub unsafe fn setFont(&self, font: Option<&NSFont>);
2656
2657 /// Determines whether the text is wrapped to fit within the bounds.
2658 ///
2659 /// For the text to be wrapped you first need to set its bounds, otherwise the text is not wrapped. The default value is NO.
2660 #[unsafe(method(isWrapped))]
2661 #[unsafe(method_family = none)]
2662 pub unsafe fn isWrapped(&self) -> bool;
2663
2664 /// Setter for [`isWrapped`][Self::isWrapped].
2665 #[unsafe(method(setWrapped:))]
2666 #[unsafe(method_family = none)]
2667 pub unsafe fn setWrapped(&self, wrapped: bool);
2668
2669 #[cfg(feature = "objc2-core-foundation")]
2670 /// A container within which the text may be wrapped or truncated.
2671 ///
2672 /// The text will start at the top-left corner of the rect. You need to set this property for text truncation or alignment to work. Getting this property when it has never been set returns CGRectZero.
2673 #[unsafe(method(containerFrame))]
2674 #[unsafe(method_family = none)]
2675 pub unsafe fn containerFrame(&self) -> CGRect;
2676
2677 #[cfg(feature = "objc2-core-foundation")]
2678 /// Setter for [`containerFrame`][Self::containerFrame].
2679 #[unsafe(method(setContainerFrame:))]
2680 #[unsafe(method_family = none)]
2681 pub unsafe fn setContainerFrame(&self, container_frame: CGRect);
2682
2683 #[cfg(feature = "objc2-core-foundation")]
2684 /// Returns the bounding box size the receiver occupies.
2685 #[unsafe(method(textSize))]
2686 #[unsafe(method_family = none)]
2687 pub unsafe fn textSize(&self) -> CGSize;
2688
2689 /// Describes how the text is truncated to fit within the bounds.
2690 ///
2691 /// For the text to be truncated you first need to set its bounds, otherwise the text is not truncated. The default value is kCATruncationNone. See truncation modes in CATextLayer.h.
2692 #[unsafe(method(truncationMode))]
2693 #[unsafe(method_family = none)]
2694 pub unsafe fn truncationMode(&self) -> Retained<NSString>;
2695
2696 /// Setter for [`truncationMode`][Self::truncationMode].
2697 #[unsafe(method(setTruncationMode:))]
2698 #[unsafe(method_family = none)]
2699 pub unsafe fn setTruncationMode(&self, truncation_mode: &NSString);
2700
2701 /// Determines how individual lines of text are horizontally aligned within the bounds.
2702 ///
2703 /// For the text to be aligned you first need to set its bounds, otherwise the text is not aligned. The default value is kCAAlignmentNatural. See alignments in CATextLayer.h.
2704 #[unsafe(method(alignmentMode))]
2705 #[unsafe(method_family = none)]
2706 pub unsafe fn alignmentMode(&self) -> Retained<NSString>;
2707
2708 /// Setter for [`alignmentMode`][Self::alignmentMode].
2709 #[unsafe(method(setAlignmentMode:))]
2710 #[unsafe(method_family = none)]
2711 pub unsafe fn setAlignmentMode(&self, alignment_mode: &NSString);
2712
2713 #[cfg(feature = "objc2-core-foundation")]
2714 /// The chamfer radius. Animatable.
2715 ///
2716 /// Values are clamped to the range [0, extrusionDepth / 2]. The actual chamfer radius might be different to the one here specified: large values are clipped to a per-glyph max value. The default value is 0.
2717 #[unsafe(method(chamferRadius))]
2718 #[unsafe(method_family = none)]
2719 pub unsafe fn chamferRadius(&self) -> CGFloat;
2720
2721 #[cfg(feature = "objc2-core-foundation")]
2722 /// Setter for [`chamferRadius`][Self::chamferRadius].
2723 #[unsafe(method(setChamferRadius:))]
2724 #[unsafe(method_family = none)]
2725 pub unsafe fn setChamferRadius(&self, chamfer_radius: CGFloat);
2726
2727 /// The number of chamfer subdivisions. Animatable.
2728 ///
2729 /// If the value is less than 1, the behavior is undefined. The default value is 10.
2730 #[deprecated = "Use SCNText.chamferProfile instead"]
2731 #[unsafe(method(chamferSegmentCount))]
2732 #[unsafe(method_family = none)]
2733 pub unsafe fn chamferSegmentCount(&self) -> NSInteger;
2734
2735 /// Setter for [`chamferSegmentCount`][Self::chamferSegmentCount].
2736 #[deprecated = "Use SCNText.chamferProfile instead"]
2737 #[unsafe(method(setChamferSegmentCount:))]
2738 #[unsafe(method_family = none)]
2739 pub unsafe fn setChamferSegmentCount(&self, chamfer_segment_count: NSInteger);
2740
2741 #[cfg(feature = "objc2-app-kit")]
2742 #[cfg(target_os = "macos")]
2743 /// Describes the profile used to when "chamferRadius" is not nil. When "chamferProfile" is nil we fallback on a path representing a quadrant.
2744 ///
2745 /// The profile should be a 2D curve beginning at (0,1) and ending at (1,0). The "flatness" property is also used to flatten this path. The default value is nil.
2746 #[unsafe(method(chamferProfile))]
2747 #[unsafe(method_family = none)]
2748 pub unsafe fn chamferProfile(&self) -> Option<Retained<NSBezierPath>>;
2749
2750 #[cfg(feature = "objc2-app-kit")]
2751 #[cfg(target_os = "macos")]
2752 /// Setter for [`chamferProfile`][Self::chamferProfile].
2753 #[unsafe(method(setChamferProfile:))]
2754 #[unsafe(method_family = none)]
2755 pub unsafe fn setChamferProfile(&self, chamfer_profile: Option<&NSBezierPath>);
2756
2757 #[cfg(feature = "objc2-core-foundation")]
2758 /// Specifies the accuracy (or smoothness) with which fonts are rendered.
2759 ///
2760 /// Smaller numbers give smoother curves at the expense of more computation and heavier geometries in terms of vertices. The default value is 0.6, which yields smooth curves.
2761 #[unsafe(method(flatness))]
2762 #[unsafe(method_family = none)]
2763 pub unsafe fn flatness(&self) -> CGFloat;
2764
2765 #[cfg(feature = "objc2-core-foundation")]
2766 /// Setter for [`flatness`][Self::flatness].
2767 #[unsafe(method(setFlatness:))]
2768 #[unsafe(method_family = none)]
2769 pub unsafe fn setFlatness(&self, flatness: CGFloat);
2770 );
2771}
2772
2773/// Methods declared on superclass `SCNGeometry`.
2774#[cfg(feature = "SCNGeometry")]
2775impl SCNText {
2776 extern_methods!(
2777 /// Creates and returns an empty geometry object.
2778 ///
2779 /// An empty geometry may be used as the lowest level of detail of a geometry.
2780 #[unsafe(method(geometry))]
2781 #[unsafe(method_family = none)]
2782 pub unsafe fn geometry() -> Retained<Self>;
2783
2784 /// Creates and returns a new geometry built from geometry sources and geometry elements.
2785 ///
2786 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
2787 ///
2788 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
2789 ///
2790 /// A geometry is made of geometry sources (at least `SCNGeometrySourceSemanticVertex`) and at least one geometry element. Multiple sources for texture coordinates are accepted. In that case the `mappingChannel` is implicitly set based on the order of the texture sources, starting at index 0.
2791 #[unsafe(method(geometryWithSources:elements:))]
2792 #[unsafe(method_family = none)]
2793 pub unsafe fn geometryWithSources_elements(
2794 sources: &NSArray<SCNGeometrySource>,
2795 elements: Option<&NSArray<SCNGeometryElement>>,
2796 ) -> Retained<Self>;
2797
2798 /// Creates and returns a new geometry built from geometry sources and geometry elements, with per-source indexed geometry data.
2799 ///
2800 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
2801 ///
2802 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
2803 ///
2804 /// Parameter `sourceChannels`: An array of indices that describes, for each geometry source, which channel of the geometry elements to use.
2805 ///
2806 /// ```text
2807 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using different indices to reference position and UV data (2 channels)
2808 ///
2809 /// Positions ┆ POS0 POS3 POS4 ┆ quad quad pentagon quad quad pentagon ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
2810 /// 0 │ (0.0, 0.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌─────┐ ┌─────┐ ┌───────┐ ┌─────┐ ┌─────┐ ┌───────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
2811 /// 1 │ (0.0, 1.0, 0.0) ┆ │UV0 UV3│UV0 UV3│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 0 1 2 3 2 3 0 1 1 2 3 4 0 ┆ primitiveCount:3
2812 /// 2 │ (1.0, 0.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────┘ └───────────────────────┘ ┆ indicesChannelCount:2
2813 /// 3 │ (1.0, 1.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 channel 1 ┆ interleavedIndicesChannels:…
2814 /// 4 │ (2.0, 0.0, 0.0) ┆ │ │ │ ┆ (positions) (UVs) ┆ bytesPerIndex:…];
2815 /// 5 │ (2.0, 1.0, 0.0) ┆ │UV1 UV2│UV1 UV2│ ┆ ┆
2816 /// 6 │ (2.0, 2.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
2817 /// @
2818 /// [positionSource, texcoordsSource]
2819 /// 7 │ (0.0, 2.0, 0.0) ┆ │UVO UV4 UV3│ ┆ ┆ elements:
2820 /// @
2821 /// [element]
2822 /// ┆ │ POS2 │ ┆ quad A quad B pentagon C ┆ sourceChannels:
2823 /// @
2824 /// [0, 1]];
2825 /// UVs ┆ │ │ ┆ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ ┆
2826 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ 4 4 5 0 0 1 1 2 2 3 3 5 2 4 3 3 0 2 1 7 1 6 2 5 3 2 4 1 0 ┆
2827 /// 1 │ (0.0, 1.0) ┆ │ │ ┆ └───┘└──────────────────────────────────────────────────┘ ┆
2828 /// 2 │ (1.0, 1.0) ┆ │UV1 UV2│ ┆ polygons interleaved channels ┆
2829 /// 3 │ (1.0, 0.0) ┆ └───────────────────────┘ ┆ (positions and UVs) ┆
2830 /// 4 │ (0.5, 0.0) ┆ POS7 POS6 ┆ ┆
2831 ///
2832 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using the same indices to reference position and UV data (1 channel)
2833 ///
2834 /// Positions ┆ POS0 POS3 POS4 ┆ quad A quad B pentagon C ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
2835 /// 0 │ (0.0, 4.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌────────┐ ┌────────┐ ┌───────────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
2836 /// 1 │ (0.0, 2.0, 0.0) ┆ │UV0 UV3│UV3 UV4│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 ┆ primitiveCount:3
2837 /// 2 │ (2.0, 2.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────────────────┘ ┆ bytesPerIndex:…];
2838 /// 3 │ (2.0, 4.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 ┆
2839 /// 4 │ (4.0, 4.0, 0.0) ┆ │ │ │ ┆ (positions and UVs) ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
2840 /// @
2841 /// [positionSource, texcoordsSource]
2842 /// 5 │ (4.0, 2.0, 0.0) ┆ │UV1 UV2│UV2 UV5│ ┆ ┆ elements:
2843 /// @
2844 /// [element]];
2845 /// 6 │ (4.0, 0.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆
2846 /// 7 │ (0.0, 0.0, 0.0) ┆ │UV1 UV2 UV5│ ┆ ┆ === or equivalently ===
2847 /// ┆ │ POS2 │ ┆ ┆
2848 /// UVs ┆ │ │ ┆ ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
2849 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
2850 /// 1 │ (0.0, 0.5) ┆ │ │ ┆ ┆ primitiveCount:3
2851 /// 2 │ (0.5, 0.5) ┆ │UV7 UV6│ ┆ ┆ indicesChannelCount:1
2852 /// 3 │ (0.5, 0.0) ┆ └───────────────────────┘ ┆ ┆ interleavedIndicesChannels:…
2853 /// 4 │ (1.0, 0.0) ┆ POS7 POS6 ┆ ┆ bytesPerIndex:…];
2854 /// 5 │ (1.0, 0.5) ┆ ┆ ┆
2855 /// 6 │ (1.0, 1.0) ┆ ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
2856 /// @
2857 /// [positionSource, texcoordsSource]
2858 /// 7 │ (0.0, 1.0) ┆ ┆ ┆ elements:
2859 /// @
2860 /// [element]
2861 /// ┆ ┆ ┆ sourceChannels:
2862 /// @
2863 /// [0, 0]]; ┆
2864 /// ```
2865 #[unsafe(method(geometryWithSources:elements:sourceChannels:))]
2866 #[unsafe(method_family = none)]
2867 pub unsafe fn geometryWithSources_elements_sourceChannels(
2868 sources: &NSArray<SCNGeometrySource>,
2869 elements: Option<&NSArray<SCNGeometryElement>>,
2870 source_channels: Option<&NSArray<NSNumber>>,
2871 ) -> Retained<Self>;
2872 );
2873}
2874
2875/// Methods declared on superclass `NSObject`.
2876#[cfg(feature = "SCNGeometry")]
2877impl SCNText {
2878 extern_methods!(
2879 #[unsafe(method(init))]
2880 #[unsafe(method_family = init)]
2881 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2882
2883 #[unsafe(method(new))]
2884 #[unsafe(method_family = new)]
2885 pub unsafe fn new() -> Retained<Self>;
2886 );
2887}
2888
2889/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnchamfermode?language=objc)
2890// NS_ENUM
2891#[repr(transparent)]
2892#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2893pub struct SCNChamferMode(pub NSInteger);
2894impl SCNChamferMode {
2895 #[doc(alias = "SCNChamferModeBoth")]
2896 pub const Both: Self = Self(0);
2897 #[doc(alias = "SCNChamferModeFront")]
2898 pub const Front: Self = Self(1);
2899 #[doc(alias = "SCNChamferModeBack")]
2900 pub const Back: Self = Self(2);
2901}
2902
2903unsafe impl Encode for SCNChamferMode {
2904 const ENCODING: Encoding = NSInteger::ENCODING;
2905}
2906
2907unsafe impl RefEncode for SCNChamferMode {
2908 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2909}
2910
2911extern_class!(
2912 /// SCNShape represents a 2D shape (cubic Bezier spline) than can be extruded.
2913 ///
2914 /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnshape?language=objc)
2915 #[unsafe(super(SCNGeometry, NSObject))]
2916 #[derive(Debug, PartialEq, Eq, Hash)]
2917 #[cfg(feature = "SCNGeometry")]
2918 pub struct SCNShape;
2919);
2920
2921#[cfg(feature = "SCNGeometry")]
2922extern_conformance!(
2923 unsafe impl NSCoding for SCNShape {}
2924);
2925
2926#[cfg(feature = "SCNGeometry")]
2927extern_conformance!(
2928 unsafe impl NSCopying for SCNShape {}
2929);
2930
2931#[cfg(feature = "SCNGeometry")]
2932unsafe impl CopyingHelper for SCNShape {
2933 type Result = Self;
2934}
2935
2936#[cfg(feature = "SCNGeometry")]
2937extern_conformance!(
2938 unsafe impl NSObjectProtocol for SCNShape {}
2939);
2940
2941#[cfg(feature = "SCNGeometry")]
2942extern_conformance!(
2943 unsafe impl NSSecureCoding for SCNShape {}
2944);
2945
2946#[cfg(all(feature = "SCNAnimation", feature = "SCNGeometry"))]
2947extern_conformance!(
2948 unsafe impl SCNAnimatable for SCNShape {}
2949);
2950
2951#[cfg(all(feature = "SCNBoundingVolume", feature = "SCNGeometry"))]
2952extern_conformance!(
2953 unsafe impl SCNBoundingVolume for SCNShape {}
2954);
2955
2956#[cfg(all(feature = "SCNGeometry", feature = "SCNShadable"))]
2957extern_conformance!(
2958 unsafe impl SCNShadable for SCNShape {}
2959);
2960
2961#[cfg(feature = "SCNGeometry")]
2962impl SCNShape {
2963 extern_methods!(
2964 #[cfg(all(feature = "objc2-app-kit", feature = "objc2-core-foundation"))]
2965 #[cfg(target_os = "macos")]
2966 /// Creates and returns a 3D representation of the given shape with the given extrusion depth.
2967 ///
2968 /// Parameter `path`: The cubic Bezier spline to extrude.
2969 ///
2970 /// Parameter `extrusionDepth`: The extrusion depth.
2971 #[unsafe(method(shapeWithPath:extrusionDepth:))]
2972 #[unsafe(method_family = none)]
2973 pub unsafe fn shapeWithPath_extrusionDepth(
2974 path: Option<&NSBezierPath>,
2975 extrusion_depth: CGFloat,
2976 ) -> Retained<Self>;
2977
2978 #[cfg(feature = "objc2-app-kit")]
2979 #[cfg(target_os = "macos")]
2980 /// The path defining the shape to be rendered.
2981 ///
2982 /// The path defines the outline of the shape. The path is filled using the even-odd rule. If the path is self-intersecting, the behavior is undefined.
2983 #[unsafe(method(path))]
2984 #[unsafe(method_family = none)]
2985 pub unsafe fn path(&self) -> Option<Retained<NSBezierPath>>;
2986
2987 #[cfg(feature = "objc2-app-kit")]
2988 #[cfg(target_os = "macos")]
2989 /// Setter for [`path`][Self::path].
2990 #[unsafe(method(setPath:))]
2991 #[unsafe(method_family = none)]
2992 pub unsafe fn setPath(&self, path: Option<&NSBezierPath>);
2993
2994 #[cfg(feature = "objc2-core-foundation")]
2995 /// The extrusion depth. Animatable.
2996 ///
2997 /// If the value is 0, we get a mono-sided, 2D version of the shape.
2998 #[unsafe(method(extrusionDepth))]
2999 #[unsafe(method_family = none)]
3000 pub unsafe fn extrusionDepth(&self) -> CGFloat;
3001
3002 #[cfg(feature = "objc2-core-foundation")]
3003 /// Setter for [`extrusionDepth`][Self::extrusionDepth].
3004 #[unsafe(method(setExtrusionDepth:))]
3005 #[unsafe(method_family = none)]
3006 pub unsafe fn setExtrusionDepth(&self, extrusion_depth: CGFloat);
3007
3008 /// The sides of the text that are chamfered.
3009 ///
3010 /// The default value is SCNChamferModeBoth.
3011 #[unsafe(method(chamferMode))]
3012 #[unsafe(method_family = none)]
3013 pub unsafe fn chamferMode(&self) -> SCNChamferMode;
3014
3015 /// Setter for [`chamferMode`][Self::chamferMode].
3016 #[unsafe(method(setChamferMode:))]
3017 #[unsafe(method_family = none)]
3018 pub unsafe fn setChamferMode(&self, chamfer_mode: SCNChamferMode);
3019
3020 #[cfg(feature = "objc2-core-foundation")]
3021 /// The chamfer radius. Animatable.
3022 ///
3023 /// Values are clamped to the range [0, extrusionDepth / 2]. The default value is 0.
3024 #[unsafe(method(chamferRadius))]
3025 #[unsafe(method_family = none)]
3026 pub unsafe fn chamferRadius(&self) -> CGFloat;
3027
3028 #[cfg(feature = "objc2-core-foundation")]
3029 /// Setter for [`chamferRadius`][Self::chamferRadius].
3030 #[unsafe(method(setChamferRadius:))]
3031 #[unsafe(method_family = none)]
3032 pub unsafe fn setChamferRadius(&self, chamfer_radius: CGFloat);
3033
3034 #[cfg(feature = "objc2-app-kit")]
3035 #[cfg(target_os = "macos")]
3036 /// Describes the profile used to when "chamferRadius" is not nil. When "chamferProfile" is nil we fallback on a path representing a quadrant.
3037 ///
3038 /// The profile should be a 2D curve beginning at (0,1) and ending at (1,0). The "flatness" property is also used to flatten this path. The default value is nil.
3039 #[unsafe(method(chamferProfile))]
3040 #[unsafe(method_family = none)]
3041 pub unsafe fn chamferProfile(&self) -> Option<Retained<NSBezierPath>>;
3042
3043 #[cfg(feature = "objc2-app-kit")]
3044 #[cfg(target_os = "macos")]
3045 /// Setter for [`chamferProfile`][Self::chamferProfile].
3046 #[unsafe(method(setChamferProfile:))]
3047 #[unsafe(method_family = none)]
3048 pub unsafe fn setChamferProfile(&self, chamfer_profile: Option<&NSBezierPath>);
3049 );
3050}
3051
3052/// Methods declared on superclass `SCNGeometry`.
3053#[cfg(feature = "SCNGeometry")]
3054impl SCNShape {
3055 extern_methods!(
3056 /// Creates and returns an empty geometry object.
3057 ///
3058 /// An empty geometry may be used as the lowest level of detail of a geometry.
3059 #[unsafe(method(geometry))]
3060 #[unsafe(method_family = none)]
3061 pub unsafe fn geometry() -> Retained<Self>;
3062
3063 /// Creates and returns a new geometry built from geometry sources and geometry elements.
3064 ///
3065 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
3066 ///
3067 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
3068 ///
3069 /// A geometry is made of geometry sources (at least `SCNGeometrySourceSemanticVertex`) and at least one geometry element. Multiple sources for texture coordinates are accepted. In that case the `mappingChannel` is implicitly set based on the order of the texture sources, starting at index 0.
3070 #[unsafe(method(geometryWithSources:elements:))]
3071 #[unsafe(method_family = none)]
3072 pub unsafe fn geometryWithSources_elements(
3073 sources: &NSArray<SCNGeometrySource>,
3074 elements: Option<&NSArray<SCNGeometryElement>>,
3075 ) -> Retained<Self>;
3076
3077 /// Creates and returns a new geometry built from geometry sources and geometry elements, with per-source indexed geometry data.
3078 ///
3079 /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
3080 ///
3081 /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
3082 ///
3083 /// Parameter `sourceChannels`: An array of indices that describes, for each geometry source, which channel of the geometry elements to use.
3084 ///
3085 /// ```text
3086 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using different indices to reference position and UV data (2 channels)
3087 ///
3088 /// Positions ┆ POS0 POS3 POS4 ┆ quad quad pentagon quad quad pentagon ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
3089 /// 0 │ (0.0, 0.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌─────┐ ┌─────┐ ┌───────┐ ┌─────┐ ┌─────┐ ┌───────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
3090 /// 1 │ (0.0, 1.0, 0.0) ┆ │UV0 UV3│UV0 UV3│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 0 1 2 3 2 3 0 1 1 2 3 4 0 ┆ primitiveCount:3
3091 /// 2 │ (1.0, 0.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────┘ └───────────────────────┘ ┆ indicesChannelCount:2
3092 /// 3 │ (1.0, 1.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 channel 1 ┆ interleavedIndicesChannels:…
3093 /// 4 │ (2.0, 0.0, 0.0) ┆ │ │ │ ┆ (positions) (UVs) ┆ bytesPerIndex:…];
3094 /// 5 │ (2.0, 1.0, 0.0) ┆ │UV1 UV2│UV1 UV2│ ┆ ┆
3095 /// 6 │ (2.0, 2.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
3096 /// @
3097 /// [positionSource, texcoordsSource]
3098 /// 7 │ (0.0, 2.0, 0.0) ┆ │UVO UV4 UV3│ ┆ ┆ elements:
3099 /// @
3100 /// [element]
3101 /// ┆ │ POS2 │ ┆ quad A quad B pentagon C ┆ sourceChannels:
3102 /// @
3103 /// [0, 1]];
3104 /// UVs ┆ │ │ ┆ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ ┆
3105 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ 4 4 5 0 0 1 1 2 2 3 3 5 2 4 3 3 0 2 1 7 1 6 2 5 3 2 4 1 0 ┆
3106 /// 1 │ (0.0, 1.0) ┆ │ │ ┆ └───┘└──────────────────────────────────────────────────┘ ┆
3107 /// 2 │ (1.0, 1.0) ┆ │UV1 UV2│ ┆ polygons interleaved channels ┆
3108 /// 3 │ (1.0, 0.0) ┆ └───────────────────────┘ ┆ (positions and UVs) ┆
3109 /// 4 │ (0.5, 0.0) ┆ POS7 POS6 ┆ ┆
3110 ///
3111 /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using the same indices to reference position and UV data (1 channel)
3112 ///
3113 /// Positions ┆ POS0 POS3 POS4 ┆ quad A quad B pentagon C ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
3114 /// 0 │ (0.0, 4.0, 0.0) ┆ ┌───────────┬───────────┐ ┆ ┌────────┐ ┌────────┐ ┌───────────┐ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
3115 /// 1 │ (0.0, 2.0, 0.0) ┆ │UV0 UV3│UV3 UV4│ ┆ 4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 ┆ primitiveCount:3
3116 /// 2 │ (2.0, 2.0, 0.0) ┆ │ │ │ ┆ └───┘ └───────────────────────────────────┘ ┆ bytesPerIndex:…];
3117 /// 3 │ (2.0, 4.0, 0.0) ┆ │ A │ B │ ┆ polygons channel 0 ┆
3118 /// 4 │ (4.0, 4.0, 0.0) ┆ │ │ │ ┆ (positions and UVs) ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
3119 /// @
3120 /// [positionSource, texcoordsSource]
3121 /// 5 │ (4.0, 2.0, 0.0) ┆ │UV1 UV2│UV2 UV5│ ┆ ┆ elements:
3122 /// @
3123 /// [element]];
3124 /// 6 │ (4.0, 0.0, 0.0) ┆ POS1 ├───────────┴───────────┤ POS5 ┆ ┆
3125 /// 7 │ (0.0, 0.0, 0.0) ┆ │UV1 UV2 UV5│ ┆ ┆ === or equivalently ===
3126 /// ┆ │ POS2 │ ┆ ┆
3127 /// UVs ┆ │ │ ┆ ┆ SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
3128 /// 0 │ (0.0, 0.0) ┆ │ C │ ┆ ┆ primitiveType:SCNGeometryPrimitiveTypePolygon
3129 /// 1 │ (0.0, 0.5) ┆ │ │ ┆ ┆ primitiveCount:3
3130 /// 2 │ (0.5, 0.5) ┆ │UV7 UV6│ ┆ ┆ indicesChannelCount:1
3131 /// 3 │ (0.5, 0.0) ┆ └───────────────────────┘ ┆ ┆ interleavedIndicesChannels:…
3132 /// 4 │ (1.0, 0.0) ┆ POS7 POS6 ┆ ┆ bytesPerIndex:…];
3133 /// 5 │ (1.0, 0.5) ┆ ┆ ┆
3134 /// 6 │ (1.0, 1.0) ┆ ┆ ┆ SCNGeometry *geometry = [SCNGeometry geometryWithSources:
3135 /// @
3136 /// [positionSource, texcoordsSource]
3137 /// 7 │ (0.0, 1.0) ┆ ┆ ┆ elements:
3138 /// @
3139 /// [element]
3140 /// ┆ ┆ ┆ sourceChannels:
3141 /// @
3142 /// [0, 0]]; ┆
3143 /// ```
3144 #[unsafe(method(geometryWithSources:elements:sourceChannels:))]
3145 #[unsafe(method_family = none)]
3146 pub unsafe fn geometryWithSources_elements_sourceChannels(
3147 sources: &NSArray<SCNGeometrySource>,
3148 elements: Option<&NSArray<SCNGeometryElement>>,
3149 source_channels: Option<&NSArray<NSNumber>>,
3150 ) -> Retained<Self>;
3151 );
3152}
3153
3154/// Methods declared on superclass `NSObject`.
3155#[cfg(feature = "SCNGeometry")]
3156impl SCNShape {
3157 extern_methods!(
3158 #[unsafe(method(init))]
3159 #[unsafe(method_family = init)]
3160 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3161
3162 #[unsafe(method(new))]
3163 #[unsafe(method_family = new)]
3164 pub unsafe fn new() -> Retained<Self>;
3165 );
3166}