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
use objc2::{
extern_class, extern_conformance, extern_methods,
rc::{Allocated, Retained},
};
use objc2_foundation::{CopyingHelper, NSCopying, NSObject, NSObjectProtocol, NSUInteger};
use crate::*;
extern_class!(
/// Describes motion triangle geometry, suitable for motion ray tracing.
///
/// Use a ``MTLResidencySet`` to mark residency of all buffers this descriptor references when you build this
/// acceleration structure.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4accelerationstructuremotiontrianglegeometrydescriptor?language=objc)
#[unsafe(super(MTL4AccelerationStructureGeometryDescriptor, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTL4AccelerationStructureMotionTriangleGeometryDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MTL4AccelerationStructureMotionTriangleGeometryDescriptor {}
);
unsafe impl CopyingHelper for MTL4AccelerationStructureMotionTriangleGeometryDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTL4AccelerationStructureMotionTriangleGeometryDescriptor {}
);
impl MTL4AccelerationStructureMotionTriangleGeometryDescriptor {
extern_methods!(
/// Assigns a buffer where each entry contains a reference to a vertex buffer.
///
/// This property references a buffer that conceptually represents an array with one entry for each keyframe in the
/// motion animation. Each one of these entries consists of a ``MTL4BufferRange`` that, in turn, references a
/// vertex buffer containing the vertex data for the keyframe.
///
/// You are responsible for ensuring the buffer address is not zero for the top-level buffer, as well as for all
/// the vertex buffers it references.
#[unsafe(method(vertexBuffers))]
#[unsafe(method_family = none)]
pub fn vertex_buffers(&self) -> MTL4BufferRange;
/// Setter for [`vertexBuffers`][Self::vertexBuffers].
#[unsafe(method(setVertexBuffers:))]
#[unsafe(method_family = none)]
pub fn set_vertex_buffers(
&self,
vertex_buffers: MTL4BufferRange,
);
/// Defines the format of the vertices in the vertex buffers.
///
/// All keyframes share the same vertex format. Defaults to `MTLAttributeFormatFloat3`, corresponding to three packed
/// floating point numbers.
#[unsafe(method(vertexFormat))]
#[unsafe(method_family = none)]
pub fn vertex_format(&self) -> MTLAttributeFormat;
/// Setter for [`vertexFormat`][Self::vertexFormat].
#[unsafe(method(setVertexFormat:))]
#[unsafe(method_family = none)]
pub fn set_vertex_format(
&self,
vertex_format: MTLAttributeFormat,
);
/// Sets the stride, in bytes, between vertices in all the vertex buffer.
///
/// All keyframes share the same vertex stride. This stride needs to be a multiple of the size of the vertex format you
/// provide in the ``vertexFormat`` property.
///
/// Similarly, you are responsible for ensuring this stride matches the vertex format data type's alignment.
///
/// Defaults to `0`, which signals the stride matches the size of the ``vertexFormat`` data.
#[unsafe(method(vertexStride))]
#[unsafe(method_family = none)]
pub fn vertex_stride(&self) -> NSUInteger;
/// Setter for [`vertexStride`][Self::vertexStride].
#[unsafe(method(setVertexStride:))]
#[unsafe(method_family = none)]
pub fn set_vertex_stride(
&self,
vertex_stride: NSUInteger,
);
/// Assigns an optional index buffer containing references to vertices in the vertex buffers you reference through the
/// vertex buffers property.
///
/// You can set this property to `0`, the default, to avoid specifying an index buffer. All keyframes share the same
/// index buffer.
#[unsafe(method(indexBuffer))]
#[unsafe(method_family = none)]
pub fn index_buffer(&self) -> MTL4BufferRange;
/// Setter for [`indexBuffer`][Self::indexBuffer].
#[unsafe(method(setIndexBuffer:))]
#[unsafe(method_family = none)]
pub fn set_index_buffer(
&self,
index_buffer: MTL4BufferRange,
);
/// Specifies the size of the indices the `indexBuffer` contains, which is typically either 16 or 32-bits for each index.
#[unsafe(method(indexType))]
#[unsafe(method_family = none)]
pub fn index_type(&self) -> MTLIndexType;
/// Setter for [`indexType`][Self::indexType].
#[unsafe(method(setIndexType:))]
#[unsafe(method_family = none)]
pub fn set_index_type(
&self,
index_type: MTLIndexType,
);
/// Declares the number of triangles in the vertex buffers that the buffer in the vertex buffers property references.
///
/// All keyframes share the same triangle count.
#[unsafe(method(triangleCount))]
#[unsafe(method_family = none)]
pub fn triangle_count(&self) -> NSUInteger;
/// Setter for [`triangleCount`][Self::triangleCount].
#[unsafe(method(setTriangleCount:))]
#[unsafe(method_family = none)]
pub fn set_triangle_count(
&self,
triangle_count: NSUInteger,
);
/// Assings an optional reference to a buffer containing a `float4x3` transformation matrix.
///
/// When the buffer address is non-zero, Metal applies this transform to the vertex data positions when building
/// the acceleration structure. All keyframes share the same transformation matrix.
///
/// Building an acceleration structure with a descriptor that specifies this property doesn't modify the contents of
/// the input `vertexBuffer`.
#[unsafe(method(transformationMatrixBuffer))]
#[unsafe(method_family = none)]
pub fn transformation_matrix_buffer(&self) -> MTL4BufferRange;
/// Setter for [`transformationMatrixBuffer`][Self::transformationMatrixBuffer].
#[unsafe(method(setTransformationMatrixBuffer:))]
#[unsafe(method_family = none)]
pub fn set_transformation_matrix_buffer(
&self,
transformation_matrix_buffer: MTL4BufferRange,
);
/// Configures the layout for the transformation matrix in the transformation matrix buffer.
///
/// You can provide matrices in column-major or row-major form, and this property allows you to control
/// how Metal interprets them.
///
/// Defaults to `MTLMatrixLayoutColumnMajor`.
#[unsafe(method(transformationMatrixLayout))]
#[unsafe(method_family = none)]
pub fn transformation_matrix_layout(&self) -> MTLMatrixLayout;
/// Setter for [`transformationMatrixLayout`][Self::transformationMatrixLayout].
#[unsafe(method(setTransformationMatrixLayout:))]
#[unsafe(method_family = none)]
pub fn set_transformation_matrix_layout(
&self,
transformation_matrix_layout: MTLMatrixLayout,
);
);
}
/// Methods declared on superclass `NSObject`.
impl MTL4AccelerationStructureMotionTriangleGeometryDescriptor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}