// This file is part of the 64k demo project. // It defines the Camera class for 3D navigation and rendering. // Handles view and projection matrix generation. #pragma once #include "util/mini_math.h" class Camera { public: vec3 position; vec3 target; vec3 up; float fov_y_rad; float aspect_ratio; float near_plane; float far_plane; Camera() : position(0, 0, 5), target(0, 0, 0), up(0, 1, 0), fov_y_rad(0.785398f), aspect_ratio(1.777f), near_plane(0.1f), far_plane(100.0f) { } mat4 get_view_matrix() const { return mat4::look_at(position, target, up); } mat4 get_projection_matrix() const { return mat4::perspective(fov_y_rad, aspect_ratio, near_plane, far_plane); } // Helper to move camera void set_look_at(vec3 pos, vec3 tgt, vec3 up_vec = vec3(0, 1, 0)) { position = pos; target = tgt; up = up_vec; } };