Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
Public Member Functions | Private Member Functions | Private Attributes
Fling::FirstPersonCamera Class Reference

A simple first person camera. More...

#include <FirstPersonCamera.h>

Inherits Fling::Camera.

Public Member Functions

 FirstPersonCamera (float aspectRatio, float t_MoveSpeed=10.0f, float t_RotSpeed=40.f)
 
 FirstPersonCamera (glm::vec3 position, glm::vec3 rotation, float speed, float aspectRatio)
 
 FirstPersonCamera (glm::vec3 front, glm::vec3 up, glm::vec3 position, glm::vec3 rotation, float speed, float nearPlane, float farPlane, float fov, float aspectRatio)
 
void Update (float dt) override
 
float GetRotationSpeed () const
 
void SetRotationSpeed (float t_NewSpeed)
 
bool IsRotating () const
 
- Public Member Functions inherited from Fling::Camera
 Camera ()
 
virtual ~Camera ()=default
 
const float GetNearPlane () const
 Gets the near plane of the view frustrum. More...
 
void SetNearPlane (const float &nearPlane)
 
const float GetFarPlane () const
 Gets the far plane of the view frustrum. More...
 
void SetFarPlane (const float &farPlane)
 
const float GetFieldOfView () const
 Gets the field of view angle from the view frustrum. More...
 
void SetFieldOfView (const float &fieldOfView)
 
const glm::vec3 & GetPosition () const
 
const glm::vec3 & GetRotation () const
 
const float GetSpeed () const
 
const float GetAspectRatio () const
 
const glm::mat4 & GetViewMatrix () const
 Gets the view matrix created by the current camera position and rotation. More...
 
const glm::mat4 & GetProjectionMatrix () const
 Gets the projection matrix used by camera. More...
 

Private Member Functions

void UpdateViewMatrix ()
 
void UpdateProjectionMatrix ()
 
void UpdateCameraVectors ()
 

Private Attributes

glm::vec3 m_front
 
glm::vec3 m_up
 
glm::vec3 m_right
 
glm::vec3 m_worldUp
 
float m_RotationSpeed = 20.0f
 
bool m_IsRotating = false
 
MousePos m_PrevMousePos
 

Additional Inherited Members

- Protected Attributes inherited from Fling::Camera
glm::mat4 m_viewMatrix
 
glm::mat4 m_projectionMatrix
 
glm::vec3 m_position
 
float m_speed
 
glm::vec3 m_rotation
 
float m_aspectRatio
 
float m_nearPlane
 
float m_farPlane
 
float m_fieldOfView
 

Detailed Description

A simple first person camera.

Moves with WASD and rotates with right click + drag

Constructor & Destructor Documentation

◆ FirstPersonCamera() [1/3]

Fling::FirstPersonCamera::FirstPersonCamera ( float  aspectRatio,
float  t_MoveSpeed = 10.0f,
float  t_RotSpeed = 40.f 
)

◆ FirstPersonCamera() [2/3]

Fling::FirstPersonCamera::FirstPersonCamera ( glm::vec3  position,
glm::vec3  rotation,
float  speed,
float  aspectRatio 
)

◆ FirstPersonCamera() [3/3]

Fling::FirstPersonCamera::FirstPersonCamera ( glm::vec3  front,
glm::vec3  up,
glm::vec3  position,
glm::vec3  rotation,
float  speed,
float  nearPlane,
float  farPlane,
float  fov,
float  aspectRatio 
)

Member Function Documentation

◆ GetRotationSpeed()

float Fling::FirstPersonCamera::GetRotationSpeed ( ) const
inline

◆ IsRotating()

bool Fling::FirstPersonCamera::IsRotating ( ) const
inline

◆ SetRotationSpeed()

void Fling::FirstPersonCamera::SetRotationSpeed ( float  t_NewSpeed)
inline

◆ Update()

void Fling::FirstPersonCamera::Update ( float  dt)
overridevirtual

Implements Fling::Camera.

◆ UpdateCameraVectors()

void Fling::FirstPersonCamera::UpdateCameraVectors ( )
private

◆ UpdateProjectionMatrix()

void Fling::FirstPersonCamera::UpdateProjectionMatrix ( )
private

◆ UpdateViewMatrix()

void Fling::FirstPersonCamera::UpdateViewMatrix ( )
private

Field Documentation

◆ m_front

glm::vec3 Fling::FirstPersonCamera::m_front
private

◆ m_IsRotating

bool Fling::FirstPersonCamera::m_IsRotating = false
private

◆ m_PrevMousePos

MousePos Fling::FirstPersonCamera::m_PrevMousePos
private

◆ m_right

glm::vec3 Fling::FirstPersonCamera::m_right
private

◆ m_RotationSpeed

float Fling::FirstPersonCamera::m_RotationSpeed = 20.0f
private

◆ m_up

glm::vec3 Fling::FirstPersonCamera::m_up
private

◆ m_worldUp

glm::vec3 Fling::FirstPersonCamera::m_worldUp
private

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