Dawn/src/display/camera.c
2021-08-14 12:02:34 -07:00

38 lines
1.0 KiB
C

/**
* Copyright (c) 2021 Dominic Msters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "camera.h"
void cameraLookAt(camera_t *camera,
float x, float y, float z,
float targetX, float targetY, float targetZ
) {
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
) {
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 camNear, float camFar
) {
matrixIdentity(&camera->projection);
matrixPerspective(&camera->projection,mathDeg2Rad(fov),aspect,camNear,camFar);
}
void cameraOrtho(camera_t *camera,
float left, float right, float bottom, float top, float camNear, float camFar
) {
matrixIdentity(&camera->projection);
matrixOrtho(&camera->projection, left, right, bottom, top, camNear, camFar);
}