18#ifndef HEADER_SP_TEXTURE_MANAGER_HPP
19#define HEADER_SP_TEXTURE_MANAGER_HPP
23#include "graphics/gl_headers.hpp"
24#include "utils/log.hpp"
25#include "utils/no_copy.hpp"
29#include <condition_variable>
51 std::map<std::string, std::shared_ptr<SPTexture> > m_textures;
53 std::atomic_uint m_max_threaded_load_obj;
55 std::atomic_int m_gl_cmd_function_count;
57 std::list<std::function<bool()> > m_threaded_functions;
59 std::list<std::function<bool()> > m_gl_cmd_functions;
61 std::mutex m_thread_obj_mutex, m_gl_cmd_mutex;
63 std::condition_variable m_thread_obj_cv;
65 std::list<std::thread> m_threaded_load_obj;
90 m_max_threaded_load_obj.store(0);
91 std::unique_lock<std::mutex> ul(m_thread_obj_mutex);
92 m_threaded_functions.push_back([](){
return true; });
93 m_thread_obj_cv.notify_all();
95 for (std::thread& t : m_threaded_load_obj)
99 m_threaded_load_obj.clear();
102 void removeUnusedTextures();
104 void addThreadedFunction(std::function<
bool()> threaded_function)
106 std::lock_guard<std::mutex> lock(m_thread_obj_mutex);
107 m_threaded_functions.push_back(threaded_function);
108 m_thread_obj_cv.notify_one();
111 void addGLCommandFunction(std::function<
bool()> function)
113 std::lock_guard<std::mutex> lock(m_gl_cmd_mutex);
114 m_gl_cmd_functions.push_back(function);
117 void increaseGLCommandFunctionCount(
int count)
118 { m_gl_cmd_function_count.fetch_add(count); }
120 void checkForGLCommand(
bool before_scene =
false);
122 std::shared_ptr<SPTexture> getTexture(
const std::string& p,
124 const std::string& container_id);
126 void dumpAllTextures();
128 irr::core::stringw reloadTexture(
const irr::core::stringw& name);
Definition: material.hpp:48
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:26
Definition: sp_texture_manager.hpp:47