From b9ec32ec718255b9d688439fa5d9fe652c1a0583 Mon Sep 17 00:00:00 2001 From: Quentin Bazin Date: Sat, 25 Jan 2020 15:29:14 +0900 Subject: [PATCH] =?UTF-8?q?[GameState]=20Now=20using=20a=2070=C2=B0=20FOV.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/include/states/GameState.hpp | 2 +- client/source/states/GameState.cpp | 3 +++ common/include/core/Config.hpp | 3 +-- common/source/core/Config.cpp | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/client/include/states/GameState.hpp b/client/include/states/GameState.hpp index 88f667d6..793753b2 100644 --- a/client/include/states/GameState.hpp +++ b/client/include/states/GameState.hpp @@ -45,7 +45,7 @@ class GameState : public gk::ApplicationState { gk::Shader m_shader; - gk::Camera m_camera{FOV, DIST_NEAR, DIST_FAR}; + gk::Camera m_camera{70.0f, DIST_NEAR, DIST_FAR}; ClientPlayer m_player{m_camera}; Client m_client; diff --git a/client/source/states/GameState.cpp b/client/source/states/GameState.cpp index 0c754c09..942a8846 100644 --- a/client/source/states/GameState.cpp +++ b/client/source/states/GameState.cpp @@ -85,6 +85,9 @@ void GameState::onEvent(const SDL_Event &event) { void GameState::update() { m_world.update(); + if (m_camera.getFieldOfView() != Config::cameraFOV) + m_camera.setFieldOfView(Config::cameraFOV); + if (m_clientCommandHandler.isRegistryInitialized()) { if (&m_stateStack->top() == this) { m_player.processInputs(); diff --git a/common/include/core/Config.hpp b/common/include/core/Config.hpp index eb0e00ac..20f96c88 100644 --- a/common/include/core/Config.hpp +++ b/common/include/core/Config.hpp @@ -22,8 +22,6 @@ namespace { constexpr float SCREEN_WIDTH = 1600; constexpr float SCREEN_HEIGHT = 1050; - constexpr float FOV = 45.0f; - constexpr float DIST_NEAR = 0.1f; constexpr float DIST_FAR = 1000.0f; @@ -47,6 +45,7 @@ namespace Config { extern bool isAmbientOcclusionEnabled; extern bool isWireframeModeEnabled; extern u16 renderDistance; + extern float cameraFOV; } #endif // CONFIG_HPP_ diff --git a/common/source/core/Config.cpp b/common/source/core/Config.cpp index 1a66836d..fa6eb262 100644 --- a/common/source/core/Config.cpp +++ b/common/source/core/Config.cpp @@ -25,4 +25,5 @@ bool Config::isSunSmoothLightingEnabled = true; bool Config::isAmbientOcclusionEnabled = false; bool Config::isWireframeModeEnabled = false; u16 Config::renderDistance = 8; +float Config::cameraFOV = 70.0f;