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