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() -> BoolReturn 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
enabledTrue to draw the 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”.
Parameters
colorThe new fog color.
-
Returns where the fog starts.
Declaration
Objective-C
- (float)getRangeStart;Swift
func getRangeStart() -> FloatReturn 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
rangeStartThe 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() -> FloatReturn 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
rangeEndThe new end of the range (clamped to 0 and above).
-
Returns how far up the sky the fog is blended in.
Declaration
Objective-C
- (float)getHorizonBlend;Swift
func getHorizonBlend() -> FloatReturn 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
horizonBlendThe new blend (clamped to 0..1).
-
Returns the altitude the fog starts fading out at.
Declaration
Objective-C
- (float)getVerticalRangeStart;Swift
func getVerticalRangeStart() -> FloatReturn 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
startMetersThe 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() -> FloatReturn 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
endMetersThe 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() -> FloatReturn 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
starIntensityThe 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)andfloat 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
shaderSourceThe 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()