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() -> BoolReturn 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
enabledTrue to draw the shader sky.
-
Returns what the sky pass draws.
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
typeThe new sky type.
-
Returns how finely the atmosphere is integrated.
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
qualityThe new quality.
-
Returns the brightness of the sun driving the atmosphere.
Declaration
Objective-C
- (float)getAtmosphereSunIntensity;Swift
func getAtmosphereSunIntensity() -> FloatReturn 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
intensityThe new sun intensity (clamped to 0 and above).
-
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
colorThe new atmosphere color.
-
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
colorThe new halo color.
-
Returns the exposure applied to the scattered light.
Declaration
Objective-C
- (float)getAtmosphereLuminance;Swift
func getAtmosphereLuminance() -> FloatReturn 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
luminanceThe new luminance (clamped to 0.01 and above).
-
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
colorThe new ground color.
-
Returns the angular blend width between the horizon color and the sky color.
Declaration
Objective-C
- (float)getHorizonBlend;Swift
func getHorizonBlend() -> FloatReturn 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
degreesThe 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() -> BoolReturn 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
enabledTrue 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
shaderSourceThe GLSL source, or an empty string for the built-in shader.
-
Undocumented
Declaration
Objective-C
-(void)dealloc;Swift
func dealloc()