mirror of
https://github.com/recp/cglm.git
synced 2025-10-04 09:08:53 +00:00
helper: default perspective
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
#define glm_vcam_h
|
#define glm_vcam_h
|
||||||
|
|
||||||
#include "cglm.h"
|
#include "cglm.h"
|
||||||
|
#include "cglm-platform.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -79,6 +80,19 @@ glm_perspective(float fovy,
|
|||||||
dest[3][2] = 2 * near * far / (near - far);
|
dest[3][2] = 2 * near * far / (near - far);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGLM_INLINE
|
||||||
|
void
|
||||||
|
glm_perspective_default(mat4 dest) {
|
||||||
|
GLint viewport[4];
|
||||||
|
glGetIntegerv(GL_VIEWPORT, viewport);
|
||||||
|
|
||||||
|
glm_perspective(M_PI_4,
|
||||||
|
(float)viewport[2]/viewport[3],
|
||||||
|
0.01f,
|
||||||
|
100.0f,
|
||||||
|
dest);
|
||||||
|
}
|
||||||
|
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_lookat(vec3 eye,
|
glm_lookat(vec3 eye,
|
||||||
|
Reference in New Issue
Block a user