use objc2::__framework_prelude::*;
use objc2_foundation::*;
use objc2_metal::*;
use crate::*;
pub type MTKModelError = NSString;
extern "C" {
pub static MTKModelErrorDomain: &'static MTKModelError;
}
extern "C" {
pub static MTKModelErrorKey: &'static MTKModelError;
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTKMeshBufferAllocator;
unsafe impl ClassType for MTKMeshBufferAllocator {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTKMeshBufferAllocator {}
extern_methods!(
unsafe impl MTKMeshBufferAllocator {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[method_id(@__retain_semantics Init initWithDevice:)]
pub unsafe fn initWithDevice(
this: Allocated<Self>,
device: &ProtocolObject<dyn MTLDevice>,
) -> Id<Self>;
#[method_id(@__retain_semantics Other device)]
pub unsafe fn device(&self) -> Id<ProtocolObject<dyn MTLDevice>>;
}
);
extern_methods!(
unsafe impl MTKMeshBufferAllocator {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTKMeshBuffer;
unsafe impl ClassType for MTKMeshBuffer {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTKMeshBuffer {}
unsafe impl NSObjectProtocol for MTKMeshBuffer {}
extern_methods!(
unsafe impl MTKMeshBuffer {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[method(length)]
pub unsafe fn length(&self) -> NSUInteger;
#[method_id(@__retain_semantics Other allocator)]
pub unsafe fn allocator(&self) -> Id<MTKMeshBufferAllocator>;
#[method_id(@__retain_semantics Other buffer)]
pub unsafe fn buffer(&self) -> Id<ProtocolObject<dyn MTLBuffer>>;
#[method(offset)]
pub unsafe fn offset(&self) -> NSUInteger;
}
);
extern_methods!(
unsafe impl MTKMeshBuffer {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTKSubmesh;
unsafe impl ClassType for MTKSubmesh {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTKSubmesh {}
extern_methods!(
unsafe impl MTKSubmesh {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[method(primitiveType)]
pub unsafe fn primitiveType(&self) -> MTLPrimitiveType;
#[method(indexType)]
pub unsafe fn indexType(&self) -> MTLIndexType;
#[method_id(@__retain_semantics Other indexBuffer)]
pub unsafe fn indexBuffer(&self) -> Id<MTKMeshBuffer>;
#[method(indexCount)]
pub unsafe fn indexCount(&self) -> NSUInteger;
#[method_id(@__retain_semantics Other mesh)]
pub unsafe fn mesh(&self) -> Option<Id<MTKMesh>>;
#[method_id(@__retain_semantics Other name)]
pub unsafe fn name(&self) -> Id<NSString>;
#[method(setName:)]
pub unsafe fn setName(&self, name: &NSString);
}
);
extern_methods!(
unsafe impl MTKSubmesh {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTKMesh;
unsafe impl ClassType for MTKMesh {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTKMesh {}
extern_methods!(
unsafe impl MTKMesh {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[method_id(@__retain_semantics Other vertexBuffers)]
pub unsafe fn vertexBuffers(&self) -> Id<NSArray<MTKMeshBuffer>>;
#[method_id(@__retain_semantics Other submeshes)]
pub unsafe fn submeshes(&self) -> Id<NSArray<MTKSubmesh>>;
#[method(vertexCount)]
pub unsafe fn vertexCount(&self) -> NSUInteger;
#[method_id(@__retain_semantics Other name)]
pub unsafe fn name(&self) -> Id<NSString>;
#[method(setName:)]
pub unsafe fn setName(&self, name: &NSString);
}
);
extern_methods!(
unsafe impl MTKMesh {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);