Loading...
Searching...
No Matches
hellfire::CameraComponent Class Reference

#include <CameraComponent.h>

Inheritance diagram for hellfire::CameraComponent:
Collaboration diagram for hellfire::CameraComponent:

Public Member Functions

 CameraComponent (CameraType type=CameraType::PERSPECTIVE)
 
CameraType get_camera_type () const
 
void set_camera_type (CameraType type)
 
void set_perspective (float fov, float aspect, float near_plane, float far_plane)
 
void set_orthographic (float left, float right, float bottom, float top, float near_plane, float far_plane)
 
glm::mat4 get_view_matrix () const
 
glm::mat4 get_projection_matrix () const
 
void set_fov (float fov)
 
float get_fov () const
 
void set_aspect_ratio (float aspect)
 
float get_aspect_ratio () const
 
void set_clip_planes (float near_plane, float far_plane)
 
float get_near_plane () const
 
float get_far_plane () const
 
void set_yaw (float yaw)
 
void set_pitch (float pitch)
 
float get_yaw () const
 
float get_pitch () const
 
void set_mouse_sensitivity (float sensitivity)
 
float get_mouse_sensitivity () const
 
glm::vec3 get_front_vector () const
 
glm::vec3 get_up_vector () const
 
glm::vec3 get_right_vector () const
 
void look_at (const glm::vec3 &target)
 
void set_target (const glm::vec3 &target)
 
glm::vec3 get_target () const
 
void invalidate_view () const
 
- Public Member Functions inherited from hellfire::Component
virtual ~Component ()=default
 
Entityget_owner () const
 
virtual void on_added (Entity *owner)
 
virtual void on_removed ()
 

Static Public Member Functions

static CameraComponentcreate_perspective (float fov=45.0f, float aspect=16.0f/9.0f, float near_plane=0.1f, float far_plane=100.0f)
 
static CameraComponentcreate_orthographic (float size=10.0f, float aspect=16.0f/9.0f, float near_plane=0.1f, float far_plane=100.0f)
 

Private Member Functions

void update_camera_vectors ()
 
void update_view_matrix () const
 
void update_projection_matrix () const
 
void update_orthographic_bounds ()
 

Private Attributes

CameraType camera_type_ = CameraType::PERSPECTIVE
 
float fov_ = 45.0f
 
float aspect_ratio_ = 16.0f / 9.0f
 
float near_plane_ = 0.1f
 
float far_plane_ = 100.0f
 
float ortho_size_ = 10.0f
 
float ortho_left_ = -10.0f
 
float ortho_right_ = 10.0f
 
float ortho_bottom_ = -10.0f
 
float ortho_top_ = 10.0f
 
glm::vec3 front_ = glm::vec3(0.0f, 0.0f, -1.0f)
 
glm::vec3 up_ = glm::vec3(0.0f, 1.0f, 0.0f)
 
glm::vec3 right_ = glm::vec3(1.0f, 0.0f, 0.0f)
 
glm::vec3 world_up_ = glm::vec3(0.0f, 1.0f, 0.0f)
 
glm::vec3 target_ = glm::vec3(0.0f)
 
CameraData camera_data_
 
glm::mat4 view_matrix_ = glm::mat4(1.0f)
 
glm::mat4 projection_matrix_ = glm::mat4(1.0f)
 
bool view_dirty_ = true
 
bool projection_dirty_ = true
 

Detailed Description

Definition at line 22 of file CameraComponent.h.

Constructor & Destructor Documentation

◆ CameraComponent()

hellfire::CameraComponent::CameraComponent ( CameraType  type = CameraType::PERSPECTIVE)

Definition at line 10 of file CameraComponent.cpp.

Member Function Documentation

◆ create_orthographic()

CameraComponent * hellfire::CameraComponent::create_orthographic ( float  size = 10.0f,
float  aspect = 16.0f/9.0f,
float  near_plane = 0.1f,
float  far_plane = 100.0f 
)
static

Definition at line 114 of file CameraComponent.cpp.

◆ create_perspective()

CameraComponent * hellfire::CameraComponent::create_perspective ( float  fov = 45.0f,
float  aspect = 16.0f/9.0f,
float  near_plane = 0.1f,
float  far_plane = 100.0f 
)
static

Definition at line 108 of file CameraComponent.cpp.

◆ get_aspect_ratio()

float hellfire::CameraComponent::get_aspect_ratio ( ) const
inline

Definition at line 49 of file CameraComponent.h.

◆ get_camera_type()

CameraType hellfire::CameraComponent::get_camera_type ( ) const
inline

Definition at line 27 of file CameraComponent.h.

◆ get_far_plane()

float hellfire::CameraComponent::get_far_plane ( ) const
inline

Definition at line 56 of file CameraComponent.h.

◆ get_fov()

float hellfire::CameraComponent::get_fov ( ) const
inline

Definition at line 45 of file CameraComponent.h.

◆ get_front_vector()

glm::vec3 hellfire::CameraComponent::get_front_vector ( ) const
inline

Definition at line 73 of file CameraComponent.h.

◆ get_mouse_sensitivity()

float hellfire::CameraComponent::get_mouse_sensitivity ( ) const
inline

Definition at line 69 of file CameraComponent.h.

◆ get_near_plane()

float hellfire::CameraComponent::get_near_plane ( ) const
inline

Definition at line 55 of file CameraComponent.h.

◆ get_pitch()

float hellfire::CameraComponent::get_pitch ( ) const
inline

Definition at line 64 of file CameraComponent.h.

◆ get_projection_matrix()

glm::mat4 hellfire::CameraComponent::get_projection_matrix ( ) const

Definition at line 47 of file CameraComponent.cpp.

◆ get_right_vector()

glm::vec3 hellfire::CameraComponent::get_right_vector ( ) const
inline

Definition at line 75 of file CameraComponent.h.

◆ get_target()

glm::vec3 hellfire::CameraComponent::get_target ( ) const
inline

Definition at line 82 of file CameraComponent.h.

◆ get_up_vector()

glm::vec3 hellfire::CameraComponent::get_up_vector ( ) const
inline

Definition at line 74 of file CameraComponent.h.

◆ get_view_matrix()

glm::mat4 hellfire::CameraComponent::get_view_matrix ( ) const

Definition at line 40 of file CameraComponent.cpp.

◆ get_yaw()

float hellfire::CameraComponent::get_yaw ( ) const
inline

Definition at line 63 of file CameraComponent.h.

◆ invalidate_view()

void hellfire::CameraComponent::invalidate_view ( ) const
inline

Definition at line 84 of file CameraComponent.h.

◆ look_at()

void hellfire::CameraComponent::look_at ( const glm::vec3 &  target)

Definition at line 88 of file CameraComponent.cpp.

◆ set_aspect_ratio()

void hellfire::CameraComponent::set_aspect_ratio ( float  aspect)

Definition at line 59 of file CameraComponent.cpp.

◆ set_camera_type()

void hellfire::CameraComponent::set_camera_type ( CameraType  type)

Definition at line 14 of file CameraComponent.cpp.

◆ set_clip_planes()

void hellfire::CameraComponent::set_clip_planes ( float  near_plane,
float  far_plane 
)

Definition at line 66 of file CameraComponent.cpp.

◆ set_fov()

void hellfire::CameraComponent::set_fov ( float  fov)

Definition at line 54 of file CameraComponent.cpp.

◆ set_mouse_sensitivity()

void hellfire::CameraComponent::set_mouse_sensitivity ( float  sensitivity)

Definition at line 84 of file CameraComponent.cpp.

◆ set_orthographic()

void hellfire::CameraComponent::set_orthographic ( float  left,
float  right,
float  bottom,
float  top,
float  near_plane,
float  far_plane 
)

Definition at line 28 of file CameraComponent.cpp.

◆ set_perspective()

void hellfire::CameraComponent::set_perspective ( float  fov,
float  aspect,
float  near_plane,
float  far_plane 
)

Definition at line 19 of file CameraComponent.cpp.

◆ set_pitch()

void hellfire::CameraComponent::set_pitch ( float  pitch)

Definition at line 78 of file CameraComponent.cpp.

◆ set_target()

void hellfire::CameraComponent::set_target ( const glm::vec3 &  target)

Definition at line 103 of file CameraComponent.cpp.

◆ set_yaw()

void hellfire::CameraComponent::set_yaw ( float  yaw)

Definition at line 72 of file CameraComponent.cpp.

◆ update_camera_vectors()

void hellfire::CameraComponent::update_camera_vectors ( )
private

Definition at line 123 of file CameraComponent.cpp.

◆ update_orthographic_bounds()

void hellfire::CameraComponent::update_orthographic_bounds ( )
private

Definition at line 158 of file CameraComponent.cpp.

◆ update_projection_matrix()

void hellfire::CameraComponent::update_projection_matrix ( ) const
private

Definition at line 149 of file CameraComponent.cpp.

◆ update_view_matrix()

void hellfire::CameraComponent::update_view_matrix ( ) const
private

Definition at line 136 of file CameraComponent.cpp.

Member Data Documentation

◆ aspect_ratio_

float hellfire::CameraComponent::aspect_ratio_ = 16.0f / 9.0f
private

Definition at line 101 of file CameraComponent.h.

◆ camera_data_

CameraData hellfire::CameraComponent::camera_data_
private

Definition at line 119 of file CameraComponent.h.

◆ camera_type_

CameraType hellfire::CameraComponent::camera_type_ = CameraType::PERSPECTIVE
private

Definition at line 97 of file CameraComponent.h.

◆ far_plane_

float hellfire::CameraComponent::far_plane_ = 100.0f
private

Definition at line 103 of file CameraComponent.h.

◆ fov_

float hellfire::CameraComponent::fov_ = 45.0f
private

Definition at line 100 of file CameraComponent.h.

◆ front_

glm::vec3 hellfire::CameraComponent::front_ = glm::vec3(0.0f, 0.0f, -1.0f)
private

Definition at line 113 of file CameraComponent.h.

◆ near_plane_

float hellfire::CameraComponent::near_plane_ = 0.1f
private

Definition at line 102 of file CameraComponent.h.

◆ ortho_bottom_

float hellfire::CameraComponent::ortho_bottom_ = -10.0f
private

Definition at line 109 of file CameraComponent.h.

◆ ortho_left_

float hellfire::CameraComponent::ortho_left_ = -10.0f
private

Definition at line 107 of file CameraComponent.h.

◆ ortho_right_

float hellfire::CameraComponent::ortho_right_ = 10.0f
private

Definition at line 108 of file CameraComponent.h.

◆ ortho_size_

float hellfire::CameraComponent::ortho_size_ = 10.0f
private

Definition at line 106 of file CameraComponent.h.

◆ ortho_top_

float hellfire::CameraComponent::ortho_top_ = 10.0f
private

Definition at line 110 of file CameraComponent.h.

◆ projection_dirty_

bool hellfire::CameraComponent::projection_dirty_ = true
mutableprivate

Definition at line 125 of file CameraComponent.h.

◆ projection_matrix_

glm::mat4 hellfire::CameraComponent::projection_matrix_ = glm::mat4(1.0f)
mutableprivate

Definition at line 123 of file CameraComponent.h.

◆ right_

glm::vec3 hellfire::CameraComponent::right_ = glm::vec3(1.0f, 0.0f, 0.0f)
private

Definition at line 115 of file CameraComponent.h.

◆ target_

glm::vec3 hellfire::CameraComponent::target_ = glm::vec3(0.0f)
private

Definition at line 117 of file CameraComponent.h.

◆ up_

glm::vec3 hellfire::CameraComponent::up_ = glm::vec3(0.0f, 1.0f, 0.0f)
private

Definition at line 114 of file CameraComponent.h.

◆ view_dirty_

bool hellfire::CameraComponent::view_dirty_ = true
mutableprivate

Definition at line 124 of file CameraComponent.h.

◆ view_matrix_

glm::mat4 hellfire::CameraComponent::view_matrix_ = glm::mat4(1.0f)
mutableprivate

Definition at line 122 of file CameraComponent.h.

◆ world_up_

glm::vec3 hellfire::CameraComponent::world_up_ = glm::vec3(0.0f, 1.0f, 0.0f)
private

Definition at line 116 of file CameraComponent.h.


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