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