MaplyRenderTarget

Objective-C

@interface MaplyRenderTarget : NSObject

Swift

class MaplyRenderTarget : NSObject

Represents a render target (other than the screen)

Individual objects can ask to be drawn somewhere other than the screen. This is how we do that.

A render target is just a link between a render every frame and a MaplyTexture. To get at the actual image you use the MaplyTexture.

At the moment a render target can only draw the full screen, possibly at a lower resolution.

  • The texture we’ll draw into.

    This is the texture we’ll draw into. Use createTexture to set it up.

    Declaration

    Objective-C

    @property (nonatomic, strong) MaplyTexture *texture;

    Swift

    var texture: MaplyTexture! { get set }
  • If set, we’ll clear the target textures every frame before rendering to it.

    If not set, we won’t clear the render target texture between frames.

    True by default.

    Declaration

    Objective-C

    @property (nonatomic) _Bool clearEveryFrame;

    Swift

    var clearEveryFrame: Bool { get set }
  • If we’re generating a mipmap for the attached texture of a render target, this controls how we do it. The default is none.

    Declaration

    Objective-C

    @property (nonatomic) MaplyMipmapType mipmapType;

    Swift

    var mipmapType: MaplyMipmapType { get set }
  • If set, we’ll caclulate the min/max for this render target every frame. This is a GPU based calculation for Metal.

    Declaration

    Objective-C

    @property (nonatomic) _Bool calculateMinMax;

    Swift

    var calculateMinMax: Bool { get set }
  • Clear the render target to this color every frame.

    Default is clear black.

    Declaration

    Objective-C

    @property (nonatomic, strong) UIColor *clearColor

    Swift

    var clearColor: UnsafeMutablePointer<Int32>! { get set }
  • Clear the render target to this value on every frame.

    This is for render targets that are not purely color, such as multiple floats.

    Declaration

    Objective-C

    @property (nonatomic) float clearVal;

    Swift

    var clearVal: Float { get set }
  • If set, anything rendered to this render target will blend with what’s there.

    If not set, what’s rendered will replace what was there before. This is the way it normally works for screen rendering.

    Set to false by default.

    Declaration

    Objective-C

    @property (nonatomic) _Bool blend;

    Swift

    var blend: Bool { get set }
  • Retrieves a single data value out of the render target. Size is the number of components * size of components. It’s best to call this in the snapshot callback. We know the destination isn’t being written to at the moment. Metal only.

    Declaration

    Objective-C

    - (NSData *)getValueAtX:(int)x y:(int)y;

    Swift

    func getValueAt(x: Int32, y: Int32) -> Data!
  • Returns the whole render target snapshot in the NSData. It’s best to call this in the snapshot callback. We know the destination isn’t being written to at the moment. Metal only.

    Declaration

    Objective-C

    - (NSData *)getSnapshot;

    Swift

    func getSnapshot() -> Data!
  • Retreives the min/max data values if those are being calculated. It’s best to call this in the snapshot callback. We know the destination isn’t being written to at the moment. Metal only.

    Declaration

    Objective-C

    - (NSData *)getMinMaxValues;

    Swift

    func getMinMaxValues() -> Data!