MaplyAtmosphere

Objective-C

@interface MaplyAtmosphere : NSObject

Swift

class MaplyAtmosphere : NSObject

Sets up the objects and shaders to implement an atmosphere.

This object sets up a shader implementation of the simple atmosphere from GPU Gems 2 http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html

  • Initialize the view controller. Will place objects in that view controller.

    Declaration

    Objective-C

    - (nullable instancetype)initWithViewC:
        (WhirlyGlobeViewController *_Nonnull)viewC;

    Swift

    init?(viewC: WhirlyGlobeViewController)
  • Kr

    Rayleigh scattering constant (0.0025 by default)

    Declaration

    Objective-C

    @property (nonatomic) float Kr;

    Swift

    var kr: Float { get set }
  • Km

    Mie scattering constant (0.0010 by default)

    Declaration

    Objective-C

    @property (nonatomic) float Km;

    Swift

    var km: Float { get set }
  • Brightness of the sun (20.0 by default)

    Declaration

    Objective-C

    @property (nonatomic) float ESun;

    Swift

    var eSun: Float { get set }
  • Number of samples for the ray through the atmosphere (3 by default)

    Declaration

    Objective-C

    @property (nonatomic) int numSamples;

    Swift

    var numSamples: Int32 { get set }
  • Outer radius of the atmosphere (1.05 by default). Earth is radius 1.0.

    Declaration

    Objective-C

    @property (nonatomic) float outerRadius;

    Swift

    var outerRadius: Float { get set }
  • g

    Constant used in the fragment shader. Default is -0.95.

    Declaration

    Objective-C

    @property (nonatomic) float g;

    Swift

    var g: Float { get set }
  • Exposure constant in fragment shader. Default is 2.0.

    Declaration

    Objective-C

    @property (nonatomic) float exposure;

    Swift

    var exposure: Float { get set }
  • The ground shader we set up. You need to apply it yourself.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) MaplyShader *groundShader;

    Swift

    var groundShader: MaplyShader? { get set }
  • If set we’ll lock the sun direction to the camera position. Permanent daylight.

    Declaration

    Objective-C

    @property (nonatomic) _Bool lockToCamera;

    Swift

    var lockToCamera: Bool { get set }
  • Wavelengths of the light (RGB). Three floats, defaults are: 0.650, 0.570, 0.475

    Declaration

    Objective-C

    - (void)setWavelength:(float *_Nonnull)wavelength;

    Swift

    func setWavelength(_ wavelength: UnsafeMutablePointer<Float>)
  • Wavelengths of the light (RGB). Defaults are: 0.650, 0.570, 0.475

    Declaration

    Objective-C

    - (void)setWavelengthRed:(float)redWavelength
                       green:(float)greenWavelength
                        blue:(float)blueWavelength;

    Swift

    func setWavelengthRed(_ redWavelength: Float, green greenWavelength: Float, blue blueWavelength: Float)
  • Return the current wavelength settings (RGB)

    Declaration

    Objective-C

    - (void)getWavelength:(float *_Nonnull)wavelength;

    Swift

    func getWavelength(_ wavelength: UnsafeMutablePointer<Float>)
  • Return the current wavelength settings (RGB). The component is 0 for red, 1 for green and 2 for blue

    Declaration

    Objective-C

    - (float)getWavelengthForComponent:(short)component;

    Swift

    func getWavelengthForComponent(_ component: Int16) -> Float
  • Set the sun’s position relative to the earth. This is what comes out of MaplySun.

    Declaration

    Objective-C

    - (void)setSunPosition:(MaplyCoordinate3d)sunDir;

    Swift

    func setSunPosition(_ sunDir: MaplyCoordinate3d)
  • Remove objects from the view controller we set it up in.

    Declaration

    Objective-C

    - (void)removeFromViewC;

    Swift

    func removeFromViewC()