Interface MDLMeshBufferAllocator

  • All Known Implementing Classes:
    GLKMeshBufferAllocator, MDLMeshBufferDataAllocator, MTKMeshBufferAllocator

    public interface MDLMeshBufferAllocator
    [@protocol] MDLMeshBufferAllocator 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.
    • Method Detail

      • newBufferType

        MDLMeshBuffer newBufferType​(long length,
                                    long type)
        newBuffer:type: Create a buffer in a default zone
        Parameters:
        length - Size of buffer to be created in bytes
        type - Type of data to be stored in this buffer
      • newBufferFromZoneDataType

        MDLMeshBuffer newBufferFromZoneDataType​(MDLMeshBufferZone zone,
                                                NSData data,
                                                long type)
        newBufferFromZone:data:type: Create a buffer from a given zone and fill with data in the supplied NSData object 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.
        Parameters:
        zone - Zone from which to allocate the memory
        data - Values with which to fill the buffer
        type - Type of data to be stored in this buffer
        Returns:
        An object conforming to the MDLMeshBuffer protocol. Returns nil the buffer could not be allocated in the given zone
      • newBufferFromZoneLengthType

        MDLMeshBuffer newBufferFromZoneLengthType​(MDLMeshBufferZone zone,
                                                  long length,
                                                  long type)
        newBufferFromZone:length:type: Create a buffer from a given zone with the given length 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.
        Parameters:
        zone - Zone from which to allocate the memory
        type - Type of data to be stored in this buffer
        Returns:
        An object conforming to the MDLMeshBuffer protocol. Returns nil the buffer could not be allocated in the zone given.
      • newBufferWithDataType

        MDLMeshBuffer newBufferWithDataType​(NSData data,
                                            long type)
        newBufferWithData:type: Create a buffer in a default zone and fill with data in the supplied NSData object
        Parameters:
        data - Memory to fill the buffer with
        type - Type of data to be stored in this buffer
      • newZone

        MDLMeshBufferZone newZone​(long capacity)
        newZone: Create a zone which can be used to allocate MDLMeshBuffer objects
        Parameters:
        capacity - Total size in bytes of all buffers which can be created from this zone
      • newZoneForBuffersWithSizeAndType

        MDLMeshBufferZone newZoneForBuffersWithSizeAndType​(NSArray<? extends NSNumber> sizes,
                                                           NSArray<? extends NSNumber> types)
        newZoneForBuffersWithSize:andType: Create a zone which can be used to allocate MDLMeshBuffer objects 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.
        Parameters:
        sizes - Sizes of each buffer to be created in this zone
        types - Type of each buffer to be created in this zone. Values to be of MDLMeshBufferType