objc2_model_io/generated/
MDLSubmesh.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    /// [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlsubmeshtopology?language=objc)
12    #[unsafe(super(NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct MDLSubmeshTopology;
15);
16
17unsafe impl NSObjectProtocol for MDLSubmeshTopology {}
18
19impl MDLSubmeshTopology {
20    extern_methods!(
21        /// create a topology object corresponding to the topology in the submesh
22        #[unsafe(method(initWithSubmesh:))]
23        #[unsafe(method_family = init)]
24        pub unsafe fn initWithSubmesh(
25            this: Allocated<Self>,
26            submesh: &MDLSubmesh,
27        ) -> Retained<Self>;
28
29        #[cfg(feature = "MDLMeshBuffer")]
30        /// A buffer of 8 bit unsigned integer values, where each entry corresponds
31        /// to the number of vertices making up a face.
32        ///
33        ///
34        /// A submesh containing two triangles, a four sided polygon, and a
35        /// line, would contain the data 3 3 4 2.
36        /// If geometryType is of a fixed type, such as triangles, the buffer
37        /// is optional, and will be created on demand if read.
38        ///
39        /// Indices to the vertex buffer will be stored in the index buffer
40        /// correspondingly. In the example above, the indices would be stored
41        /// in order, three indices for the first triangle, followed by three
42        /// for the second, followed by four for the polygon, and finally two
43        /// indices for the line.
44        #[unsafe(method(faceTopology))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn faceTopology(&self) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>;
47
48        #[cfg(feature = "MDLMeshBuffer")]
49        /// Setter for [`faceTopology`][Self::faceTopology].
50        #[unsafe(method(setFaceTopology:))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn setFaceTopology(
53            &self,
54            face_topology: Option<&ProtocolObject<dyn MDLMeshBuffer>>,
55        );
56
57        /// The number of faces encoded in faceTopologyBuffer
58        #[unsafe(method(faceCount))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn faceCount(&self) -> NSUInteger;
61
62        /// Setter for [`faceCount`][Self::faceCount].
63        #[unsafe(method(setFaceCount:))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn setFaceCount(&self, face_count: NSUInteger);
66
67        #[cfg(feature = "MDLMeshBuffer")]
68        /// A crease value at a vertex to be applied during subdivision. Vertex creases
69        /// A zero value is smooth, a one value is peaked. It is intended to be used
70        /// with an index buffer, where the index buffer entries are vertex indices.
71        /// The corresponding values in the corner sharpness attribute indicate the
72        /// corner sharpness of those vertices. The index buffer is sparse. If a mesh
73        /// has three sharp vertices, then the index buffer will have three entries.
74        /// Since the number of entries in this vertex buffer is likely to be different
75        /// than the number of entries in any other vertex buffer, it shouldn't be
76        /// interleaved with other data.
77        #[unsafe(method(vertexCreaseIndices))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn vertexCreaseIndices(
80            &self,
81        ) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>;
82
83        #[cfg(feature = "MDLMeshBuffer")]
84        /// Setter for [`vertexCreaseIndices`][Self::vertexCreaseIndices].
85        #[unsafe(method(setVertexCreaseIndices:))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn setVertexCreaseIndices(
88            &self,
89            vertex_crease_indices: Option<&ProtocolObject<dyn MDLMeshBuffer>>,
90        );
91
92        #[cfg(feature = "MDLMeshBuffer")]
93        #[unsafe(method(vertexCreases))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn vertexCreases(&self) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>;
96
97        #[cfg(feature = "MDLMeshBuffer")]
98        /// Setter for [`vertexCreases`][Self::vertexCreases].
99        #[unsafe(method(setVertexCreases:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn setVertexCreases(
102            &self,
103            vertex_creases: Option<&ProtocolObject<dyn MDLMeshBuffer>>,
104        );
105
106        /// The number of vertex creases encoded in vertexCreases
107        #[unsafe(method(vertexCreaseCount))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn vertexCreaseCount(&self) -> NSUInteger;
110
111        /// Setter for [`vertexCreaseCount`][Self::vertexCreaseCount].
112        #[unsafe(method(setVertexCreaseCount:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn setVertexCreaseCount(&self, vertex_crease_count: NSUInteger);
115
116        #[cfg(feature = "MDLMeshBuffer")]
117        /// A crease value at an edge to be applied during subdivision. Edge creases
118        /// A zero value is smooth, a one value is peaked. It is intended to be used
119        /// with an index buffer, where the index buffer entries are edge index pairs.
120        /// Accordingly, there will be two index entries for each edge sharpness entry,
121        /// and the sharpness entry corresponds to the edge itself.
122        /// The corresponding values in the edge sharpness attribute indicate the
123        /// edge sharpness of those edges.  The index buffer is sparse. If a mesh
124        /// has three sharp edges, then the index buffer will have six entries.
125        /// Since the number of entries in this vertex buffer is likely to be different
126        /// than the number of entries in any other vertex buffer, it shouldn't be
127        /// interleaved with other data.
128        #[unsafe(method(edgeCreaseIndices))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn edgeCreaseIndices(
131            &self,
132        ) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>;
133
134        #[cfg(feature = "MDLMeshBuffer")]
135        /// Setter for [`edgeCreaseIndices`][Self::edgeCreaseIndices].
136        #[unsafe(method(setEdgeCreaseIndices:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn setEdgeCreaseIndices(
139            &self,
140            edge_crease_indices: Option<&ProtocolObject<dyn MDLMeshBuffer>>,
141        );
142
143        #[cfg(feature = "MDLMeshBuffer")]
144        #[unsafe(method(edgeCreases))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn edgeCreases(&self) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>;
147
148        #[cfg(feature = "MDLMeshBuffer")]
149        /// Setter for [`edgeCreases`][Self::edgeCreases].
150        #[unsafe(method(setEdgeCreases:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn setEdgeCreases(
153            &self,
154            edge_creases: Option<&ProtocolObject<dyn MDLMeshBuffer>>,
155        );
156
157        /// The number of edge creases encoded in edgeCreases
158        #[unsafe(method(edgeCreaseCount))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn edgeCreaseCount(&self) -> NSUInteger;
161
162        /// Setter for [`edgeCreaseCount`][Self::edgeCreaseCount].
163        #[unsafe(method(setEdgeCreaseCount:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn setEdgeCreaseCount(&self, edge_crease_count: NSUInteger);
166
167        #[cfg(feature = "MDLMeshBuffer")]
168        /// The hole attribute is a vertex attribute of single integer values where
169        /// each integer is an index of a face that is to be used as a hole. If there
170        /// are two holes in a mesh, then the vertex buffer will have two entries.
171        /// Since the number of entries in this vertex buffer is likely to be different
172        /// than the number of entries in any other vertex buffer, it shouldn't be
173        /// interleaved with other data.
174        #[unsafe(method(holes))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn holes(&self) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>;
177
178        #[cfg(feature = "MDLMeshBuffer")]
179        /// Setter for [`holes`][Self::holes].
180        #[unsafe(method(setHoles:))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn setHoles(&self, holes: Option<&ProtocolObject<dyn MDLMeshBuffer>>);
183
184        /// The number of holes encoded in holes
185        #[unsafe(method(holeCount))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn holeCount(&self) -> NSUInteger;
188
189        /// Setter for [`holeCount`][Self::holeCount].
190        #[unsafe(method(setHoleCount:))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn setHoleCount(&self, hole_count: NSUInteger);
193    );
194}
195
196/// Methods declared on superclass `NSObject`.
197impl MDLSubmeshTopology {
198    extern_methods!(
199        #[unsafe(method(init))]
200        #[unsafe(method_family = init)]
201        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
202
203        #[unsafe(method(new))]
204        #[unsafe(method_family = new)]
205        pub unsafe fn new() -> Retained<Self>;
206    );
207}
208
209extern_class!(
210    /// A drawable subset of an MDLMesh, with its own material
211    ///
212    /// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlsubmesh?language=objc)
213    #[unsafe(super(NSObject))]
214    #[derive(Debug, PartialEq, Eq, Hash)]
215    pub struct MDLSubmesh;
216);
217
218#[cfg(feature = "MDLTypes")]
219unsafe impl MDLNamed for MDLSubmesh {}
220
221unsafe impl NSObjectProtocol for MDLSubmesh {}
222
223impl MDLSubmesh {
224    extern_methods!(
225        #[cfg(all(
226            feature = "MDLMaterial",
227            feature = "MDLMeshBuffer",
228            feature = "MDLTypes"
229        ))]
230        /// Initialize submesh with all data necessary to make properties valid
231        #[unsafe(method(initWithName:indexBuffer:indexCount:indexType:geometryType:material:))]
232        #[unsafe(method_family = init)]
233        pub unsafe fn initWithName_indexBuffer_indexCount_indexType_geometryType_material(
234            this: Allocated<Self>,
235            name: &NSString,
236            index_buffer: &ProtocolObject<dyn MDLMeshBuffer>,
237            index_count: NSUInteger,
238            index_type: MDLIndexBitDepth,
239            geometry_type: MDLGeometryType,
240            material: Option<&MDLMaterial>,
241        ) -> Retained<Self>;
242
243        #[cfg(all(
244            feature = "MDLMaterial",
245            feature = "MDLMeshBuffer",
246            feature = "MDLTypes"
247        ))]
248        /// Initialize submesh with all data necessary to make properties valid
249        #[unsafe(method(initWithIndexBuffer:indexCount:indexType:geometryType:material:))]
250        #[unsafe(method_family = init)]
251        pub unsafe fn initWithIndexBuffer_indexCount_indexType_geometryType_material(
252            this: Allocated<Self>,
253            index_buffer: &ProtocolObject<dyn MDLMeshBuffer>,
254            index_count: NSUInteger,
255            index_type: MDLIndexBitDepth,
256            geometry_type: MDLGeometryType,
257            material: Option<&MDLMaterial>,
258        ) -> Retained<Self>;
259
260        #[cfg(all(
261            feature = "MDLMaterial",
262            feature = "MDLMeshBuffer",
263            feature = "MDLTypes"
264        ))]
265        /// Initialize submesh with all data necessary to make properties valid
266        ///
267        ///
268        /// The geometry type will typically be MDLGeometryTypeVariableTopology,
269        /// if other types are used the faceTopologyBuffer contents should
270        /// reflect that.
271        #[unsafe(method(initWithName:indexBuffer:indexCount:indexType:geometryType:material:topology:))]
272        #[unsafe(method_family = init)]
273        pub unsafe fn initWithName_indexBuffer_indexCount_indexType_geometryType_material_topology(
274            this: Allocated<Self>,
275            name: &NSString,
276            index_buffer: &ProtocolObject<dyn MDLMeshBuffer>,
277            index_count: NSUInteger,
278            index_type: MDLIndexBitDepth,
279            geometry_type: MDLGeometryType,
280            material: Option<&MDLMaterial>,
281            topology: Option<&MDLSubmeshTopology>,
282        ) -> Retained<Self>;
283
284        #[cfg(feature = "MDLTypes")]
285        /// Initialize submesh using another submesh as input.
286        ///
287        /// the resulting submesh will have a new index type if necessary.
288        /// If a conversion from the source submesh's geometry type to the requested
289        /// geometry type is possible, conversion will be performed. Otherwise nil will
290        /// be returned.
291        #[unsafe(method(initWithMDLSubmesh:indexType:geometryType:))]
292        #[unsafe(method_family = init)]
293        pub unsafe fn initWithMDLSubmesh_indexType_geometryType(
294            this: Allocated<Self>,
295            submesh: &MDLSubmesh,
296            index_type: MDLIndexBitDepth,
297            geometry_type: MDLGeometryType,
298        ) -> Option<Retained<Self>>;
299
300        #[cfg(feature = "MDLMeshBuffer")]
301        /// Index data referencing vertex data in parent mesh
302        #[unsafe(method(indexBuffer))]
303        #[unsafe(method_family = none)]
304        pub unsafe fn indexBuffer(&self) -> Retained<ProtocolObject<dyn MDLMeshBuffer>>;
305
306        #[cfg(all(feature = "MDLMeshBuffer", feature = "MDLTypes"))]
307        #[unsafe(method(indexBufferAsIndexType:))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn indexBufferAsIndexType(
310            &self,
311            index_type: MDLIndexBitDepth,
312        ) -> Retained<ProtocolObject<dyn MDLMeshBuffer>>;
313
314        /// Number of indices in the indexBuffer
315        #[unsafe(method(indexCount))]
316        #[unsafe(method_family = none)]
317        pub unsafe fn indexCount(&self) -> NSUInteger;
318
319        #[cfg(feature = "MDLTypes")]
320        /// Data type of indices in indexBuffer
321        ///
322        /// Support 8, 16, and 32 bit unsigned integer values
323        #[unsafe(method(indexType))]
324        #[unsafe(method_family = none)]
325        pub unsafe fn indexType(&self) -> MDLIndexBitDepth;
326
327        #[cfg(feature = "MDLTypes")]
328        /// Type of primitive that vertices referenced by the indexBuffer are
329        /// assembled into
330        #[unsafe(method(geometryType))]
331        #[unsafe(method_family = none)]
332        pub unsafe fn geometryType(&self) -> MDLGeometryType;
333
334        #[cfg(feature = "MDLMaterial")]
335        /// Material to apply when rendering this object
336        #[unsafe(method(material))]
337        #[unsafe(method_family = none)]
338        pub unsafe fn material(&self) -> Option<Retained<MDLMaterial>>;
339
340        #[cfg(feature = "MDLMaterial")]
341        /// Setter for [`material`][Self::material].
342        #[unsafe(method(setMaterial:))]
343        #[unsafe(method_family = none)]
344        pub unsafe fn setMaterial(&self, material: Option<&MDLMaterial>);
345
346        /// Topology data structure for use with MDLGeometryTypeVariableTopology
347        ///
348        ///
349        /// ignored for geometry types other than MDLGeometryTypeVariableTopology.
350        /// A submesh of type MDLGeometryTypeVariableTopology with no topology
351        /// data is an empty submesh.
352        #[unsafe(method(topology))]
353        #[unsafe(method_family = none)]
354        pub unsafe fn topology(&self) -> Option<Retained<MDLSubmeshTopology>>;
355
356        /// Setter for [`topology`][Self::topology].
357        #[unsafe(method(setTopology:))]
358        #[unsafe(method_family = none)]
359        pub unsafe fn setTopology(&self, topology: Option<&MDLSubmeshTopology>);
360
361        /// Identifying name for this object
362        #[unsafe(method(name))]
363        #[unsafe(method_family = none)]
364        pub unsafe fn name(&self) -> Retained<NSString>;
365
366        /// Setter for [`name`][Self::name].
367        #[unsafe(method(setName:))]
368        #[unsafe(method_family = none)]
369        pub unsafe fn setName(&self, name: &NSString);
370    );
371}
372
373/// Methods declared on superclass `NSObject`.
374impl MDLSubmesh {
375    extern_methods!(
376        #[unsafe(method(init))]
377        #[unsafe(method_family = init)]
378        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
379
380        #[unsafe(method(new))]
381        #[unsafe(method_family = new)]
382        pub unsafe fn new() -> Retained<Self>;
383    );
384}