Symphony Of Empires
Eng3D::FlatCamera Class Reference

#include <flat_camera.hpp>

Inheritance diagram for Eng3D::FlatCamera:
Collaboration diagram for Eng3D::FlatCamera:

Public Member Functions

 FlatCamera (glm::vec2 _screen_size, glm::vec2 _map_size)
 
 FlatCamera (const Camera &camera)
 
void move (float x_dir, float y_dir, float z_dir) override
 Move the camera in the specified direction. Uses the map coordinate system, where the Z-axis is the map zoom. More...
 
void update () override
 Update the movement of the camera. Used for smooth camera movement. More...
 
void set_pos (float x, float y) override
 Set the map position of the camera. More...
 
glm::vec3 get_map_pos () const override
 Get the map position of the camera. More...
 
glm::mat4 get_view () const override
 Get the view matrix. More...
 
bool get_cursor_map_pos (glm::ivec2 mouse_pos, glm::ivec2 &out_pos) const override
 Get the cursors position on the map. More...
 
glm::vec3 get_tile_world_pos (glm::vec2 tile_pos) const override
 Get the tiles world position. More...
 
- Public Member Functions inherited from Eng3D::Camera
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...
 
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 glm::mat4 get_projection () const
 Get the projection matrix. More...
 
virtual glm::vec2 get_tile_screen_pos (glm::vec2 tile_pos) const
 Get the tiles position on the screen. More...
 

Public Attributes

glm::vec3 target
 
ValueChase< glm::vec3 > chase { 0.2f }
 
- Public Attributes inherited from Eng3D::Camera
float fov = 45.0f
 
float near_plane = 1.0f
 
float far_plane = 20000.0f
 

Additional Inherited Members

- Protected Attributes inherited from Eng3D::Camera
glm::vec3 map_position
 
glm::vec3 world_position
 
glm::vec2 screen_size
 
glm::vec2 map_size
 

Detailed Description

Definition at line 37 of file flat_camera.hpp.

Constructor & Destructor Documentation

◆ FlatCamera() [1/2]

Eng3D::FlatCamera::FlatCamera ( glm::vec2  _screen_size,
glm::vec2  _map_size 
)
inline

Definition at line 42 of file flat_camera.hpp.

◆ FlatCamera() [2/2]

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

Definition at line 50 of file flat_camera.hpp.

Member Function Documentation

◆ get_cursor_map_pos()

bool Eng3D::FlatCamera::get_cursor_map_pos ( glm::ivec2  mouse_pos,
glm::ivec2 &  out_pos 
) const
inlineoverridevirtual

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

Implements Eng3D::Camera.

Definition at line 98 of file flat_camera.hpp.

Here is the call graph for this function:

◆ get_map_pos()

glm::vec3 Eng3D::FlatCamera::get_map_pos ( ) const
inlineoverridevirtual

Get the map position of the camera.

Implements Eng3D::Camera.

Definition at line 84 of file flat_camera.hpp.

◆ get_tile_world_pos()

glm::vec3 Eng3D::FlatCamera::get_tile_world_pos ( glm::vec2  tile_pos) const
inlineoverridevirtual

Get the tiles world position.

Implements Eng3D::Camera.

Definition at line 129 of file flat_camera.hpp.

◆ get_view()

glm::mat4 Eng3D::FlatCamera::get_view ( ) const
inlineoverridevirtual

Get the view matrix.

Implements Eng3D::Camera.

Definition at line 90 of file flat_camera.hpp.

Here is the caller graph for this function:

◆ move()

void Eng3D::FlatCamera::move ( float  x_dir,
float  y_dir,
float  z_dir 
)
inlineoverridevirtual

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

Implements Eng3D::Camera.

Definition at line 57 of file flat_camera.hpp.

◆ set_pos()

void Eng3D::FlatCamera::set_pos ( float  x,
float  y 
)
inlineoverridevirtual

Set the map position of the camera.

Implements Eng3D::Camera.

Definition at line 76 of file flat_camera.hpp.

Here is the call graph for this function:

◆ update()

void Eng3D::FlatCamera::update ( )
inlineoverridevirtual

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

Implements Eng3D::Camera.

Definition at line 66 of file flat_camera.hpp.

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

Member Data Documentation

◆ chase

ValueChase<glm::vec3> Eng3D::FlatCamera::chase { 0.2f }

Definition at line 40 of file flat_camera.hpp.

◆ target

glm::vec3 Eng3D::FlatCamera::target

Definition at line 39 of file flat_camera.hpp.


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