Skip to content
Snippets Groups Projects
Commit 7e1d5750 authored by JonShard's avatar JonShard
Browse files

Added camera zooming.

parent 3cf6e434
No related branches found
No related tags found
No related merge requests found
...@@ -7,9 +7,9 @@ WinName: Assignment 2 - Cube ...@@ -7,9 +7,9 @@ WinName: Assignment 2 - Cube
ClearColor: 0.4 0.4 0.5 1.0 ClearColor: 0.4 0.4 0.5 1.0
FOV: 88.0 FOV: 88.0
MaxFOV: 88.2 MaxFOV: 160.0
MinFOV: 87.97 MinFOV: 20.0
ZoomSensitivity: 0.0 ZoomSensitivity: 0.2
LookSensitivity: 0.084 LookSensitivity: 0.084
PanSensitivity: 0.3 PanSensitivity: 0.3
NearClip: 0.1 NearClip: 0.1
......
...@@ -59,6 +59,21 @@ glm::mat4 EntityCamera::getViewMatrix(glm::mat4 parentModelMatrix) ...@@ -59,6 +59,21 @@ glm::mat4 EntityCamera::getViewMatrix(glm::mat4 parentModelMatrix)
void EntityCamera::checkInput() void EntityCamera::checkInput()
{ {
// Zooming:
if (Input::m_navKeyPressed[N] && m_FOV < glm::radians(C::MaxFOV))
{
m_FOV += glm::radians(C::ZoomSensitivity);
LOG_DEBUG("Changing camera FOV: %f", glm::degrees(m_FOV));
m_cameraTransform.projectionMatrix = glm::perspective(m_FOV, m_aspectRatio, m_nearClip, m_farClip);
}
if (Input::m_navKeyPressed[M] && m_FOV > glm::radians(C::MinFOV))
{
m_FOV -= glm::radians(C::ZoomSensitivity);
LOG_DEBUG("Changing camera FOV: %f", glm::degrees(m_FOV));
m_cameraTransform.projectionMatrix = glm::perspective(m_FOV, m_aspectRatio, m_nearClip, m_farClip);
}
// Moving camera.
switch (m_cameraMode) switch (m_cameraMode)
{ {
case FREELOOK: case FREELOOK:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment