MSFFogOptions

Objective-C


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

Swift

class MSFFogOptions : NSObject

The atmosphere (haze, upper-sky colours, stars), modelled on the Mapbox “fog” property. Ranges are in multiples of the camera-to-focus distance; the default colour is transparent (no fog). Note: this class is experimental and may change or even be removed in future SDK versions.

  • Constructs a FogOptions object with default values.

    Declaration

    Objective-C

    - (id)init;

    Swift

    init!()
  • Returns whether the fog is drawn at all.

    Declaration

    Objective-C

    - (BOOL)isEnabled;

    Swift

    func isEnabled() -> Bool

    Return Value

    True if the fog is drawn. The default is true.

  • Enables or disables the haze everywhere without touching any value; HighColor, SpaceColor and the stars are unaffected. ANDed with the style, so a style cannot re-enable it. Style property: “fog-enabled” (0 or 1).

    Declaration

    Objective-C

    - (void)setEnabled:(BOOL)enabled;

    Swift

    func setEnabled(_ enabled: Bool)

    Parameters

    enabled

    True to draw the fog.

  • Returns the fog color.

    Declaration

    Objective-C

    - (MSFColor *)getColor;

    Swift

    func getColor() -> MSFColor!

    Return Value

    The fog color. The default is transparent (no fog).

  • Sets the color distant content fades towards; alpha is the opacity at full distance, so transparent (the default) means no fog. With terrain lighting on it is lit by the sun first. Style property: “fog-color”.

    Declaration

    Objective-C

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

    Swift

    func setColor(_ color: MSFColor!)

    Parameters

    color

    The new fog color.

  • Returns where the fog starts.

    Declaration

    Objective-C

    - (float)getRangeStart;

    Swift

    func getRangeStart() -> Float

    Return Value

    The start of the range, in multiples of the camera-to-focus distance. The default is 0.8.

  • Sets where the fog starts, in multiples of the camera-to-focus distance. Mapbox range[0]. Style property: “fog-range-start”.

    Declaration

    Objective-C

    - (void)setRangeStart:(float)rangeStart;

    Swift

    func setRangeStart(_ rangeStart: Float)

    Parameters

    rangeStart

    The new start of the range (clamped to 0 and above).

  • Returns where the fog reaches full strength.

    Declaration

    Objective-C

    - (float)getRangeEnd;

    Swift

    func getRangeEnd() -> Float

    Return Value

    The end of the range, in multiples of the camera-to-focus distance. The default is 8.

  • Sets where the fog reaches full strength, in multiples of the camera-to-focus distance (the view distance under FREE_ROAM_MODE_FIRST_PERSON). At or below RangeStart turns the fog off. Mapbox range[1]. Style property: “fog-range-end”.

    Declaration

    Objective-C

    - (void)setRangeEnd:(float)rangeEnd;

    Swift

    func setRangeEnd(_ rangeEnd: Float)

    Parameters

    rangeEnd

    The new end of the range (clamped to 0 and above).

  • Returns the color of the upper atmosphere.

    Declaration

    Objective-C

    - (MSFColor *)getHighColor;

    Swift

    func getHighColor() -> MSFColor!

    Return Value

    The high color. The default is transparent, which leaves the sky to SkyOptions.

  • Sets the sky color above the fog band - Mapbox high-color. Transparent (the default) leaves the sky to SkyOptions. Style property: “fog-high-color”.

    Declaration

    Objective-C

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

    Swift

    func setHighColor(_ color: MSFColor!)

    Parameters

    color

    The new high color.

  • Returns the color of the sky at the zenith, beyond the atmosphere.

    Declaration

    Objective-C

    - (MSFColor *)getSpaceColor;

    Swift

    func getSpaceColor() -> MSFColor!

    Return Value

    The space color. The default is transparent, which leaves the sky to SkyOptions.

  • Sets the sky color at the zenith - Mapbox space-color. Transparent (the default) leaves the sky to SkyOptions. Style property: “fog-space-color”.

    Declaration

    Objective-C

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

    Swift

    func setSpaceColor(_ color: MSFColor!)

    Parameters

    color

    The new space color.

  • Returns how far up the sky the fog is blended in.

    Declaration

    Objective-C

    - (float)getHorizonBlend;

    Swift

    func getHorizonBlend() -> Float

    Return Value

    The blend, 0 to 1. The default is 0.133.

  • Sets how far above the horizon the fog fades out (Mapbox horizon-blend): scaled by exp(-3 * (sin(elevation) / blend)^2), 1 below the horizon so ground and sky meet seamlessly. Style property: “fog-horizon-blend”.

    Declaration

    Objective-C

    - (void)setHorizonBlend:(float)horizonBlend;

    Swift

    func setHorizonBlend(_ horizonBlend: Float)

    Parameters

    horizonBlend

    The new blend (clamped to 0..1).

  • Returns the altitude the fog starts fading out at.

    Declaration

    Objective-C

    - (float)getVerticalRangeStart;

    Swift

    func getVerticalRangeStart() -> Float

    Return Value

    The altitude in meters. The default is 0.

  • Sets the altitude above sea level where the fog starts to fade out - Mapbox vertical-range[0]. Both at 0 (the default) fogs every altitude equally. Style property: “fog-vertical-range-start”.

    Declaration

    Objective-C

    - (void)setVerticalRangeStart:(float)startMeters;

    Swift

    func setVerticalRangeStart(_ startMeters: Float)

    Parameters

    startMeters

    The new altitude in meters (clamped to 0 and above).

  • Returns the altitude the fog has fully faded out at.

    Declaration

    Objective-C

    - (float)getVerticalRangeEnd;

    Swift

    func getVerticalRangeEnd() -> Float

    Return Value

    The altitude in meters. The default is 0.

  • Sets the altitude above sea level where the fog has fully faded out - Mapbox vertical-range[1]. At or below VerticalRangeStart disables the fade. Style property: “fog-vertical-range-end”.

    Declaration

    Objective-C

    - (void)setVerticalRangeEnd:(float)endMeters;

    Swift

    func setVerticalRangeEnd(_ endMeters: Float)

    Parameters

    endMeters

    The new altitude in meters (clamped to 0 and above).

  • Returns how brightly stars are drawn beyond the atmosphere.

    Declaration

    Objective-C

    - (float)getStarIntensity;

    Swift

    func getStarIntensity() -> Float

    Return Value

    The star intensity, 0 to 1. The default is 0 (no stars).

  • Sets how brightly stars are drawn beyond the atmosphere - Mapbox star-intensity. 0 (the default) draws none. Only the built-in sky shader draws them. Style property: “fog-star-intensity”.

    Declaration

    Objective-C

    - (void)setStarIntensity:(float)starIntensity;

    Swift

    func setStarIntensity(_ starIntensity: Float)

    Parameters

    starIntensity

    The new star intensity (clamped to 0..1).

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

    Declaration

    Objective-C

    - (NSString *)getShaderSource;

    Swift

    func getShaderSource() -> String!

    Return Value

    The custom shader source.

  • Replaces the whole fog block (tiles, background, terrain, vector elements, sky). Must define vec4 applyFog(vec4 color, vec3 dir, float dist, float heightM), vec4 skyFog(vec4 color, vec3 dir) and float fogLabelFade(); uniforms/helpers are predeclared - see docs/features/sky-sun-shadows.md.

    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 blend (also used, and the error logged, if it fails to compile).

  • Undocumented

    Declaration

    Objective-C

    -(void)dealloc;

    Swift

    func dealloc()