Nimbin2git.christianimmanuel.de / Games / strichmaennchen / camera.h

strichmaennchen git · main

git clone https://git.christianimmanuel.de/games/strichmaennchen.gitwget https://git.christianimmanuel.de/games/strichmaennchen/archive/strichmaennchen.tar.gz
camera.h 726 B · 35 lines raw
#ifndef CAMERA_H
#define CAMERA_H
#include "linalg.h"
#include "input.h"


typedef struct Human Human;
typedef struct Renderer Renderer;


typedef struct {
    Vec3 position;
    Vec3 front;
    Vec3 up;
    Vec3 right;   // add this for consistency
    Vec3 world_up;

    Mat4 projection;
    Mat4 view;

    float yaw;
    float pitch;
    float fov;
} Camera;


void Camera_init(Camera* cam, Vec3 pos, float yaw, float pitch, float fov);

void Camera_update(Camera* cam, Renderer* renderer);
void Camera_rotate(Camera* cam, float yaw_delta, float pitch_delta);
void Camera_move(Camera* cam, Userinput* input, float dt);
void Camera_followPlayer(Camera *cam, Human *player);
Mat4 Camera_getViewMatrix(Camera* cam);

#endif