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::ffi::*;
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::*;
#[cfg(feature = "objc2-scene-kit")]
use objc2_scene_kit::*;

use crate::*;

#[cfg(feature = "objc2")]
extern_class!(
    /// A SceneKit geometry representing a plane.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arscnplanegeometry?language=objc)
    #[unsafe(super(SCNGeometry, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "objc2", feature = "objc2-scene-kit"))]
    pub struct ARSCNPlaneGeometry;
);

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

#[cfg(all(
    feature = "objc2",
    feature = "objc2-foundation",
    feature = "objc2-scene-kit"
))]
extern_conformance!(
    unsafe impl NSCopying for ARSCNPlaneGeometry {}
);

#[cfg(all(
    feature = "objc2",
    feature = "objc2-foundation",
    feature = "objc2-scene-kit"
))]
unsafe impl CopyingHelper for ARSCNPlaneGeometry {
    type Result = Self;
}

#[cfg(all(feature = "objc2", feature = "objc2-scene-kit"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for ARSCNPlaneGeometry {}
);

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

#[cfg(all(feature = "objc2", feature = "objc2-scene-kit"))]
extern_conformance!(
    unsafe impl SCNAnimatable for ARSCNPlaneGeometry {}
);

#[cfg(all(feature = "objc2", feature = "objc2-scene-kit"))]
extern_conformance!(
    unsafe impl SCNBoundingVolume for ARSCNPlaneGeometry {}
);

#[cfg(all(feature = "objc2", feature = "objc2-scene-kit"))]
extern_conformance!(
    unsafe impl SCNShadable for ARSCNPlaneGeometry {}
);

#[cfg(all(feature = "objc2", feature = "objc2-scene-kit"))]
impl ARSCNPlaneGeometry {
    extern_methods!(
        #[cfg(feature = "objc2-metal")]
        /// Creates a new plane geometry using a Metal device.
        ///
        ///
        /// Parameter `device`: A Metal device.
        ///
        /// Returns: A new plane geometry.
        #[unsafe(method(planeGeometryWithDevice:))]
        #[unsafe(method_family = none)]
        pub unsafe fn planeGeometryWithDevice(
            device: &ProtocolObject<dyn MTLDevice>,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "ARPlaneGeometry")]
        /// Updates the geometry with the vertices of a plane geometry.
        ///
        ///
        /// Parameter `planeGeometry`: A plane geometry.
        #[unsafe(method(updateFromPlaneGeometry:))]
        #[unsafe(method_family = none)]
        pub unsafe fn updateFromPlaneGeometry(&self, plane_geometry: &ARPlaneGeometry);
    );
}

/// Methods declared on superclass `SCNGeometry`.
#[cfg(all(feature = "objc2", feature = "objc2-scene-kit"))]
impl ARSCNPlaneGeometry {
    extern_methods!(
        /// Creates and returns an empty geometry object.
        ///
        /// An empty geometry may be used as the lowest level of detail of a geometry.
        #[unsafe(method(geometry))]
        #[unsafe(method_family = none)]
        pub unsafe fn geometry() -> Retained<Self>;

        #[cfg(feature = "objc2-foundation")]
        /// Creates and returns a new geometry built from geometry sources and geometry elements.
        ///
        /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
        ///
        /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
        ///
        /// A geometry is made of geometry sources (at least `SCNGeometrySourceSemanticVertex`) and at least one geometry element. Multiple sources for texture coordinates are accepted. In that case the `mappingChannel` is implicitly set based on the order of the texture sources, starting at index 0.
        #[unsafe(method(geometryWithSources:elements:))]
        #[unsafe(method_family = none)]
        pub unsafe fn geometryWithSources_elements(
            sources: &NSArray<SCNGeometrySource>,
            elements: Option<&NSArray<SCNGeometryElement>>,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-foundation")]
        /// Creates and returns a new geometry built from geometry sources and geometry elements, with per-source indexed geometry data.
        ///
        /// Parameter `sources`: An array of geometry sources. If several geometry sources have the same semantic, only the first one is taken into account.
        ///
        /// Parameter `elements`: An array of geometry elements. The sort order in the array determines the mapping between materials and geometry elements.
        ///
        /// Parameter `sourceChannels`: An array of indices that describes, for each geometry source, which channel of the geometry elements to use.
        ///
        /// ```text
        /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using different indices to reference position and UV data (2 channels)
        ///
        /// Positions         ┆   POS0           POS3           POS4    ┆             quad   quad   pentagon    quad   quad   pentagon    ┆   SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
        /// 0 │ (0.0, 0.0, 0.0)   ┆        ┌───────────┬───────────┐        ┆           ┌─────┐ ┌─────┐ ┌───────┐ ┌─────┐ ┌─────┐ ┌───────┐   ┆                                                               primitiveType:SCNGeometryPrimitiveTypePolygon
        /// 1 │ (0.0, 1.0, 0.0)   ┆        │UV0     UV3│UV0     UV3│        ┆     4 4 5 0 1 2 3 5 4 3 2 7 6 5 2 1 0 1 2 3 2 3 0 1 1 2 3 4 0   ┆                                                              primitiveCount:3
        /// 2 │ (1.0, 0.0, 0.0)   ┆        │           │           │        ┆     └───┘ └───────────────────────┘ └───────────────────────┘   ┆                                                         indicesChannelCount:2
        /// 3 │ (1.0, 1.0, 0.0)   ┆        │     A     │     B     │        ┆   polygons        channel 0                 channel 1           ┆                                                  interleavedIndicesChannels:…
        /// 4 │ (2.0, 0.0, 0.0)   ┆        │           │           │        ┆                  (positions)                  (UVs)             ┆                                                               bytesPerIndex:…];
        /// 5 │ (2.0, 1.0, 0.0)   ┆        │UV1     UV2│UV1     UV2│        ┆                                                                 ┆
        /// 6 │ (2.0, 2.0, 0.0)   ┆   POS1 ├───────────┴───────────┤ POS5   ┆                                                                 ┆   SCNGeometry *geometry = [SCNGeometry geometryWithSources:
        /// @
        /// [positionSource, texcoordsSource]
        /// 7 │ (0.0, 2.0, 0.0)   ┆        │UVO       UV4       UV3│        ┆                                                                 ┆                                                   elements:
        /// @
        /// [element]
        /// ┆        │         POS2          │        ┆                quad A          quad B          pentagon C       ┆                                             sourceChannels:
        /// @
        /// [0, 1]];
        /// UVs               ┆        │                       │        ┆           ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐   ┆
        /// 0 │ (0.0, 0.0)        ┆        │           C           │        ┆     4 4 5 0 0 1 1 2 2 3 3 5 2 4 3 3 0 2 1 7 1 6 2 5 3 2 4 1 0   ┆
        /// 1 │ (0.0, 1.0)        ┆        │                       │        ┆     └───┘└──────────────────────────────────────────────────┘   ┆
        /// 2 │ (1.0, 1.0)        ┆        │UV1                 UV2│        ┆   polygons               interleaved  channels                  ┆
        /// 3 │ (1.0, 0.0)        ┆        └───────────────────────┘        ┆                           (positions and UVs)                   ┆
        /// 4 │ (0.5, 0.0)        ┆   POS7                          POS6    ┆                                                                 ┆
        ///
        /// Example: geometry made of 3 primitives (2 quads, 1 pentagon) using the same indices to reference position and UV data (1 channel)
        ///
        /// Positions         ┆   POS0           POS3           POS4    ┆             quad A      quad B      pentagon C                  ┆   SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
        /// 0 │ (0.0, 4.0, 0.0)   ┆        ┌───────────┬───────────┐        ┆           ┌────────┐  ┌────────┐  ┌───────────┐                 ┆                                                               primitiveType:SCNGeometryPrimitiveTypePolygon
        /// 1 │ (0.0, 2.0, 0.0)   ┆        │UV0     UV3│UV3     UV4│        ┆     4 4 5 0  1  2  3  5  4  3  2  7  6  5  2  1                 ┆                                                              primitiveCount:3
        /// 2 │ (2.0, 2.0, 0.0)   ┆        │           │           │        ┆     └───┘ └───────────────────────────────────┘                 ┆                                                               bytesPerIndex:…];
        /// 3 │ (2.0, 4.0, 0.0)   ┆        │     A     │     B     │        ┆   polygons              channel 0                               ┆
        /// 4 │ (4.0, 4.0, 0.0)   ┆        │           │           │        ┆                    (positions and UVs)                          ┆   SCNGeometry *geometry = [SCNGeometry geometryWithSources:
        /// @
        /// [positionSource, texcoordsSource]
        /// 5 │ (4.0, 2.0, 0.0)   ┆        │UV1     UV2│UV2     UV5│        ┆                                                                 ┆                                                   elements:
        /// @
        /// [element]];
        /// 6 │ (4.0, 0.0, 0.0)   ┆   POS1 ├───────────┴───────────┤ POS5   ┆                                                                 ┆
        /// 7 │ (0.0, 0.0, 0.0)   ┆        │UV1       UV2       UV5│        ┆                                                                 ┆                                            === or equivalently ===
        /// ┆        │         POS2          │        ┆                                                                 ┆
        /// UVs               ┆        │                       │        ┆                                                                 ┆   SCNGeometryElement *element = [SCNGeometryElement geometryElementWithData:…
        /// 0 │ (0.0, 0.0)        ┆        │           C           │        ┆                                                                 ┆                                                               primitiveType:SCNGeometryPrimitiveTypePolygon
        /// 1 │ (0.0, 0.5)        ┆        │                       │        ┆                                                                 ┆                                                              primitiveCount:3
        /// 2 │ (0.5, 0.5)        ┆        │UV7                 UV6│        ┆                                                                 ┆                                                         indicesChannelCount:1
        /// 3 │ (0.5, 0.0)        ┆        └───────────────────────┘        ┆                                                                 ┆                                                  interleavedIndicesChannels:…
        /// 4 │ (1.0, 0.0)        ┆   POS7                          POS6    ┆                                                                 ┆                                                               bytesPerIndex:…];
        /// 5 │ (1.0, 0.5)        ┆                                         ┆                                                                 ┆
        /// 6 │ (1.0, 1.0)        ┆                                         ┆                                                                 ┆   SCNGeometry *geometry = [SCNGeometry geometryWithSources:
        /// @
        /// [positionSource, texcoordsSource]
        /// 7 │ (0.0, 1.0)        ┆                                         ┆                                                                 ┆                                                   elements:
        /// @
        /// [element]
        /// ┆                                         ┆                                                                 ┆                                             sourceChannels:
        /// @
        /// [0, 0]];                                                                                                                                               ┆
        /// ```
        #[unsafe(method(geometryWithSources:elements:sourceChannels:))]
        #[unsafe(method_family = none)]
        pub unsafe fn geometryWithSources_elements_sourceChannels(
            sources: &NSArray<SCNGeometrySource>,
            elements: Option<&NSArray<SCNGeometryElement>>,
            source_channels: Option<&NSArray<NSNumber>>,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "objc2", feature = "objc2-scene-kit"))]
impl ARSCNPlaneGeometry {
    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>;
    );
}