57 lines
1.1 KiB
C
57 lines
1.1 KiB
C
#ifndef CAMERA_H
|
|
#define CAMERA_H
|
|
|
|
#include "utils.h"
|
|
|
|
#include <stdbool.h>
|
|
#include "chunk.h"
|
|
|
|
#define GRAVITY 4
|
|
/**
|
|
* Camera, as a moving point with direction
|
|
*/
|
|
typedef struct Camera
|
|
{
|
|
vec3f position;
|
|
vec3f rotation;
|
|
vec3f speed;
|
|
ChunkManager *cm;
|
|
} Camera;
|
|
|
|
/**
|
|
* Initialize the camera to the start position.
|
|
*/
|
|
void init_camera(Camera* camera);
|
|
|
|
/**
|
|
* Update the position of the camera.
|
|
*/
|
|
void update_camera(Camera* camera, double time);
|
|
|
|
/**
|
|
* Apply the camera settings to the view transformation.
|
|
*/
|
|
void set_view(const Camera* camera);
|
|
void set_view_fix(const Camera* camera);
|
|
|
|
/**
|
|
* Set the horizontal and vertical rotation of the view angle.
|
|
*/
|
|
void rotate_camera(Camera* camera, double horizontal, double vertical);
|
|
|
|
/**
|
|
* Set the speed of forward and backward motion.
|
|
*/
|
|
void camera_set_speed(Camera* camera, double speed);
|
|
|
|
void camera_set_vertical_speed(Camera* camera, double speed);
|
|
|
|
/**
|
|
* Set the speed of left and right side steps.
|
|
*/
|
|
void camera_set_side_speed(Camera* camera, double speed);
|
|
|
|
vec3f get_camera_dir_vec3f(Camera* camera);
|
|
|
|
#endif /* CAMERA_H */
|