Symphony Of Empires
Eng3D::OrbitCamera Class Reference

#include <orbit_camera.hpp>

Inheritance diagram for Eng3D::OrbitCamera:
Collaboration diagram for Eng3D::OrbitCamera:

Public Member Functions

 OrbitCamera (glm::vec2 _screen_size, glm::vec2 _map_size, float _radius)
 
 OrbitCamera (const Camera &_camera, float _radius)
 
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::mat4 get_view () const override
 Get the view matrix. More...
 
glm::vec3 get_map_pos () const override
 Get the map position of the camera. 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

float radius
 
float circumference
 
float zoom_dist
 
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 orbit_camera.hpp.

Constructor & Destructor Documentation

◆ OrbitCamera() [1/2]

Eng3D::OrbitCamera::OrbitCamera ( glm::vec2  _screen_size,
glm::vec2  _map_size,
float  _radius 
)
inline

Definition at line 45 of file orbit_camera.hpp.

◆ OrbitCamera() [2/2]

Eng3D::OrbitCamera::OrbitCamera ( const Camera _camera,
float  _radius 
)
inline

Definition at line 53 of file orbit_camera.hpp.

Member Function Documentation

◆ get_cursor_map_pos()

bool Eng3D::OrbitCamera::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 123 of file orbit_camera.hpp.

Here is the call graph for this function:

◆ get_map_pos()

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

Get the map position of the camera.

Implements Eng3D::Camera.

Definition at line 117 of file orbit_camera.hpp.

◆ get_tile_world_pos()

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

Get the tiles world position.

Implements Eng3D::Camera.

Definition at line 157 of file orbit_camera.hpp.

◆ get_view()

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

Get the view matrix.

Implements Eng3D::Camera.

Definition at line 96 of file orbit_camera.hpp.

Here is the caller graph for this function:

◆ move()

void Eng3D::OrbitCamera::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 61 of file orbit_camera.hpp.

◆ set_pos()

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

Set the map position of the camera.

Implements Eng3D::Camera.

Definition at line 89 of file orbit_camera.hpp.

Here is the call graph for this function:

◆ update()

void Eng3D::OrbitCamera::update ( )
inlineoverridevirtual

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

Implements Eng3D::Camera.

Definition at line 70 of file orbit_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::OrbitCamera::chase { 0.2f }

Definition at line 43 of file orbit_camera.hpp.

◆ circumference

float Eng3D::OrbitCamera::circumference

Definition at line 40 of file orbit_camera.hpp.

◆ radius

float Eng3D::OrbitCamera::radius

Definition at line 39 of file orbit_camera.hpp.

◆ target

glm::vec3 Eng3D::OrbitCamera::target

Definition at line 42 of file orbit_camera.hpp.

◆ zoom_dist

float Eng3D::OrbitCamera::zoom_dist

Definition at line 41 of file orbit_camera.hpp.


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