3 Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4 Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include "irrlichttypes_extrabloated.h"
28 #include "client/render/core.h"
29 // include the shadow mapper classes too
30 #include "client/shadows/dynamicshadowsrender.h"
32 struct VideoDriverInfo {
34 std::string friendly_name;
49 static const float BASE_BLOOM_STRENGTH;
51 RenderingEngine(IEventReceiver *eventReceiver);
54 void setResizable(bool resize);
56 video::IVideoDriver *getVideoDriver() { return driver; }
58 static const VideoDriverInfo &getVideoDriverInfo(irr::video::E_DRIVER_TYPE type);
59 static float getDisplayDensity();
61 bool setupTopLevelWindow(const std::string &name);
62 void setupTopLevelXorgWindow(const std::string &name);
64 bool setXorgWindowIconFromPath(const std::string &icon_file);
65 static bool print_video_modes();
66 void cleanupMeshCache();
68 void removeMesh(const scene::IMesh* mesh);
71 * This takes 3d_mode into account - side-by-side will return a
72 * halved horizontal size.
74 * @return "window" size
76 static v2u32 getWindowSize()
78 sanity_check(s_singleton);
79 return s_singleton->_getWindowSize();
82 io::IFileSystem *get_filesystem()
84 return m_device->getFileSystem();
87 static video::IVideoDriver *get_video_driver()
89 sanity_check(s_singleton && s_singleton->m_device);
90 return s_singleton->m_device->getVideoDriver();
93 scene::ISceneManager *get_scene_manager()
95 return m_device->getSceneManager();
98 static irr::IrrlichtDevice *get_raw_device()
100 sanity_check(s_singleton && s_singleton->m_device);
101 return s_singleton->m_device;
106 return m_device->getTimer()->getTime();
109 gui::IGUIEnvironment *get_gui_env()
111 return m_device->getGUIEnvironment();
114 void draw_load_screen(const std::wstring &text,
115 gui::IGUIEnvironment *guienv, ITextureSource *tsrc,
116 float dtime = 0, int percent = 0, bool clouds = true);
118 void draw_menu_scene(gui::IGUIEnvironment *guienv, float dtime, bool clouds);
119 void draw_scene(video::SColor skycolor, bool show_hud,
120 bool show_minimap, bool draw_wield_tool, bool draw_crosshair);
122 void initialize(Client *client, Hud *hud);
127 return m_device->run();
130 // FIXME: this is still global when it shouldn't be
131 static ShadowRenderer *get_shadow_renderer()
133 if (s_singleton && s_singleton->core)
134 return s_singleton->core->get_shadow_renderer();
137 static std::vector<irr::video::E_DRIVER_TYPE> getSupportedVideoDrivers();
140 v2u32 _getWindowSize() const;
142 std::unique_ptr<RenderingCore> core;
143 irr::IrrlichtDevice *m_device = nullptr;
144 irr::video::IVideoDriver *driver;
145 static RenderingEngine *s_singleton;