How do I set up coordinates for perspective matrix like in orthographic projection for left, right, top and bottom and add in fov and aspect ratio. I have only seen perspective matrix use other arguments in a method without left, right, bottom, top. This is my ortho matrix:
public static Matrix4f Orthographic(float left, float right, float bottom, float top, float near, float far) {
Matrix4f result = Identity();
result.elements[0 + 0 * 4] = 2.0f / (right - left);
result.elements[1 + 1 * 4] = 2.0f / (top - bottom);
result.elements[2 + 2 * 4] = 2.0f / (near - far);
result.elements[0 + 3 * 4] = (left + right) / (left - right);
result.elements[1 + 3 * 4] = (bottom + top) / (bottom - top);
result.elements[2 + 3 * 4] = (far + near) / (far - near);
return result;
}
Now I want to create perspective one with same arguments but with added fov.