18 void setAspect(
float width,
float height);
21 void setFov(
float fovyDegrees);
31 void setEye(glm::vec3 eye);
37 void setTarget(
float pitch,
float yaw,
float roll);
41 void setUp(glm::vec3 up);
51 [[nodiscard]]
const glm::vec3&
getEye()
const {
return eye_; }
53 [[nodiscard]]
const glm::vec3
getRight()
const;
55 [[nodiscard]]
const glm::vec3
getForward()
const;
56 [[nodiscard]]
const glm::vec3&
getUp()
const {
return up_; }
64 [[nodiscard]]
float getFovy()
const {
return glm::degrees(
fovy_); }
83 glm::vec3
eye_{0.0f, 0.0f, 3.0f};
85 glm::vec3
up_{0.0f, 1.0f, 0.0f};
88 float fovy_ = glm::radians(60.0f);
Camera()
Construct with default eye position, 60 degree FOV, and Quake-unit near/far.
Definition Camera.cpp:10
void setUp(glm::vec3 up)
Override the up direction explicitly.
Definition Camera.cpp:72
void computeViewMatrix()
Recompute the view matrix from current eye, target, and up.
Definition Camera.cpp:78
glm::mat4 projection_
Definition Camera.hpp:94
glm::mat4 getViewProjection() const
Return the combined view-projection matrix.
Definition Camera.hpp:58
glm::vec3 up_
Definition Camera.hpp:85
const glm::vec3 getRight() const
Return the camera right vector (normalized cross of forward and up).
Definition Camera.cpp:100
float zNear_
Near clip (Quake units); 5 ≈ half a foot.
Definition Camera.hpp:90
float aspect_
Definition Camera.hpp:89
const glm::vec3 & getUp() const
Definition Camera.hpp:56
glm::mat4 view_
Definition Camera.hpp:93
void setZNear(float zNear)
Set the near clip plane distance (Quake units) and recompute projection.
Definition Camera.cpp:28
float zFar_
Far clip; covers the 4 000-unit play area with margin.
Definition Camera.hpp:91
float getFar() const
Return the far clip plane distance.
Definition Camera.hpp:70
glm::vec3 target_
Definition Camera.hpp:84
void setAspect(float width, float height)
Update aspect ratio from viewport dimensions and recompute projection.
Definition Camera.cpp:16
glm::vec3 eye_
Definition Camera.hpp:83
void applySubpixelJitter(float jitterX, float jitterY)
Apply a sub-pixel jitter offset to the projection matrix.
Definition Camera.cpp:89
void setTarget(float pitch, float yaw, float roll)
Set view direction from pitch, yaw, and roll (all radians).
Definition Camera.cpp:46
const glm::mat4 & getProjectionMatrix() const
Definition Camera.hpp:50
void setEye(glm::vec3 eye)
Set camera world-space position and recompute view matrix.
Definition Camera.cpp:40
void setZFar(float zFar)
Set the far clip plane distance (Quake units) and recompute projection.
Definition Camera.cpp:34
void setFov(float fovyDegrees)
Set vertical field of view in degrees and recompute projection.
Definition Camera.cpp:22
const glm::mat4 & getViewMatrix() const
Definition Camera.hpp:49
void computeProjectionMatrix()
Recompute the projection matrix from current FOV, aspect, near, far.
Definition Camera.cpp:83
float getNear() const
Return the near clip plane distance.
Definition Camera.hpp:68
const glm::vec3 getForward() const
Return the camera forward vector (normalized target - eye).
Definition Camera.cpp:95
float getFovy() const
Return the vertical field of view in degrees.
Definition Camera.hpp:64
const glm::vec3 & getEye() const
Definition Camera.hpp:51
float fovy_
Definition Camera.hpp:88
float getAspect() const
Return the aspect ratio (width / height).
Definition Camera.hpp:66