Symphony Of Empires
Eng3D::Camera Class Referenceabstract

#include <camera.hpp>

Inheritance diagram for Eng3D::Camera:

Public Member Functions

constexpr Camera (glm::vec2 _screen_size, glm::vec2 _map_size)
 
 Camera (const Camera &camera)
 
virtual ~Camera ()=default
 
void set_screen (const int width, const int height)
 Set the width and height of the screen. More...
 
virtual void move (float x_dir, float y_dir, float z_dir)=0
 Move the camera in the specified direction. Uses the map coordinate system, where the Z-axis is the map zoom. More...
 
virtual void set_pos (float x, float y)=0
 Set the map position of the camera. More...
 
virtual glm::vec3 get_map_pos () const =0
 Get the map position of the camera. More...
 
glm::vec3 get_world_pos () const
 Get the world positions of the camera. More...
 
glm::vec2 get_map_size () const
 Get the size of the map. More...
 
virtual void update ()=0
 Update the movement of the camera. Used for smooth camera movement. More...
 
virtual glm::mat4 get_projection () const
 Get the projection matrix. More...
 
virtual glm::mat4 get_view () const =0
 Get the view matrix. More...
 
virtual bool get_cursor_map_pos (glm::ivec2 mouse_pos, glm::ivec2 &out_pos) const =0
 Get the cursors position on the map. More...
 
virtual glm::vec3 get_tile_world_pos (glm::vec2 tile_pos) const =0
 Get the tiles world position. More...
 
virtual glm::vec2 get_tile_screen_pos (glm::vec2 tile_pos) const
 Get the tiles position on the screen. More...
 

Public Attributes

float fov = 45.0f
 
float near_plane = 1.0f
 
float far_plane = 20000.0f
 

Protected Attributes

glm::vec3 map_position
 
glm::vec3 world_position
 
glm::vec2 screen_size
 
glm::vec2 map_size
 

Detailed Description

Definition at line 34 of file camera.hpp.

Constructor & Destructor Documentation

◆ Camera() [1/2]

constexpr Eng3D::Camera::Camera ( glm::vec2  _screen_size,
glm::vec2  _map_size 
)
inlineconstexpr

Definition at line 43 of file camera.hpp.

◆ Camera() [2/2]

Eng3D::Camera::Camera ( const Camera camera)
inline

Definition at line 52 of file camera.hpp.

◆ ~Camera()

virtual Eng3D::Camera::~Camera ( )
virtualdefault

Member Function Documentation

◆ get_cursor_map_pos()

virtual bool Eng3D::Camera::get_cursor_map_pos ( glm::ivec2  mouse_pos,
glm::ivec2 &  out_pos 
) const
pure virtual

Get the cursors position on the map.

Parameters
mouse_posthe cursor position on the screen
out_poswhere the cursor position on the map is written to
Returns
true if the the cursor is inside the map otherwise false

Implemented in Eng3D::OrbitCamera, and Eng3D::FlatCamera.

◆ get_map_pos()

virtual glm::vec3 Eng3D::Camera::get_map_pos ( ) const
pure virtual

Get the map position of the camera.

Implemented in Eng3D::OrbitCamera, and Eng3D::FlatCamera.

Here is the caller graph for this function:

◆ get_map_size()

glm::vec2 Eng3D::Camera::get_map_size ( ) const
inline

Get the size of the map.

Definition at line 83 of file camera.hpp.

Here is the caller graph for this function:

◆ get_projection()

virtual glm::mat4 Eng3D::Camera::get_projection ( ) const
inlinevirtual

Get the projection matrix.

Definition at line 91 of file camera.hpp.

Here is the caller graph for this function:

◆ get_tile_screen_pos()

virtual glm::vec2 Eng3D::Camera::get_tile_screen_pos ( glm::vec2  tile_pos) const
inlinevirtual

Get the tiles position on the screen.

Definition at line 109 of file camera.hpp.

Here is the call graph for this function:

◆ get_tile_world_pos()

virtual glm::vec3 Eng3D::Camera::get_tile_world_pos ( glm::vec2  tile_pos) const
pure virtual

Get the tiles world position.

Implemented in Eng3D::OrbitCamera, and Eng3D::FlatCamera.

Here is the caller graph for this function:

◆ get_view()

virtual glm::mat4 Eng3D::Camera::get_view ( ) const
pure virtual

Get the view matrix.

Implemented in Eng3D::OrbitCamera, and Eng3D::FlatCamera.

Here is the caller graph for this function:

◆ get_world_pos()

glm::vec3 Eng3D::Camera::get_world_pos ( ) const
inline

Get the world positions of the camera.

Definition at line 78 of file camera.hpp.

Here is the caller graph for this function:

◆ move()

virtual void Eng3D::Camera::move ( float  x_dir,
float  y_dir,
float  z_dir 
)
pure virtual

Move the camera in the specified direction. Uses the map coordinate system, where the Z-axis is the map zoom.

Implemented in Eng3D::OrbitCamera, and Eng3D::FlatCamera.

◆ set_pos()

virtual void Eng3D::Camera::set_pos ( float  x,
float  y 
)
pure virtual

Set the map position of the camera.

Implemented in Eng3D::OrbitCamera, and Eng3D::FlatCamera.

◆ set_screen()

void Eng3D::Camera::set_screen ( const int  width,
const int  height 
)
inline

Set the width and height of the screen.

Definition at line 64 of file camera.hpp.

◆ update()

virtual void Eng3D::Camera::update ( )
pure virtual

Update the movement of the camera. Used for smooth camera movement.

Implemented in Eng3D::OrbitCamera, and Eng3D::FlatCamera.

Member Data Documentation

◆ far_plane

float Eng3D::Camera::far_plane = 20000.0f

Definition at line 41 of file camera.hpp.

◆ fov

float Eng3D::Camera::fov = 45.0f

Definition at line 41 of file camera.hpp.

◆ map_position

glm::vec3 Eng3D::Camera::map_position
protected

Definition at line 36 of file camera.hpp.

◆ map_size

glm::vec2 Eng3D::Camera::map_size
protected

Definition at line 39 of file camera.hpp.

◆ near_plane

float Eng3D::Camera::near_plane = 1.0f

Definition at line 41 of file camera.hpp.

◆ screen_size

glm::vec2 Eng3D::Camera::screen_size
protected

Definition at line 38 of file camera.hpp.

◆ world_position

glm::vec3 Eng3D::Camera::world_position
protected

Definition at line 37 of file camera.hpp.


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