mirror of
https://github.com/recp/cglm.git
synced 2026-01-03 22:22:11 +00:00
extract fovy and aspect for perpective matrix
This commit is contained in:
@@ -426,6 +426,31 @@ glm_persp_decomp_near(mat4 proj, float * __restrict nearVal) {
|
||||
*nearVal = proj[3][2] / (proj[2][2] - 1);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief returns field of view angle along the Y-axis (in radians)
|
||||
*
|
||||
* if you need to degrees, use glm_deg to convert it or use this:
|
||||
* fovy_deg = glm_deg(glm_persp_fovy(projMatrix))
|
||||
*
|
||||
* @param[in] proj perspective projection matrix
|
||||
*/
|
||||
CGLM_INLINE
|
||||
float
|
||||
glm_persp_fovy(mat4 proj) {
|
||||
return 2.0 * atan(1.0 / proj[1][1]);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief returns aspect ratio of perspective projection
|
||||
*
|
||||
* @param[in] proj perspective projection matrix
|
||||
*/
|
||||
CGLM_INLINE
|
||||
float
|
||||
glm_persp_aspect(mat4 proj) {
|
||||
return proj[1][1] / proj[0][0];
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief extracts view frustum planes
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user