Basic concept working
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/ext/matrix_transform.hpp>
|
||||
|
||||
Camera::Camera(float fov, int width, int height) {
|
||||
Camera::Camera(float fov, float aspectRatio) {
|
||||
this->fov = fov;
|
||||
viewMatrix = glm::mat4(1.0f);
|
||||
updateAspectRatio(width, height);
|
||||
updateAspectRatio(aspectRatio);
|
||||
updateVPM();
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ void Camera::updateVPM() {
|
||||
viewProjectionMatrix = projectionMatrix * viewMatrix;
|
||||
}
|
||||
|
||||
void Camera::updateAspectRatio(int width, int height) {
|
||||
void Camera::updateAspectRatio(float aspectRatio) {
|
||||
//projectionMatrix = glm::ortho(-2.0f, 2.0f, -2.0f, 2.0f, -10.f, 100.0f);
|
||||
projectionMatrix = glm::perspective(fov/2.0f, (float)width / (float)height, 0.1f, 1000.0f);
|
||||
projectionMatrix = glm::perspective(fov/2.0f, aspectRatio, 0.1f, 1000.0f);
|
||||
updateVPM();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user