Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import { mat4 } from 'gl-matrix';
/**
* Computes the projection scaling matrix used for canvas stretch.
* The scaling is applied along the canvas axes.
*
* @param aspectRatio - [scaleX, scaleY], where each value controls stretching along the corresponding canvas axis
* @returns Projection scaling matrix for canvas stretch
*/
export function getProjectionScaleMatrix(aspectRatio: Array<number>): mat4 {
const [scaleX, scaleY] = aspectRatio;
const projectionScaleMatrix = mat4.fromScaling(mat4.create(), [
scaleX,
scaleY,
1.0,
]);
return projectionScaleMatrix;
}
|