aboutsummaryrefslogtreecommitdiff
path: root/include/math/camera.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/math/camera.h')
-rw-r--r--include/math/camera.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/include/math/camera.h b/include/math/camera.h
index 1621927..cb2c50b 100644
--- a/include/math/camera.h
+++ b/include/math/camera.h
@@ -5,7 +5,7 @@
5 5
6typedef struct Camera { 6typedef struct Camera {
7 Spatial3 spatial; 7 Spatial3 spatial;
8 mat4 projection; 8 mat4 projection;
9} Camera; 9} Camera;
10 10
11/// Create an orthographic camera. 11/// Create an orthographic camera.
@@ -19,11 +19,11 @@ typedef struct Camera {
19/// \param top The coordinate for the top horizontal clipping plane. 19/// \param top The coordinate for the top horizontal clipping plane.
20/// \param near The distance to the near clipping plane. 20/// \param near The distance to the near clipping plane.
21/// \param far The distance to the far clipping plane. 21/// \param far The distance to the far clipping plane.
22static inline Camera camera_orthographic(R left, R right, R bottom, R top, 22static inline Camera camera_orthographic(
23 R near, R far) { 23 R left, R right, R bottom, R top, R near, R far) {
24 return (Camera){.spatial = spatial3_make(), 24 return (Camera){
25 .projection = 25 .spatial = spatial3_make(),
26 mat4_ortho(left, right, bottom, top, near, far)}; 26 .projection = mat4_ortho(left, right, bottom, top, near, far)};
27} 27}
28 28
29/// Create a perspective camera. 29/// Create a perspective camera.
@@ -37,6 +37,7 @@ static inline Camera camera_orthographic(R left, R right, R bottom, R top,
37/// \param near Distance to the near clipping plane. 37/// \param near Distance to the near clipping plane.
38/// \param far Distance to the far clipping plane. 38/// \param far Distance to the far clipping plane.
39static inline Camera camera_perspective(R fovy, R aspect, R near, R far) { 39static inline Camera camera_perspective(R fovy, R aspect, R near, R far) {
40 return (Camera){.spatial = spatial3_make(), 40 return (Camera){
41 .projection = mat4_perspective(fovy, aspect, near, far)}; 41 .spatial = spatial3_make(),
42 .projection = mat4_perspective(fovy, aspect, near, far)};
42} 43}