HPC_Voxel_Engine 0.2.0
High-Performance C++ Voxel Engine
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Core::Camera Class Reference

Processes input and calculates the View Matrix for OpenGL rendering. More...

#include <src/core/camera.h>

Collaboration diagram for Core::Camera:
Collaboration graph

Public Member Functions

 Camera (Vec3 startPos=Vec3(0.0f, 0.0f, 0.0f), Vec3 startUP=Vec3(0.0f, 1.0f, 0.0f))
 Constructs the camera at a specific position.
 
Mat4 GetViewMatrix ()
 Calculates the LookAt View Matrix.
 
void ProcessKeyboard (int iDirection, float fDeltaTime)
 Moves the camera based on keyboard input direction.
 
void ProcessMouseMovement (float fXOffset, float fYOffset, bool bConstrainPitch=true)
 Rotates the camera based on mouse movement.
 
void ProcessMousePan (float fXOffset, float fYOffset)
 Pans the camera (Editor style movement).
 
void ProcessMouseScroll (float fYOffset)
 Zooms (changes FOV) based on scroll wheel.
 
Vec3 GetUp () const
 
Vec3 GetFront () const
 
Vec3 GetRight () const
 
Vec3 GetCameraPosition () const
 
float GetZoom () const
 
void SetCameraPosition (const Vec3 &position)
 
void SetCameraFront (const Vec3 &front)
 
void SetCameraZoom (float zoom)
 
void SetCameraYawPitch (float yaw, float pitch)
 
void UpdateCameraVectors ()
 Recalculates Front, Right, and Up vectors from Euler angles.
 

Private Attributes

Vec3 m_objPtPosition
 
Vec3 m_objVecFront
 
Vec3 m_objVecUp
 
Vec3 m_objVecRight
 
Vec3 m_objWorldUp
 
float m_fYaw = YAW
 
float m_fPitch = PITCH
 
float m_fZoom = ZOOM
 
float m_fSpeed = SPEED
 
float m_fSensitivity = SENSITIVITY
 

Detailed Description

Processes input and calculates the View Matrix for OpenGL rendering.

Constructor & Destructor Documentation

◆ Camera()

Core::Camera::Camera ( Vec3  startPos = Vec3(0.0f, 0.0f, 0.0f),
Vec3  startUP = Vec3(0.0f, 1.0f, 0.0f) 
)
inline

Constructs the camera at a specific position.

Parameters
startPosInitial world space position.
startUPWorld's "Up" direction (usually 0,1,0).
Here is the call graph for this function:

Member Function Documentation

◆ GetCameraPosition()

Vec3 Core::Camera::GetCameraPosition ( ) const
inline
Here is the caller graph for this function:

◆ GetFront()

Vec3 Core::Camera::GetFront ( ) const
inline
Here is the caller graph for this function:

◆ GetRight()

Vec3 Core::Camera::GetRight ( ) const
inline
Here is the caller graph for this function:

◆ GetUp()

Vec3 Core::Camera::GetUp ( ) const
inline
Here is the caller graph for this function:

◆ GetViewMatrix()

Mat4 Core::Camera::GetViewMatrix ( )
inline

Calculates the LookAt View Matrix.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetZoom()

float Core::Camera::GetZoom ( ) const
inline

◆ ProcessKeyboard()

void Core::Camera::ProcessKeyboard ( int  iDirection,
float  fDeltaTime 
)
inline

Moves the camera based on keyboard input direction.

Parameters
iDirectionEnum/Int representing direction (0=Fwd, 1=Back, 2=Left, 3=Right, 4=Up, 5=Down).
fDeltaTimeTime elapsed per frame.

◆ ProcessMouseMovement()

void Core::Camera::ProcessMouseMovement ( float  fXOffset,
float  fYOffset,
bool  bConstrainPitch = true 
)
inline

Rotates the camera based on mouse movement.

Parameters
fXOffsetMouse X delta.
fYOffsetMouse Y delta.
bConstrainPitchIf true, prevents camera from flipping upside down.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessMousePan()

void Core::Camera::ProcessMousePan ( float  fXOffset,
float  fYOffset 
)
inline

Pans the camera (Editor style movement).

◆ ProcessMouseScroll()

void Core::Camera::ProcessMouseScroll ( float  fYOffset)
inline

Zooms (changes FOV) based on scroll wheel.

◆ SetCameraFront()

void Core::Camera::SetCameraFront ( const Vec3 front)
inline
Here is the call graph for this function:

◆ SetCameraPosition()

void Core::Camera::SetCameraPosition ( const Vec3 position)
inline
Here is the caller graph for this function:

◆ SetCameraYawPitch()

void Core::Camera::SetCameraYawPitch ( float  yaw,
float  pitch 
)
inline
Here is the call graph for this function:

◆ SetCameraZoom()

void Core::Camera::SetCameraZoom ( float  zoom)
inline

◆ UpdateCameraVectors()

void Core::Camera::UpdateCameraVectors ( )
inline

Recalculates Front, Right, and Up vectors from Euler angles.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_fPitch

float Core::Camera::m_fPitch = PITCH
private

◆ m_fSensitivity

float Core::Camera::m_fSensitivity = SENSITIVITY
private

◆ m_fSpeed

float Core::Camera::m_fSpeed = SPEED
private

◆ m_fYaw

float Core::Camera::m_fYaw = YAW
private

◆ m_fZoom

float Core::Camera::m_fZoom = ZOOM
private

◆ m_objPtPosition

Vec3 Core::Camera::m_objPtPosition
private

◆ m_objVecFront

Vec3 Core::Camera::m_objVecFront
private

◆ m_objVecRight

Vec3 Core::Camera::m_objVecRight
private

◆ m_objVecUp

Vec3 Core::Camera::m_objVecUp
private

◆ m_objWorldUp

Vec3 Core::Camera::m_objWorldUp
private

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