fix transpose

v1
Brett 2023-02-28 23:43:56 -05:00
parent cd4e4581ae
commit b2666dc39e
1 changed files with 5 additions and 8 deletions

View File

@ -268,14 +268,11 @@ namespace blt {
float oneOverNearMFar = 1.0f / (near - far);
float halfTan = tanf(fov * 0.5f * (float)M_PI / 180.0f);
// this should be all it takes to create a mostly correct projection matrix
// the values are transposed because my matrix implementation is terrible.
// TODO: redo matrix implementation
perspectiveMat4x4.m00(float(1.0 / (aspect_ratio * halfTan)));
perspectiveMat4x4.m11(float(1.0 / halfTan));
perspectiveMat4x4.m22(float(-((far + near) / (far - near))));
perspectiveMat4x4.m23(-1);
perspectiveMat4x4.m32(float(-((2 * near * far) / (far - near))));
perspectiveMat4x4.m32(-1);
perspectiveMat4x4.m23(float(-((2 * near * far) / (far - near))));
return perspectiveMat4x4;
}
@ -287,9 +284,9 @@ namespace blt {
perspectiveMat4x4.m11(2/(top-bottom));
perspectiveMat4x4.m22(2/(far-near));
perspectiveMat4x4.m33(1);
perspectiveMat4x4.m30(-(right + left) / (right - left));
perspectiveMat4x4.m31(-(top + bottom) / (top - bottom));
perspectiveMat4x4.m32(-(far + near) / (far - near));
perspectiveMat4x4.m03(-(right + left) / (right - left));
perspectiveMat4x4.m13(-(top + bottom) / (top - bottom));
perspectiveMat4x4.m23(-(far + near) / (far - near));
return perspectiveMat4x4;
}