Files
BeyondDepth/src/engine/renderer/camera/camera.h
Natsirt867 65e7d1b401 feat: establish stable OpenGL 3.3 core graphics conxtext
initializes the full graphics context pipeline required for modern OpenGL rendering
2025-10-17 12:40:25 -05:00

41 lines
1.0 KiB
C

//
// Created by Tristan on 10/16/2025.
//
#ifndef CAMERA_H
#define CAMERA_H
#include <SDL3/SDL.h>
#include <cglm/cglm.h>
#include "../shaders/shader.h"
typedef struct {
vec3 Position;
vec3 Orientation;
vec3 Up;
float speed;
float sensitivity;
float FOV_deg;
int width;
int height;
mat4 View; // cache for the calculated View Matrix
} Camera;
// initializer
void camera_init(Camera *self, vec3 initial_position, int width, int height);
/* --- Matrix calculation functions --- */
// Updates self->View matrix based on pos, orientation and up
void camera_update_view_matrix(Camera *self);
// calculates the projection matrix for a given set of planes
void camera_update_projection(Camera *self, float nearPlane, float forPlane, mat4 dest);
// generates (projection * view) and uploads to the shader program
void camera_matrix_to_shader(Camera *self, GLuint shader_program_ID, const char *uniform_name);
// TODO: Input handling (needs full SDL context later)
void camera_inputs(Camera *self, SDL_Event *event);
#endif //CAMERA_H