engine/include/components/camera.hpp

57 lines
838 B
C++
Raw Normal View History

2022-09-02 11:06:59 +00:00
#pragma once
2022-09-07 09:02:01 +00:00
#include "engine_api.h"
2022-09-02 23:02:09 +00:00
2022-09-02 11:06:59 +00:00
#include "component.hpp"
#include "object.hpp"
#include <vector>
2022-10-31 16:21:07 +00:00
#include <glm/vec3.hpp>
#include <glm/vec4.hpp>
#include <glm/mat4x4.hpp>
2022-09-02 11:06:59 +00:00
2022-10-06 10:30:44 +00:00
namespace engine::components {
2022-09-02 11:06:59 +00:00
2022-09-03 04:56:51 +00:00
class ENGINE_API Camera : public Component {
2022-09-02 11:06:59 +00:00
public:
Camera(Object* parent);
~Camera();
// called every frame, don't call manually
void updateCam(glm::mat4 transform);
void makeActive();
bool isActive();
void usePerspective(float fovDeg);
void useOrtho();
bool m_noClear = false;
glm::vec3 m_lightPos = { 0.0f, 100.0f, 0.0f };
glm::vec4 clearColor{0.1f, 0.1f, 0.1f, 1.0f};
glm::mat4 m_projMatrix{ 1.0f };
private:
enum class Modes {
PERSPECTIVE,
ORTHOGRAPHIC
};
Modes m_mode = Modes::ORTHOGRAPHIC;
// perspective mode settings
float m_fovDeg = 90.0f;
static glm::vec4 s_clearColor;
};
}