gl2d
Version:
2D graphics package for WebGL
671 lines (670 loc) • 23.9 kB
TypeScript
import { RectLike } from "./rect";
import { Struct } from "gulp-structify/struct";
import { StructBuffer } from "gulp-structify/buffer";
/**
* A 4x4 matrix.
*/
export declare class Mat4 {
static create(other: Mat4Like): Mat4;
/**
* The first entry in the first column of this Mat4.
*/
c1r1: number;
/**
* The second entry in the first column of this Mat4.
*/
c1r2: number;
/**
* The third entry in the first column of this Mat4.
*/
c1r3: number;
/**
* The fourth entry in the first column of this Mat4.
*/
c1r4: number;
/**
* The first entry in the second column of this Mat4.
*/
c2r1: number;
/**
* The second entry in the second column of this Mat4.
*/
c2r2: number;
/**
* The third entry in the second column of this Mat4.
*/
c2r3: number;
/**
* The fourth entry in the second column of this Mat4.
*/
c2r4: number;
/**
* The first entry in the third column of this Mat4.
*/
c3r1: number;
/**
* The second entry in the third column of this Mat4.
*/
c3r2: number;
/**
* The third entry in the third column of this Mat4.
*/
c3r3: number;
/**
* The fourth entry in the third column of this Mat4.
*/
c3r4: number;
/**
* The first entry in the fourth column of this Mat4.
*/
c4r1: number;
/**
* The second entry in the fourth column of this Mat4.
*/
c4r2: number;
/**
* The third entry in the fourth column of this Mat4.
*/
c4r3: number;
/**
* The fourth entry in the fourth column of this Mat4.
*/
c4r4: number;
/**
* A 4x4 matrix.
*/
constructor(c1r1?: number, c1r2?: number, c1r3?: number, c1r4?: number, c2r1?: number, c2r2?: number, c2r3?: number, c2r4?: number, c3r1?: number, c3r2?: number, c3r3?: number, c3r4?: number, c4r1?: number, c4r2?: number, c4r3?: number, c4r4?: number);
/**
* Sets this Mat4 to an othogonal transformation matrix given the
* dimensions of the near clipping plane as well as the
* near and far clipping plane distances.
* @param left left side of the near clipping plane viewport.
* @param right side of the near clipping plane viewport.
* @param top top of the near clipping plane viewport.
* @param bottom bottom of the near clipping plane viewport.
* @param near the depth (negative z coordinate) of the near clipping plane.
* @param far the depth (negative z coordinate) of the far clipping plane.
* @param dst where to store the result. Defaults to new Mat4.
* @returns the ortho matrix.
*/
ortho(clip: RectLike, near: number, far: number): void;
/**
* Sets this Mat4 to an othogonal transformation matrix given the left, right,
* bottom, and top dimensions of the near clipping plane as well as the
* near and far clipping plane distances.
* @param left left side of the near clipping plane viewport.
* @param right side of the near clipping plane viewport.
* @param top top of the near clipping plane viewport.
* @param bottom bottom of the near clipping plane viewport.
* @param near the depth (negative z coordinate) of the near clipping plane.
* @param far the depth (negative z coordinate) of the far clipping plane.
* @param dst where to store the result. Defaults to new Mat4.
* @returns the ortho matrix.
*/
ortho$(left: number, right: number, bottom: number, top: number, near: number, far: number): void;
/**
* Sets each component of this Mat4 to that of the other Mat4.
*/
set(other: Mat4Like): void;
/**
* Sets each component of this Mat4.
*/
set$(c1r1: number, c1r2: number, c1r3: number, c1r4: number, c2r1: number, c2r2: number, c2r3: number, c2r4: number, c3r1: number, c3r2: number, c3r3: number, c3r4: number, c4r1: number, c4r2: number, c4r3: number, c4r4: number): void;
/**
* Sets each component of this Mat4 to the specified scalar.
*/
setScalar(k: number): void;
/**
* Adds the other Mat4 to this Mat4 componentwise.
*/
add(other: Mat4Like): void;
/**
* Adds the specified values to this Mat4 componentwise.
*/
add$(c1r1: number, c1r2: number, c1r3: number, c1r4: number, c2r1: number, c2r2: number, c2r3: number, c2r4: number, c3r1: number, c3r2: number, c3r3: number, c3r4: number, c4r1: number, c4r2: number, c4r3: number, c4r4: number): void;
/**
* Subtracts the other Mat4 from this Mat4 componentwise.
*/
subtract(other: Mat4Like): void;
/**
* Subtracts the specified values from this Mat4 componentwise.
*/
subtract$(c1r1: number, c1r2: number, c1r3: number, c1r4: number, c2r1: number, c2r2: number, c2r3: number, c2r4: number, c3r1: number, c3r2: number, c3r3: number, c3r4: number, c4r1: number, c4r2: number, c4r3: number, c4r4: number): void;
/**
* Multiplies each component of this Mat4 by the specified scalar.
*/
mulScalar(k: number): void;
/**
* Divides each component of this Mat4 by the specified scalar.
*/
divScalar(k: number): void;
/**
* Checks if each component of this Mat4 is exactly equal to that of the other Mat4.
*/
equals(other: Mat4Like): boolean;
/**
* Checks if each component of this Mat4 is exactly equal to the specified scalar.
*/
equalsScalar(k: number): boolean;
/**
* Checks if each component of this Mat4 is approximately equal to that of the other Mat4.
*/
epsilonEquals(other: Mat4Like, e: number): boolean;
/**
* Checks if each component of this Mat4 is approximately equal to the specified scalar.
*/
epsilonEqualsScalar(k: number, e: number): boolean;
/**
* Returns a string representation of this Mat4.
*/
toString(): string;
}
/**
* A 4x4 matrix.
*/
export interface Mat4Like {
/**
* The first entry in the first column of this Mat4.
*/
c1r1: number;
/**
* The second entry in the first column of this Mat4.
*/
c1r2: number;
/**
* The third entry in the first column of this Mat4.
*/
c1r3: number;
/**
* The fourth entry in the first column of this Mat4.
*/
c1r4: number;
/**
* The first entry in the second column of this Mat4.
*/
c2r1: number;
/**
* The second entry in the second column of this Mat4.
*/
c2r2: number;
/**
* The third entry in the second column of this Mat4.
*/
c2r3: number;
/**
* The fourth entry in the second column of this Mat4.
*/
c2r4: number;
/**
* The first entry in the third column of this Mat4.
*/
c3r1: number;
/**
* The second entry in the third column of this Mat4.
*/
c3r2: number;
/**
* The third entry in the third column of this Mat4.
*/
c3r3: number;
/**
* The fourth entry in the third column of this Mat4.
*/
c3r4: number;
/**
* The first entry in the fourth column of this Mat4.
*/
c4r1: number;
/**
* The second entry in the fourth column of this Mat4.
*/
c4r2: number;
/**
* The third entry in the fourth column of this Mat4.
*/
c4r3: number;
/**
* The fourth entry in the fourth column of this Mat4.
*/
c4r4: number;
}
/**
* A Mat4 backed by a Float32Array.
*/
export declare class Mat4Struct extends Struct<Float32Array> {
static create(other: Mat4Like): Mat4Struct;
static create$(c1r1: number, c1r2: number, c1r3: number, c1r4: number, c2r1: number, c2r2: number, c2r3: number, c2r4: number, c3r1: number, c3r2: number, c3r3: number, c3r4: number, c4r1: number, c4r2: number, c4r3: number, c4r4: number): Mat4Struct;
/**
* Sets this Mat4 to an othogonal transformation matrix given the
* dimensions of the near clipping plane as well as the
* near and far clipping plane distances.
* @param left left side of the near clipping plane viewport.
* @param right side of the near clipping plane viewport.
* @param top top of the near clipping plane viewport.
* @param bottom bottom of the near clipping plane viewport.
* @param near the depth (negative z coordinate) of the near clipping plane.
* @param far the depth (negative z coordinate) of the far clipping plane.
* @param dst where to store the result. Defaults to new Mat4.
* @returns the ortho matrix.
*/
ortho: (clip: RectLike, near: number, far: number) => void;
/**
* Sets this Mat4 to an othogonal transformation matrix given the left, right,
* bottom, and top dimensions of the near clipping plane as well as the
* near and far clipping plane distances.
* @param left left side of the near clipping plane viewport.
* @param right side of the near clipping plane viewport.
* @param top top of the near clipping plane viewport.
* @param bottom bottom of the near clipping plane viewport.
* @param near the depth (negative z coordinate) of the near clipping plane.
* @param far the depth (negative z coordinate) of the far clipping plane.
* @param dst where to store the result. Defaults to new Mat4.
* @returns the ortho matrix.
*/
ortho$: (left: number, right: number, bottom: number, top: number, near: number, far: number) => void;
/**
* Sets each component of this Mat4 to that of the other Mat4.
*/
set: (other: Mat4Like) => void;
/**
* Sets each component of this Mat4.
*/
set$: (c1r1: number, c1r2: number, c1r3: number, c1r4: number, c2r1: number, c2r2: number, c2r3: number, c2r4: number, c3r1: number, c3r2: number, c3r3: number, c3r4: number, c4r1: number, c4r2: number, c4r3: number, c4r4: number) => void;
/**
* Sets each component of this Mat4 to the specified scalar.
*/
setScalar: (k: number) => void;
/**
* Adds the other Mat4 to this Mat4 componentwise.
*/
add: (other: Mat4Like) => void;
/**
* Adds the specified values to this Mat4 componentwise.
*/
add$: (c1r1: number, c1r2: number, c1r3: number, c1r4: number, c2r1: number, c2r2: number, c2r3: number, c2r4: number, c3r1: number, c3r2: number, c3r3: number, c3r4: number, c4r1: number, c4r2: number, c4r3: number, c4r4: number) => void;
/**
* Subtracts the other Mat4 from this Mat4 componentwise.
*/
subtract: (other: Mat4Like) => void;
/**
* Subtracts the specified values from this Mat4 componentwise.
*/
subtract$: (c1r1: number, c1r2: number, c1r3: number, c1r4: number, c2r1: number, c2r2: number, c2r3: number, c2r4: number, c3r1: number, c3r2: number, c3r3: number, c3r4: number, c4r1: number, c4r2: number, c4r3: number, c4r4: number) => void;
/**
* Multiplies each component of this Mat4 by the specified scalar.
*/
mulScalar: (k: number) => void;
/**
* Divides each component of this Mat4 by the specified scalar.
*/
divScalar: (k: number) => void;
/**
* Checks if each component of this Mat4 is exactly equal to that of the other Mat4.
*/
equals: (other: Mat4Like) => boolean;
/**
* Checks if each component of this Mat4 is exactly equal to the specified scalar.
*/
equalsScalar: (k: number) => boolean;
/**
* Checks if each component of this Mat4 is approximately equal to that of the other Mat4.
*/
epsilonEquals: (other: Mat4Like, e: number) => boolean;
/**
* Checks if each component of this Mat4 is approximately equal to the specified scalar.
*/
epsilonEqualsScalar: (k: number, e: number) => boolean;
/**
* Returns a string representation of this Mat4.
*/
toString: () => string;
/**
* Creates a Mat4 struct backed by the specified data.
*/
constructor(data?: Float32Array);
/**
* The first entry in the first column of this Mat4.
*/
/**
* The first entry in the first column of this Mat4.
*/
c1r1: number;
/**
* The second entry in the first column of this Mat4.
*/
/**
* The second entry in the first column of this Mat4.
*/
c1r2: number;
/**
* The third entry in the first column of this Mat4.
*/
/**
* The third entry in the first column of this Mat4.
*/
c1r3: number;
/**
* The fourth entry in the first column of this Mat4.
*/
/**
* The fourth entry in the first column of this Mat4.
*/
c1r4: number;
/**
* The first entry in the second column of this Mat4.
*/
/**
* The first entry in the second column of this Mat4.
*/
c2r1: number;
/**
* The second entry in the second column of this Mat4.
*/
/**
* The second entry in the second column of this Mat4.
*/
c2r2: number;
/**
* The third entry in the second column of this Mat4.
*/
/**
* The third entry in the second column of this Mat4.
*/
c2r3: number;
/**
* The fourth entry in the second column of this Mat4.
*/
/**
* The fourth entry in the second column of this Mat4.
*/
c2r4: number;
/**
* The first entry in the third column of this Mat4.
*/
/**
* The first entry in the third column of this Mat4.
*/
c3r1: number;
/**
* The second entry in the third column of this Mat4.
*/
/**
* The second entry in the third column of this Mat4.
*/
c3r2: number;
/**
* The third entry in the third column of this Mat4.
*/
/**
* The third entry in the third column of this Mat4.
*/
c3r3: number;
/**
* The fourth entry in the third column of this Mat4.
*/
/**
* The fourth entry in the third column of this Mat4.
*/
c3r4: number;
/**
* The first entry in the fourth column of this Mat4.
*/
/**
* The first entry in the fourth column of this Mat4.
*/
c4r1: number;
/**
* The second entry in the fourth column of this Mat4.
*/
/**
* The second entry in the fourth column of this Mat4.
*/
c4r2: number;
/**
* The third entry in the fourth column of this Mat4.
*/
/**
* The third entry in the fourth column of this Mat4.
*/
c4r3: number;
/**
* The fourth entry in the fourth column of this Mat4.
*/
/**
* The fourth entry in the fourth column of this Mat4.
*/
c4r4: number;
}
/**
* A Mat4 buffer backed by a Float32Array.
*/
export declare class Mat4Buffer extends StructBuffer<Float32Array> {
/**
* Creates an empty Mat4 buffer with the specified Mat4 capacity.
*/
static create(capacity: number): Mat4Buffer;
/**
* Sets this Mat4 to an othogonal transformation matrix given the
* dimensions of the near clipping plane as well as the
* near and far clipping plane distances.
* @param left left side of the near clipping plane viewport.
* @param right side of the near clipping plane viewport.
* @param top top of the near clipping plane viewport.
* @param bottom bottom of the near clipping plane viewport.
* @param near the depth (negative z coordinate) of the near clipping plane.
* @param far the depth (negative z coordinate) of the far clipping plane.
* @param dst where to store the result. Defaults to new Mat4.
* @returns the ortho matrix.
*/
ortho: (clip: RectLike, near: number, far: number) => void;
/**
* Sets this Mat4 to an othogonal transformation matrix given the left, right,
* bottom, and top dimensions of the near clipping plane as well as the
* near and far clipping plane distances.
* @param left left side of the near clipping plane viewport.
* @param right side of the near clipping plane viewport.
* @param top top of the near clipping plane viewport.
* @param bottom bottom of the near clipping plane viewport.
* @param near the depth (negative z coordinate) of the near clipping plane.
* @param far the depth (negative z coordinate) of the far clipping plane.
* @param dst where to store the result. Defaults to new Mat4.
* @returns the ortho matrix.
*/
ortho$: (left: number, right: number, bottom: number, top: number, near: number, far: number) => void;
/**
* Sets each component of this Mat4 to that of the other Mat4.
*/
set: (other: Mat4Like) => void;
/**
* Sets each component of this Mat4.
*/
set$: (c1r1: number, c1r2: number, c1r3: number, c1r4: number, c2r1: number, c2r2: number, c2r3: number, c2r4: number, c3r1: number, c3r2: number, c3r3: number, c3r4: number, c4r1: number, c4r2: number, c4r3: number, c4r4: number) => void;
/**
* Sets each component of this Mat4 to the specified scalar.
*/
setScalar: (k: number) => void;
/**
* Adds the other Mat4 to this Mat4 componentwise.
*/
add: (other: Mat4Like) => void;
/**
* Adds the specified values to this Mat4 componentwise.
*/
add$: (c1r1: number, c1r2: number, c1r3: number, c1r4: number, c2r1: number, c2r2: number, c2r3: number, c2r4: number, c3r1: number, c3r2: number, c3r3: number, c3r4: number, c4r1: number, c4r2: number, c4r3: number, c4r4: number) => void;
/**
* Subtracts the other Mat4 from this Mat4 componentwise.
*/
subtract: (other: Mat4Like) => void;
/**
* Subtracts the specified values from this Mat4 componentwise.
*/
subtract$: (c1r1: number, c1r2: number, c1r3: number, c1r4: number, c2r1: number, c2r2: number, c2r3: number, c2r4: number, c3r1: number, c3r2: number, c3r3: number, c3r4: number, c4r1: number, c4r2: number, c4r3: number, c4r4: number) => void;
/**
* Multiplies each component of this Mat4 by the specified scalar.
*/
mulScalar: (k: number) => void;
/**
* Divides each component of this Mat4 by the specified scalar.
*/
divScalar: (k: number) => void;
/**
* Checks if each component of this Mat4 is exactly equal to that of the other Mat4.
*/
equals: (other: Mat4Like) => boolean;
/**
* Checks if each component of this Mat4 is exactly equal to the specified scalar.
*/
equalsScalar: (k: number) => boolean;
/**
* Checks if each component of this Mat4 is approximately equal to that of the other Mat4.
*/
epsilonEquals: (other: Mat4Like, e: number) => boolean;
/**
* Checks if each component of this Mat4 is approximately equal to the specified scalar.
*/
epsilonEqualsScalar: (k: number, e: number) => boolean;
/**
* Returns a string representation of this Mat4.
*/
toString: () => string;
/**
* The first entry in the first column of the current Mat4.
*/
/**
* The first entry in the first column of the current Mat4.
*/
c1r1: number;
/**
* The second entry in the first column of the current Mat4.
*/
/**
* The second entry in the first column of the current Mat4.
*/
c1r2: number;
/**
* The third entry in the first column of the current Mat4.
*/
/**
* The third entry in the first column of the current Mat4.
*/
c1r3: number;
/**
* The fourth entry in the first column of the current Mat4.
*/
/**
* The fourth entry in the first column of the current Mat4.
*/
c1r4: number;
/**
* The first entry in the second column of the current Mat4.
*/
/**
* The first entry in the second column of the current Mat4.
*/
c2r1: number;
/**
* The second entry in the second column of the current Mat4.
*/
/**
* The second entry in the second column of the current Mat4.
*/
c2r2: number;
/**
* The third entry in the second column of the current Mat4.
*/
/**
* The third entry in the second column of the current Mat4.
*/
c2r3: number;
/**
* The fourth entry in the second column of the current Mat4.
*/
/**
* The fourth entry in the second column of the current Mat4.
*/
c2r4: number;
/**
* The first entry in the third column of the current Mat4.
*/
/**
* The first entry in the third column of the current Mat4.
*/
c3r1: number;
/**
* The second entry in the third column of the current Mat4.
*/
/**
* The second entry in the third column of the current Mat4.
*/
c3r2: number;
/**
* The third entry in the third column of the current Mat4.
*/
/**
* The third entry in the third column of the current Mat4.
*/
c3r3: number;
/**
* The fourth entry in the third column of the current Mat4.
*/
/**
* The fourth entry in the third column of the current Mat4.
*/
c3r4: number;
/**
* The first entry in the fourth column of the current Mat4.
*/
/**
* The first entry in the fourth column of the current Mat4.
*/
c4r1: number;
/**
* The second entry in the fourth column of the current Mat4.
*/
/**
* The second entry in the fourth column of the current Mat4.
*/
c4r2: number;
/**
* The third entry in the fourth column of the current Mat4.
*/
/**
* The third entry in the fourth column of the current Mat4.
*/
c4r3: number;
/**
* The fourth entry in the fourth column of the current Mat4.
*/
/**
* The fourth entry in the fourth column of the current Mat4.
*/
c4r4: number;
/**
* Gets the number of properties in a Mat4, namely 16.
*/
structLength(): number;
/**
* Gets the components of the Mat4 at the specified position of this buffer.
*/
aget(position: number, dst?: Mat4Like): Mat4Like;
/**
* Gets the components of the current Mat4, then moves to the next position of this buffer.
*/
rget(dst?: Mat4Like): Mat4Like;
/**
* Sets each component of the Mat4 at the specified position to that of the src Mat4.
*/
aset(position: number, src: Mat4Like): void;
/**
* Sets each component of the Mat4 at the specified position.
*/
aset$(position: number, c1r1: number, c1r2: number, c1r3: number, c1r4: number, c2r1: number, c2r2: number, c2r3: number, c2r4: number, c3r1: number, c3r2: number, c3r3: number, c3r4: number, c4r1: number, c4r2: number, c4r3: number, c4r4: number): void;
/**
* Sets each component of the current Mat4 to that of the src Mat4, then moves to the next position of this buffer.
*/
rset(src: Mat4Like): void;
/**
* Sets each component of the current Mat4, then moves to the next position of this buffer.
*/
rset$(c1r1: number, c1r2: number, c1r3: number, c1r4: number, c2r1: number, c2r2: number, c2r3: number, c2r4: number, c3r1: number, c3r2: number, c3r3: number, c3r4: number, c4r1: number, c4r2: number, c4r3: number, c4r4: number): void;
}