27 #include <glm/vec3.hpp>
28 #include <glm/glm.hpp>
29 #include <glm/gtc/matrix_transform.hpp>
30 #include <glm/gtc/type_ptr.hpp>
31 #include <glm/gtx/intersect.hpp>
43 constexpr
Camera(glm::vec2 _screen_size, glm::vec2 _map_size)
64 inline void set_screen(
const int width,
const int height) {
69 virtual void move(
float x_dir,
float y_dir,
float z_dir) = 0;
72 virtual void set_pos(
float x,
float y) = 0;
112 auto screen_pos = glm::vec2(v) / v.w;
114 screen_pos = (0.5f * (screen_pos + 1.f)) *
screen_size;
Camera(const Camera &camera)
virtual ~Camera()=default
glm::vec2 get_map_size() const
Get the size of the map.
virtual glm::mat4 get_view() const =0
Get the view matrix.
virtual void set_pos(float x, float y)=0
Set the map position of the camera.
virtual glm::vec3 get_map_pos() const =0
Get the map position of the camera.
void set_screen(const int width, const int height)
Set the width and height of the screen.
virtual glm::mat4 get_projection() const
Get the projection matrix.
virtual bool get_cursor_map_pos(glm::ivec2 mouse_pos, glm::ivec2 &out_pos) const =0
Get the cursors position on the map.
glm::vec3 get_world_pos() const
Get the world positions of the camera.
virtual glm::vec2 get_tile_screen_pos(glm::vec2 tile_pos) const
Get the tiles position on the screen.
virtual void update()=0
Update the movement of the camera. Used for smooth camera movement.
virtual glm::vec3 get_tile_world_pos(glm::vec2 tile_pos) const =0
Get the tiles world position.
constexpr Camera(glm::vec2 _screen_size, glm::vec2 _map_size)
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 m...