From b3a36f7378ea0f299cfa36c81de42e00adb7292d Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Mon, 26 Jun 2017 20:11:17 +0200 Subject: Isolate irrlicht references and use a singleton (#6041) * Add Device3D class which will contain IrrlichtDevice interface move getSupportedVideoDrivers to Device3D Add Device3D singleton & use it in various places Rename Device3D to Rendering engine & add helper functions to various device pointers More singleton work RenderingEngine owns draw_load_screen move draw functions to RenderingEngine Reduce IrrlichtDevice exposure and guienvironment RenderingEngine: Expose get_timer_time() to remove device from guiEngine Make irrlichtdevice & scene manager less exposed * Code style fixes * Move porting::getVideoDriverName, getVideoDriverFriendlyName, getDisplayDensity, getDisplaySize to RenderingEngine Fix XORG_USED macro -> RenderingEngine + create_engine_device from RenderingEngine constructor directly * enum paralax => enum parallax --- src/camera.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/camera.cpp') diff --git a/src/camera.cpp b/src/camera.cpp index dd4e3963b..83239fe7c 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "clientmap.h" // MapDrawControl #include "player.h" #include +#include "client/renderingengine.h" #include "settings.h" #include "wieldmesh.h" #include "noise.h" // easeCurve @@ -99,7 +100,7 @@ bool Camera::successfullyCreated(std::string &error_message) } else { error_message.clear(); } - + if (g_settings->getBool("enable_client_modding")) { m_client->getScript()->on_camera_ready(this); } @@ -449,7 +450,8 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, fov_degrees = rangelim(fov_degrees, 7.0, 160.0); // FOV and aspect ratio - m_aspect = (f32) porting::getWindowSize().X / (f32) porting::getWindowSize().Y; + const v2u32 &window_size = RenderingEngine::get_instance()->getWindowSize(); + m_aspect = (f32) window_size.X / (f32) window_size.Y; m_fov_y = fov_degrees * M_PI / 180.0; // Increase vertical FOV on lower aspect ratios (<16:10) m_fov_y *= MYMAX(1.0, MYMIN(1.4, sqrt(16./10. / m_aspect))); -- cgit v1.2.3