An orthographic projection has no perspective to it. An orthographic projection maps linearly to NDC space. Orthographic projections are often used for two-dimensional games. It's often used to achieve an isometric perspective.
Implement the ortho function in mat4.cpp. Don't forget to add the function declaration to mat4.h:
mat4 ortho(float l, float r, float b, float t,
float n, float f) {
if (l == r || t == b || n == f) {
return mat4(); // Error
}
return mat4(
2.0f / (r - l), 0, 0, 0,
0, 2.0f / (t - b), 0, 0,
0, 0, -2.0f / (f - n), 0,
-((r+l)/(r-l)),-((t+b)/(t-b)),-((f+n)/(f-n)), 1
);
}
Orthographic view projections are generally useful for displaying UI or other two-dimensional elements.