2020-09-30 13:48:41 +02:00
|
|
|
#pragma once
|
|
|
|
|
#include "Component.h"
|
|
|
|
|
#include "Math/Matrix.h"
|
2022-04-17 09:10:20 +02:00
|
|
|
#include "Graphics/GraphicsResources.h"
|
2022-11-15 12:19:11 +01:00
|
|
|
#include "Transform.h"
|
2020-09-30 13:48:41 +02:00
|
|
|
|
|
|
|
|
namespace Seele
|
|
|
|
|
{
|
2022-11-15 12:19:11 +01:00
|
|
|
namespace Component
|
2020-09-30 13:48:41 +02:00
|
|
|
{
|
2022-11-15 12:19:11 +01:00
|
|
|
struct Camera
|
|
|
|
|
{
|
|
|
|
|
REQUIRE_COMPONENT(Transform)
|
|
|
|
|
|
|
|
|
|
Camera();
|
|
|
|
|
~Camera();
|
2020-09-30 13:48:41 +02:00
|
|
|
|
2022-11-17 16:47:42 +01:00
|
|
|
Math::Matrix4 getViewMatrix() const
|
2022-03-19 22:45:30 +01:00
|
|
|
{
|
2022-11-15 12:19:11 +01:00
|
|
|
assert (!bNeedsViewBuild);
|
2022-03-19 22:45:30 +01:00
|
|
|
return viewMatrix;
|
|
|
|
|
}
|
2022-11-17 16:47:42 +01:00
|
|
|
Math::Vector getCameraPosition() const
|
2022-03-19 22:45:30 +01:00
|
|
|
{
|
2022-11-17 16:47:42 +01:00
|
|
|
return Math::Vector(viewMatrix[3]);
|
2022-03-19 22:45:30 +01:00
|
|
|
}
|
2022-04-17 09:10:20 +02:00
|
|
|
void setViewport(Gfx::PViewport viewport);
|
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();
|
2022-11-17 16:47:42 +01:00
|
|
|
Math::Matrix4 viewMatrix;
|
2022-11-29 16:34:42 +01:00
|
|
|
//Transforms relative to actor
|
|
|
|
|
float yaw;
|
|
|
|
|
float pitch;
|
2020-09-30 13:48:41 +02:00
|
|
|
private:
|
|
|
|
|
bool bNeedsViewBuild;
|
|
|
|
|
};
|
2022-11-15 12:19:11 +01:00
|
|
|
} // namespace Component
|
2020-09-30 13:48:41 +02:00
|
|
|
} // namespace Seele
|