Wrath of Zeus
Made by Torchlight Games for CSE 125 SP24
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes
Camera Class Reference

Class representing a camera for rendering. Primarily used to compute the view-projection matrix and pass it to the Client for rendering objects from different viewing angles. More...

#include <camera.hpp>

Inheritance diagram for Camera:
DungeonMasterCamera

Public Member Functions

 Camera ()
 Constructs a new Camera object. More...
 
 ~Camera ()
 Destroys the Camera object. More...
 
void setAspect (float a)
 Sets the aspect ratio of the camera. More...
 
virtual void update (float xpos, float ypos)
 Updates the the camera based on the input screen coordinates. More...
 
glm::vec3 move (bool is_x_axis, float dir)
 Moves the camera based on the axis, direction, and speed. Factors in the current direction of the camera to compute proper lateral and forward movement. More...
 
glm::mat4 getViewProj ()
 Returns the view-projection matrix of the Camera, for use in rendering. More...
 
glm::vec3 getFacing ()
 Returns a normalized vector representing the direction that the camera is facing. More...
 
void updatePos (glm::vec3 pos)
 Updates the position of the camera. More...
 
glm::vec3 getPos ()
 
glm::mat4 getProjection ()
 
glm::mat4 getView ()
 
void setPitch (float pitch)
 

Protected Attributes

float FOV
 
float aspect
 
float nearClip
 
float farClip
 
float yaw
 
float pitch
 
float lastX
 
float lastY
 
float fov
 
bool firstMouse
 
float sensitivity
 
glm::vec3 cameraPos
 
glm::vec3 cameraFront
 
glm::vec3 cameraUp
 
glm::vec3 cameraRight
 
glm::vec3 worldUp
 
float speed
 
glm::mat4 viewProjMat
 
glm::mat4 projection
 
glm::mat4 view
 

Detailed Description

Class representing a camera for rendering. Primarily used to compute the view-projection matrix and pass it to the Client for rendering objects from different viewing angles.

Constructor & Destructor Documentation

◆ Camera()

Camera::Camera ( )

Constructs a new Camera object.

◆ ~Camera()

Camera::~Camera ( )

Destroys the Camera object.

Member Function Documentation

◆ getFacing()

glm::vec3 Camera::getFacing ( )
inline

Returns a normalized vector representing the direction that the camera is facing.

Returns
glm::vec3 A normalized vector representing the direction the camera is facing.

◆ getPos()

glm::vec3 Camera::getPos ( )

◆ getProjection()

glm::mat4 Camera::getProjection ( )

◆ getView()

glm::mat4 Camera::getView ( )

◆ getViewProj()

glm::mat4 Camera::getViewProj ( )
inline

Returns the view-projection matrix of the Camera, for use in rendering.

Returns
glm::mat4 The view-projection matrix.

◆ move()

glm::vec3 Camera::move ( bool  is_x_axis,
float  dir 
)

Moves the camera based on the axis, direction, and speed. Factors in the current direction of the camera to compute proper lateral and forward movement.

Parameters
is_x_axisA flag denoting whether the movement is along the x-axis or z-axis.
dirThe direction that the camera is moving in.
Returns
glm::vec3 An output vector representing the movement of the camera in the specified axis and direction.

◆ setAspect()

void Camera::setAspect ( float  a)
inline

Sets the aspect ratio of the camera.

Parameters
aThe new aspect ratio.

◆ setPitch()

void Camera::setPitch ( float  pitch)

◆ update()

void Camera::update ( float  xpos,
float  ypos 
)
virtual

Updates the the camera based on the input screen coordinates.

Parameters
xposNew x-coordinate for the cursor.
yposNew y-coordinate for the cursor.

Reimplemented in DungeonMasterCamera.

◆ updatePos()

void Camera::updatePos ( glm::vec3  pos)

Updates the position of the camera.

Parameters
posThe new position of the camera.

Field Documentation

◆ aspect

float Camera::aspect
protected

◆ cameraFront

glm::vec3 Camera::cameraFront
protected

◆ cameraPos

glm::vec3 Camera::cameraPos
protected

◆ cameraRight

glm::vec3 Camera::cameraRight
protected

◆ cameraUp

glm::vec3 Camera::cameraUp
protected

◆ farClip

float Camera::farClip
protected

◆ firstMouse

bool Camera::firstMouse
protected

◆ FOV

float Camera::FOV
protected

◆ fov

float Camera::fov
protected

◆ lastX

float Camera::lastX
protected

◆ lastY

float Camera::lastY
protected

◆ nearClip

float Camera::nearClip
protected

◆ pitch

float Camera::pitch
protected

◆ projection

glm::mat4 Camera::projection
protected

◆ sensitivity

float Camera::sensitivity
protected

◆ speed

float Camera::speed
protected

◆ view

glm::mat4 Camera::view
protected

◆ viewProjMat

glm::mat4 Camera::viewProjMat
protected

◆ worldUp

glm::vec3 Camera::worldUp
protected

◆ yaw

float Camera::yaw
protected

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