Class: ShaderFilterVectorGlyph

ShaderFilterVectorGlyph

A shader filter that implements sprite-based vector field visualization.

Features:

  • SVG glyph-based vector field visualization
  • Magnitude-dependent glyph selection
  • Custom glyph coloring
  • Optional vector normalization
  • Background field visualization
  • Smooth rotation and scaling

Technical Implementation:

  • Sprite sheet-based glyph rendering
  • Dynamic glyph rotation and scaling
  • Automatic magnitude mapping
  • Alpha-based glyph composition
  • WebGL texture management

GLSL Implementation Constants:

  • GLYPH_TILE_SIZE: Spacing between glyphs (16.0)
  • ISQRT2: 1/sqrt(2) for magnitude normalization

new ShaderFilterVectorGlyph(colorscale, glyphsUrl [, options])

Creates a new glyph-based vector field visualization filter

Parameters:
Name Type Argument Description
colorscale ColorScale

Colorscale for magnitude mapping

glyphsUrl string

URL to SVG sprite sheet containing glyphs

options ShaderFilterVectorGlyph~Options <optional>

Configuration options

Source:
Throws:

If inDomain is invalid or glyphsUrl is empty

Type
Error
Example
```javascript
// Create with custom options
const filter = new ShaderFilterVectorGlyph(colorscale, 'glyphs.svg', {
    inDomain: [0, 1],
    glyphsSize: [304, 64],
    glyphsStride: 80,
    glyphColor: [0, 0, 0, 1]
});
```

Extends

Methods


getSampler(name)

Finds a sampler by name

Parameters:
Name Type Description
name string

Base sampler name

Inherited From:
Overrides:
Source:
Returns:

Found sampler or undefined

Type
ShaderFilter~Sampler | undefined

setMode(mode, id)

Sets the active mode for the filter

Parameters:
Name Type Description
mode string

Mode category to modify

id string

Specific mode ID to enable

Inherited From:
Overrides:
Source:
Throws:

If shader not registered or mode doesn't exist

Type
Error

setUniform(name, value)

Sets a uniform variable value

Parameters:
Name Type Description
name string

Base name of uniform variable

value number | boolean | Array

Value to set

Inherited From:
Overrides:
Source:
Throws:

If shader not registered

Type
Error

Type Definitions


Modes

Available visualization modes

Type:
  • Object
Properties:
Name Type Description
normalize string

Glyph size normalization ('on'|'off')

glyph string

Glyph coloring mode ('mag'|'col')

field string

Background field visualization ('none'|'mag')

Source:

Options

Configuration options for glyph-based vector field visualization

Type:
  • Object
Properties:
Name Type Argument Default Description
inDomain Array.<number> <optional>
[]

Input value range [min, max] for magnitude mapping

maxSteps number <optional>
256

Number of discrete steps in the colormap texture

glyphColor Array.<number> <optional>
[0.0, 0.0, 0.0, 1.0]

RGBA color for glyphs when using 'col' mode

glyphsStride number <optional>
80

Horizontal spacing between glyphs in the sprite sheet

glyphsSize Array.<number> <optional>
[304, 64]

Dimensions of the glyph sprite sheet [width, height]

Source: