mathc
mathc copied to clipboard
results are different from the DirectX math library (DirectXMath.h)
Hi!
I'm trying to find a C alternative to the DirectXMath.h header (which requires C++)
I'm brand new to this repo, so please excuse me if I'm missing something obvious, but it appears that DirectXMath.h gives different results from this library.
example:
int Width = 800;
int Height = 600;
XMMATRIX tmpMat = XMMatrixPerspectiveFovLH(
45.0f * (3.14f / 180.0f),
(float)Width / (float)Height,
0.1f,
1000.0f);
for (int i = 0; i < 4; i++)
{
for(int j = 0; j < 4; j++)
std::cout << tmpMat.r[i].m128_f32[j] << '\t' << '\t';
std::cout << '\n';
}
std::cout << '\n';
mat4_perspective(
tmpMat.r[0].m128_f32,
45.0f * (3.14f / 180.0f),
(float)Width / (float)Height,
0.1f,
1000.0f);
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
std::cout << tmpMat.r[i].m128_f32[j] << '\t' << '\t';
std::cout << '\n';
}
std::cout << '\n';
output:
1.81168 0 0 0 0 2.41557 0 0 0 0 1.0001 1 0 0 -0.10001 0
1.81168 0 0 0 0 0.41398 0 0 0 0 -1.0001 -1 0 0 -0.10001 0