Files
Seele/src/Engine/Scene/Components/CameraComponent.h
T

53 lines
1.1 KiB
C++
Raw Normal View History

#pragma once
#include "Component.h"
#include "Math/Matrix.h"
namespace Seele
{
class CameraComponent : public Component
{
public:
CameraComponent();
virtual ~CameraComponent();
2022-03-19 22:45:30 +01:00
Matrix4 getViewMatrix()
{
if (bNeedsViewBuild)
{
buildViewMatrix();
}
return viewMatrix;
}
Matrix4 getProjectionMatrix()
{
if (bNeedsProjectionBuild)
{
buildProjectionMatrix();
}
return projectionMatrix;
}
Vector getCameraPosition()
{
return getTransform().getPosition();
}
void mouseMove(float deltaX, float deltaY);
void mouseScroll(float x);
void moveX(float amount);
void moveY(float amount);
float aspectRatio;
float fieldOfView;
private:
bool bNeedsViewBuild;
2022-03-19 22:45:30 +01:00
bool bNeedsProjectionBuild;
void buildViewMatrix();
void buildProjectionMatrix();
2022-03-19 22:45:30 +01:00
//Transforms relative to actor
Matrix4 viewMatrix;
Matrix4 projectionMatrix;
2022-03-26 12:55:04 +01:00
float yaw;
float pitch;
};
2021-04-01 16:40:14 +02:00
DEFINE_REF(CameraComponent)
} // namespace Seele