X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fclient%2Frenderingengine.h;h=6f104bba98e2ee09eb0e8963f0a39082a712752e;hb=1320c51d8e15409544cba970a97b167a37513bae;hp=8728363d23eb1e13bc36f021f9a04a8d3aeb03ac;hpb=792752997c5ae2aaa4f54d0a2e2af2a96d7d1e9f;p=minetest.git diff --git a/src/client/renderingengine.h b/src/client/renderingengine.h index 8728363d2..6f104bba9 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 #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,46 +49,43 @@ class RenderingEngine 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(); - static void setXorgClassHint(const video::SExposedVideoData &video_data, - const std::string &name); + bool setupTopLevelWindow(const std::string &name); + void setupTopLevelXorgWindow(const std::string &name); 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 @@ class RenderingEngine 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> getSupportedVideoModes(); static std::vector 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 core; irr::IrrlichtDevice *m_device = nullptr;