objc2-ar-kit 0.3.2

Bindings to the ARKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-foundation")]
use objc2_foundation::*;
#[cfg(feature = "objc2-metal")]
use objc2_metal::*;

use crate::*;

#[cfg(feature = "objc2")]
extern_class!(
    /// A container for vector data of a geometry.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/argeometrysource?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2")]
    pub struct ARGeometrySource;
);

#[cfg(feature = "objc2")]
unsafe impl Send for ARGeometrySource {}

#[cfg(feature = "objc2")]
unsafe impl Sync for ARGeometrySource {}

#[cfg(all(feature = "objc2", feature = "objc2-foundation"))]
extern_conformance!(
    unsafe impl NSCoding for ARGeometrySource {}
);

#[cfg(feature = "objc2")]
extern_conformance!(
    unsafe impl NSObjectProtocol for ARGeometrySource {}
);

#[cfg(all(feature = "objc2", feature = "objc2-foundation"))]
extern_conformance!(
    unsafe impl NSSecureCoding for ARGeometrySource {}
);

#[cfg(feature = "objc2")]
impl ARGeometrySource {
    extern_methods!(
        #[cfg(feature = "objc2-metal")]
        /// A Metal buffer containing per-vector data for the source.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(buffer))]
        #[unsafe(method_family = none)]
        pub unsafe fn buffer(&self) -> Retained<ProtocolObject<dyn MTLBuffer>>;

        /// The number of vectors in the source.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(count))]
        #[unsafe(method_family = none)]
        pub unsafe fn count(&self) -> NSInteger;

        #[cfg(feature = "objc2-metal")]
        /// The type of per-vector data in the buffer.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(format))]
        #[unsafe(method_family = none)]
        pub unsafe fn format(&self) -> MTLVertexFormat;

        /// The number of scalar components in each vector.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(componentsPerVector))]
        #[unsafe(method_family = none)]
        pub unsafe fn componentsPerVector(&self) -> NSInteger;

        /// The offset (in bytes) from the beginning of the buffer.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(offset))]
        #[unsafe(method_family = none)]
        pub unsafe fn offset(&self) -> NSInteger;

        /// The number of bytes from a vector to the next one in the buffer.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(stride))]
        #[unsafe(method_family = none)]
        pub unsafe fn stride(&self) -> NSInteger;

        /// Unavailable
        #[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>;
    );
}

/// The primitive that defines how vertices are connected.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/argeometryprimitivetype?language=objc)
// NS_ENUM
#[cfg(feature = "objc2")]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ARGeometryPrimitiveType(pub NSInteger);
#[cfg(feature = "objc2")]
impl ARGeometryPrimitiveType {
    /// The geometry element is a sequence of line segments, where each line segment is described by two new vertices.
    #[doc(alias = "ARGeometryPrimitiveTypeLine")]
    pub const Line: Self = Self(0);
    /// The geometry element is a sequence of triangles, where each triangle is described by three new vertices.
    #[doc(alias = "ARGeometryPrimitiveTypeTriangle")]
    pub const Triangle: Self = Self(1);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for ARGeometryPrimitiveType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for ARGeometryPrimitiveType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

#[cfg(feature = "objc2")]
extern_class!(
    /// A container for index data describing how vertices connect to define a geometry.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/argeometryelement?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2")]
    pub struct ARGeometryElement;
);

#[cfg(feature = "objc2")]
unsafe impl Send for ARGeometryElement {}

#[cfg(feature = "objc2")]
unsafe impl Sync for ARGeometryElement {}

#[cfg(all(feature = "objc2", feature = "objc2-foundation"))]
extern_conformance!(
    unsafe impl NSCoding for ARGeometryElement {}
);

#[cfg(feature = "objc2")]
extern_conformance!(
    unsafe impl NSObjectProtocol for ARGeometryElement {}
);

#[cfg(all(feature = "objc2", feature = "objc2-foundation"))]
extern_conformance!(
    unsafe impl NSSecureCoding for ARGeometryElement {}
);

#[cfg(feature = "objc2")]
impl ARGeometryElement {
    extern_methods!(
        #[cfg(feature = "objc2-metal")]
        /// A Metal buffer containing index data that defines the geometry.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(buffer))]
        #[unsafe(method_family = none)]
        pub unsafe fn buffer(&self) -> Retained<ProtocolObject<dyn MTLBuffer>>;

        /// The number of primitives in the buffer.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(count))]
        #[unsafe(method_family = none)]
        pub unsafe fn count(&self) -> NSInteger;

        /// The number of bytes that represent an index value.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(bytesPerIndex))]
        #[unsafe(method_family = none)]
        pub unsafe fn bytesPerIndex(&self) -> NSInteger;

        /// The number of indices for each primitive.
        ///
        /// See: ARGeometryPrimitiveType
        ///
        /// This is based on the primitiveType. For ARGeometryPrimitiveTypeTriangle the value is 3.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(indexCountPerPrimitive))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexCountPerPrimitive(&self) -> NSInteger;

        /// The type of the geometry element.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(primitiveType))]
        #[unsafe(method_family = none)]
        pub unsafe fn primitiveType(&self) -> ARGeometryPrimitiveType;

        /// Unavailable
        #[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>;
    );
}

/// A value describing the classification of a mesh face.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/armeshclassification?language=objc)
// NS_ENUM
#[cfg(feature = "objc2")]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ARMeshClassification(pub NSInteger);
#[cfg(feature = "objc2")]
impl ARMeshClassification {
    #[doc(alias = "ARMeshClassificationNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "ARMeshClassificationWall")]
    pub const Wall: Self = Self(1);
    #[doc(alias = "ARMeshClassificationFloor")]
    pub const Floor: Self = Self(2);
    #[doc(alias = "ARMeshClassificationCeiling")]
    pub const Ceiling: Self = Self(3);
    #[doc(alias = "ARMeshClassificationTable")]
    pub const Table: Self = Self(4);
    #[doc(alias = "ARMeshClassificationSeat")]
    pub const Seat: Self = Self(5);
    #[doc(alias = "ARMeshClassificationWindow")]
    pub const Window: Self = Self(6);
    #[doc(alias = "ARMeshClassificationDoor")]
    pub const Door: Self = Self(7);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for ARMeshClassification {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for ARMeshClassification {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

#[cfg(feature = "objc2")]
extern_class!(
    /// A three-dimensional shape that represents the geometry of a mesh.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/armeshgeometry?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2")]
    pub struct ARMeshGeometry;
);

#[cfg(feature = "objc2")]
unsafe impl Send for ARMeshGeometry {}

#[cfg(feature = "objc2")]
unsafe impl Sync for ARMeshGeometry {}

#[cfg(all(feature = "objc2", feature = "objc2-foundation"))]
extern_conformance!(
    unsafe impl NSCoding for ARMeshGeometry {}
);

#[cfg(feature = "objc2")]
extern_conformance!(
    unsafe impl NSObjectProtocol for ARMeshGeometry {}
);

#[cfg(all(feature = "objc2", feature = "objc2-foundation"))]
extern_conformance!(
    unsafe impl NSSecureCoding for ARMeshGeometry {}
);

#[cfg(feature = "objc2")]
impl ARMeshGeometry {
    extern_methods!(
        /// The vertices of the mesh.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(vertices))]
        #[unsafe(method_family = none)]
        pub unsafe fn vertices(&self) -> Retained<ARGeometrySource>;

        /// Normal of each vertex in the mesh.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(normals))]
        #[unsafe(method_family = none)]
        pub unsafe fn normals(&self) -> Retained<ARGeometrySource>;

        /// A list of all faces in the mesh.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(faces))]
        #[unsafe(method_family = none)]
        pub unsafe fn faces(&self) -> Retained<ARGeometryElement>;

        /// Classification for each face in the mesh.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(classification))]
        #[unsafe(method_family = none)]
        pub unsafe fn classification(&self) -> Option<Retained<ARGeometrySource>>;

        /// Unavailable
        #[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>;
    );
}