Files
Vibe-HD-2D/engine/include/hd2d/Camera.h
Gabrieal Jimmy 2c99305fb0 init
2026-10-02 12:42:00 -05:00

25 lines
799 B
C++

#pragma once
#include <glm/glm.hpp>
namespace hd2d {
// Orbit camera looking at `target`. HD-2D scenes use a high, narrow-FOV
// (near telephoto) camera tilted down so the world reads like a diorama.
struct Camera {
glm::vec3 target{0.0f};
float yaw = 0.0f; // radians; 0 looks toward -Z
float pitch = 0.56f; // radians below horizon
float distance = 17.0f;
float fovY = 0.52f; // radians (~30 deg)
float nearPlane = 0.5f;
float farPlane = 250.0f;
glm::vec3 forward() const; // unit vector camera -> target
glm::vec3 position() const { return target - forward() * distance; }
glm::vec3 right() const; // horizontal right vector
glm::mat4 view() const;
glm::mat4 projection(float aspect) const;
};
} // namespace hd2d