Variable: CutlineBbox
constCutlineBbox:object
Defined in: cutline-bbox.ts:50
A shader module that discards fragments whose position falls outside an axis-aligned common-space 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.
The module assumes the layer's mesh positions attribute is in deck.gl
common space (world units) — the convention used by COGLayer /
RasterLayer in the Web Mercator rendering path. It injects a vertex
shader varying that passes each vertex's common-space position through to
the fragment shader, and compares against a uniform bbox also in common
space. Capturing the raw positions attribute (rather than deck.gl's
viewport-anchored, camera-relative position_commonspace) keeps the test
stable across 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_cutlineBboxCommon;"
inject.fs:#main-start
readonlyfs:#main-start: "\n {\n if (v_cutlineBboxCommon.x < cutlineBbox.bbox.x ||\n v_cutlineBboxCommon.x > cutlineBbox.bbox.z ||\n v_cutlineBboxCommon.y < cutlineBbox.bbox.y ||\n v_cutlineBboxCommon.y > cutlineBbox.bbox.w) {\n discard;\n }\n }\n "
inject.vs:#decl
readonlyvs:#decl:"out vec2 v_cutlineBboxCommon;"
inject.vs:#main-start
readonlyvs:#main-start: "\n v_cutlineBboxCommon = positions.xy;\n "
name
readonlyname:"cutlineBbox"=MODULE_NAME
uniformTypes
readonlyuniformTypes:object
uniformTypes.bbox
readonlybbox:"vec4<f32>"="vec4<f32>"