2020-09-30 13:48:41 +02:00
|
|
|
#pragma once
|
|
|
|
|
#include "Component.h"
|
|
|
|
|
#include "Math/Matrix.h"
|
2022-11-15 12:19:11 +01:00
|
|
|
#include "Transform.h"
|
2020-09-30 13:48:41 +02:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
namespace Seele {
|
|
|
|
|
namespace Component {
|
|
|
|
|
struct Camera {
|
2022-11-15 12:19:11 +01:00
|
|
|
REQUIRE_COMPONENT(Transform)
|
2024-06-09 12:20:04 +02:00
|
|
|
|
2022-11-15 12:19:11 +01:00
|
|
|
Camera();
|
|
|
|
|
~Camera();
|
2020-09-30 13:48:41 +02:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
Matrix4 getViewMatrix() const {
|
|
|
|
|
assert(!bNeedsViewBuild);
|
2022-03-19 22:45:30 +01:00
|
|
|
return viewMatrix;
|
|
|
|
|
}
|
2024-06-09 12:20:04 +02:00
|
|
|
Vector getCameraPosition() const { return cameraPos; }
|
2022-03-19 22:45:30 +01:00
|
|
|
void mouseMove(float deltaX, float deltaY);
|
|
|
|
|
void mouseScroll(float x);
|
|
|
|
|
void moveX(float amount);
|
|
|
|
|
void moveY(float amount);
|
2022-11-15 12:19:11 +01:00
|
|
|
void buildViewMatrix();
|
2024-06-09 12:20:04 +02:00
|
|
|
|
2023-11-13 13:23:16 +01:00
|
|
|
bool mainCamera = false;
|
2024-06-09 12:20:04 +02:00
|
|
|
|
|
|
|
|
private:
|
2024-01-02 16:48:03 +01:00
|
|
|
float yaw;
|
|
|
|
|
float pitch;
|
|
|
|
|
Matrix4 viewMatrix;
|
|
|
|
|
Vector cameraPos;
|
2020-09-30 13:48:41 +02:00
|
|
|
bool bNeedsViewBuild;
|
|
|
|
|
};
|
2022-11-15 12:19:11 +01:00
|
|
|
} // namespace Component
|
2020-09-30 13:48:41 +02:00
|
|
|
} // namespace Seele
|