MDLMeshBufferAllocator

Trait MDLMeshBufferAllocator 

Source
pub unsafe trait MDLMeshBufferAllocator: NSObjectProtocol {
    // Provided methods
    unsafe fn newZone(
        &self,
        capacity: NSUInteger,
    ) -> Retained<ProtocolObject<dyn MDLMeshBufferZone>>
       where Self: Sized + Message { ... }
    unsafe fn newZoneForBuffersWithSize_andType(
        &self,
        sizes: &NSArray<NSNumber>,
        types: &NSArray<NSNumber>,
    ) -> Retained<ProtocolObject<dyn MDLMeshBufferZone>>
       where Self: Sized + Message { ... }
    unsafe fn newBuffer_type(
        &self,
        length: NSUInteger,
        type: MDLMeshBufferType,
    ) -> Retained<ProtocolObject<dyn MDLMeshBuffer>>
       where Self: Sized + Message { ... }
    unsafe fn newBufferWithData_type(
        &self,
        data: &NSData,
        type: MDLMeshBufferType,
    ) -> Retained<ProtocolObject<dyn MDLMeshBuffer>>
       where Self: Sized + Message { ... }
    unsafe fn newBufferFromZone_length_type(
        &self,
        zone: Option<&ProtocolObject<dyn MDLMeshBufferZone>>,
        length: NSUInteger,
        type: MDLMeshBufferType,
    ) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>
       where Self: Sized + Message { ... }
    unsafe fn newBufferFromZone_data_type(
        &self,
        zone: Option<&ProtocolObject<dyn MDLMeshBufferZone>>,
        data: &NSData,
        type: MDLMeshBufferType,
    ) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>
       where Self: Sized + Message { ... }
}
Available on crate feature MDLMeshBuffer only.
Expand description

Object for allocating buffers to back vertex and index data

Accepted by MDLAsset init method. Implementor creates objects implementing MDLMeshBuffer with memory to be filled with vertex and index data during 3d file loading and parsing.

See also Apple’s documentation

Provided Methods§

Source

unsafe fn newZone( &self, capacity: NSUInteger, ) -> Retained<ProtocolObject<dyn MDLMeshBufferZone>>
where Self: Sized + Message,

Create a zone which can be used to allocate MDLMeshBuffer objects

Parameter capacity: Total size in bytes of all buffers which can be created from this zone

Source

unsafe fn newZoneForBuffersWithSize_andType( &self, sizes: &NSArray<NSNumber>, types: &NSArray<NSNumber>, ) -> Retained<ProtocolObject<dyn MDLMeshBufferZone>>
where Self: Sized + Message,

Create a zone which can be used to allocate MDLMeshBuffer objects

Parameter sizes: Sizes of each buffer to be created in this zone

Parameter types: Type of each buffer to be created in this zone. Values to be of MDLMeshBufferType

Will create a zone from which MDLMeshBuffer objects can be allocated. This will allocate a zone with enough capacity for each of the buffers with sizes and types specified even taking into any alignment restrictions necessary to use these buffers.

Source

unsafe fn newBuffer_type( &self, length: NSUInteger, type: MDLMeshBufferType, ) -> Retained<ProtocolObject<dyn MDLMeshBuffer>>
where Self: Sized + Message,

Create a buffer in a default zone

Parameter length: Size of buffer to be created in bytes

Parameter type: Type of data to be stored in this buffer

Source

unsafe fn newBufferWithData_type( &self, data: &NSData, type: MDLMeshBufferType, ) -> Retained<ProtocolObject<dyn MDLMeshBuffer>>
where Self: Sized + Message,

Create a buffer in a default zone and fill with data in the supplied NSData object

Parameter data: Memory to fill the buffer with

Parameter type: Type of data to be stored in this buffer

Source

unsafe fn newBufferFromZone_length_type( &self, zone: Option<&ProtocolObject<dyn MDLMeshBufferZone>>, length: NSUInteger, type: MDLMeshBufferType, ) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>
where Self: Sized + Message,

Create a buffer from a given zone with the given length

Returns: An object conforming to the MDLMeshBuffer protocol. Returns nil the buffer could not be allocated in the zone given.

Parameter zone: Zone from which to allocate the memory

Parameter type: Type of data to be stored in this buffer

An implementing MDLMeshBufferAllocator object may increase the size of the zone if the buffer could not be allocated with the current zone size. Alternatively the implementation may return nil if the buffer could not be allocated.

Source

unsafe fn newBufferFromZone_data_type( &self, zone: Option<&ProtocolObject<dyn MDLMeshBufferZone>>, data: &NSData, type: MDLMeshBufferType, ) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>
where Self: Sized + Message,

Create a buffer from a given zone and fill with data in the supplied NSData object

Returns: An object conforming to the MDLMeshBuffer protocol. Returns nil the buffer could not be allocated in the given zone

Parameter zone: Zone from which to allocate the memory

Parameter data: Values with which to fill the buffer

Parameter type: Type of data to be stored in this buffer

An implementing MDLMeshBufferAllocator object may increase the size of the zone if the buffer could not be allocated with the current zone size. Alternatively the implementation may return nil if the buffer could not be allocated.

Trait Implementations§

Source§

impl ProtocolType for dyn MDLMeshBufferAllocator

Source§

const NAME: &'static str = "MDLMeshBufferAllocator"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn MDLMeshBufferAllocator

Implementations on Foreign Types§

Source§

impl<T> MDLMeshBufferAllocator for ProtocolObject<T>

Implementors§