Files
Seele/src/Engine/Scene/Component/Camera.h
T

55 lines
1.1 KiB
C++
Raw Normal View History

#pragma once
#include "Component.h"
#include "Math/Matrix.h"
2022-04-17 09:10:20 +02:00
#include "Graphics/GraphicsResources.h"
#include "Transform.h"
namespace Seele
{
namespace Component
{
struct Camera
{
REQUIRE_COMPONENT(Transform)
Camera();
~Camera();
Math::Matrix4 getViewMatrix()
2022-03-19 22:45:30 +01:00
{
assert (!bNeedsViewBuild);
2022-03-19 22:45:30 +01:00
return viewMatrix;
}
Math::Matrix4 getProjectionMatrix()
2022-03-19 22:45:30 +01:00
{
assert (!bNeedsProjectionBuild);
2022-03-19 22:45:30 +01:00
return projectionMatrix;
}
Math::Vector getCameraPosition()
2022-03-19 22:45:30 +01:00
{
return getTransform().getPosition();
}
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);
float aspectRatio;
float fieldOfView;
void buildViewMatrix();
void buildProjectionMatrix();
private:
bool bNeedsViewBuild;
2022-03-19 22:45:30 +01:00
bool bNeedsProjectionBuild;
2022-04-17 09:10:20 +02:00
Gfx::PViewport viewport;
2022-03-19 22:45:30 +01:00
//Transforms relative to actor
Math::Matrix4 viewMatrix;
Math::Matrix4 projectionMatrix;
2022-03-26 12:55:04 +01:00
float yaw;
float pitch;
};
} // namespace Component
} // namespace Seele