Skip to content

Commit

Permalink
Avoid resetting FOV which caused issue after resizing cutscene
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingJellyfish committed May 5, 2024
1 parent 0969a17 commit 7d02e57
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/graphics/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ Camera::Camera(CameraType type, int camera_index, AbstractKart* kart)
m_camera = irr_driver->addCameraSceneNode();
m_previous_pv_matrix = core::matrix4();

if (RaceManager::get()->getNumLocalPlayers() > 1)
{
m_fov = DEGREE_TO_RAD * stk_config->m_camera_fov
[RaceManager::get()->getNumLocalPlayers() - 1];
}
else
{
m_fov = DEGREE_TO_RAD * UserConfigParams::m_camera_fov;
}
m_camera->setFOV(m_fov);
setupCamera();
setKart(kart);
m_ambient_light = Track::getCurrentTrack()->getDefaultAmbientColor();
Expand Down Expand Up @@ -170,22 +180,10 @@ void Camera::setupCamera()
{
m_viewport = irr_driver->getSplitscreenWindow(m_index);
m_aspect = (float)((float)(m_viewport.getWidth()) / (float)(m_viewport.getHeight()));

m_scaling = core::vector2df(
float(irr_driver->getActualScreenSize().Width) / m_viewport.getWidth() ,
float(irr_driver->getActualScreenSize().Height) / m_viewport.getHeight());

if (RaceManager::get()->getNumLocalPlayers() > 1)
{
m_fov = DEGREE_TO_RAD * stk_config->m_camera_fov
[RaceManager::get()->getNumLocalPlayers() - 1];
}
else
{
m_fov = DEGREE_TO_RAD * UserConfigParams::m_camera_fov;
}

m_camera->setFOV(m_fov);
m_camera->setAspectRatio(m_aspect);
m_camera->setFarValue(Track::getCurrentTrack()->getCameraFar());
} // setupCamera
Expand Down

0 comments on commit 7d02e57

Please sign in to comment.