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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
//! 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!(
/// [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlsubmeshtopology?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MDLSubmeshTopology;
);
extern_conformance!(
unsafe impl NSObjectProtocol for MDLSubmeshTopology {}
);
impl MDLSubmeshTopology {
extern_methods!(
/// create a topology object corresponding to the topology in the submesh
#[unsafe(method(initWithSubmesh:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithSubmesh(
this: Allocated<Self>,
submesh: &MDLSubmesh,
) -> Retained<Self>;
#[cfg(feature = "MDLMeshBuffer")]
/// A buffer of 8 bit unsigned integer values, where each entry corresponds
/// to the number of vertices making up a face.
///
///
/// A submesh containing two triangles, a four sided polygon, and a
/// line, would contain the data 3 3 4 2.
/// If geometryType is of a fixed type, such as triangles, the buffer
/// is optional, and will be created on demand if read.
///
/// Indices to the vertex buffer will be stored in the index buffer
/// correspondingly. In the example above, the indices would be stored
/// in order, three indices for the first triangle, followed by three
/// for the second, followed by four for the polygon, and finally two
/// indices for the line.
#[unsafe(method(faceTopology))]
#[unsafe(method_family = none)]
pub unsafe fn faceTopology(&self) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>;
#[cfg(feature = "MDLMeshBuffer")]
/// Setter for [`faceTopology`][Self::faceTopology].
#[unsafe(method(setFaceTopology:))]
#[unsafe(method_family = none)]
pub unsafe fn setFaceTopology(
&self,
face_topology: Option<&ProtocolObject<dyn MDLMeshBuffer>>,
);
/// The number of faces encoded in faceTopologyBuffer
#[unsafe(method(faceCount))]
#[unsafe(method_family = none)]
pub unsafe fn faceCount(&self) -> NSUInteger;
/// Setter for [`faceCount`][Self::faceCount].
#[unsafe(method(setFaceCount:))]
#[unsafe(method_family = none)]
pub unsafe fn setFaceCount(&self, face_count: NSUInteger);
#[cfg(feature = "MDLMeshBuffer")]
/// A crease value at a vertex to be applied during subdivision. Vertex creases
/// A zero value is smooth, a one value is peaked. It is intended to be used
/// with an index buffer, where the index buffer entries are vertex indices.
/// The corresponding values in the corner sharpness attribute indicate the
/// corner sharpness of those vertices. The index buffer is sparse. If a mesh
/// has three sharp vertices, then the index buffer will have three entries.
/// Since the number of entries in this vertex buffer is likely to be different
/// than the number of entries in any other vertex buffer, it shouldn't be
/// interleaved with other data.
#[unsafe(method(vertexCreaseIndices))]
#[unsafe(method_family = none)]
pub unsafe fn vertexCreaseIndices(
&self,
) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>;
#[cfg(feature = "MDLMeshBuffer")]
/// Setter for [`vertexCreaseIndices`][Self::vertexCreaseIndices].
#[unsafe(method(setVertexCreaseIndices:))]
#[unsafe(method_family = none)]
pub unsafe fn setVertexCreaseIndices(
&self,
vertex_crease_indices: Option<&ProtocolObject<dyn MDLMeshBuffer>>,
);
#[cfg(feature = "MDLMeshBuffer")]
#[unsafe(method(vertexCreases))]
#[unsafe(method_family = none)]
pub unsafe fn vertexCreases(&self) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>;
#[cfg(feature = "MDLMeshBuffer")]
/// Setter for [`vertexCreases`][Self::vertexCreases].
#[unsafe(method(setVertexCreases:))]
#[unsafe(method_family = none)]
pub unsafe fn setVertexCreases(
&self,
vertex_creases: Option<&ProtocolObject<dyn MDLMeshBuffer>>,
);
/// The number of vertex creases encoded in vertexCreases
#[unsafe(method(vertexCreaseCount))]
#[unsafe(method_family = none)]
pub unsafe fn vertexCreaseCount(&self) -> NSUInteger;
/// Setter for [`vertexCreaseCount`][Self::vertexCreaseCount].
#[unsafe(method(setVertexCreaseCount:))]
#[unsafe(method_family = none)]
pub unsafe fn setVertexCreaseCount(&self, vertex_crease_count: NSUInteger);
#[cfg(feature = "MDLMeshBuffer")]
/// A crease value at an edge to be applied during subdivision. Edge creases
/// A zero value is smooth, a one value is peaked. It is intended to be used
/// with an index buffer, where the index buffer entries are edge index pairs.
/// Accordingly, there will be two index entries for each edge sharpness entry,
/// and the sharpness entry corresponds to the edge itself.
/// The corresponding values in the edge sharpness attribute indicate the
/// edge sharpness of those edges. The index buffer is sparse. If a mesh
/// has three sharp edges, then the index buffer will have six entries.
/// Since the number of entries in this vertex buffer is likely to be different
/// than the number of entries in any other vertex buffer, it shouldn't be
/// interleaved with other data.
#[unsafe(method(edgeCreaseIndices))]
#[unsafe(method_family = none)]
pub unsafe fn edgeCreaseIndices(
&self,
) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>;
#[cfg(feature = "MDLMeshBuffer")]
/// Setter for [`edgeCreaseIndices`][Self::edgeCreaseIndices].
#[unsafe(method(setEdgeCreaseIndices:))]
#[unsafe(method_family = none)]
pub unsafe fn setEdgeCreaseIndices(
&self,
edge_crease_indices: Option<&ProtocolObject<dyn MDLMeshBuffer>>,
);
#[cfg(feature = "MDLMeshBuffer")]
#[unsafe(method(edgeCreases))]
#[unsafe(method_family = none)]
pub unsafe fn edgeCreases(&self) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>;
#[cfg(feature = "MDLMeshBuffer")]
/// Setter for [`edgeCreases`][Self::edgeCreases].
#[unsafe(method(setEdgeCreases:))]
#[unsafe(method_family = none)]
pub unsafe fn setEdgeCreases(
&self,
edge_creases: Option<&ProtocolObject<dyn MDLMeshBuffer>>,
);
/// The number of edge creases encoded in edgeCreases
#[unsafe(method(edgeCreaseCount))]
#[unsafe(method_family = none)]
pub unsafe fn edgeCreaseCount(&self) -> NSUInteger;
/// Setter for [`edgeCreaseCount`][Self::edgeCreaseCount].
#[unsafe(method(setEdgeCreaseCount:))]
#[unsafe(method_family = none)]
pub unsafe fn setEdgeCreaseCount(&self, edge_crease_count: NSUInteger);
#[cfg(feature = "MDLMeshBuffer")]
/// The hole attribute is a vertex attribute of single integer values where
/// each integer is an index of a face that is to be used as a hole. If there
/// are two holes in a mesh, then the vertex buffer will have two entries.
/// Since the number of entries in this vertex buffer is likely to be different
/// than the number of entries in any other vertex buffer, it shouldn't be
/// interleaved with other data.
#[unsafe(method(holes))]
#[unsafe(method_family = none)]
pub unsafe fn holes(&self) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>;
#[cfg(feature = "MDLMeshBuffer")]
/// Setter for [`holes`][Self::holes].
#[unsafe(method(setHoles:))]
#[unsafe(method_family = none)]
pub unsafe fn setHoles(&self, holes: Option<&ProtocolObject<dyn MDLMeshBuffer>>);
/// The number of holes encoded in holes
#[unsafe(method(holeCount))]
#[unsafe(method_family = none)]
pub unsafe fn holeCount(&self) -> NSUInteger;
/// Setter for [`holeCount`][Self::holeCount].
#[unsafe(method(setHoleCount:))]
#[unsafe(method_family = none)]
pub unsafe fn setHoleCount(&self, hole_count: NSUInteger);
);
}
/// Methods declared on superclass `NSObject`.
impl MDLSubmeshTopology {
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>;
);
}
extern_class!(
/// A drawable subset of an MDLMesh, with its own material
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlsubmesh?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MDLSubmesh;
);
#[cfg(feature = "MDLTypes")]
extern_conformance!(
unsafe impl MDLNamed for MDLSubmesh {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for MDLSubmesh {}
);
impl MDLSubmesh {
extern_methods!(
#[cfg(all(
feature = "MDLMaterial",
feature = "MDLMeshBuffer",
feature = "MDLTypes"
))]
/// Initialize submesh with all data necessary to make properties valid
#[unsafe(method(initWithName:indexBuffer:indexCount:indexType:geometryType:material:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithName_indexBuffer_indexCount_indexType_geometryType_material(
this: Allocated<Self>,
name: &NSString,
index_buffer: &ProtocolObject<dyn MDLMeshBuffer>,
index_count: NSUInteger,
index_type: MDLIndexBitDepth,
geometry_type: MDLGeometryType,
material: Option<&MDLMaterial>,
) -> Retained<Self>;
#[cfg(all(
feature = "MDLMaterial",
feature = "MDLMeshBuffer",
feature = "MDLTypes"
))]
/// Initialize submesh with all data necessary to make properties valid
#[unsafe(method(initWithIndexBuffer:indexCount:indexType:geometryType:material:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithIndexBuffer_indexCount_indexType_geometryType_material(
this: Allocated<Self>,
index_buffer: &ProtocolObject<dyn MDLMeshBuffer>,
index_count: NSUInteger,
index_type: MDLIndexBitDepth,
geometry_type: MDLGeometryType,
material: Option<&MDLMaterial>,
) -> Retained<Self>;
#[cfg(all(
feature = "MDLMaterial",
feature = "MDLMeshBuffer",
feature = "MDLTypes"
))]
/// Initialize submesh with all data necessary to make properties valid
///
///
/// The geometry type will typically be MDLGeometryTypeVariableTopology,
/// if other types are used the faceTopologyBuffer contents should
/// reflect that.
#[unsafe(method(initWithName:indexBuffer:indexCount:indexType:geometryType:material:topology:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithName_indexBuffer_indexCount_indexType_geometryType_material_topology(
this: Allocated<Self>,
name: &NSString,
index_buffer: &ProtocolObject<dyn MDLMeshBuffer>,
index_count: NSUInteger,
index_type: MDLIndexBitDepth,
geometry_type: MDLGeometryType,
material: Option<&MDLMaterial>,
topology: Option<&MDLSubmeshTopology>,
) -> Retained<Self>;
#[cfg(feature = "MDLTypes")]
/// Initialize submesh using another submesh as input.
///
/// the resulting submesh will have a new index type if necessary.
/// If a conversion from the source submesh's geometry type to the requested
/// geometry type is possible, conversion will be performed. Otherwise nil will
/// be returned.
#[unsafe(method(initWithMDLSubmesh:indexType:geometryType:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithMDLSubmesh_indexType_geometryType(
this: Allocated<Self>,
submesh: &MDLSubmesh,
index_type: MDLIndexBitDepth,
geometry_type: MDLGeometryType,
) -> Option<Retained<Self>>;
#[cfg(feature = "MDLMeshBuffer")]
/// Index data referencing vertex data in parent mesh
#[unsafe(method(indexBuffer))]
#[unsafe(method_family = none)]
pub unsafe fn indexBuffer(&self) -> Retained<ProtocolObject<dyn MDLMeshBuffer>>;
#[cfg(all(feature = "MDLMeshBuffer", feature = "MDLTypes"))]
#[unsafe(method(indexBufferAsIndexType:))]
#[unsafe(method_family = none)]
pub unsafe fn indexBufferAsIndexType(
&self,
index_type: MDLIndexBitDepth,
) -> Retained<ProtocolObject<dyn MDLMeshBuffer>>;
/// Number of indices in the indexBuffer
#[unsafe(method(indexCount))]
#[unsafe(method_family = none)]
pub unsafe fn indexCount(&self) -> NSUInteger;
#[cfg(feature = "MDLTypes")]
/// Data type of indices in indexBuffer
///
/// Support 8, 16, and 32 bit unsigned integer values
#[unsafe(method(indexType))]
#[unsafe(method_family = none)]
pub unsafe fn indexType(&self) -> MDLIndexBitDepth;
#[cfg(feature = "MDLTypes")]
/// Type of primitive that vertices referenced by the indexBuffer are
/// assembled into
#[unsafe(method(geometryType))]
#[unsafe(method_family = none)]
pub unsafe fn geometryType(&self) -> MDLGeometryType;
#[cfg(feature = "MDLMaterial")]
/// Material to apply when rendering this object
#[unsafe(method(material))]
#[unsafe(method_family = none)]
pub unsafe fn material(&self) -> Option<Retained<MDLMaterial>>;
#[cfg(feature = "MDLMaterial")]
/// Setter for [`material`][Self::material].
#[unsafe(method(setMaterial:))]
#[unsafe(method_family = none)]
pub unsafe fn setMaterial(&self, material: Option<&MDLMaterial>);
/// Topology data structure for use with MDLGeometryTypeVariableTopology
///
///
/// ignored for geometry types other than MDLGeometryTypeVariableTopology.
/// A submesh of type MDLGeometryTypeVariableTopology with no topology
/// data is an empty submesh.
#[unsafe(method(topology))]
#[unsafe(method_family = none)]
pub unsafe fn topology(&self) -> Option<Retained<MDLSubmeshTopology>>;
/// Setter for [`topology`][Self::topology].
#[unsafe(method(setTopology:))]
#[unsafe(method_family = none)]
pub unsafe fn setTopology(&self, topology: Option<&MDLSubmeshTopology>);
/// Identifying name for this object
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub unsafe fn name(&self) -> Retained<NSString>;
/// Setter for [`name`][Self::name].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setName:))]
#[unsafe(method_family = none)]
pub unsafe fn setName(&self, name: &NSString);
);
}
/// Methods declared on superclass `NSObject`.
impl MDLSubmesh {
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>;
);
}