@phaserjs/phaser
Version:
24 lines (23 loc) • 373 B
JavaScript
export function Mat4Ortho(matrix, left, right, bottom, top, near, far) {
const lr = 1 / (left - right);
const bt = 1 / (bottom - top);
const nf = 1 / (near - far);
matrix.set([
-2 * lr,
0,
0,
0,
0,
-2 * bt,
0,
0,
0,
0,
2 * nf,
0,
(left + right) * lr,
(top + bottom) * bt,
(far + near) * nf,
1
]);
}