1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// Voxel data represented on a three dimensional grid. Voxel data can
/// include voxels considered to be on the surface of an object, and a
/// series of shells on the outside and inside of the surface.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlvoxelarray?language=objc)
#[unsafe(super(MDLObject, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "MDLObject")]
pub struct MDLVoxelArray;
);
#[cfg(all(feature = "MDLObject", feature = "MDLTypes"))]
extern_conformance!(
unsafe impl MDLNamed for MDLVoxelArray {}
);
#[cfg(feature = "MDLObject")]
extern_conformance!(
unsafe impl NSObjectProtocol for MDLVoxelArray {}
);
#[cfg(feature = "MDLObject")]
impl MDLVoxelArray {
extern_methods!(
#[cfg(feature = "MDLAsset")]
/// Initialize a voxel grid from an MDLAsset. Attempts to create a closed volume
/// model by applying "patches" of radius patchRadius to any holes found in the
/// orginal mesh. Choose a patch radius that will be large enough to fill in the largest
/// hole in the model.
#[unsafe(method(initWithAsset:divisions:patchRadius:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithAsset_divisions_patchRadius(
this: Allocated<Self>,
asset: &MDLAsset,
divisions: c_int,
patch_radius: c_float,
) -> Retained<Self>;
#[cfg(feature = "MDLAsset")]
/// Initialize a voxel grid from an MDLAsset and dilate the resulting voxels by
/// a number of interior and exterior shells.
/// Routine will attempt to create a closed volume model by applying patches of
/// a given radius to any holes it may find in the asset.
///
///
/// Parameter `divisions`: The number of divisions to divide the vertical extent of the
/// model by.
///
/// Parameter `interiorShells`: The number of shells to compute inside the surface shell
///
/// Parameter `exteriorShells`: The number of shells to compute outside the surface shell
///
/// Parameter `patchRadius`: The radius of the largest model mending patch in world space units
#[deprecated]
#[unsafe(method(initWithAsset:divisions:interiorShells:exteriorShells:patchRadius:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithAsset_divisions_interiorShells_exteriorShells_patchRadius(
this: Allocated<Self>,
asset: &MDLAsset,
divisions: c_int,
interior_shells: c_int,
exterior_shells: c_int,
patch_radius: c_float,
) -> Retained<Self>;
#[cfg(feature = "MDLAsset")]
/// Initialize a voxel grid from an MDLAsset and dilate the resulting voxels by
/// a spatial distance in the interior and exterior directions.
/// Routine will attempt to create a closed volume model by applying "patches" of
/// a given radius to any holes it may find in the asset.
///
///
/// Parameter `divisions`: The number of divisions to divide the vertical extent of the
/// model by.
///
/// Parameter `interiorNBWidth`: The interior narrow band width in world space units
///
/// Parameter `exteriorNBWidth`: The exterior narrow band width in world space units
///
/// Parameter `patchRadius`: The radius of the largest model mending patch in world space units
#[deprecated]
#[unsafe(method(initWithAsset:divisions:interiorNBWidth:exteriorNBWidth:patchRadius:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithAsset_divisions_interiorNBWidth_exteriorNBWidth_patchRadius(
this: Allocated<Self>,
asset: &MDLAsset,
divisions: c_int,
interior_nb_width: c_float,
exterior_nb_width: c_float,
patch_radius: c_float,
) -> Retained<Self>;
/// The number of voxels in the grid
#[unsafe(method(count))]
#[unsafe(method_family = none)]
pub unsafe fn count(&self) -> NSUInteger;
/// Returns an NSData containing the indices of all voxels in the voxel grid
#[unsafe(method(voxelIndices))]
#[unsafe(method_family = none)]
pub unsafe fn voxelIndices(&self) -> Option<Retained<NSData>>;
#[cfg(feature = "MDLMesh")]
/// Set voxels corresponding to a mesh.
/// Routine will attempt to create a closed volume model by applying "patches" of
/// a given radius to any holes it may find in the mesh.
#[unsafe(method(setVoxelsForMesh:divisions:patchRadius:))]
#[unsafe(method_family = none)]
pub unsafe fn setVoxelsForMesh_divisions_patchRadius(
&self,
mesh: &MDLMesh,
divisions: c_int,
patch_radius: c_float,
);
#[cfg(feature = "MDLMesh")]
/// Set voxels corresponding to a mesh
/// Routine will attempt to create a closed volume model by applying "patches" of
/// a given radius to any holes it may find in the mesh.
///
///
/// Parameter `divisions`: The number of divisions to divide the vertical extent of the
/// model by.
///
/// Parameter `interiorShells`: The number of shells to compute inside the surface shell
///
/// Parameter `exteriorShells`: The number of shells to compute outside the surface shell
///
/// Parameter `patchRadius`: The radius of the largest model mending patch in world space units
#[deprecated]
#[unsafe(method(setVoxelsForMesh:divisions:interiorShells:exteriorShells:patchRadius:))]
#[unsafe(method_family = none)]
pub unsafe fn setVoxelsForMesh_divisions_interiorShells_exteriorShells_patchRadius(
&self,
mesh: &MDLMesh,
divisions: c_int,
interior_shells: c_int,
exterior_shells: c_int,
patch_radius: c_float,
);
#[cfg(feature = "MDLMesh")]
/// Set voxels corresponding to a mesh
/// Routine will attempt to create a closed volume model by applying "patches" of
/// a given radius to any holes it may find in the mesh.
///
///
/// Parameter `divisions`: The number of divisions to divide the vertical extent of the
/// model by.
///
/// Parameter `interiorNBWidth`: The interior narrow band width in world space units
///
/// Parameter `exteriorNBWidth`: The exterior narrow band width in world space units
///
/// Parameter `patchRadius`: The radius of the largest model mending patch in world space units
#[deprecated]
#[unsafe(method(setVoxelsForMesh:divisions:interiorNBWidth:exteriorNBWidth:patchRadius:))]
#[unsafe(method_family = none)]
pub unsafe fn setVoxelsForMesh_divisions_interiorNBWidth_exteriorNBWidth_patchRadius(
&self,
mesh: &MDLMesh,
divisions: c_int,
interior_nb_width: c_float,
exterior_nb_width: c_float,
patch_radius: c_float,
);
/// Union modifies the voxel grid to be the merger with the supplied voxel grid.
/// It is assumed that the spatial voxel extent of one voxel in the supplied grid is the same as that of the voxel grid.
/// Note that the shell level data will be cleared.
#[unsafe(method(unionWithVoxels:))]
#[unsafe(method_family = none)]
pub unsafe fn unionWithVoxels(&self, voxels: &MDLVoxelArray);
/// Intersection modifies the voxel grid so that only voxels that are also in the supplied voxel grid are retained.
/// It is assumed that the spatial voxel extent of one voxel in the supplied grid is the same as that of the voxel grid.
/// Note that the shell level data will be cleared.
#[unsafe(method(intersectWithVoxels:))]
#[unsafe(method_family = none)]
pub unsafe fn intersectWithVoxels(&self, voxels: &MDLVoxelArray);
/// Difference modifies the voxel grid so that voxels also in the supplied voxel grid are removed.
/// It is assumed that the spatial voxel extent of one voxel in the supplied grid is the same as that of the voxel grid.
/// Note that the shell level data will be cleared.
#[unsafe(method(differenceWithVoxels:))]
#[unsafe(method_family = none)]
pub unsafe fn differenceWithVoxels(&self, voxels: &MDLVoxelArray);
/// Converts volume grid into a signed shell field by surrounding the surface voxels, which have shell
/// level values of zero, by an inner layer of voxels with shell level values of negative one and an
/// outer layer of voxels with shell level values of positive one.
///
/// The volume model must be closed in order to generate a signed shell field.
#[unsafe(method(convertToSignedShellField))]
#[unsafe(method_family = none)]
pub unsafe fn convertToSignedShellField(&self);
/// Returns whether or not the volume grid is in a valid signed shell field form.
///
/// This property will be set to YES after calling generateSignedShellField. All other
/// methods that modify the voxel grid will cause this property to be set to NO. Setting
/// shellFieldInteriorThickness and shellFieldExteriorThickness will not affect the value
/// of this property.
#[unsafe(method(isValidSignedShellField))]
#[unsafe(method_family = none)]
pub unsafe fn isValidSignedShellField(&self) -> bool;
/// If voxel grid is in a valid signed shell field form, sets the interior thickness to the desired width,
/// as measured from the model surface. If the voxel grid is not in a valid signed shell field form, the
/// value of this property is zero.
#[unsafe(method(shellFieldInteriorThickness))]
#[unsafe(method_family = none)]
pub unsafe fn shellFieldInteriorThickness(&self) -> c_float;
/// Setter for [`shellFieldInteriorThickness`][Self::shellFieldInteriorThickness].
#[unsafe(method(setShellFieldInteriorThickness:))]
#[unsafe(method_family = none)]
pub unsafe fn setShellFieldInteriorThickness(
&self,
shell_field_interior_thickness: c_float,
);
/// If voxel grid is in a valid signed shell field form, sets the exterior thickness to the desired width,
/// as measured from the model surface. If the voxel grid is not in a valid signed shell field form, the
/// value of this property is zero.
#[unsafe(method(shellFieldExteriorThickness))]
#[unsafe(method_family = none)]
pub unsafe fn shellFieldExteriorThickness(&self) -> c_float;
/// Setter for [`shellFieldExteriorThickness`][Self::shellFieldExteriorThickness].
#[unsafe(method(setShellFieldExteriorThickness:))]
#[unsafe(method_family = none)]
pub unsafe fn setShellFieldExteriorThickness(
&self,
shell_field_exterior_thickness: c_float,
);
#[cfg(feature = "MDLMesh")]
/// Creates a coarse mesh from the voxel grid
#[unsafe(method(coarseMesh))]
#[unsafe(method_family = none)]
pub unsafe fn coarseMesh(&self) -> Option<Retained<MDLMesh>>;
#[cfg(all(feature = "MDLMesh", feature = "MDLMeshBuffer"))]
#[unsafe(method(coarseMeshUsingAllocator:))]
#[unsafe(method_family = none)]
pub unsafe fn coarseMeshUsingAllocator(
&self,
allocator: Option<&ProtocolObject<dyn MDLMeshBufferAllocator>>,
) -> Option<Retained<MDLMesh>>;
#[cfg(all(feature = "MDLMesh", feature = "MDLMeshBuffer"))]
/// Creates a smooth mesh from the voxel grid
#[unsafe(method(meshUsingAllocator:))]
#[unsafe(method_family = none)]
pub unsafe fn meshUsingAllocator(
&self,
allocator: Option<&ProtocolObject<dyn MDLMeshBufferAllocator>>,
) -> Option<Retained<MDLMesh>>;
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(feature = "MDLObject")]
impl MDLVoxelArray {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}