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