group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
NewCamera Class Reference

Camera for the new renderer, combining view and projection into one matrix. More...

#include <Camera.hpp>

Public Member Functions

 NewCamera ()
 Construct a NewCamera with default perspective and position.
void setAspect (float width, float height)
 Set the aspect ratio from pixel dimensions (modifies projection matrix).
void setFov (float fovyDegrees)
 Set the vertical field of view in degrees.
void setZNear (float zNear)
 Set the near clip plane distance.
void setZFar (float zFar)
 Set the far clip plane distance.
void setEye (glm::vec3 eye)
 Set the camera eye position in world space (modifies view matrix).
void setTarget (float pitch, float yaw, float roll)
 Set the view direction from pitch, yaw, and roll (all in radians).
void setUp (glm::vec3 up)
 Explicitly set the camera up direction, overriding setTarget's up vector.
void computeViewProjectionMatrix ()
 Recompute the combined view-projection matrix from current parameters.
glm::mat4 getViewProjectionMatrix () const
 Return the combined view-projection matrix.
glm::mat4 getViewMatrix () const
glm::mat4 getProjectionMatrix () const
glm::mat4 getViewProjection () const
 Alias for getViewProjectionMatrix() — kept short for callsite ergonomics.
const glm::vec3 & getEye () const
glm::vec3 getForward () const
glm::vec3 getRight () const
const glm::vec3 & getUp () const

Private Attributes

glm::vec3 eye_ {0.0f, 0.0f, 3.0f}
glm::vec3 target_ {0.0f, 0.0f, 0.0f}
glm::vec3 up_ {0.0f, 1.0f, 0.0f}
float fovy_ = glm::radians(60.0f)
float aspect_ = 1.0f
float zNear_ = 5.0f
 Near clip (Quake units); 5 ≈ half a foot.
float zFar_ = 15000.0f
 Far clip; covers the 4 000-unit play area with margin.
glm::mat4 view_ {1.0f}
glm::mat4 projection_ {1.0f}
glm::mat4 view_projection_ {1.0f}

Detailed Description

Camera for the new renderer, combining view and projection into one matrix.

Constructor & Destructor Documentation

◆ NewCamera()

NewCamera::NewCamera ( )

Construct a NewCamera with default perspective and position.

Here is the call graph for this function:

Member Function Documentation

◆ computeViewProjectionMatrix()

void NewCamera::computeViewProjectionMatrix ( )

Recompute the combined view-projection matrix from current parameters.

Here is the caller graph for this function:

◆ getEye()

const glm::vec3 & NewCamera::getEye ( ) const
inlinenodiscard
Here is the caller graph for this function:

◆ getForward()

glm::vec3 NewCamera::getForward ( ) const
nodiscard
Here is the caller graph for this function:

◆ getProjectionMatrix()

glm::mat4 NewCamera::getProjectionMatrix ( ) const
inlinenodiscard

◆ getRight()

glm::vec3 NewCamera::getRight ( ) const
nodiscard
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getUp()

const glm::vec3 & NewCamera::getUp ( ) const
inlinenodiscard
Here is the caller graph for this function:

◆ getViewMatrix()

glm::mat4 NewCamera::getViewMatrix ( ) const
inlinenodiscard

◆ getViewProjection()

glm::mat4 NewCamera::getViewProjection ( ) const
inlinenodiscard

Alias for getViewProjectionMatrix() — kept short for callsite ergonomics.

◆ getViewProjectionMatrix()

glm::mat4 NewCamera::getViewProjectionMatrix ( ) const
inlinenodiscard

Return the combined view-projection matrix.

◆ setAspect()

void NewCamera::setAspect ( float width,
float height )

Set the aspect ratio from pixel dimensions (modifies projection matrix).

Parameters
widthViewport width in pixels.
heightViewport height in pixels.

◆ setEye()

void NewCamera::setEye ( glm::vec3 eye)

Set the camera eye position in world space (modifies view matrix).

Parameters
eyeWorld-space position.

◆ setFov()

void NewCamera::setFov ( float fovyDegrees)

Set the vertical field of view in degrees.

Parameters
fovyDegreesVertical FOV in degrees.

◆ setTarget()

void NewCamera::setTarget ( float pitch,
float yaw,
float roll )

Set the view direction from pitch, yaw, and roll (all in radians).

Roll rotates the up vector around the forward axis, used for camera tilt during wallruns.

Parameters
pitchPitch angle in radians.
yawYaw angle in radians.
rollRoll angle in radians.

◆ setUp()

void NewCamera::setUp ( glm::vec3 up)

Explicitly set the camera up direction, overriding setTarget's up vector.

Parameters
upThe desired up direction.

◆ setZFar()

void NewCamera::setZFar ( float zFar)

Set the far clip plane distance.

Parameters
zFarFar clip distance.

◆ setZNear()

void NewCamera::setZNear ( float zNear)

Set the near clip plane distance.

Parameters
zNearNear clip distance.

Member Data Documentation

◆ aspect_

float NewCamera::aspect_ = 1.0f
private

◆ eye_

glm::vec3 NewCamera::eye_ {0.0f, 0.0f, 3.0f}
private

◆ fovy_

float NewCamera::fovy_ = glm::radians(60.0f)
private

◆ projection_

glm::mat4 NewCamera::projection_ {1.0f}
private

◆ target_

glm::vec3 NewCamera::target_ {0.0f, 0.0f, 0.0f}
private

◆ up_

glm::vec3 NewCamera::up_ {0.0f, 1.0f, 0.0f}
private

◆ view_

glm::mat4 NewCamera::view_ {1.0f}
private

◆ view_projection_

glm::mat4 NewCamera::view_projection_ {1.0f}
private

◆ zFar_

float NewCamera::zFar_ = 15000.0f
private

Far clip; covers the 4 000-unit play area with margin.

◆ zNear_

float NewCamera::zNear_ = 5.0f
private

Near clip (Quake units); 5 ≈ half a foot.


The documentation for this class was generated from the following files: