Kohi Game Engine
camera.h
Go to the documentation of this file.
1 
12 #pragma once
13 
14 #include "math/math_types.h"
15 
21 typedef struct camera {
36 
44 
54 
62 
70 
77 KAPI void camera_position_set(camera* c, vec3 position);
78 
86 
94 
103 
111 
119 
127 
135 
143 
151 
159 
166 KAPI void camera_move_left(camera* c, f32 amount);
167 
174 KAPI void camera_move_right(camera* c, f32 amount);
175 
182 KAPI void camera_move_up(camera* c, f32 amount);
183 
190 KAPI void camera_move_down(camera* c, f32 amount);
191 
198 KAPI void camera_yaw(camera* c, f32 amount);
199 
206 KAPI void camera_pitch(camera* c, f32 amount);
KAPI mat4 camera_view_get(camera *c)
Obtains a copy of the camera's view matrix. If camera is dirty, a new one is created,...
KAPI vec3 camera_left(camera *c)
Returns a copy of the camera's left vector.
KAPI void camera_position_set(camera *c, vec3 position)
Sets the provided camera's position.
KAPI void camera_reset(camera *c)
Defaults the provided camera to default zero rotation and position, and view matrix to identity.
KAPI camera camera_create(void)
Creates a new camera with default zero position and rotation, and view identity matrix....
KAPI vec3 camera_position_get(const camera *c)
Gets a copy of the camera's position.
KAPI vec3 camera_rotation_euler_get(const camera *c)
Gets a copy of the camera's rotation in Euler angles.
KAPI void camera_move_down(camera *c, f32 amount)
Moves the camera down (straight along the y-axis) by the given amount.
KAPI void camera_move_left(camera *c, f32 amount)
Moves the camera left by the given amount.
KAPI vec3 camera_forward(camera *c)
Returns a copy of the camera's forward vector.
KAPI vec3 camera_right(camera *c)
Returns a copy of the camera's right vector.
KAPI void camera_move_up(camera *c, f32 amount)
Moves the camera up (straight along the y-axis) by the given amount.
KAPI vec3 camera_up(camera *c)
Returns a copy of the camera's up vector.
KAPI void camera_move_backward(camera *c, f32 amount)
Moves the camera backward by the given amount.
KAPI vec3 camera_backward(camera *c)
Returns a copy of the camera's backward vector.
KAPI void camera_rotation_euler_set(camera *c, vec3 rotation)
Sets the provided camera's rotation in Euler angles.
KAPI void camera_yaw(camera *c, f32 amount)
Adjusts the camera's yaw by the given amount.
KAPI void camera_pitch(camera *c, f32 amount)
Adjusts the camera's pitch by the given amount.
struct camera camera
Represents a camera that can be used for a variety of things, especially rendering....
KAPI void camera_move_forward(camera *c, f32 amount)
Moves the camera forward by the given amount.
KAPI void camera_move_right(camera *c, f32 amount)
Moves the camera right by the given amount.
#define KAPI
Import/export qualifier.
Definition: defines.h:177
_Bool b8
8-bit boolean type
Definition: defines.h:58
float f32
32-bit floating point number
Definition: defines.h:47
Contains various math types required for the engine.
Represents a camera that can be used for a variety of things, especially rendering....
Definition: camera.h:21
vec3 position
The position of this camera. NOTE: Do not set this directly, use camera_positon_set() instead so the ...
Definition: camera.h:27
mat4 view_matrix
The view matrix of this camera. NOTE: IMPORTANT: Do not get this directly, use camera_view_get() inst...
Definition: camera.h:42
b8 is_dirty
Internal flag used to determine when the view matrix needs to be rebuilt.
Definition: camera.h:35
vec3 euler_rotation
The rotation of this camera using Euler angles (pitch, yaw, roll). NOTE: Do not set this directly,...
Definition: camera.h:33
a 4x4 matrix, typically used to represent object transformations.
Definition: math_types.h:147
A 3-element vector.
Definition: math_types.h:49