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