UNPKG

textmode.js

Version:

Apply real-time ASCII conversion to any HTML canvas.

32 lines (31 loc) 1.28 kB
/** * Line geometry for WebGL rendering that uses vertices to create lines of varying thickness. * Handles coordinate system differences between canvas and framebuffer targets by flipping Y-axis for framebuffers. * Creates a rectangular geometry to represent the line segment with the specified thickness. */ export declare class Line { /** The WebGL rendering context */ private gl; /** The vertex buffer containing position and texture coordinates */ private vertexBuffer; /** The number of vertices in this geometry (always 6 for two triangles) */ private readonly vertexCount; /** Bytes per vertex: vec2+vec2 = 16 bytes */ private bytesPerVertex; constructor(gl: WebGLRenderingContext, x1: number, y1: number, x2: number, y2: number, weight: number); /** * Generate vertex data for a rectangle representing the line with texture coordinates * @private */ private generateVertices; /** * Generate vertex data for the line rectangle with texture coordinates * Uses the four corners calculated based on line direction and thickness * @private */ private generateLineVertices; /** * Render the line using position and texture coordinate attributes */ render(): void; }