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 { ... }
}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§
Sourceunsafe fn newZone(
&self,
capacity: NSUInteger,
) -> Retained<ProtocolObject<dyn MDLMeshBufferZone>>
unsafe fn newZone( &self, capacity: NSUInteger, ) -> Retained<ProtocolObject<dyn MDLMeshBufferZone>>
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
Sourceunsafe fn newZoneForBuffersWithSize_andType(
&self,
sizes: &NSArray<NSNumber>,
types: &NSArray<NSNumber>,
) -> Retained<ProtocolObject<dyn MDLMeshBufferZone>>
unsafe fn newZoneForBuffersWithSize_andType( &self, sizes: &NSArray<NSNumber>, types: &NSArray<NSNumber>, ) -> Retained<ProtocolObject<dyn MDLMeshBufferZone>>
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.
Sourceunsafe fn newBuffer_type(
&self,
length: NSUInteger,
type: MDLMeshBufferType,
) -> Retained<ProtocolObject<dyn MDLMeshBuffer>>
unsafe fn newBuffer_type( &self, length: NSUInteger, type: MDLMeshBufferType, ) -> Retained<ProtocolObject<dyn MDLMeshBuffer>>
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
Sourceunsafe fn newBufferWithData_type(
&self,
data: &NSData,
type: MDLMeshBufferType,
) -> Retained<ProtocolObject<dyn MDLMeshBuffer>>
unsafe fn newBufferWithData_type( &self, data: &NSData, type: MDLMeshBufferType, ) -> Retained<ProtocolObject<dyn MDLMeshBuffer>>
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
Sourceunsafe fn newBufferFromZone_length_type(
&self,
zone: Option<&ProtocolObject<dyn MDLMeshBufferZone>>,
length: NSUInteger,
type: MDLMeshBufferType,
) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>
unsafe fn newBufferFromZone_length_type( &self, zone: Option<&ProtocolObject<dyn MDLMeshBufferZone>>, length: NSUInteger, type: MDLMeshBufferType, ) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>
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.
Sourceunsafe fn newBufferFromZone_data_type(
&self,
zone: Option<&ProtocolObject<dyn MDLMeshBufferZone>>,
data: &NSData,
type: MDLMeshBufferType,
) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>
unsafe fn newBufferFromZone_data_type( &self, zone: Option<&ProtocolObject<dyn MDLMeshBufferZone>>, data: &NSData, type: MDLMeshBufferType, ) -> Option<Retained<ProtocolObject<dyn MDLMeshBuffer>>>
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.