2020-09-30 13:48:41 +02:00
|
|
|
#pragma once
|
|
|
|
|
#include "Component.h"
|
|
|
|
|
#include "Math/Matrix.h"
|
|
|
|
|
|
|
|
|
|
namespace Seele
|
|
|
|
|
{
|
|
|
|
|
class CameraComponent : public Component
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
CameraComponent();
|
|
|
|
|
virtual ~CameraComponent();
|
|
|
|
|
|
|
|
|
|
Matrix4 getViewMatrix()
|
|
|
|
|
{
|
|
|
|
|
if (bNeedsViewBuild)
|
|
|
|
|
{
|
|
|
|
|
buildViewMatrix();
|
|
|
|
|
}
|
|
|
|
|
return viewMatrix;
|
|
|
|
|
}
|
|
|
|
|
Matrix4 getProjectionMatrix()
|
|
|
|
|
{
|
|
|
|
|
if (bNeedsProjectionBuild)
|
|
|
|
|
{
|
|
|
|
|
buildProjectionMatrix();
|
|
|
|
|
}
|
|
|
|
|
return projectionMatrix;
|
|
|
|
|
}
|
2021-01-19 15:30:00 +01:00
|
|
|
Vector getCameraPosition()
|
|
|
|
|
{
|
|
|
|
|
if(bNeedsViewBuild)
|
|
|
|
|
{
|
|
|
|
|
buildViewMatrix();
|
|
|
|
|
}
|
|
|
|
|
return cameraPosition;
|
|
|
|
|
}
|
2020-09-30 13:48:41 +02:00
|
|
|
void mouseMove(float deltaX, float deltaY);
|
|
|
|
|
void mouseScroll(double x);
|
|
|
|
|
void moveOrigin(float up);
|
|
|
|
|
float aspectRatio;
|
|
|
|
|
float fieldOfView;
|
|
|
|
|
private:
|
|
|
|
|
bool bNeedsViewBuild;
|
|
|
|
|
bool bNeedsProjectionBuild;
|
|
|
|
|
void buildViewMatrix();
|
|
|
|
|
void buildProjectionMatrix();
|
|
|
|
|
|
|
|
|
|
float rotationX;
|
|
|
|
|
float rotationY;
|
|
|
|
|
float distance;
|
|
|
|
|
|
|
|
|
|
Vector eye;
|
|
|
|
|
Vector originPoint;
|
|
|
|
|
Vector cameraPosition;
|
|
|
|
|
//Transforms relative to actor
|
|
|
|
|
Matrix4 viewMatrix;
|
|
|
|
|
Matrix4 projectionMatrix;
|
|
|
|
|
};
|
2021-04-01 16:40:14 +02:00
|
|
|
DEFINE_REF(CameraComponent)
|
2020-09-30 13:48:41 +02:00
|
|
|
} // namespace Seele
|