mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
matrix_4x4_ortho - cleanup
This commit is contained in:
parent
8649852e18
commit
0ceffb87f2
@ -119,20 +119,18 @@ void matrix_4x4_ortho(math_matrix_4x4 *mat,
|
|||||||
float bottom, float top,
|
float bottom, float top,
|
||||||
float znear, float zfar)
|
float znear, float zfar)
|
||||||
{
|
{
|
||||||
float tx, ty, tz;
|
float rl = right - left;
|
||||||
|
float tb = top - bottom;
|
||||||
|
float fn = zfar - znear;
|
||||||
|
|
||||||
matrix_4x4_identity(mat);
|
matrix_4x4_identity(mat);
|
||||||
|
|
||||||
tx = -(right + left) / (right - left);
|
MAT_ELEM_4X4(*mat, 0, 0) = 2.0f / rl;
|
||||||
ty = -(top + bottom) / (top - bottom);
|
MAT_ELEM_4X4(*mat, 1, 1) = 2.0f / tb;
|
||||||
tz = -(zfar + znear) / (zfar - znear);
|
MAT_ELEM_4X4(*mat, 2, 2) = -2.0f / fn;
|
||||||
|
MAT_ELEM_4X4(*mat, 0, 3) = -(left + right) / rl;
|
||||||
MAT_ELEM_4X4(*mat, 0, 0) = 2.0f / (right - left);
|
MAT_ELEM_4X4(*mat, 1, 3) = -(top + bottom) / tb;
|
||||||
MAT_ELEM_4X4(*mat, 1, 1) = 2.0f / (top - bottom);
|
MAT_ELEM_4X4(*mat, 2, 3) = -(zfar + znear) / fn;
|
||||||
MAT_ELEM_4X4(*mat, 2, 2) = -2.0f / (zfar - znear);
|
|
||||||
MAT_ELEM_4X4(*mat, 0, 3) = tx;
|
|
||||||
MAT_ELEM_4X4(*mat, 1, 3) = ty;
|
|
||||||
MAT_ELEM_4X4(*mat, 2, 3) = tz;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_4x4_scale(math_matrix_4x4 *out, float x, float y,
|
void matrix_4x4_scale(math_matrix_4x4 *out, float x, float y,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user