diff --git a/gl-matrix/gl-matrix-tests.ts b/gl-matrix/gl-matrix-tests.ts index ce5251edad..682bca7b8b 100644 --- a/gl-matrix/gl-matrix-tests.ts +++ b/gl-matrix/gl-matrix-tests.ts @@ -308,6 +308,11 @@ q = [0, 0, 0, 1]; out = mat4.fromRotationTranslation(out, q, [1, 2, 3]); out = mat4.fromQuat(out, q); +q = [0, 0, 0, 1]; +out = mat4.fromRotationTranslationScale(out, q, [1, 2, 3], [1, 2, 3]); +out = mat4.fromQuat(out, q); + + // quat var quatA = [1, 2, 3, 4]; var quatB = [5, 6, 7, 8]; diff --git a/gl-matrix/gl-matrix.d.ts b/gl-matrix/gl-matrix.d.ts index b5dcdf3f1d..16366f263a 100644 --- a/gl-matrix/gl-matrix.d.ts +++ b/gl-matrix/gl-matrix.d.ts @@ -1828,8 +1828,27 @@ declare namespace mat4 { * @param v Translation vector * @returns out */ - export function fromRotationTranslation(out: GLM.IArray, q: GLM.IArray, - v: GLM.IArray): GLM.IArray; + export function fromRotationTranslation(out: GLM.IArray, q: GLM.IArray, v: GLM.IArray): GLM.IArray; + + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale. + * + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * var quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * + * @param out mat4 receiving operation result + * @param q Rotation quaternion + * @param v Translation vector + * @param s Scale vector + * @returns out + */ + export function fromRotationTranslationScale(out: GLM.IArray, q: GLM.IArray, v: GLM.IArray, s: GLM.IArray): GLM.IArray /** * Creates a matrix from a quaternion