From e33497fb48dcdb88c2895075715776c5cc96703d Mon Sep 17 00:00:00 2001 From: Kaesebrot84 <13865115+Kaesebrot84@users.noreply.github.com> Date: Fri, 6 Oct 2017 19:08:08 +0200 Subject: [PATCH] Added a definition for projection in mat3 class in gl-Matrix (#20294) * Added a definition for projection in mat3 class Added the missing definition for projection function in the `mat3` class * Added semicolon Added missing semicolon. * Added test for mat3.projection() Added test for mat3.projection() --- types/gl-matrix/gl-matrix-tests.ts | 1 + types/gl-matrix/index.d.ts | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/types/gl-matrix/gl-matrix-tests.ts b/types/gl-matrix/gl-matrix-tests.ts index 505bbcbb26..765f871e30 100644 --- a/types/gl-matrix/gl-matrix-tests.ts +++ b/types/gl-matrix/gl-matrix-tests.ts @@ -267,6 +267,7 @@ outMat3 = mat3.multiplyScalar (outMat3, mat3A, 2); outMat3 = mat3.multiplyScalarAndAdd (outMat3, mat3A, mat3B, 2); outBool = mat3.exactEquals(mat3A, mat3B); outBool = mat3.equals(mat3A, mat3B); +outMat3 = mat3.projection(outMat3, 100, 100); //mat4 outMat4 = mat4.create(); diff --git a/types/gl-matrix/index.d.ts b/types/gl-matrix/index.d.ts index d39496e20d..1ce2ea5d58 100644 --- a/types/gl-matrix/index.d.ts +++ b/types/gl-matrix/index.d.ts @@ -1950,6 +1950,16 @@ declare module 'gl-matrix' { * @returns out */ public static transpose(out: mat3, a: mat3): mat3; + + /** + * Generates a 2D projection matrix with the given bounds + * + * @param out the receiving matrix + * @param width width of your gl context + * @param height height of gl context + * @returns out + */ + public static projection(out: mat3, width: number, height: number): mat3; /** * Inverts a mat3