Package com.massifmaps.layers
Class CustomRasterTileLayer
java.lang.Object
com.massifmaps.layers.Layer
com.massifmaps.layers.TileLayer
com.massifmaps.layers.RasterTileLayer
com.massifmaps.layers.CustomRasterTileLayer
- Direct Known Subclasses:
HillshadeRasterTileLayer
A raster tile layer that renders each tile through a custom GLSL fragment shader ("filter").
The data source can be any raster TileDataSource - most commonly an RGB-encoded elevation
(terrarium/mapbox) source, but any raster works. This is the general form of
HillshadeRasterTileLayer, which specializes it for DEM data (normal map + hillshade + contours).
The shader must define:
vec4 applyLighting(lowp vec4 color, mediump vec3 normal, mediump vec3 surfaceNormal, mediump float intensity)
and it can use these helpers (injected before it):
getRawColor() - the untouched RGBA texel of the source tile at this fragment
getMapZoom() - the current fractional map zoom (for per-zoom logic)
plus the shared uniforms/varyings vUV (tile uv), uUVScale (texture size) and uBitmap.
It must return a PREMULTIPLIED color (rgb already multiplied by alpha); return alpha 0 where the
output should be transparent so layers below show through.
Note: this class is experimental and may change or even be removed in future SDK versions.
The data source can be any raster TileDataSource - most commonly an RGB-encoded elevation
(terrarium/mapbox) source, but any raster works. This is the general form of
HillshadeRasterTileLayer, which specializes it for DEM data (normal map + hillshade + contours).
The shader must define:
vec4 applyLighting(lowp vec4 color, mediump vec3 normal, mediump vec3 surfaceNormal, mediump float intensity)
and it can use these helpers (injected before it):
getRawColor() - the untouched RGBA texel of the source tile at this fragment
getMapZoom() - the current fractional map zoom (for per-zoom logic)
plus the shared uniforms/varyings vUV (tile uv), uUVScale (texture size) and uBitmap.
It must return a PREMULTIPLIED color (rgb already multiplied by alpha); return alpha 0 where the
output should be transparent so layers below show through.
Note: this class is experimental and may change or even be removed in future SDK versions.
-
Constructor Summary
ConstructorsConstructorDescriptionCustomRasterTileLayer(TileDataSource dataSource) Constructs a CustomRasterTileLayer object from a raster data source. -
Method Summary
Modifier and TypeMethodDescriptionReturns the custom fragment shader source.voidsetShaderSource(String shaderSource) Sets the custom fragment shader source (the "filter").Methods inherited from class com.massifmaps.layers.RasterTileLayer
getRasterTileEventListener, getTextureCacheCapacity, getTileBlendingSpeed, getTileFilterMode, setRasterTileEventListener, setTextureCacheCapacity, setTileBlendingSpeed, setTileFilterModeMethods inherited from class com.massifmaps.layers.TileLayer
bakeDrapeCoverage, bakeGroundAOMask, bakeSpanDrapeTile, calculateMapTile, calculateMapTileBounds, calculateMapTileOrigin, clearTileCaches, collectDrapeStackOrder, collectSpanDrapeTiles, consumeShadowCastersMissingElevation, getDataSource, getFrameNr, getMaxOverzoomLevel, getMaxStandInLevel, getMaxUnderzoomLevel, getPreloadingTileCount, getProjection, getTileLoadListener, getTileSubstitutionPolicy, getUTFGridDataSource, getUTFGridEventListener, getVisibleTileCount, getZoomLevelBias, isGroundAOActive, isGroundAOBakeable, isLabelOcclusionWanted, isPreloading, isSynchronizedRefresh, isTerrainDecodeSettled, isUpdateInProgress, renderGroundAOMask, renderLabelOcclusionDepth, renderTerrainShadowMask, setDrapeCoverageMasks, setFrameNr, setGroundDrapeTextures, setLabelOcclusionDepth, setMaxOverzoomLevel, setMaxStandInLevel, setMaxUnderzoomLevel, setPreloading, setSpanDrapeTextures, setSynchronizedRefresh, setTerrainShadowMask, setTileLoadListener, setTileSubstitutionPolicy, setUTFGridDataSource, setUTFGridEventListener, setZoomLevelBiasMethods inherited from class com.massifmaps.layers.Layer
containsMetaDataKey, equals, getMetaData, getMetaDataElement, getOpacity, getUpdatePriority, getVisibleZoomRange, hashCode, isPostProcessed, isVisible, refresh, setCullDelay, setMetaData, setMetaDataElement, setOpacity, setPostProcessed, setUpdatePriority, setVisible, setVisibleZoomRange, simulateClick, update
-
Constructor Details
-
CustomRasterTileLayer
Constructs a CustomRasterTileLayer object from a raster data source.- Parameters:
dataSource- The raster data source from which this layer loads data.
-
-
Method Details
-
getShaderSource
Returns the custom fragment shader source.- Returns:
- The shader source. Empty means the default passthrough (outputs the raw tile).
-
setShaderSource
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.- Parameters:
shaderSource- The GLSL shader source.
-