char: Bitmap Character Rendering System
Pixel-Perfect Text Display through Hexadecimal Font Encoding
The char function renders ASCII characters using pre-encoded 8×16 pixel bitmap data stored as hexadecimal values. Each character is defined by four 32-bit integers representing compressed bitmap rows, enabling compact text display without external font dependencies.
Bitmap Structure
Character data follows an 8×16 pixel grid where each bit represents one pixel:
The encoding packs 4 rows of 8-bit data into each 32-bit integer, with bit-shifting operations extracting individual pixels.
Character Coordinate System
Component | Range | Description |
---|---|---|
UV Input | Normalized texture coordinates | |
Character Grid | Pixel resolution per character | |
Bit Position | Horizontal pixel index | |
Row Group | Vertical 4-row segments |
The coordinate transformation maps UV space to discrete pixel positions:
Character Constants
The system provides 95 printable ASCII characters (codes 32-126) through exported constants:
CHAR_SPACE
throughCHAR_TILDE
for symbol accessCHAR_0
throughCHAR_9
for numeric charactersCHAR_A
throughCHAR_Z
for uppercase lettersCHAR_a
throughCHAR_z
for lowercase letters
ライブエディター
const fragment = () => { const charIndex = iTime.floor().mod(26).add(33).toInt() const glyph = char(uv, charIndex) return vec4(vec3(glyph), 1) }