-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove unused code and refactor ACamera and descendants
- Loading branch information
Showing
20 changed files
with
275 additions
and
446 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <Engine/ACamera.hpp> | ||
|
||
ACamera::~ACamera() = default; | ||
|
||
const glm::mat4& ACamera::GetViewMatrix() const noexcept { return viewMatrix; } | ||
const glm::mat4& ACamera::GetProjectionMatrix() const noexcept { return projectionMatrix; } | ||
const glm::mat4& ACamera::GetViewProjectionMatrix() const noexcept { return viewProjectionMatrix; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,37 @@ | ||
#include "OrthoCamera.hpp" | ||
#include <Engine/OrthoCamera.hpp> | ||
|
||
#include <glm/gtx/quaternion.hpp> | ||
#include <glm/gtc/matrix_transform.hpp> | ||
|
||
OrthoCamera::OrthoCamera(float left, float right, float bottom, float top, float near, float far) : | ||
_left(left), | ||
_right(right), | ||
_bottom(bottom), | ||
_top(top), | ||
_near(near), | ||
_far(far) {} | ||
OrthoCamera::OrthoCamera(float left, float right, float bottom, float top, float near, float far) noexcept : | ||
LeftPlane(left), | ||
RightPlane(right), | ||
BottomPlane(bottom), | ||
TopPlane(top), | ||
NearPlane(near), | ||
FarPlane(far) {} | ||
|
||
void OrthoCamera::Set(float left, float right, float bottom, float top, float near, float far) { | ||
_left = left; | ||
_right = right; | ||
_bottom = bottom; | ||
_top = top; | ||
_near = near; | ||
_far = far; | ||
void OrthoCamera::Set(float left, float right, float bottom, float top, float near, float far) noexcept { | ||
LeftPlane = left; | ||
RightPlane = right; | ||
BottomPlane = bottom; | ||
TopPlane = top; | ||
NearPlane = near; | ||
FarPlane = far; | ||
} | ||
|
||
void OrthoCamera::UpdateView() { | ||
forward = glm::normalize(forward); | ||
up = glm::normalize(up); | ||
_viewMatrix = glm::lookAt(eye, eye + forward, up); | ||
_viewMatrix = glm::scale(_viewMatrix, { 1, 1, 1 / zoom }); | ||
} | ||
|
||
void OrthoCamera::UpdateProjection() { | ||
_projectionMatrix = glm::ortho(_left, _right, _bottom, _top, _near, _far); | ||
void OrthoCamera::UpdateView() noexcept { | ||
Forward = glm::normalize(Forward); | ||
Up = glm::normalize(Up); | ||
viewMatrix = glm::lookAt(Eye, Eye + Forward, Up); | ||
viewMatrix = glm::scale(viewMatrix, { 1, 1, 1 / Zoom }); | ||
} | ||
|
||
void OrthoCamera::UpdateViewProjection() { | ||
_viewProjectionMatrix = _projectionMatrix * _viewMatrix; | ||
void OrthoCamera::UpdateProjection() noexcept { | ||
projectionMatrix = glm::ortho( | ||
LeftPlane, RightPlane, | ||
BottomPlane, TopPlane, | ||
NearPlane, FarPlane | ||
); | ||
} | ||
void OrthoCamera::UpdateViewProjection() noexcept { | ||
viewProjectionMatrix = projectionMatrix * viewMatrix; | ||
} |
Oops, something went wrong.