objc2_phase/generated/PHASEShape.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::*;
6use objc2_foundation::*;
7#[cfg(feature = "objc2-model-io")]
8use objc2_model_io::*;
9
10use crate::*;
11
12extern_class!(
13 /// *************************************************************************************************
14 ///
15 ///
16 ///
17 /// A single element within a shape. The attached material defines its acoustical properties.
18 ///
19 /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phaseshapeelement?language=objc)
20 #[unsafe(super(NSObject))]
21 #[derive(Debug, PartialEq, Eq, Hash)]
22 pub struct PHASEShapeElement;
23);
24
25extern_conformance!(
26 unsafe impl NSObjectProtocol for PHASEShapeElement {}
27);
28
29impl PHASEShapeElement {
30 extern_methods!(
31 #[unsafe(method(init))]
32 #[unsafe(method_family = init)]
33 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
34
35 #[unsafe(method(new))]
36 #[unsafe(method_family = new)]
37 pub unsafe fn new() -> Retained<Self>;
38
39 #[cfg(feature = "PHASEMaterial")]
40 /// The shape's material defines the acoustical properties of this element.
41 #[unsafe(method(material))]
42 #[unsafe(method_family = none)]
43 pub unsafe fn material(&self) -> Option<Retained<PHASEMaterial>>;
44
45 #[cfg(feature = "PHASEMaterial")]
46 /// Setter for [`material`][Self::material].
47 #[unsafe(method(setMaterial:))]
48 #[unsafe(method_family = none)]
49 pub unsafe fn setMaterial(&self, material: Option<&PHASEMaterial>);
50 );
51}
52
53extern_class!(
54 /// *************************************************************************************************
55 ///
56 ///
57 ///
58 /// The physical representation of an object within the simulated acoustic scene.
59 ///
60 /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phaseshape?language=objc)
61 #[unsafe(super(NSObject))]
62 #[derive(Debug, PartialEq, Eq, Hash)]
63 pub struct PHASEShape;
64);
65
66extern_conformance!(
67 unsafe impl NSCopying for PHASEShape {}
68);
69
70unsafe impl CopyingHelper for PHASEShape {
71 type Result = Self;
72}
73
74extern_conformance!(
75 unsafe impl NSObjectProtocol for PHASEShape {}
76);
77
78impl PHASEShape {
79 extern_methods!(
80 #[unsafe(method(init))]
81 #[unsafe(method_family = init)]
82 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
83
84 #[unsafe(method(new))]
85 #[unsafe(method_family = new)]
86 pub unsafe fn new() -> Retained<Self>;
87
88 #[cfg(all(feature = "PHASEEngine", feature = "objc2-model-io"))]
89 /// Initialize a shape from a mesh.
90 ///
91 /// One PHASEShapeElement will be created for every submesh within the mesh.
92 ///
93 /// Note: A single shape can be used to create multiple instances of sources and occluders.
94 /// For example, a client could create a single shape for a window, then create multiple occluders from it.
95 /// The same can be done with with sources.
96 ///
97 /// Parameter `engine`: The engine this shape will be used with.
98 ///
99 /// Parameter `mesh`: A Model I/O mesh object.
100 ///
101 /// Returns: A new shape object
102 #[unsafe(method(initWithEngine:mesh:))]
103 #[unsafe(method_family = init)]
104 pub unsafe fn initWithEngine_mesh(
105 this: Allocated<Self>,
106 engine: &PHASEEngine,
107 mesh: &MDLMesh,
108 ) -> Retained<Self>;
109
110 #[cfg(all(
111 feature = "PHASEEngine",
112 feature = "PHASEMaterial",
113 feature = "objc2-model-io"
114 ))]
115 /// Initialize a shape from an MDLMesh and a list of materials
116 ///
117 /// Parameter `engine`: The engine this shape will be used with
118 ///
119 /// Parameter `mesh`: A Model I/O mesh object.
120 ///
121 /// Parameter `materials`: An array of PHASEMaterial objects that overrides any acoustical materials within the mesh object
122 ///
123 /// Returns: A new shape object
124 ///
125 /// The materials array cannot be empty and cannot contain nil entries, otherwise an exception is thrown.
126 /// If the number of submeshes within the mesh are less than or equal to the size of the material array, the material will be assigned
127 /// to the corresponding element. If the number of submeshes within the mesh is greater than the size of the material array, the material
128 /// assigned to the element will be the index of the element modulo the number of materials. IE: given a mesh with 6 submeshes and an array
129 /// of 3 materials, the element at index 5 will be assigned the material at index: 5 % 3 = 2.
130 #[unsafe(method(initWithEngine:mesh:materials:))]
131 #[unsafe(method_family = init)]
132 pub unsafe fn initWithEngine_mesh_materials(
133 this: Allocated<Self>,
134 engine: &PHASEEngine,
135 mesh: &MDLMesh,
136 materials: &NSArray<PHASEMaterial>,
137 ) -> Retained<Self>;
138
139 /// List of all the shape elements associated with this shape.
140 #[unsafe(method(elements))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn elements(&self) -> Retained<NSArray<PHASEShapeElement>>;
143 );
144}