(math/matrix_4x4c.) Cleanup

This commit is contained in:
twinaphex 2015-06-24 11:48:20 +02:00
parent 2c09bbcda3
commit 4078bc5756

View File

@ -155,11 +155,13 @@ void matrix_4x4_translate(math_matrix_4x4 *out, float x,
void matrix_4x4_projection(math_matrix_4x4 *out, float znear,
float zfar)
{
float delta_z = zfar - znear;
memset(out, 0, sizeof(*out));
MAT_ELEM_4X4(*out, 0, 0) = znear;
MAT_ELEM_4X4(*out, 1, 1) = zfar;
MAT_ELEM_4X4(*out, 2, 2) = (zfar + znear) / (zfar - znear);
MAT_ELEM_4X4(*out, 2, 3) = -2.0f * zfar * znear / (zfar - znear);
MAT_ELEM_4X4(*out, 2, 2) = (zfar + znear) / delta_z;
MAT_ELEM_4X4(*out, 2, 3) = -2.0f * zfar * znear / delta_z;
MAT_ELEM_4X4(*out, 3, 2) = -1.0f;
}