Add LH & RH_NO perspective functions

This commit adds functions `glm_perspective_lh_no` and
`glm_perspective_rh_no` to the code. Unit tests are added and this
commit follows the new pattern of adding the a new file per
coordinate-system and clip-space tuple.

. Makefile.am updated
. removed test/glm_cmp project stub
. unit tests include naive implementations to as well as magic number
  ref-data generated by the corresponding GLM functions.

No tests run yet on Windows or Mac.
This commit is contained in:
michaelg
2021-04-30 21:53:17 +01:00
committed by Tai Chi Minh Ralph Eastwood
parent b3a18b8a15
commit c013bd462c
21 changed files with 266 additions and 89 deletions

View File

@@ -17,9 +17,8 @@ TEST_IMPL(perspective_rh_zo) {
glm_perspective_rh_zo(fovy, aspect, zNearVal, zFarVal, dst);
/* Sanity mk. I: longhand version */
float focal_len = 1 / tanf(fovy / 2);
ASSERT(test_eq(dst[0][0], focal_len / aspect))
ASSERT(test_eq(dst[1][1], focal_len))
ASSERT(test_eq(dst[0][0], 1 / (tanf(fovy / 2) * aspect)))
ASSERT(test_eq(dst[1][1], 1 / tanf(fovy / 2)))
ASSERT(test_eq(dst[2][2], zFarVal / (zNearVal - zFarVal)))
ASSERT(test_eq(dst[2][3], -1.0f))
ASSERT(test_eq(dst[3][2], -1 * zFarVal * zNearVal / (zFarVal - zNearVal)))
@@ -27,8 +26,8 @@ TEST_IMPL(perspective_rh_zo) {
/* Sanity mk. II */
/*reference test data for glm_perspective_rh_zo*/
mat4 cmp = {0};
cmp[0][0] = 1.8106601f;
cmp[1][1] = 2.4142134f;
cmp[0][0] = 1.8106601f;
cmp[1][1] = 2.4142134f;
cmp[2][2] = -1.0010010f;
cmp[2][3] = -1.0000000f;
cmp[3][2] = -0.1001001f;