charcoal/OpenGLEngine/Camera2D.h

37 lines
741 B
C
Raw Normal View History

#pragma once
#include "Camera.h"
#include "vec2.h"
#include "vec3.h"
using namespace egm;
class Camera2D : public Camera
{
public:
Camera2D(const vec2& size, const vec2& position = vec2(0.0f, 0.0f));
Camera2D(const vec3& size = vec3(2.0f, 2.0f, 2.0f), const vec3& position = vec3(0.0f, 0.0f, 0.0f));
void update_size(const vec3& size);
void update_position(const vec3& position);
void translate(const vec2& translation);
void translate(const vec3& translation);
const vec3& get_size() { return m_size; }
const vec3& get_position() { return m_position; }
void update_view_projection_matrix() override;
private:
void update_scale();
void update_offset();
vec3 m_size;
vec3 m_position;
vec3 m_scale;
vec3 m_offset;
};