Adding Mtx_Transpose() test case to the PC main.cpp file. (Not tested, due to setup configurations not adequate on my end.)

Code is mostly formatted from the 3DS equivalent, test/3ds/main.cpp.
This commit is contained in:
Thompson Lee 2016-08-12 21:01:59 -04:00
parent 183b80eb86
commit 69df64c9d7

View File

@ -737,6 +737,31 @@ check_matrix(generator_t &gen, distribution_t &dist)
assert(Mtx_MultiplyFVecH(&m, FVec3_New(v.x, v.y, v.z)) == glm::mat4x3(g)*v); assert(Mtx_MultiplyFVecH(&m, FVec3_New(v.x, v.y, v.z)) == glm::mat4x3(g)*v);
} }
// check matrix transpose
{
C3D_Mtx m;
glm::mat4 check;
randomMatrix(m, gen, dist);
//Reducing rounding errors, and copying the values over to the check matrix.
for(size_t i = 0; i < 16; ++i)
{
m.m[i] = static_cast<int>(m.m[i]);
}
check = loadMatrix(m);
Mtx_Transpose(&m);
Mtx_Transpose(&m);
assert(m == glm::transpose(glm::transpose(check)));
//Comparing inverse(transpose(m)) == transpose(inverse(m))
Mtx_Transpose(&m);
Mtx_Inverse(&m);
assert(m == glm::transpose(glm::inverse(check)));
}
} }
} }