#include "camera.h"

Matrix4 get_camera_view_matrix(Camera *camera, Render_Data *render_data) {
  f32 azimuth_radians = glm::radians(render_data->view_azimuth);
  f32 elevation_radians = glm::radians(render_data->view_elevation);

  f32 sin_azimuth = glm::sin(azimuth_radians);
  f32 cos_azimuth = glm::cos(azimuth_radians);
  f32 sin_elevation = glm::sin(elevation_radians);
  f32 cos_elevation = glm::cos(elevation_radians);

  camera->view_direction = glm::normalize(Vector3(sin_azimuth * cos_elevation, sin_elevation, -cos_azimuth * cos_elevation));

  Matrix4 look_at = glm::lookAt(camera->world_position, camera->world_position + camera->view_direction, camera->world_up_vector);

  return look_at;
}
