/**
 * 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 near, float far
) {
  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
) {
  matrixIdentity(&camera->projection);
  matrixOrtho(&camera->projection, left, right, bottom, top, near, far);
}