MSFSkyOptions

Objective-C


@interface MSFSkyOptions : NSObject {
  void *swigCPtr;
  BOOL swigCMemOwn;
}

Swift

class MSFSkyOptions : NSObject

Shader-based sky configuration, attached to the map via Options::setSkyOptions: one full-screen pass, a physical atmosphere (default) or a two-colour gradient, lit by LightOptions and hazed by FogOptions. Custom shader contract and uniforms: docs/features/sky-sun-shadows.md. Note: this class is experimental and may change or even be removed in future SDK versions.

  • Constructs a SkyOptions object with default values.

    Declaration

    Objective-C

    - (id)init;

    Swift

    init!()
  • Returns whether the shader sky is enabled.

    Declaration

    Objective-C

    - (BOOL)isEnabled;

    Swift

    func isEnabled() -> Bool

    Return Value

    True if the shader sky is drawn. The default is true.

  • Enables or disables the shader sky. When disabled, the legacy sky bitmap band (Options::setSkyColor / the style sky bitmap) is drawn instead.

    Declaration

    Objective-C

    - (void)setEnabled:(BOOL)enabled;

    Swift

    func setEnabled(_ enabled: Bool)

    Parameters

    enabled

    True to draw the shader sky.

  • Returns what the sky pass draws.

    Declaration

    Objective-C

    - (enum MSFSkyType)getType;

    Swift

    func getType() -> MSFSkyType

    Return Value

    The sky type. The default is SKY_TYPE_ATMOSPHERE.

  • Sets what the sky pass draws - a physical atmosphere or the two-colour gradient, which ignores every Atmosphere* property. Style property: “sky-type” (0 gradient, non-zero atmosphere).

    Declaration

    Objective-C

    - (void)setType:(enum MSFSkyType)type;

    Swift

    func setType(_ type: MSFSkyType)

    Parameters

    type

    The new sky type.

  • Returns how finely the atmosphere is integrated.

    Declaration

    Objective-C

    - (enum MSFSkyQuality)getQuality;

    Swift

    func getQuality() -> MSFSkyQuality

    Return Value

    The quality. The default is SKY_QUALITY_MEDIUM.

  • Sets how finely the atmosphere is integrated; the cost is per fragment of visible sky. Ignored by SKY_TYPE_GRADIENT.

    Declaration

    Objective-C

    - (void)setQuality:(enum MSFSkyQuality)quality;

    Swift

    func setQuality(_ quality: MSFSkyQuality)

    Parameters

    quality

    The new quality.

  • Returns the brightness of the sun driving the atmosphere.

    Declaration

    Objective-C

    - (float)getAtmosphereSunIntensity;

    Swift

    func getAtmosphereSunIntensity() -> Float

    Return Value

    The sun intensity. The default is 10.

  • Sets how bright the scattering model’s own sun is (not LightOptions’ ground light); raising it brightens the whole sky, not only the disc. Style property: “sky-atmosphere-sun-intensity”.

    Declaration

    Objective-C

    - (void)setAtmosphereSunIntensity:(float)intensity;

    Swift

    func setAtmosphereSunIntensity(_ intensity: Float)

    Parameters

    intensity

    The new sun intensity (clamped to 0 and above).

  • Returns the tint applied to Rayleigh scattering.

    Declaration

    Objective-C

    - (MSFColor *)getAtmosphereColor;

    Swift

    func getAtmosphereColor() -> MSFColor!

    Return Value

    The atmosphere color. The default is opaque white, i.e. no tint.

  • Sets the tint of the Rayleigh term - the blue of the sky - as Mapbox sky-atmosphere-color. The alpha channel scales how much of it there is, so a lower alpha thins the atmosphere. Style property: “sky-atmosphere-color”.

    Declaration

    Objective-C

    - (void)setAtmosphereColor:(MSFColor *)color;

    Swift

    func setAtmosphereColor(_ color: MSFColor!)

    Parameters

    color

    The new atmosphere color.

  • Returns the tint applied to Mie scattering.

    Declaration

    Objective-C

    - (MSFColor *)getHaloColor;

    Swift

    func getHaloColor() -> MSFColor!

    Return Value

    The halo color. The default is opaque white, i.e. no tint.

  • Sets the tint of the Mie term - the halo around the sun and the whiteness near the horizon - as Mapbox sky-atmosphere-halo-color. The alpha channel scales its strength. Style property: “sky-atmosphere-halo-color”.

    Declaration

    Objective-C

    - (void)setHaloColor:(MSFColor *)color;

    Swift

    func setHaloColor(_ color: MSFColor!)

    Parameters

    color

    The new halo color.

  • Returns the exposure applied to the scattered light.

    Declaration

    Objective-C

    - (float)getAtmosphereLuminance;

    Swift

    func getAtmosphereLuminance() -> Float

    Return Value

    The luminance. The default is 1.

  • Sets the exposure the scattered light is tonemapped with. Lower values brighten the sky, which is what a night or a heavily tinted atmosphere needs to stay readable. Style property: “sky-atmosphere-luminance”.

    Declaration

    Objective-C

    - (void)setAtmosphereLuminance:(float)luminance;

    Swift

    func setAtmosphereLuminance(_ luminance: Float)

    Parameters

    luminance

    The new luminance (clamped to 0.01 and above).

  • Returns the zenith sky color.

    Declaration

    Objective-C

    - (MSFColor *)getSkyColor;

    Swift

    func getSkyColor() -> MSFColor!

    Return Value

    The sky color. The default is a light blue.

  • Sets the zenith sky color, used by the built-in shader at the top of the sky.

    Declaration

    Objective-C

    - (void)setSkyColor:(MSFColor *)color;

    Swift

    func setSkyColor(_ color: MSFColor!)

    Parameters

    color

    The new sky color.

  • Returns the horizon color.

    Declaration

    Objective-C

    - (MSFColor *)getHorizonColor;

    Swift

    func getHorizonColor() -> MSFColor!

    Return Value

    The horizon color. The default is a pale blue-white.

  • Sets the horizon color, used by the built-in shader at the horizon line.

    Declaration

    Objective-C

    - (void)setHorizonColor:(MSFColor *)color;

    Swift

    func setHorizonColor(_ color: MSFColor!)

    Parameters

    color

    The new horizon color.

  • Returns the ground color.

    Declaration

    Objective-C

    - (MSFColor *)getGroundColor;

    Swift

    func getGroundColor() -> MSFColor!

    Return Value

    The color drawn below the horizon. Until setGroundColor is called this is the horizon color, though the built-in shaders then draw the sky’s own horizon there.

  • Sets the color drawn below the mathematical horizon, where a ray meets no drawn map (past the view distance, or a tile not loaded yet). Setting it makes it explicit: it is then used as is, and it should match the fog color or the horizon haze or it shows as a band under the sky. Left unset, the built-in shaders carry the sky’s horizon color down instead, which always matches. Setting it transparent leaves the clear color there.

    Declaration

    Objective-C

    - (void)setGroundColor:(MSFColor *)color;

    Swift

    func setGroundColor(_ color: MSFColor!)

    Parameters

    color

    The new ground color.

  • Returns the angular blend width between the horizon color and the sky color.

    Declaration

    Objective-C

    - (float)getHorizonBlend;

    Swift

    func getHorizonBlend() -> Float

    Return Value

    The blend width in degrees. The default is 12.

  • Sets how far above the horizon, in degrees, the horizon color fades into the sky color.

    Declaration

    Objective-C

    - (void)setHorizonBlend:(float)degrees;

    Swift

    func setHorizonBlend(_ degrees: Float)

    Parameters

    degrees

    The new blend width in degrees (clamped to 0..90).

  • Returns whether the built-in shader draws a sun disc.

    Declaration

    Objective-C

    - (BOOL)isSunDiscEnabled;

    Swift

    func isSunDiscEnabled() -> Bool

    Return Value

    True if the sun disc is drawn. The default is true.

  • Enables or disables the sun disc and its glow in the built-in shader.

    Declaration

    Objective-C

    - (void)setSunDiscEnabled:(BOOL)enabled;

    Swift

    func setSunDiscEnabled(_ enabled: Bool)

    Parameters

    enabled

    True to draw the sun disc.

  • Returns the custom sky fragment shader source, or an empty string if the built-in shader is used.

    Declaration

    Objective-C

    - (NSString *)getShaderSource;

    Swift

    func getShaderSource() -> String!

    Return Value

    The custom shader source.

  • Sets a custom sky fragment shader. The source must define “vec4 skyColor(vec3 rayDir)” and may use the uniforms documented on this class. Pass an empty string to go back to the built-in shader. If the shader fails to compile, the built-in shader is used and the error is logged.

    Declaration

    Objective-C

    - (void)setShaderSource:(NSString *)shaderSource;

    Swift

    func setShaderSource(_ shaderSource: String!)

    Parameters

    shaderSource

    The GLSL source, or an empty string for the built-in shader.

  • Undocumented

    Declaration

    Objective-C

    -(void)dealloc;

    Swift

    func dealloc()