/**
 * Copyright (c) 2021 Dominic Masters
 * 
 * This software is released under the MIT License.
 * https://opensource.org/licenses/MIT
 */

#include "matrix.h"

void matrixIdentity(matrix_t *matrix) {
  glm_mat4_identity(matrix->internalMatrix);
}

void matrixLookAt(matrix_t *matrix,
  float x,float y,float z,
  float tx,float ty, float tz,
  float ux, float uy, float uz
) {
  glm_lookat(
    (vec3){  x,  y,  z },
    (vec3){ tx, ty, tz },
    (vec3){ ux, uy, uz },
    matrix->internalMatrix
  );
}

void matrixLook(matrix_t *matrix, 
  float x, float y, float z,
  float pitch, float yaw, float roll, 
  float ux, float uy, float uz
) {
  glm_look(
    (vec3){ x, y, z },
    (vec3){ pitch, yaw, roll },
    (vec3){ ux, uy, uz },
    matrix->internalMatrix
  );
}

void matrixPerspective(matrix_t *matrix,
  float fov, float aspect, float camNear, float camFar
) {
  glm_perspective(fov, aspect, camNear, camFar, matrix->internalMatrix);
}

void matrixOrtho(matrix_t *matrix,
  float left, float right, float bottom, float top, float camNear, float camFar
) {
  glm_ortho(left, right, bottom, top, camNear, camFar, matrix->internalMatrix);
}

void matrixTranslate(matrix_t *matrix, float x, float y, float z) {
  glm_translate(matrix->internalMatrix, (vec3){ x, y, z });
}

void matrixRotate(matrix_t *matrix, float angle, float x, float y, float z) {
  glm_rotate(matrix->internalMatrix, angle, (vec3){ x, y, z });
}

void matrixScale(matrix_t *matrix, float x, float y, float z) {
  glm_scale(matrix->internalMatrix, (vec3){ x, y, z });
}