textmode.js
Version:
Apply real-time ASCII conversion to any HTML canvas.
26 lines (25 loc) • 1.03 kB
TypeScript
/**
* Simplified rectangle geometry for WebGL rendering using a unified vertex layout.
* Always includes texture coordinates for maximum shader compatibility.
* Handles coordinate system differences between canvas and framebuffer targets by flipping Y-axis for framebuffers.
*/
export declare class Rectangle {
/** 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: depends on position format (vec2 vs vec3) */
private bytesPerVertex;
constructor(gl: WebGLRenderingContext, x: number, y: number, width: number, height: number);
/**
* Generate vertex data for the rectangle with texture coordinates
* @private
*/
private generateVertices;
/**
* Render the rectangle using position and texture coordinate attributes
*/
render(): void;
}