diff options
Diffstat (limited to 'src/client/renderingengine.h')
-rw-r--r-- | src/client/renderingengine.h | 100 |
1 files changed, 39 insertions, 61 deletions
diff --git a/src/client/renderingengine.h b/src/client/renderingengine.h index 34cc60630..a0ddb0d9a 100644 --- a/src/client/renderingengine.h +++ b/src/client/renderingengine.h @@ -25,6 +25,14 @@ with this program; if not, write to the Free Software Foundation, Inc., #include <string> #include "irrlichttypes_extrabloated.h" #include "debug.h" +#include "client/render/core.h" +// include the shadow mapper classes too +#include "client/shadows/dynamicshadowsrender.h" + +struct VideoDriverInfo { + std::string name; + std::string friendly_name; +}; class ITextureSource; class Camera; @@ -41,13 +49,11 @@ public: RenderingEngine(IEventReceiver *eventReceiver); ~RenderingEngine(); - v2u32 getWindowSize() const; void setResizable(bool resize); video::IVideoDriver *getVideoDriver() { return driver; } - static const char *getVideoDriverName(irr::video::E_DRIVER_TYPE type); - static const char *getVideoDriverFriendlyName(irr::video::E_DRIVER_TYPE type); + static const VideoDriverInfo &getVideoDriverInfo(irr::video::E_DRIVER_TYPE type); static float getDisplayDensity(); static v2u32 getDisplaySize(); @@ -56,31 +62,30 @@ public: bool setWindowIcon(); bool setXorgWindowIconFromPath(const std::string &icon_file); static bool print_video_modes(); + void cleanupMeshCache(); - static RenderingEngine *get_instance() { return s_singleton; } + void removeMesh(const scene::IMesh* mesh); - static io::IFileSystem *get_filesystem() + static v2u32 getWindowSize() { - sanity_check(s_singleton && s_singleton->m_device); - return s_singleton->m_device->getFileSystem(); + sanity_check(s_singleton); + return s_singleton->_getWindowSize(); } - static video::IVideoDriver *get_video_driver() + io::IFileSystem *get_filesystem() { - sanity_check(s_singleton && s_singleton->m_device); - return s_singleton->m_device->getVideoDriver(); + return m_device->getFileSystem(); } - static scene::IMeshCache *get_mesh_cache() + static video::IVideoDriver *get_video_driver() { sanity_check(s_singleton && s_singleton->m_device); - return s_singleton->m_device->getSceneManager()->getMeshCache(); + return s_singleton->m_device->getVideoDriver(); } - static scene::ISceneManager *get_scene_manager() + scene::ISceneManager *get_scene_manager() { - sanity_check(s_singleton && s_singleton->m_device); - return s_singleton->m_device->getSceneManager(); + return m_device->getSceneManager(); } static irr::IrrlichtDevice *get_raw_device() @@ -89,70 +94,43 @@ public: return s_singleton->m_device; } - static u32 get_timer_time() + u32 get_timer_time() { - sanity_check(s_singleton && s_singleton->m_device && - s_singleton->m_device->getTimer()); - return s_singleton->m_device->getTimer()->getTime(); + return m_device->getTimer()->getTime(); } - static gui::IGUIEnvironment *get_gui_env() + gui::IGUIEnvironment *get_gui_env() { - sanity_check(s_singleton && s_singleton->m_device); - return s_singleton->m_device->getGUIEnvironment(); + return m_device->getGUIEnvironment(); } - inline static void draw_load_screen(const std::wstring &text, + void draw_load_screen(const std::wstring &text, gui::IGUIEnvironment *guienv, ITextureSource *tsrc, - float dtime = 0, int percent = 0, bool clouds = true) - { - s_singleton->_draw_load_screen( - text, guienv, tsrc, dtime, percent, clouds); - } + float dtime = 0, int percent = 0, bool clouds = true); - inline static void draw_menu_scene( - gui::IGUIEnvironment *guienv, float dtime, bool clouds) - { - s_singleton->_draw_menu_scene(guienv, dtime, clouds); - } + void draw_menu_scene(gui::IGUIEnvironment *guienv, float dtime, bool clouds); + void draw_scene(video::SColor skycolor, bool show_hud, + bool show_minimap, bool draw_wield_tool, bool draw_crosshair); - inline static void draw_scene(video::SColor skycolor, bool show_hud, - bool show_minimap, bool draw_wield_tool, bool draw_crosshair) - { - s_singleton->_draw_scene(skycolor, show_hud, show_minimap, - draw_wield_tool, draw_crosshair); - } + void initialize(Client *client, Hud *hud); + void finalize(); - inline static void initialize(Client *client, Hud *hud) + bool run() { - s_singleton->_initialize(client, hud); + return m_device->run(); } - inline static void finalize() { s_singleton->_finalize(); } - - static bool run() + // FIXME: this is still global when it shouldn't be + static ShadowRenderer *get_shadow_renderer() { - sanity_check(s_singleton && s_singleton->m_device); - return s_singleton->m_device->run(); + //if (s_singleton && s_singleton->core) + // return s_singleton->core->get_shadow_renderer(); + return nullptr; } - - static std::vector<core::vector3d<u32>> getSupportedVideoModes(); static std::vector<irr::video::E_DRIVER_TYPE> getSupportedVideoDrivers(); private: - void _draw_load_screen(const std::wstring &text, gui::IGUIEnvironment *guienv, - ITextureSource *tsrc, float dtime = 0, int percent = 0, - bool clouds = true); - - void _draw_menu_scene(gui::IGUIEnvironment *guienv, float dtime = 0, - bool clouds = true); - - void _draw_scene(video::SColor skycolor, bool show_hud, bool show_minimap, - bool draw_wield_tool, bool draw_crosshair); - - void _initialize(Client *client, Hud *hud); - - void _finalize(); + v2u32 _getWindowSize() const; std::unique_ptr<RenderingCore> core; irr::IrrlichtDevice *m_device = nullptr; |