mirror of
https://github.com/minetest/minetest.git
synced 2024-07-04 15:05:27 +02:00
Live FOV changes
Probably should add a method for changing the FOV but I am tired. This also works with /set fov ###, so not sure why something like this isn't done already.
This commit is contained in:
parent
96ea24ffef
commit
1f52edb14c
@ -228,7 +228,9 @@ class Camera
|
|||||||
Client *m_client;
|
Client *m_client;
|
||||||
|
|
||||||
// Default Client FOV (as defined by the "fov" setting)
|
// Default Client FOV (as defined by the "fov" setting)
|
||||||
|
public: // TODO make a setter
|
||||||
f32 m_cache_fov;
|
f32 m_cache_fov;
|
||||||
|
private:
|
||||||
|
|
||||||
// Absolute camera position
|
// Absolute camera position
|
||||||
v3f m_camera_position;
|
v3f m_camera_position;
|
||||||
|
@ -202,7 +202,6 @@ struct LocalFormspecHandler : public TextDest
|
|||||||
if (i.first.rfind("page_", 0) == 0)
|
if (i.first.rfind("page_", 0) == 0)
|
||||||
{
|
{
|
||||||
m_client->getScript()->show_settings(i.first.substr(5));
|
m_client->getScript()->show_settings(i.first.substr(5));
|
||||||
std::cout << "Found ..." << m_client << std::endl;
|
|
||||||
}
|
}
|
||||||
//std::cout << "Setting " << i.first << " set!" << std::endl;
|
//std::cout << "Setting " << i.first << " set!" << std::endl;
|
||||||
|
|
||||||
@ -1041,6 +1040,8 @@ Game::Game() :
|
|||||||
&settingChangedCallback, this);
|
&settingChangedCallback, this);
|
||||||
g_settings->registerChangedCallback("pause_on_lost_focus",
|
g_settings->registerChangedCallback("pause_on_lost_focus",
|
||||||
&settingChangedCallback, this);
|
&settingChangedCallback, this);
|
||||||
|
g_settings->registerChangedCallback("fov",
|
||||||
|
&settingChangedCallback, this);
|
||||||
|
|
||||||
readSettings();
|
readSettings();
|
||||||
}
|
}
|
||||||
@ -4441,13 +4442,17 @@ void Game::readSettings()
|
|||||||
|
|
||||||
m_cache_enable_noclip = g_settings->getBool("noclip");
|
m_cache_enable_noclip = g_settings->getBool("noclip");
|
||||||
m_cache_enable_free_move = g_settings->getBool("free_move");
|
m_cache_enable_free_move = g_settings->getBool("free_move");
|
||||||
|
|
||||||
|
|
||||||
m_cache_cam_smoothing = 0;
|
m_cache_cam_smoothing = 0;
|
||||||
if (g_settings->getBool("cinematic"))
|
if (g_settings->getBool("cinematic"))
|
||||||
m_cache_cam_smoothing = 1 - g_settings->getFloat("cinematic_camera_smoothing");
|
m_cache_cam_smoothing = 1 - g_settings->getFloat("cinematic_camera_smoothing");
|
||||||
else
|
else
|
||||||
m_cache_cam_smoothing = 1 - g_settings->getFloat("camera_smoothing");
|
m_cache_cam_smoothing = 1 - g_settings->getFloat("camera_smoothing");
|
||||||
|
|
||||||
|
if (camera)
|
||||||
|
camera->m_cache_fov = g_settings->getFloat("fov");
|
||||||
|
|
||||||
m_cache_cam_smoothing = rangelim(m_cache_cam_smoothing, 0.01f, 1.0f);
|
m_cache_cam_smoothing = rangelim(m_cache_cam_smoothing, 0.01f, 1.0f);
|
||||||
m_cache_mouse_sensitivity = rangelim(m_cache_mouse_sensitivity, 0.001, 100.0);
|
m_cache_mouse_sensitivity = rangelim(m_cache_mouse_sensitivity, 0.001, 100.0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user