UNPKG

gl2d

Version:

2D graphics package for WebGL

67 lines (66 loc) 3.23 kB
import { Mat2d } from '../struct/mat2d'; import { PointLike } from '../struct/point'; import { Rect } from '../struct/rect'; import { Vec2Buffer, Vec2Like } from '../struct/vec2'; /** * Helper class for working with vertex data stored in a Float32Array. */ export declare class VertexBuffer extends Vec2Buffer { /** * Creates an empty VertexBuf with the specified vertex capacity. */ static create(capacity: number): VertexBuffer; /** * Measures the boundaries of a subset of vertices in this buffer. * @param offset the offset of the first vertex in the subset. * @param count the number of vertices in the subset. */ measureBoundaries(offset?: number, count?: number): Rect; /** * Checks if a polygon (specified by indices into this buffer) contains the specified point. * @param pt the point to check. * @param polygonIndices the indices for each of the polygons. */ indexedContains(pt: PointLike, polygonIndices: number[]): boolean; /** * Checks if a polygon (specified by indices into this buffer) contains the specified point. * @param x the x coordinate of the point to check. * @param y the y coordinate of the point to check. * @param polygonIndices the indices for each of the polygons. */ indexedContains$(x: number, y: number, polygonIndices: number[]): boolean; /** * Checks if a polygon (specified by a subset of vertices in this buffer) contains the specified point. * @param pt the point to check. * @param offset the offset of the first polygon vertex. Defaults to zero. * @param count the number of polygon vertices. Defaults to the number of vertices in this buffer. */ contains(pt: PointLike, offset?: number, count?: number): boolean; /** * Checks if a polygon (specified by a subset of vertices in this buffer) contains the specified point. * @param x the x coordinate of the point to check. * @param y the y coordinate of the point to check. * @param offset the offset of the first polygon vertex. Defaults to zero. * @param count the number of polygon vertices. Defaults to the number of vertices in this buffer. */ contains$(x: number, y: number, offset?: number, count?: number): boolean; /** * Offsets the specified vertices in this buffer by the specified vector. * @param offset the offset of the first vertex. * @param count the number of vertices to include. */ offset(vec: Vec2Like, offset?: number, count?: number): void; /** * Offsets the specified vertices in this buffer by the vector (dx,dy). * @param offset the offset of the first vertex. * @param count the number of vertices to include. */ offset$(dx: number, dy: number, offset?: number, count?: number): void; /** * Transforms the specified vertices in this buffer by the specified matrix. * @param matrix the transformation matrix. * @param offset the offset of the first vertex. * @param count the number of vertices to include. */ transform(matrix: Mat2d, offset?: number, count?: number): void; }