MSFCustomRasterTileLayer
Objective-C
@interface MSFCustomRasterTileLayer : MSFRasterTileLayer
Swift
class MSFCustomRasterTileLayer : MSFRasterTileLayer
A raster tile layer (the general form of HillshadeRasterTileLayer) rendering each tile through a GLSL shader defining
vec4 applyLighting(lowp vec4 color, mediump vec3 normal, mediump vec3 surfaceNormal, mediump float intensity); it may use
getRawColor(), getMapZoom(), vUV, uUVScale and uBitmap, and returns a premultiplied color. Note: experimental, may change.
Up to 4 sources are drawn in one pass (see addDataSource): sampleRaster(i) reads source i, i being a literal, and
sampleRaster(0) is getRawColor(). A source whose tile is not loaded yet reads as source 0. Every parameter set with
setShaderParameter() is a uniform float of the same name. Sources must share a tile size and zoom range.
-
Constructs a CustomRasterTileLayer object from a raster data source.
Declaration
Objective-C
- (id)initWithDataSource:(MSFTileDataSource *)dataSource;Swift
init!(dataSource: MSFTileDataSource!)Parameters
dataSourceThe raster data source from which this layer loads data.
-
Returns the custom fragment shader source.
Declaration
Objective-C
- (NSString *)getShaderSource;Swift
func getShaderSource() -> String!Return Value
The shader source. Empty means the default passthrough (outputs the raw tile).
-
Sets the custom fragment shader source (the “filter”). See the class description for the required entry point and available helpers. Empty resets to the passthrough shader.
Declaration
Objective-C
- (void)setShaderSource:(NSString *)shaderSource;Swift
func setShaderSource(_ shaderSource: String!)Parameters
shaderSourceThe GLSL shader source.
-
Adds a source drawn together with the layer’s own, read in the shader as sampleRaster(getDataSourceCount() - 1). Not used by HillshadeRasterTileLayer.
Declaration
Objective-C
- (void)addDataSource:(MSFTileDataSource *)dataSource;Swift
func add(_ dataSource: MSFTileDataSource!)Parameters
dataSourceThe raster data source; at most 4 sources in total.
-
Returns the number of sources, the layer’s own included.
Declaration
Objective-C
- (int)getDataSourceCount;Swift
func getDataSourceCount() -> Int32Return Value
The number of sources.
-
Sets a
uniform floatof the shader, e.g. a blend factor driven by a clock.Declaration
Objective-C
- (void)setShaderParameter:(NSString *)name value:(float)value;Swift
func setShaderParameter(_ name: String!, value: Float)Parameters
nameThe uniform name.
valueThe value.
-
Returns a shader parameter.
Declaration
Objective-C
- (float)getShaderParameter:(NSString *)name;Swift
func getShaderParameter(_ name: String!) -> FloatParameters
nameThe uniform name.
Return Value
The value, or 0 when it was never set.
-
Returns all shader parameters, as numbers.
Declaration
Objective-C
- (MSFStringVariantMap *)getShaderParameters;Swift
func getShaderParameters() -> MSFStringVariantMap!Return Value
The shader parameters by name.
-
Sets shader parameters; the ones not named keep their value.
Declaration
Objective-C
- (void)setShaderParameters:(MSFStringVariantMap *)parameters;Swift
func setShaderParameters(_ parameters: MSFStringVariantMap!)Parameters
parametersThe shader parameters by name; values that are not numbers read as 0.
-
Undocumented
Declaration
Objective-C
-(void)dealloc;Swift
func dealloc()