From 0ced620e8a08607e91696aba961ada9445d11e58 Mon Sep 17 00:00:00 2001 From: Austin Martin Date: Tue, 29 Aug 2017 13:24:38 -0500 Subject: [PATCH] Add mat4.getScaling function declaration. --- types/gl-matrix/gl-matrix-tests.ts | 10 ++++++---- types/gl-matrix/index.d.ts | 12 ++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/types/gl-matrix/gl-matrix-tests.ts b/types/gl-matrix/gl-matrix-tests.ts index 3642cca521..3a9c3175c8 100644 --- a/types/gl-matrix/gl-matrix-tests.ts +++ b/types/gl-matrix/gl-matrix-tests.ts @@ -294,8 +294,9 @@ outMat4 = mat4.fromXRotation(outMat4, Math.PI); outMat4 = mat4.fromYRotation(outMat4, Math.PI); outMat4 = mat4.fromZRotation(outMat4, Math.PI); outMat4 = mat4.fromRotationTranslation(outMat4, quatA, vec3A); -outVec3 = mat4.getTranslation(outVec3, mat4A) -outQuat = mat4.getRotation(outQuat, mat4A) +outVec3 = mat4.getTranslation(outVec3, mat4A); +outVec3 = mat4.getScaling(outVec3, mat4A); +outQuat = mat4.getRotation(outQuat, mat4A); outMat4 = mat4.fromRotationTranslationScale(outMat4, quatA, vec3A, vec3B); outMat4 = mat4.fromRotationTranslationScaleOrigin(outMat4, quatA, vec3A, vec3B, vec3A); outMat4 = mat4.fromQuat(outMat4, quatB); @@ -643,8 +644,9 @@ outMat4 = _mat4.fromXRotation(outMat4, Math.PI); outMat4 = _mat4.fromYRotation(outMat4, Math.PI); outMat4 = _mat4.fromZRotation(outMat4, Math.PI); outMat4 = _mat4.fromRotationTranslation(outMat4, quatA, vec3A); -outVec3 = _mat4.getTranslation(outVec3, mat4A) -outQuat = _mat4.getRotation(outQuat, mat4A) +outVec3 = _mat4.getTranslation(outVec3, mat4A); +outVec3 = _mat4.getScaling(outVec3, mat4A); +outQuat = _mat4.getRotation(outQuat, mat4A); outMat4 = _mat4.fromRotationTranslationScale(outMat4, quatA, vec3A, vec3B); outMat4 = _mat4.fromRotationTranslationScaleOrigin(outMat4, quatA, vec3A, vec3B, vec3A); outMat4 = _mat4.fromQuat(outMat4, quatB); diff --git a/types/gl-matrix/index.d.ts b/types/gl-matrix/index.d.ts index 89f28934b8..1e6d310ed6 100644 --- a/types/gl-matrix/index.d.ts +++ b/types/gl-matrix/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for gl-matrix 2.2.2 // Project: https://github.com/toji/gl-matrix // Definitions by: Mattijs Kneppers , based on definitions by Tat +// Austin Martin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module 'gl-matrix' { @@ -2450,6 +2451,17 @@ declare module 'gl-matrix' { */ public static getTranslation(out: vec3, mat: mat4): vec3; + /** + * Returns the scaling factor component of a transformation matrix. + * If a matrix is built with fromRotationTranslationScale with a + * normalized Quaternion parameter, the returned vector will be + * the same as the scaling vector originally supplied. + * @param {vec3} out Vector to receive scaling factor component + * @param {mat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + public static getScaling(out: vec3, mat: mat4): vec3; + /** * Returns a quaternion representing the rotational component * of a transformation matrix. If a matrix is built with