Skip to main content

Variable: CutlineBbox

const CutlineBbox: 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

readonly fs: "uniform cutlineBboxUniforms {\n vec4 bbox;\n} cutlineBbox;\n" = uniformBlock

getUniforms

readonly getUniforms: (props) => { bbox: [number, number, number, number]; } | { bbox?: undefined; }

Parameters

props

Partial<CutlineBboxProps>

Returns

{ bbox: [number, number, number, number]; } | { bbox?: undefined; }

inject

readonly inject: object

inject.fs:#decl

readonly fs:#decl: "in vec2 v_cutlineBboxCommon;"

inject.fs:#main-start

readonly fs:#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

readonly vs:#decl: "out vec2 v_cutlineBboxCommon;"

inject.vs:#main-start

readonly vs:#main-start: "\n v_cutlineBboxCommon = positions.xy;\n "

name

readonly name: "cutlineBbox" = MODULE_NAME

uniformTypes

readonly uniformTypes: object

uniformTypes.bbox

readonly bbox: "vec4<f32>" = "vec4<f32>"