All types below are exported from @glyphcss/core unless marked with glyphcss
(the vanilla package).
| Type | Description | Used in |
|---|
Vec2 | [u, v] tuple — UV coordinates | TextureTriangle.uvs, polygon UVs |
Vec3 | [x, y, z] tuple — world-space point or vector | Vertices, directions, hotspot anchors |
Polygon | N coplanar vertices + optional color/texture | Helper generators, mesh parsers |
TextureTriangle | 3 vertices + 3 UV pairs + optional color | Parser-internal type for UV-mapped meshes |
WireframeEdge | from/to Vec3 pair + optional weight/color | buildSceneContext wireframe mode |
type Vec2 = [number, number];
type Vec3 = [number, number, number];
interface TextureTriangle {
vertices: [Vec3, Vec3, Vec3];
interface WireframeEdge {
weight?: EdgeWeight; // 1 | 2 | 3
| Type | Description | Used in |
|---|
RenderMode | "wireframe" | "solid" | "voxel" | SceneContextOptions.mode, all framework props |
CharRamp | string[] — index 0 = darkest, last = brightest | Solid-mode Lambert → glyph mapping |
EdgeWeight | 1 | 2 | 3 — thin / normal / core | WireframeEdge.weight |
type RenderMode = "wireframe" | "solid" | "voxel";
type CharRamp = string[]; // e.g. [" ", ".", ":", "-", "=", "+", "*", "#", "%", "@"]
type EdgeWeight = 1 | 2 | 3;
| Type | Description | Used in |
|---|
GlyphDirectionalLight | Single distant light source | SceneContextOptions.directionalLight |
GlyphAmbientLight | Uniform fill light | SceneContextOptions.ambientLight |
interface GlyphDirectionalLight {
intensity?: number; // default 1
color?: string; // hex, default white
interface GlyphAmbientLight {
intensity?: number; // default 0.4
color?: string; // hex, default white
| Type | Description | Used in |
|---|
GlyphShadowOptions | Shadow-map configuration. undefined on the scene = shadows off | SceneContextOptions.shadow, <GlyphScene shadow={…}> |
interface GlyphShadowOptions {
color?: string; // shadow tint hex; default "#000000"
opacity?: number; // darkness 0..1 toward color; default 0.25
lift?: number; // depth bias — prevents self-shadow acne; default 0.05
maxExtend?: number; // half-extent of the light-space projection volume; default 2000
Shadow flags on meshes (GlyphMeshTransform, <GlyphMesh>, <glyph-mesh>):
| Field / prop / attribute | Default | Description |
|---|
castShadow / cast-shadow | false | This mesh casts shadows onto receiveShadow surfaces |
receiveShadow / receive-shadow | false | This mesh receives shadows. Both flags on the same mesh = self-shadow |
GlyphGround sets receiveShadow=true and castShadow=false by default.
| Type | Description | Used in |
|---|
GridSize | { cols, rows, cellAspect } | buildSceneContext, camera project() |
SceneContext | Resolved scene state used by the rasterizer | buildSceneContext return value |
cellAspect: number; // cellH / cellW — typically ~2.0
| Type | Description | Used in |
|---|
Hotspot | A 3D anchor that projects to a 2D hitbox | scene.addHotspot(), projectHotspots() |
HotspotCell | Projected result for one frame | projectHotspots() return value |
size?: [number, number]; // cols × rows in cells; default [1, 1]
depth: number; // camera-space Z; use for z-index
visible: boolean; // false when behind camera or off-grid
| Type | Description | Used in |
|---|
ParseResult | Unified output of all polygon-emitting parsers | parseObj, parseGltf, loadMesh |
ParseAnimationClip | Metadata for one animation in a glTF file | ParseResult.animation.clips |
animation?: ParseAnimationController;
dispose: () => void; // revoke blob URLs — always call on unmount
animations?: ParseAnimationClip[];
interface ParseAnimationClip {
duration: number; // seconds
| Type | Description | Used in |
|---|
GlyphAnimationMixer | Drives one or more animation actions against a mesh target | createGlyphAnimationMixer() |
GlyphAnimationAction | Per-clip playback state | mixer.clipAction() |
// Minimal usage — requires a glTF/GLB file with embedded animation clips.
// Replace "/character.glb" with the path to your own animated mesh.
import { createGlyphAnimationMixer, LoopRepeat, loadMesh } from "@glyphcss/core";
const { polygons, animation } = await loadMesh("/character.glb");
const mixer = createGlyphAnimationMixer(meshHandle, animation!);
const action = mixer.clipAction("walk");
action.setLoop(LoopRepeat, Infinity).play();
// In your animation loop (requestAnimationFrame):
mixer.update(deltaSeconds);