mirror of
https://github.com/recp/cglm.git
synced 2026-02-17 03:39:05 +00:00
Implement default infinite perspective projection matrix creation functions
This commit is contained in:
@@ -63,6 +63,10 @@ CGLM_EXPORT
|
||||
void
|
||||
glmc_perspective_default(float aspect, mat4 dest);
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_perspective_default_infinite(float aspect, mat4 dest);
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_perspective_resize(float aspect, mat4 proj);
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
float nearZ,
|
||||
mat4 dest)
|
||||
CGLM_INLINE void glm_perspective_default(float aspect, mat4 dest)
|
||||
CGLM_INLINE void glm_perspective_default_infinite(float aspect, mat4 dest)
|
||||
CGLM_INLINE void glm_perspective_resize(float aspect, mat4 proj)
|
||||
CGLM_INLINE void glm_lookat(vec3 eye, vec3 center, vec3 up, mat4 dest)
|
||||
CGLM_INLINE void glm_look(vec3 eye, vec3 dir, vec3 up, mat4 dest)
|
||||
@@ -343,6 +344,27 @@ glm_perspective_default(float aspect, mat4 dest) {
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief set up infinite perspective projection matrix with default near
|
||||
* and angle values
|
||||
*
|
||||
* @param[in] aspect aspect ratio ( width / height )
|
||||
* @param[out] dest result matrix
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_perspective_default_infinite(float aspect, mat4 dest) {
|
||||
#if CGLM_CONFIG_CLIP_CONTROL == CGLM_CLIP_CONTROL_LH_ZO
|
||||
glm_perspective_default_infinite_lh_zo(aspect, dest);
|
||||
#elif CGLM_CONFIG_CLIP_CONTROL == CGLM_CLIP_CONTROL_LH_NO
|
||||
glm_perspective_default_infinite_lh_no(aspect, dest);
|
||||
#elif CGLM_CONFIG_CLIP_CONTROL == CGLM_CLIP_CONTROL_RH_ZO
|
||||
glm_perspective_default_infinite_rh_zo(aspect, dest);
|
||||
#elif CGLM_CONFIG_CLIP_CONTROL == CGLM_CLIP_CONTROL_RH_NO
|
||||
glm_perspective_default_infinite_rh_no(aspect, dest);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief resize perspective matrix by aspect ratio ( width / height )
|
||||
* this makes very easy to resize proj matrix when window /viewport
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
float nearZ,
|
||||
mat4 dest)
|
||||
CGLM_INLINE void glm_perspective_default_lh_no(float aspect, mat4 dest)
|
||||
CGLM_INLINE void glm_perspective_default_infinite_lh_no(float aspect, mat4 dest)
|
||||
CGLM_INLINE void glm_perspective_resize_lh_no(float aspect, mat4 proj)
|
||||
CGLM_INLINE void glm_persp_move_far_lh_no(mat4 proj,
|
||||
float deltaFar)
|
||||
@@ -165,6 +166,20 @@ glm_perspective_default_lh_no(float aspect, mat4 dest) {
|
||||
glm_perspective_lh_no(GLM_PI_4f, aspect, 0.01f, 100.0f, dest);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief set up infinite perspective projection matrix with default near
|
||||
* and angle values with a left-hand coordinate system and a
|
||||
* clip-space of [-1, 1].
|
||||
*
|
||||
* @param[in] aspect aspect ratio ( width / height )
|
||||
* @param[out] dest result matrix
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_perspective_default_infinite_lh_no(float aspect, mat4 dest) {
|
||||
glm_perspective_infinite_lh_no(GLM_PI_4f, aspect, 0.01f, dest);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief resize perspective matrix by aspect ratio ( width / height )
|
||||
* this makes very easy to resize proj matrix when window /viewport
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
float nearZ,
|
||||
mat4 dest)
|
||||
CGLM_INLINE void glm_perspective_default_lh_zo(float aspect, mat4 dest)
|
||||
CGLM_INLINE void glm_perspective_default_infinite_lh_zo(float aspect, mat4 dest)
|
||||
CGLM_INLINE void glm_perspective_resize_lh_zo(float aspect, mat4 proj)
|
||||
CGLM_INLINE void glm_persp_move_far_lh_zo(mat4 proj,
|
||||
float deltaFar)
|
||||
@@ -177,7 +178,7 @@ glm_persp_move_far_lh_zo(mat4 proj, float deltaFar) {
|
||||
|
||||
/*!
|
||||
* @brief set up perspective projection matrix with default near/far
|
||||
* and angle values with a left-hand coordinate system and a
|
||||
* and angle values with a left-hand coordinate system and a
|
||||
* clip-space of [0, 1].
|
||||
*
|
||||
* @param[in] aspect aspect ratio ( width / height )
|
||||
@@ -189,6 +190,20 @@ glm_perspective_default_lh_zo(float aspect, mat4 dest) {
|
||||
glm_perspective_lh_zo(GLM_PI_4f, aspect, 0.01f, 100.0f, dest);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief set up infinite perspective projection matrix with default near
|
||||
* and angle values with a left-hand coordinate system and a
|
||||
* clip-space of [0, 1].
|
||||
*
|
||||
* @param[in] aspect aspect ratio ( width / height )
|
||||
* @param[out] dest result matrix
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_perspective_default_infinite_lh_zo(float aspect, mat4 dest) {
|
||||
glm_perspective_infinite_lh_zo(GLM_PI_4f, aspect, 0.01f, dest);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief resize perspective matrix by aspect ratio ( width / height )
|
||||
* this makes very easy to resize proj matrix when window /viewport
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
float nearZ,
|
||||
mat4 dest)
|
||||
CGLM_INLINE void glm_perspective_default_rh_no(float aspect, mat4 dest)
|
||||
CGLM_INLINE void glm_perspective_default_infinite_rh_no(float aspect, mat4 dest)
|
||||
CGLM_INLINE void glm_perspective_resize_rh_no(float aspect, mat4 proj)
|
||||
CGLM_INLINE void glm_persp_move_far_rh_no(mat4 proj,
|
||||
float deltaFar)
|
||||
@@ -165,6 +166,20 @@ glm_perspective_default_rh_no(float aspect, mat4 dest) {
|
||||
glm_perspective_rh_no(GLM_PI_4f, aspect, 0.01f, 100.0f, dest);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief set up infinite perspective projection matrix with default near
|
||||
* and angle values with a right-hand coordinate system and a
|
||||
* clip-space of [-1, 1].
|
||||
*
|
||||
* @param[in] aspect aspect ratio ( width / height )
|
||||
* @param[out] dest result matrix
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_perspective_default_infinite_rh_no(float aspect, mat4 dest) {
|
||||
glm_perspective_infinite_rh_no(GLM_PI_4f, aspect, 0.01f, dest);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief resize perspective matrix by aspect ratio ( width / height )
|
||||
* this makes very easy to resize proj matrix when window /viewport
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
float nearZ,
|
||||
mat4 dest)
|
||||
CGLM_INLINE void glm_perspective_default_rh_zo(float aspect, mat4 dest)
|
||||
CGLM_INLINE void glm_perspective_default_infinite_rh_zo(float aspect, mat4 dest)
|
||||
CGLM_INLINE void glm_perspective_resize_rh_zo(float aspect, mat4 proj)
|
||||
CGLM_INLINE void glm_persp_move_far_rh_zo(mat4 proj,
|
||||
float deltaFar)
|
||||
@@ -163,6 +164,20 @@ glm_perspective_default_rh_zo(float aspect, mat4 dest) {
|
||||
glm_perspective_rh_zo(GLM_PI_4f, aspect, 0.01f, 100.0f, dest);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief set up infinite perspective projection matrix with default near
|
||||
* and angle values with a right-hand coordinate system and a
|
||||
* clip-space of [0, 1].
|
||||
*
|
||||
* @param[in] aspect aspect ratio ( width / height )
|
||||
* @param[out] dest result matrix
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_perspective_default_infinite_rh_zo(float aspect, mat4 dest) {
|
||||
glm_perspective_infinite_rh_zo(GLM_PI_4f, aspect, 0.01f, dest);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief resize perspective matrix by aspect ratio ( width / height )
|
||||
* this makes very easy to resize proj matrix when window /viewport
|
||||
|
||||
@@ -80,6 +80,12 @@ glmc_perspective_default(float aspect, mat4 dest) {
|
||||
glm_perspective_default(aspect, dest);
|
||||
}
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_perspective_default_infinite(float aspect, mat4 dest) {
|
||||
glm_perspective_default_infinite(aspect, dest);
|
||||
}
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_perspective_resize(float aspect, mat4 proj) {
|
||||
|
||||
Reference in New Issue
Block a user