glyphFor
The character drawn in each cell, picked by how bright the cell is.
glyphFor(slots: {
grid: FragmentStage
cell: FragmentStage
gamma: PropRef
atlas: (params: GpuFragmentParams) => KitTexture
}): FragmentStage
Import effects from shaders/std and use effects.stylize.glyphFor.
gamma bends the brightness curve: below 1 favours the light characters, above 1 the dark ones. atlas is your function that draws the character set into a texture and returns it (the Ascii shader shows one). The definition needs three extra fields the atlas fills in: _charCount, _atlasScale and _atlasSize.
Parameters
| Name | Type | Notes |
|---|---|---|
slots | `{ |
grid: FragmentStage
cell: FragmentStage
gamma: PropRef
atlas: (params: GpuFragmentParams) => KitTexture
}` | |
Example
glyph: glyphFor({grid, cell, gamma: p('gamma'), atlas: setupGlyphAtlas})
See also
glyphTint— The finished ASCII look: each character tinted with its cell's color, everything else transparent.cellSample— The color of the layer inside at the centre of each character cell.