|
|
|
@ -105,7 +105,7 @@ namespace Renderer { |
|
|
|
|
// Camera
|
|
|
|
|
Camera::Camera(Window* win) { |
|
|
|
|
window = win; |
|
|
|
|
setFOV(DEFAULT_FOV); |
|
|
|
|
FOV = DEFAULT_FOV; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Camera::Camera(Window* win, glm::vec3 pos) : Camera(win) { |
|
|
|
@ -116,8 +116,9 @@ namespace Renderer { |
|
|
|
|
setRotation(angle); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Camera::setFOV(float fov) { |
|
|
|
|
projection = glm::perspective(glm::radians(fov), (float)window->width() / (float)window->height(), NEAR_PLANE, FAR_PLANE); |
|
|
|
|
glm::mat4 Camera::getProjection() { |
|
|
|
|
projection = glm::perspective(glm::radians(FOV), (float)window->width() / (float)window->height(), NEAR_PLANE, FAR_PLANE); |
|
|
|
|
return projection; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Camera::updateCameraTransforms() { |
|
|
|
@ -173,7 +174,7 @@ namespace Renderer { |
|
|
|
|
shader.setMat4("model", modelTransform); |
|
|
|
|
|
|
|
|
|
shader.setMat4("view", cam.view); |
|
|
|
|
shader.setMat4("projection", cam.projection); |
|
|
|
|
shader.setMat4("projection", cam.getProjection()); |
|
|
|
|
|
|
|
|
|
shader.use(); |
|
|
|
|
|
|
|
|
|