summaryrefslogtreecommitdiff
path: root/src/core/camera.h
diff options
context:
space:
mode:
authorOmniscient <omniscient.oce@gmail.com>2024-07-11 18:03:29 +1000
committerOmniscient <omniscient.oce@gmail.com>2024-07-11 18:03:29 +1000
commit65d74bdb26af833b5380046dec204f685f745cc1 (patch)
tree6a913e8b47787fff9f4650963074ea3f8ab5de27 /src/core/camera.h
parent3103f383751a12f8a0bdb22309704f1f826d204c (diff)
changing styles plus simplifying a bit
Diffstat (limited to 'src/core/camera.h')
-rw-r--r--src/core/camera.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/core/camera.h b/src/core/camera.h
new file mode 100644
index 0000000..233f5f3
--- /dev/null
+++ b/src/core/camera.h
@@ -0,0 +1,37 @@
+/**
+ * @file camera.h
+ * @brief
+ */
+#pragma once
+
+#include "defines.h"
+#include "maths_types.h"
+
+typedef struct Camera {
+ vec3 position;
+ vec3 front;
+ vec3 up;
+ f32 fov;
+} Camera;
+
+/** @brief create a camera */
+Camera Camera_Create(vec3 pos, vec3 front, vec3 up, f32 fov);
+
+/**
+ * @brief Get 3D camera transform matrix
+ * @param out_view optionally stores just the view matrix
+ * @param out_proj optionally stores just the projection matrix
+ * @returns the camera's view projection matrix pre-multiplied
+*/
+PUB mat4 Camera_ViewProj(Camera* c, f32 lens_height, f32 lens_width, mat4* out_view, mat4* out_proj);
+
+/** @brief Get 2D camera transform matrix */
+PUB mat4 Camera_View2D(Camera* c); // TODO: 2D cameras
+
+
+// TODO: Basic reusable camera controls
+/*
+Right click + move = pan
+Left click = orbit camera
+WASD = forward/backward/left/right
+*/