diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-06-26 20:11:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-26 20:11:17 +0200 |
commit | b3a36f7378ea0f299cfa36c81de42e00adb7292d (patch) | |
tree | 23d056b575ff0dba8cc759cc00f732099a1f3bce /src/camera.cpp | |
parent | a8650e785df3f12efa5f8cd3c6a695fb9e22a598 (diff) | |
download | minetest-b3a36f7378ea0f299cfa36c81de42e00adb7292d.tar.xz |
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
Diffstat (limited to 'src/camera.cpp')
-rw-r--r-- | src/camera.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
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 <cmath> +#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))); |