From 7d02e57a194f41c0dacdec615074017097166c6a Mon Sep 17 00:00:00 2001 From: CodingJellyfish Date: Sun, 5 May 2024 13:08:35 +0800 Subject: [PATCH] Avoid resetting FOV which caused issue after resizing cutscene --- src/graphics/camera.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/graphics/camera.cpp b/src/graphics/camera.cpp index 7330c3b7442..2c37711be24 100644 --- a/src/graphics/camera.cpp +++ b/src/graphics/camera.cpp @@ -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(); @@ -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