MaplyLight

Objective-C

@interface MaplyLight : NSObject

Swift

class MaplyLight : NSObject

The Light provides a simple interface to basic lighting within the toolkit.

You can have up to 8 lights in the current version of the toolkit. Obviously this is all shader implementation with OpenGL ES 2.0, so you can always just bypass this and do what you like. However, the default shaders will look for these lights.

The lights are very simple, suitable for the globe, and contain a position, a couple of colors, and a view dependent flag.

  • pos

    The location of this particular light in display space.

    This is a single light’s location in display space. Display space for the globe is based on a radius of 1.0.

    Declaration

    Objective-C

    @property (nonatomic) MaplyCoordinate3d pos;

    Swift

    var pos: MaplyCoordinate3d { get set }
  • Controls whether the light takes the model matrix into account or not.

    If set, this light moves with the model (usually the globe). You’d use this for a real sun position. If not set, the light is static and does not move or rotate.

    Declaration

    Objective-C

    @property (nonatomic) _Bool viewDependent;

    Swift

    var viewDependent: Bool { get set }
  • Ambient color for the light.

    This color will always be added to any given pixel. It provides a baseline lighting value.

    Declaration

    Objective-C

    @property (nonatomic, strong) UIColor *__nullable ambient

    Swift

    var ambient: UnsafeMutablePointer<Int32>? { get set }
  • Diffuse light color.

    The diffuse color is multiplied by a directional value and so will vary depending on geometry normals.

    Declaration

    Objective-C

    @property (nonatomic, strong) UIColor *__nullable diffuse

    Swift

    var diffuse: UnsafeMutablePointer<Int32>? { get set }