aboutsummaryrefslogtreecommitdiff
path: root/src/scene/camera.c
blob: 475101d43f39579b0f0180ce170346d3cc3f7c7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <gfx/scene/camera.h>

#include "memory.h"

#include <assert.h>
#include <math/camera.h>

Camera* gfx_make_camera() {
  Camera* camera = mem_alloc_camera();
  *camera        = camera_perspective(
      /*fovy=*/90.0 * TO_RAD, /*aspect=*/16.0 / 9.0,
      /*near=*/0.1, /*far=*/1000);
  return camera;
}

void gfx_destroy_camera(Camera** camera) {
  assert(camera);
  if (*camera) {
    mem_free_camera(camera);
  }
}