Camera should be correct now
This commit is contained in:
@@ -22,8 +22,8 @@ Matrix4 Viewport::getProjectionMatrix() const {
|
|||||||
if (fieldOfView > 0.0f) {
|
if (fieldOfView > 0.0f) {
|
||||||
Matrix4 projectionMatrix = glm::perspective(fieldOfView, sizeX / static_cast<float>(sizeY), 0.1f, 1000.0f);
|
Matrix4 projectionMatrix = glm::perspective(fieldOfView, sizeX / static_cast<float>(sizeY), 0.1f, 1000.0f);
|
||||||
Matrix4 correctionMatrix = Matrix4(
|
Matrix4 correctionMatrix = Matrix4(
|
||||||
1, 0, 0, 0,
|
1, 0, 0, 0,
|
||||||
0, -1, 0, 0,
|
0, -1, 0, 0,
|
||||||
0, 0, 1 / 2.f, 0,
|
0, 0, 1 / 2.f, 0,
|
||||||
0, 0, 1 / 2.f, 1);
|
0, 0, 1 / 2.f, 1);
|
||||||
return correctionMatrix * projectionMatrix;
|
return correctionMatrix * projectionMatrix;
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ CameraUpdater::~CameraUpdater() {}
|
|||||||
|
|
||||||
void CameraUpdater::update(Component::Camera& camera, Component::Transform& transform) {
|
void CameraUpdater::update(Component::Camera& camera, Component::Transform& transform) {
|
||||||
Vector eyePos = transform.getPosition();
|
Vector eyePos = transform.getPosition();
|
||||||
Vector lookAt = eyePos + transform.getForward();
|
Vector lookAt = eyePos - transform.getForward();
|
||||||
camera.viewMatrix = glm::lookAt(eyePos, lookAt, Vector(0, 1, 0));
|
camera.viewMatrix = glm::lookAt(eyePos, lookAt, Vector(0, 1, 0));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user