objc2_metal_performance_shaders/generated/MPSRayIntersector/
MPSPolygonBuffer.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::*;
7use objc2_metal::*;
8
9use crate::*;
10
11extern_class!(
12    /// A vertex buffer and optional index and mask buffer for a set of polygons
13    ///
14    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpspolygonbuffer?language=objc)
15    #[unsafe(super(NSObject))]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    #[deprecated]
18    pub struct MPSPolygonBuffer;
19);
20
21extern_conformance!(
22    unsafe impl NSCoding for MPSPolygonBuffer {}
23);
24
25extern_conformance!(
26    unsafe impl NSCopying for MPSPolygonBuffer {}
27);
28
29unsafe impl CopyingHelper for MPSPolygonBuffer {
30    type Result = Self;
31}
32
33extern_conformance!(
34    unsafe impl NSObjectProtocol for MPSPolygonBuffer {}
35);
36
37extern_conformance!(
38    unsafe impl NSSecureCoding for MPSPolygonBuffer {}
39);
40
41impl MPSPolygonBuffer {
42    extern_methods!(
43        /// Initialize the polygon buffer
44        #[deprecated]
45        #[unsafe(method(init))]
46        #[unsafe(method_family = init)]
47        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
48
49        /// Initialize the polygon buffer with an NSCoder. Buffer properties such as the vertex
50        /// buffer, instance buffer, etc. are set to nil. Encode and decode these buffers along with the
51        /// polygon buffer instead.
52        ///
53        /// # Safety
54        ///
55        /// `a_decoder` possibly has further requirements.
56        #[deprecated]
57        #[unsafe(method(initWithCoder:))]
58        #[unsafe(method_family = init)]
59        pub unsafe fn initWithCoder(
60            this: Allocated<Self>,
61            a_decoder: &NSCoder,
62        ) -> Option<Retained<Self>>;
63
64        #[deprecated]
65        #[unsafe(method(polygonBuffer))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn polygonBuffer() -> Retained<Self>;
68
69        /// Create a a copy of this polygon buffer
70        ///
71        ///
72        /// Buffer properties of the polygon buffer such as the vertex buffer, instance, buffer,
73        /// etc. are set to nil. Copy these buffers and assign them to the new polygon buffer or reassign
74        /// the existing buffers to the new polygon buffer.
75        ///
76        ///
77        /// Parameter `zone`: This parameter is ignored. Memory zones are no longer used by Objective-C.
78        ///
79        /// # Safety
80        ///
81        /// `zone` must be a valid pointer or null.
82        #[deprecated]
83        #[unsafe(method(copyWithZone:))]
84        #[unsafe(method_family = copy)]
85        pub unsafe fn copyWithZone(&self, zone: *mut NSZone) -> Retained<Self>;
86
87        /// Vertex buffer containing vertex data encoded as three 32 bit floats per vertex. Note
88        /// that by default each vertex is aligned to the alignment of the vector_float3 type: 16 bytes.
89        /// This can be changed using the vertexStride property. A vertex buffer must be provided before
90        /// the acceleration structure is built.
91        ///
92        /// When using triangle polygons, degenerate (zero or negative area) triangles are ignored
93        /// during acceleration structure construction. This can be used to pad triangle indices if needed.
94        ///
95        /// Quadrilateral polygons are internally treated as two triangles. If the quadrilateral has
96        /// vertices v0, v1, v2, and v3, the two triangles will have vertices v0, v1, v2 and v0, v2, v3.
97        /// A quadrilateral may be used to represent a triangle by repeating the last vertex. If the first
98        /// triangle is degenerate (zero or negative area), the entire quadrilateral will be ignored. This
99        /// can be used to pad quadrilateral indices if needed. All four vertices of a quadrilateral must
100        /// be coplanar and the quadrilateral must be convex.
101        #[deprecated]
102        #[unsafe(method(vertexBuffer))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn vertexBuffer(&self) -> Option<Retained<ProtocolObject<dyn MTLBuffer>>>;
105
106        /// Setter for [`vertexBuffer`][Self::vertexBuffer].
107        ///
108        /// # Safety
109        ///
110        /// - `vertex_buffer` may need to be synchronized.
111        /// - `vertex_buffer` may be unretained, you must ensure it is kept alive while in use.
112        /// - `vertex_buffer` contents should be of the correct type.
113        #[deprecated]
114        #[unsafe(method(setVertexBuffer:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn setVertexBuffer(&self, vertex_buffer: Option<&ProtocolObject<dyn MTLBuffer>>);
117
118        /// Offset, in bytes, into the vertex buffer. Defaults to 0 bytes. Must be aligned to 4
119        /// bytes.
120        #[deprecated]
121        #[unsafe(method(vertexBufferOffset))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn vertexBufferOffset(&self) -> NSUInteger;
124
125        /// Setter for [`vertexBufferOffset`][Self::vertexBufferOffset].
126        #[deprecated]
127        #[unsafe(method(setVertexBufferOffset:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn setVertexBufferOffset(&self, vertex_buffer_offset: NSUInteger);
130
131        /// Index buffer containing index data. Each index references a vertex in the vertex buffer.
132        /// May be nil.
133        #[deprecated]
134        #[unsafe(method(indexBuffer))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn indexBuffer(&self) -> Option<Retained<ProtocolObject<dyn MTLBuffer>>>;
137
138        /// Setter for [`indexBuffer`][Self::indexBuffer].
139        ///
140        /// # Safety
141        ///
142        /// - `index_buffer` may need to be synchronized.
143        /// - `index_buffer` may be unretained, you must ensure it is kept alive while in use.
144        /// - `index_buffer` contents should be of the correct type.
145        #[deprecated]
146        #[unsafe(method(setIndexBuffer:))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn setIndexBuffer(&self, index_buffer: Option<&ProtocolObject<dyn MTLBuffer>>);
149
150        /// Offset, in bytes, into the index buffer. Defaults to 0 bytes. Must be aligned to a
151        /// multiple of the index type. Changes to this property require rebuilding the acceleration
152        /// structure.
153        #[deprecated]
154        #[unsafe(method(indexBufferOffset))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn indexBufferOffset(&self) -> NSUInteger;
157
158        /// Setter for [`indexBufferOffset`][Self::indexBufferOffset].
159        #[deprecated]
160        #[unsafe(method(setIndexBufferOffset:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn setIndexBufferOffset(&self, index_buffer_offset: NSUInteger);
163
164        /// Mask buffer containing one uint32_t mask per polygon. May be nil. Otherwise, the mask
165        /// type must be specified on the MPSRayIntersector with which it is used.
166        #[deprecated]
167        #[unsafe(method(maskBuffer))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn maskBuffer(&self) -> Option<Retained<ProtocolObject<dyn MTLBuffer>>>;
170
171        /// Setter for [`maskBuffer`][Self::maskBuffer].
172        ///
173        /// # Safety
174        ///
175        /// - `mask_buffer` may need to be synchronized.
176        /// - `mask_buffer` may be unretained, you must ensure it is kept alive while in use.
177        /// - `mask_buffer` contents should be of the correct type.
178        #[deprecated]
179        #[unsafe(method(setMaskBuffer:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn setMaskBuffer(&self, mask_buffer: Option<&ProtocolObject<dyn MTLBuffer>>);
182
183        /// Offset, in bytes, into the mask buffer. Defaults to 0 bytes. Must be aligned to 4 bytes.
184        #[deprecated]
185        #[unsafe(method(maskBufferOffset))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn maskBufferOffset(&self) -> NSUInteger;
188
189        /// Setter for [`maskBufferOffset`][Self::maskBufferOffset].
190        #[deprecated]
191        #[unsafe(method(setMaskBufferOffset:))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn setMaskBufferOffset(&self, mask_buffer_offset: NSUInteger);
194
195        /// Number of polygons. Changes to this property require rebuilding the acceleration
196        /// structure.
197        #[deprecated]
198        #[unsafe(method(polygonCount))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn polygonCount(&self) -> NSUInteger;
201
202        /// Setter for [`polygonCount`][Self::polygonCount].
203        #[deprecated]
204        #[unsafe(method(setPolygonCount:))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn setPolygonCount(&self, polygon_count: NSUInteger);
207    );
208}
209
210/// Methods declared on superclass `NSObject`.
211impl MPSPolygonBuffer {
212    extern_methods!(
213        #[unsafe(method(new))]
214        #[unsafe(method_family = new)]
215        pub unsafe fn new() -> Retained<Self>;
216    );
217}