Added matrix
This commit is contained in:
@ -11,38 +11,28 @@ void cameraLookAt(camera_t *camera,
|
||||
float x, float y, float z,
|
||||
float targetX, float targetY, float targetZ
|
||||
) {
|
||||
glm_mat4_identity(camera->view);
|
||||
glm_lookat(
|
||||
(vec3){ x, y, z },
|
||||
(vec3){ targetX, targetY, targetZ },
|
||||
(vec3){ 0,1,0 },
|
||||
camera->view
|
||||
);
|
||||
matrixIdentity(&camera->view);
|
||||
matrixLookAt(&camera->view, x, y, z, targetX, targetY, targetZ, 0, 1, 0);
|
||||
}
|
||||
|
||||
void cameraLook(camera_t *camera,
|
||||
float x, float y, float z,
|
||||
float pitch, float yaw, float roll
|
||||
) {
|
||||
glm_mat4_identity(camera->view);
|
||||
glm_look(
|
||||
(vec3){ x, y, z },
|
||||
(vec3){ pitch, yaw, roll },
|
||||
(vec3){ 0,1,0 },
|
||||
camera->view
|
||||
);
|
||||
matrixIdentity(&camera->view);
|
||||
matrixLook(&camera->view, x, y, z, pitch, yaw, roll, 0, 1, 0);
|
||||
}
|
||||
|
||||
void cameraPerspective(camera_t *camera,
|
||||
float fov, float aspect, float near, float far
|
||||
) {
|
||||
glm_mat4_identity(camera->projection);
|
||||
glm_perspective(mathDeg2Rad(fov), aspect, near, far, camera->projection);
|
||||
matrixIdentity(&camera->projection);
|
||||
matrixPerspective(&camera->projection, mathDeg2Rad(fov), aspect, near, far);
|
||||
}
|
||||
|
||||
void cameraOrtho(camera_t *camera,
|
||||
float left, float right, float bottom, float top, float near, float far
|
||||
) {
|
||||
glm_mat4_identity(camera->projection);
|
||||
glm_ortho(left, right, bottom, top, near, far, camera->projection);
|
||||
matrixIdentity(&camera->projection);
|
||||
matrixOrtho(&camera->projection, left, right, bottom, top, near, far);
|
||||
}
|
Reference in New Issue
Block a user