Variable: CutlineBbox
constCutlineBbox:object
Defined in: cutline-bbox.ts:51
A shader module that discards fragments whose position falls outside a Web Mercator (EPSG:3857) axis-aligned bbox.
Intended for rendering rasters with a "map collar" (e.g. USGS historical topographic maps) where the valid data area is described as a bbox but the raw pixels include surrounding metadata.
Only supports rendering in a WebMercatorViewport. The caller is
responsible for enforcing this in application code; the module itself
does not have viewport access.
This module assumes the layer's mesh positions attribute is in EPSG:3857
meters — the convention used by COGLayer / RasterLayer in Web Mercator
rendering mode. It injects a vertex shader varying that passes each
vertex's 3857 meters through to the fragment shader, and compares against
a uniform bbox also in 3857 meters. This avoids deck.gl's common space and
its viewport-anchored precision translation, which would otherwise cause
the test to drift at higher zoom levels.
Type Declaration
fs
readonlyfs: "uniform cutlineBboxUniforms {\n vec4 bbox;\n} cutlineBbox;\n" =uniformBlock
getUniforms
readonlygetUniforms: (props) => {bbox: [number,number,number,number]; } | {bbox?:undefined; }
Parameters
props
Returns
{ bbox: [number, number, number, number]; } | { bbox?: undefined; }
inject
readonlyinject:object
inject.fs:#decl
readonlyfs:#decl:"in vec2 v_cutlineBboxMercator;"
inject.fs:#main-start
readonlyfs:#main-start: "\n {\n if (v_cutlineBboxMercator.x < cutlineBbox.bbox.x ||\n v_cutlineBboxMercator.x > cutlineBbox.bbox.z ||\n v_cutlineBboxMercator.y < cutlineBbox.bbox.y ||\n v_cutlineBboxMercator.y > cutlineBbox.bbox.w) {\n discard;\n }\n }\n "
inject.vs:#decl
readonlyvs:#decl:"out vec2 v_cutlineBboxMercator;"
inject.vs:#main-start
readonlyvs:#main-start: "\n v_cutlineBboxMercator = positions.xy;\n "
name
readonlyname:"cutlineBbox"=MODULE_NAME
uniformTypes
readonlyuniformTypes:object
uniformTypes.bbox
readonlybbox:"vec4<f32>"="vec4<f32>"